CODE STYLE

This commit is contained in:
Ralph Asendeteufrer
2012-10-17 11:41:42 -04:00
parent ff2b54a2ed
commit 27e9c59fd1
8 changed files with 399 additions and 410 deletions

View File

@@ -20,10 +20,8 @@
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if (isset( $_POST['function'] )) { if (isset( $_POST['function'] )) {
switch ($_POST['function']) { switch ($_POST['function']) {
@@ -41,7 +39,8 @@ if(isset($_POST['function'])) {
} }
break; break;
default: echo 'default'; default:
echo 'default';
} }
} }

View File

@@ -2,16 +2,16 @@
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
//G::header('location: ../login/login'); //G::header('location: ../login/login');
die; die();
} }
//to do: improve the way to pass two or more parameters in the paged-table ( link ) //to do: improve the way to pass two or more parameters in the paged-table ( link )
$aux = explode( '|', $_GET['id'] ); $aux = explode( '|', $_GET['id'] );
$index = 0; $index = 0;
$CategoryUid = str_replace( '"', '', $aux[$index ++] ); $CategoryUid = str_replace( '"', '', $aux[$index ++] );
require_once ("classes/model/ProcessCategory.php"); require_once ("classes/model/ProcessCategory.php");
//if exists the row in the database propel will update it, otherwise will insert. //if exists the row in the database propel will update it, otherwise will insert.
$tr = ProcessCategoryPeer::retrieveByPK( $CategoryUid ); $tr = ProcessCategoryPeer::retrieveByPK( $CategoryUid );
@@ -25,8 +25,7 @@ if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVAN
$fields['LABEL_CATEGORY_NAME'] = $tr->getCategoryName(); $fields['LABEL_CATEGORY_NAME'] = $tr->getCategoryName();
$fields['CATEGORY_ICON'] = $tr->getCategoryIcon(); $fields['CATEGORY_ICON'] = $tr->getCategoryIcon();
$fields['LABEL_CATEGORY_ICON'] = $tr->getCategoryIcon(); $fields['LABEL_CATEGORY_ICON'] = $tr->getCategoryIcon();
} } else
else
$fields = array (); $fields = array ();
$G_MAIN_MENU = 'workflow'; $G_MAIN_MENU = 'workflow';
@@ -34,8 +33,7 @@ if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVAN
$G_ID_MENU_SELECTED = ''; $G_ID_MENU_SELECTED = '';
$G_ID_SUB_MENU_SELECTED = ''; $G_ID_SUB_MENU_SELECTED = '';
$G_PUBLISH = new Publisher();
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processCategory/processCategoryDelete', '', $fields, 'processCategoryDeleteExec' ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processCategory/processCategoryDelete', '', $fields, 'processCategoryDeleteExec' );
G::RenderPage( 'publishBlank', 'blank' ); G::RenderPage( 'publishBlank', 'blank' );
?> ?>

View File

@@ -3,7 +3,7 @@
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
//G::header('location: ../login/login'); //G::header('location: ../login/login');
die; die();
} }
try { try {
@@ -36,11 +36,9 @@ if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVAN
G::Header( 'location: processCategoryList' ); G::Header( 'location: processCategoryList' );
} } catch (Exception $e) {
catch ( Exception $e ) { $G_PUBLISH = new Publisher();
$G_PUBLISH = new Publisher;
$aMessage['MESSAGE'] = $e->getMessage(); $aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'blank' ); G::RenderPage( 'publish', 'blank' );
} }

View File

@@ -3,13 +3,12 @@
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
//G::header('location: ../login/login'); //G::header('location: ../login/login');
die; die();
} }
$aux = explode( '|', isset( $_GET['id'] ) ? $_GET['id'] : '' ); $aux = explode( '|', isset( $_GET['id'] ) ? $_GET['id'] : '' );
$CategoryUid = str_replace( '"', '', $aux[0] ); $CategoryUid = str_replace( '"', '', $aux[0] );
require_once ("classes/model/ProcessCategory.php"); require_once ("classes/model/ProcessCategory.php");
//if exists the row in the database propel will update it, otherwise will insert. //if exists the row in the database propel will update it, otherwise will insert.
$tr = ProcessCategoryPeer::retrieveByPK( $CategoryUid ); $tr = ProcessCategoryPeer::retrieveByPK( $CategoryUid );
@@ -19,8 +18,7 @@ if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVAN
$fields['CATEGORY_PARENT'] = $tr->getCategoryParent(); $fields['CATEGORY_PARENT'] = $tr->getCategoryParent();
$fields['CATEGORY_NAME'] = $tr->getCategoryName(); $fields['CATEGORY_NAME'] = $tr->getCategoryName();
$fields['CATEGORY_ICON'] = $tr->getCategoryIcon(); $fields['CATEGORY_ICON'] = $tr->getCategoryIcon();
} } else
else
$fields = array (); $fields = array ();
$G_MAIN_MENU = 'workflow'; $G_MAIN_MENU = 'workflow';
@@ -28,8 +26,7 @@ if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVAN
$G_ID_MENU_SELECTED = ''; $G_ID_MENU_SELECTED = '';
$G_ID_SUB_MENU_SELECTED = ''; $G_ID_SUB_MENU_SELECTED = '';
$G_PUBLISH = new Publisher();
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processCategory/processCategoryEdit', '', $fields, 'processCategorySave' ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processCategory/processCategoryEdit', '', $fields, 'processCategorySave' );
G::RenderPage( 'publishBlank', 'blank' ); G::RenderPage( 'publishBlank', 'blank' );
?> ?>

View File

@@ -20,11 +20,10 @@
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::SendTemporalMessage( 'krlos', 'error', 'labels' ); G::SendTemporalMessage( 'krlos', 'error', 'labels' );
die; die();
} }
G::LoadClass( 'configuration' ); G::LoadClass( 'configuration' );
@@ -37,7 +36,7 @@ $G_SUB_MENU = 'processCategory';
$G_ID_MENU_SELECTED = ''; $G_ID_MENU_SELECTED = '';
$G_ID_SUB_MENU_SELECTED = ''; $G_ID_SUB_MENU_SELECTED = '';
$G_PUBLISH = new Publisher; $G_PUBLISH = new Publisher();
$oHeadPublisher = & headPublisher::getSingleton(); $oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'processCategory/processCategoryList', false ); //adding a javascript file .js $oHeadPublisher->addExtJsScript( 'processCategory/processCategoryList', false ); //adding a javascript file .js

View File

@@ -3,13 +3,13 @@
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
//G::header('location: ../login/login'); //G::header('location: ../login/login');
die; die();
} }
require_once ("classes/model/ProcessCategory.php"); require_once ("classes/model/ProcessCategory.php");
$fields['CATEGORY_UID'] = G::GenerateUniqueID();
$fields['CATEGORY_UID'] = G::GenerateUniqueID();; ;
$fields['CATEGORY_PARENT'] = ''; $fields['CATEGORY_PARENT'] = '';
$fields['CATEGORY_NAME'] = ''; $fields['CATEGORY_NAME'] = '';
@@ -20,8 +20,7 @@ if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVAN
$G_ID_MENU_SELECTED = ''; $G_ID_MENU_SELECTED = '';
$G_ID_SUB_MENU_SELECTED = ''; $G_ID_SUB_MENU_SELECTED = '';
$G_PUBLISH = new Publisher();
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processCategory/processCategoryNew', '', $fields, 'processCategorySave' ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processCategory/processCategoryNew', '', $fields, 'processCategorySave' );
G::RenderPage( 'publishBlank', 'blank' ); G::RenderPage( 'publishBlank', 'blank' );
?> ?>

View File

@@ -6,7 +6,6 @@
$CategoryName = $form['CATEGORY_NAME']; $CategoryName = $form['CATEGORY_NAME'];
$CategoryIcon = $form['CATEGORY_ICON']; $CategoryIcon = $form['CATEGORY_ICON'];
require_once ("classes/model/ProcessCategory.php"); require_once ("classes/model/ProcessCategory.php");
//if exists the row in the database propel will update it, otherwise will insert. //if exists the row in the database propel will update it, otherwise will insert.
@@ -26,8 +25,7 @@
if ($tr->validate()) { if ($tr->validate()) {
// we save it, since we get no validation errors, or do whatever else you like. // we save it, since we get no validation errors, or do whatever else you like.
$res = $tr->save(); $res = $tr->save();
} } else {
else {
// Something went wrong. We can now get the validationFailures and handle them. // Something went wrong. We can now get the validationFailures and handle them.
$msg = ''; $msg = '';
$validationFailuresArray = $tr->getValidationFailures(); $validationFailuresArray = $tr->getValidationFailures();
@@ -38,8 +36,10 @@
} }
//return array ( 'codError' => 0, 'rowsAffected' => $res, 'message' => ''); //return array ( 'codError' => 0, 'rowsAffected' => $res, 'message' => '');
//to do: uniform coderror structures for all classes //to do: uniform coderror structures for all classes
//if ( $res['codError'] < 0 ) { //if ( $res['codError'] < 0 ) {
// G::SendMessageText ( $res['message'] , 'error' ); // G::SendMessageText ( $res['message'] , 'error' );
//} //}
@@ -47,13 +47,12 @@
} else { } else {
// G::SendTemporalMessage("El registro ya existe", "warning", 'labels'); // G::SendTemporalMessage("El registro ya existe", "warning", 'labels');
G::Header( 'location: processCategoryList' ); G::Header( 'location: processCategoryList' );
die; die();
} }
} catch (Exception $e) { } catch (Exception $e) {
$G_PUBLISH = new Publisher; $G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage(); $aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'blank' ); G::RenderPage( 'publish', 'blank' );
} }

View File

@@ -20,7 +20,6 @@
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
if (isset( $_REQUEST['action'] )) { if (isset( $_REQUEST['action'] )) {
@@ -160,6 +159,7 @@ if(isset($_REQUEST['action'])) {
echo '{success: false, error: ' . $ex->getMessage() . '}'; echo '{success: false, error: ' . $ex->getMessage() . '}';
} }
break; break;
default: echo 'default'; default:
echo 'default';
} }
} }