Merge pull request #815 from norahmollo/master

CODE STYLE Formating
This commit is contained in:
ferOnti
2012-10-18 10:01:31 -07:00
11 changed files with 851 additions and 879 deletions

View File

@@ -1,73 +1,77 @@
<?php
require_once 'classes/model/Application.php';
G::LoadClass('case');
class adhocUserProxy extends HttpProxyController
{
//list of users into adhoc option
function adhocAssignUsersk($params){
G::LoadClass('groups');
G::LoadClass('tasks');
$oTasks = new Tasks();
$aAux = $oTasks->getGroupsOfTask($_SESSION['TASK'], 2);
$aAdhocUsers = array();
$oGroups = new Groups();
foreach($aAux as $aGroup) {
$aUsers = $oGroups->getUsersOfGroup($aGroup['GRP_UID']);
foreach($aUsers as $aUser) {
if($aUser['USR_UID'] != $_SESSION['USER_LOGGED']) {
$aAdhocUsers[] = $aUser['USR_UID'];
}
}
}
$aAux = $oTasks->getUsersOfTask($_SESSION['TASK'], 2);
foreach($aAux as $aUser) {
if($aUser['USR_UID'] != $_SESSION['USER_LOGGED']) {
$aAdhocUsers[] = $aUser['USR_UID'];
}
}
require_once 'classes/model/Users.php';
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(UsersPeer::USR_UID);
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$oCriteria->add(UsersPeer::USR_UID, $aAdhocUsers, Criteria::IN);
$oDataset = UsersPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$aData=array();
while ($oDataset->next()){
$aData[] = $oDataset->getRow();
}
$this->data = $aData;
}
//assign user adhoc
function reassignCase($params){
$cases = new Cases();
$cases->reassignCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], $_POST['USR_UID'], $_POST['THETYPE']);
$this->success = true;
}
//delete case adhoc
function deleteCase($params){
$ainfoCase = array();
try{
$applicationUID = (isset($_POST['APP_UID'])) ? $_POST['APP_UID'] : $_SESSION['APPLICATION'];
$app = new Application();
$caseData = $app->load($applicationUID);
$data['APP_NUMBER'] = $caseData['APP_NUMBER'];
$oCase = new Cases();
$oCase->removeCase($applicationUID);
$this->success = true;
$this->msg = G::LoadTranslation('ID_CASE_DELETED_SUCCESSFULLY', SYS_LANG, $data);
} catch(Exception $e) {
$this->success = false;
$this->msg = $e->getMessage();
}
}
} //End adhocUserProxy
<?php
require_once 'classes/model/Application.php';
G::LoadClass( 'case' );
class adhocUserProxy extends HttpProxyController
{
//list of users into adhoc option
function adhocAssignUsersk ($params)
{
G::LoadClass( 'groups' );
G::LoadClass( 'tasks' );
$oTasks = new Tasks();
$aAux = $oTasks->getGroupsOfTask( $_SESSION['TASK'], 2 );
$aAdhocUsers = array ();
$oGroups = new Groups();
foreach ($aAux as $aGroup) {
$aUsers = $oGroups->getUsersOfGroup( $aGroup['GRP_UID'] );
foreach ($aUsers as $aUser) {
if ($aUser['USR_UID'] != $_SESSION['USER_LOGGED']) {
$aAdhocUsers[] = $aUser['USR_UID'];
}
}
}
$aAux = $oTasks->getUsersOfTask( $_SESSION['TASK'], 2 );
foreach ($aAux as $aUser) {
if ($aUser['USR_UID'] != $_SESSION['USER_LOGGED']) {
$aAdhocUsers[] = $aUser['USR_UID'];
}
}
require_once 'classes/model/Users.php';
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( UsersPeer::USR_UID );
$oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME );
$oCriteria->add( UsersPeer::USR_UID, $aAdhocUsers, Criteria::IN );
$oDataset = UsersPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$aData = array ();
while ($oDataset->next()) {
$aData[] = $oDataset->getRow();
}
$this->data = $aData;
}
//assign user adhoc
function reassignCase ($params)
{
$cases = new Cases();
$cases->reassignCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], $_POST['USR_UID'], $_POST['THETYPE'] );
$this->success = true;
}
//delete case adhoc
function deleteCase ($params)
{
$ainfoCase = array ();
try {
$applicationUID = (isset( $_POST['APP_UID'] )) ? $_POST['APP_UID'] : $_SESSION['APPLICATION'];
$app = new Application();
$caseData = $app->load( $applicationUID );
$data['APP_NUMBER'] = $caseData['APP_NUMBER'];
$oCase = new Cases();
$oCase->removeCase( $applicationUID );
$this->success = true;
$this->msg = G::LoadTranslation( 'ID_CASE_DELETED_SUCCESSFULLY', SYS_LANG, $data );
} catch (Exception $e) {
$this->success = false;
$this->msg = $e->getMessage();
}
}
}
//End adhocUserProxy

View File

@@ -1,184 +1,185 @@
<?php
/**
* Admin controller
* @access public
*/
class Admin extends Controller
{
/**
* UX - User experience
*/
public $debug = true;
public function system()
{
require_once PATH_CONTROLLERS . 'main.php';
G::loadClass('system');
$skinsList = System::getSkingList();
$skins = array();
$timeZonesList = System::getAllTimeZones();
$timeZonesList = array_keys($timeZonesList);
$mainController = new Main();
$languagesList = $mainController->getLanguagesList();
$sysConf = System::getSystemConfiguration(PATH_CONFIG . 'env.ini');
foreach ($skinsList['skins'] as $skin) {
$skins[] = array($skin['SKIN_FOLDER_ID'], $skin['SKIN_NAME']);
}
foreach ($timeZonesList as $tz) {
$timeZones[] = array($tz, $tz);
}
$this->includeExtJS('admin/system');
//G::LoadClass('configuration');
// $c = new Configurations();
// $configPage = $c->getConfiguration('usersList', 'pageSize','',$_SESSION['USER_LOGGED']);
// $Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
$this->setJSVar('skinsList', $skins);
$this->setJSVar('languagesList', $languagesList);
$this->setJSVar('timeZonesList', $timeZones);
$this->setJSVar('sysConf', $sysConf);
G::RenderPage('publish', 'extJs');
}
public function uxList()
{
require_once PATH_CONTROLLERS . 'adminProxy.php';
$this->includeExtJS('admin/uxUsersList');
G::LoadClass('configuration');
$c = new Configurations();
$configPage = $c->getConfiguration('usersList', 'pageSize','',$_SESSION['USER_LOGGED']);
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
$this->setJSVar('CONFIG', $Config);
$this->setJSVar('FORMATS', $c->getFormats());
$this->setJSVar('uxTypes', AdminProxy::getUxTypesList('list'));
G::RenderPage('publish', 'extJs');
}
/**
* CALENDAR
* getting default list
* @param string $httpData->PRO_UID (opional)
*/
public function calendarEdit($httpData)
{
global $RBAC;
//$RBAC->requirePermissions('PM_SETUP_ADVANCE');
G::LoadClass('configuration');
G::LoadClass('calendar');
$CalendarUid = str_replace ( '"', '', isset ( $_GET ['id'] ) ? $_GET ['id'] : G::GenerateUniqueID () );
$calendarObj = new calendar ( );
if ((isset ( $_GET ['id'] )) && ($_GET ['id'] != "")) {
$fields = $calendarObj->getCalendarInfoE ( $CalendarUid );
$fields ['OLD_NAME'] = $fields['CALENDAR_NAME'];
}
if (!isset($fields['CALENDAR_UID'])) { //For a new Calendar
$fields ['CALENDAR_UID'] = $CalendarUid;
$fields ['OLD_NAME'] = '';
//Default Business Hour
$fields ['BUSINESS_DAY'] [1] ['CALENDAR_BUSINESS_DAY'] = 7;
$fields ['BUSINESS_DAY'] [1] ['CALENDAR_BUSINESS_START'] = "09:00";
$fields ['BUSINESS_DAY'] [1] ['CALENDAR_BUSINESS_END'] = "17:00";
}
if ((isset ( $_GET ['cp'] )) && ($_GET ['cp'] == 1)) { // Copy Calendar
$fields ['CALENDAR_UID'] = G::GenerateUniqueID ();
$fields ['CALENDAR_NAME'] = G::LoadTranslation ( "ID_COPY_OF" ) . " " . $fields ['CALENDAR_NAME'];
$fields ['OLD_NAME'] = $fields['CALENDAR_NAME'];;
}
$c = new Configurations();
$configPage = $c->getConfiguration('additionalTablesList', 'pageSize','',$_SESSION['USER_LOGGED']);
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
$this->includeExtJS('admin/calendarEdit');
$this->setView('admin/calendarEdit');
$businessDayArray = array();
for($i=0;$i<sizeof($fields['BUSINESS_DAY']);$i++) {
$businessDayArray[$i] = $fields['BUSINESS_DAY'][$i+1];
}
$fields['BUSINESS_DAY'] = $businessDayArray;
//validating if the calendar is new, it means that we don't have the $_GET array
$fields['HOLIDAY']=(isset ( $_GET['id'] )&&$_GET['id']!='')?$fields['HOLIDAY']:array();
$holidayArray = array();
for($i=0;$i<sizeof($fields['HOLIDAY']);$i++) {
$holidayArray[$i] = $fields['HOLIDAY'][$i+1];
}
$_GET ['id']= (isset ( $_GET['id'] )&&$_GET['id']!='')?$_GET['id']:'';
$fields['HOLIDAY'] = $holidayArray;
$fields['NEWCALENDAR'] = 'NO';
if(isset ( $_GET['id'] )&&$_GET['id']=='') {
$fields['CALENDAR_UID'] = G::GenerateUniqueID();
$fields['NEWCALENDAR'] = 'YES';
}
$this->setJSVar('CALENDAR_UID',$fields['CALENDAR_UID']);
$this->setJSVar('fields',$fields);
G::RenderPage('publish', 'extJs');
}
/**
* getting email configuration
* @autor Alvaro <alvaro@colosa.com>
*/
public function emails()
{
global $RBAC;
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
$this->includeExtJS('admin/emails');
//render content
G::RenderPage('publish', 'extJs');
}
/**
* getting default list
* @param string $httpData->PRO_UID (opional)
*/
public function pmLogo($httpData)
{
global $RBAC;
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
G::LoadClass('configuration');
$c = new Configurations();
$configPage = $c->getConfiguration('additionalTablesList', 'pageSize', '', $_SESSION['USER_LOGGED']);
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
$this->includeExtJS('admin/pmLogo');
$this->setView('admin/pmLogo');
//assigning js variables
$this->setJSVar('FORMATS', $c->getFormats());
$this->setJSVar('CONFIG', $Config);
$this->setJSVar('PRO_UID', isset($_GET['PRO_UID'])? $_GET['PRO_UID'] : false);
if (isset($_SESSION['_cache_pmtables'])) {
unset($_SESSION['_cache_pmtables']);
}
if (isset($_SESSION['ADD_TAB_UID'])) {
unset($_SESSION['ADD_TAB_UID']);
}
//render content
G::RenderPage('publish', 'extJs');
}
}
<?php
/**
* Admin controller
*
* @access public
*/
class Admin extends Controller
{
/**
* UX - User experience
*/
public $debug = true;
public function system ()
{
require_once PATH_CONTROLLERS . 'main.php';
G::loadClass( 'system' );
$skinsList = System::getSkingList();
$skins = array ();
$timeZonesList = System::getAllTimeZones();
$timeZonesList = array_keys( $timeZonesList );
$mainController = new Main();
$languagesList = $mainController->getLanguagesList();
$sysConf = System::getSystemConfiguration( PATH_CONFIG . 'env.ini' );
foreach ($skinsList['skins'] as $skin) {
$skins[] = array ($skin['SKIN_FOLDER_ID'],$skin['SKIN_NAME']);
}
foreach ($timeZonesList as $tz) {
$timeZones[] = array ($tz,$tz);
}
$this->includeExtJS( 'admin/system' );
//G::LoadClass('configuration');
// $c = new Configurations();
// $configPage = $c->getConfiguration('usersList', 'pageSize','',$_SESSION['USER_LOGGED']);
// $Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
$this->setJSVar( 'skinsList', $skins );
$this->setJSVar( 'languagesList', $languagesList );
$this->setJSVar( 'timeZonesList', $timeZones );
$this->setJSVar( 'sysConf', $sysConf );
G::RenderPage( 'publish', 'extJs' );
}
public function uxList ()
{
require_once PATH_CONTROLLERS . 'adminProxy.php';
$this->includeExtJS( 'admin/uxUsersList' );
G::LoadClass( 'configuration' );
$c = new Configurations();
$configPage = $c->getConfiguration( 'usersList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20;
$this->setJSVar( 'CONFIG', $Config );
$this->setJSVar( 'FORMATS', $c->getFormats() );
$this->setJSVar( 'uxTypes', AdminProxy::getUxTypesList( 'list' ) );
G::RenderPage( 'publish', 'extJs' );
}
/**
* CALENDAR
* getting default list
*
* @param string $httpData->PRO_UID (opional)
*/
public function calendarEdit ($httpData)
{
global $RBAC;
//$RBAC->requirePermissions('PM_SETUP_ADVANCE');
G::LoadClass( 'configuration' );
G::LoadClass( 'calendar' );
$CalendarUid = str_replace( '"', '', isset( $_GET['id'] ) ? $_GET['id'] : G::GenerateUniqueID() );
$calendarObj = new calendar();
if ((isset( $_GET['id'] )) && ($_GET['id'] != "")) {
$fields = $calendarObj->getCalendarInfoE( $CalendarUid );
$fields['OLD_NAME'] = $fields['CALENDAR_NAME'];
}
if (! isset( $fields['CALENDAR_UID'] )) { //For a new Calendar
$fields['CALENDAR_UID'] = $CalendarUid;
$fields['OLD_NAME'] = '';
//Default Business Hour
$fields['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_DAY'] = 7;
$fields['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_START'] = "09:00";
$fields['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_END'] = "17:00";
}
if ((isset( $_GET['cp'] )) && ($_GET['cp'] == 1)) { // Copy Calendar
$fields['CALENDAR_UID'] = G::GenerateUniqueID();
$fields['CALENDAR_NAME'] = G::LoadTranslation( "ID_COPY_OF" ) . " " . $fields['CALENDAR_NAME'];
$fields['OLD_NAME'] = $fields['CALENDAR_NAME'];
}
$c = new Configurations();
$configPage = $c->getConfiguration( 'additionalTablesList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20;
$this->includeExtJS( 'admin/calendarEdit' );
$this->setView( 'admin/calendarEdit' );
$businessDayArray = array ();
for ($i = 0; $i < sizeof( $fields['BUSINESS_DAY'] ); $i ++) {
$businessDayArray[$i] = $fields['BUSINESS_DAY'][$i + 1];
}
$fields['BUSINESS_DAY'] = $businessDayArray;
//validating if the calendar is new, it means that we don't have the $_GET array
$fields['HOLIDAY'] = (isset( $_GET['id'] ) && $_GET['id'] != '') ? $fields['HOLIDAY'] : array ();
$holidayArray = array ();
for ($i = 0; $i < sizeof( $fields['HOLIDAY'] ); $i ++) {
$holidayArray[$i] = $fields['HOLIDAY'][$i + 1];
}
$_GET['id'] = (isset( $_GET['id'] ) && $_GET['id'] != '') ? $_GET['id'] : '';
$fields['HOLIDAY'] = $holidayArray;
$fields['NEWCALENDAR'] = 'NO';
if (isset( $_GET['id'] ) && $_GET['id'] == '') {
$fields['CALENDAR_UID'] = G::GenerateUniqueID();
$fields['NEWCALENDAR'] = 'YES';
}
$this->setJSVar( 'CALENDAR_UID', $fields['CALENDAR_UID'] );
$this->setJSVar( 'fields', $fields );
G::RenderPage( 'publish', 'extJs' );
}
/**
* getting email configuration
* @autor Alvaro <alvaro@colosa.com>
*/
public function emails ()
{
global $RBAC;
$RBAC->requirePermissions( 'PM_SETUP_ADVANCE' );
$this->includeExtJS( 'admin/emails' );
//render content
G::RenderPage( 'publish', 'extJs' );
}
/**
* getting default list
*
* @param string $httpData->PRO_UID (opional)
*/
public function pmLogo ($httpData)
{
global $RBAC;
$RBAC->requirePermissions( 'PM_SETUP_ADVANCE' );
G::LoadClass( 'configuration' );
$c = new Configurations();
$configPage = $c->getConfiguration( 'additionalTablesList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20;
$this->includeExtJS( 'admin/pmLogo' );
$this->setView( 'admin/pmLogo' );
//assigning js variables
$this->setJSVar( 'FORMATS', $c->getFormats() );
$this->setJSVar( 'CONFIG', $Config );
$this->setJSVar( 'PRO_UID', isset( $_GET['PRO_UID'] ) ? $_GET['PRO_UID'] : false );
if (isset( $_SESSION['_cache_pmtables'] )) {
unset( $_SESSION['_cache_pmtables'] );
}
if (isset( $_SESSION['ADD_TAB_UID'] )) {
unset( $_SESSION['ADD_TAB_UID'] );
}
//render content
G::RenderPage( 'publish', 'extJs' );
}
}

View File

@@ -1,222 +1,240 @@
<?php
/**
* App controller
* @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
* @herits Controller
* @access public
*/
class AppProxy extends HttpProxyController
{
/**
* Get Notes List
* @param int $httpData->start
* @param int $httpData->limit
* @param string $httpData->appUid (optionalif it is not passed try use $_SESSION['APPLICATION'])
* @return array containg the case notes
*/
function getNotesList($httpData)
{
$appUid = null;
if (isset($httpData->appUid) && trim($httpData->appUid) != "") {
$appUid = $httpData->appUid;
}
else {
if (isset($_SESSION['APPLICATION'])) {
$appUid = $_SESSION['APPLICATION'];
}
}
G::LoadClass('case');
$case = new Cases();
$proUid = ($httpData->pro == '') ? $_SESSION['PROCESS'] : $httpData->pro;
$tasUid = ($httpData->tas == '') ? $_SESSION['TASK'] : $httpData->tas;
$usrUid = $_SESSION['USER_LOGGED'];
$respView = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, 'VIEW');
$respBlock = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, 'BLOCK');
if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) {
return array('totalCount' => 0, 'notes' => array(), 'noPerms' => 1);
}
require_once ( "classes/model/AppNotes.php" );
if (!isset($appUid)) {
throw new Exception('Can\'t resolve the Apllication ID for this request.');
}
$usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : "";
$appNotes = new AppNotes();
$response = $appNotes->getNotesList($appUid, '', $httpData->start, $httpData->limit);
return $response['array'];
}
/**
* post Note Action
* @param string $httpData->appUid (optional, if it is not passed try use $_SESSION['APPLICATION'])
* @return array containg the case notes
*/
function postNote($httpData)
{
//extract(getExtJSParams());
if (isset($httpData->appUid) && trim($httpData->appUid) != "") {
$appUid = $httpData->appUid;
}
else {
$appUid = $_SESSION['APPLICATION'];
}
if (!isset($appUid)) {
throw new Exception('Can\'t resolve the Apllication ID for this request.');
}
$usrUid = (isset($_SESSION['USER_LOGGED'])) ? $_SESSION['USER_LOGGED'] : "";
require_once ( "classes/model/AppNotes.php" );
$appNotes = new AppNotes();
$noteContent = addslashes($httpData->noteText);
$result = $appNotes->postNewNote($appUid, $usrUid, $noteContent, false);
//Disabling the controller response because we handle a special behavior
$this->setSendResponse(false);
//Send the response to client
@ini_set('implicit_flush', 1);
ob_start();
echo G::json_encode($result);
@ob_flush();
@flush();
@ob_end_flush();
ob_implicit_flush(1);
//Send notification in background
if (intval($httpData->swSendMail) == 1) {
G::LoadClass("case");
$oCase = new Cases();
$p = $oCase->getUsersParticipatedInCase($appUid);
$noteRecipientsList = array();
foreach ($p["array"] as $key => $userParticipated) {
$noteRecipientsList[] = $key;
}
$noteRecipients = implode(",", $noteRecipientsList);
$noteContent = stripslashes($noteContent);
$appNotes->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients);
}
}
/**
* request to open the case summary
* @param string $httpData->appUid
* @param string $httpData->delIndex
* @return object bool $result->succes, string $result->message(is an exception was thrown), string $result->dynUid
*/
function requestOpenSummary($httpData)
{
global $RBAC;
$this->success = true;
$this->dynUid = '';
switch ($RBAC->userCanAccess('PM_CASES')) {
case -2:
throw new Exception(G::LoadTranslation('ID_USER_HAVENT_RIGHTS_SYSTEM'));
break;
case -1:
throw new Exception(G::LoadTranslation('ID_USER_HAVENT_RIGHTS_PAGE'));
break;
}
G::LoadClass('case');
$case = new Cases();
if ($RBAC->userCanAccess('PM_ALLCASES') < 0 && $case->userParticipatedInCase($httpData->appUid, $_SESSION['USER_LOGGED']) == 0) {
throw new Exception(G::LoadTranslation('ID_NO_PERMISSION_NO_PARTICIPATED'));
}
$applicationFields = $case->loadCase($httpData->appUid, $httpData->delIndex);
$process = new Process();
$processData = $process->load($applicationFields['PRO_UID']);
if (isset($processData['PRO_DYNAFORMS']['PROCESS'])) {
$this->dynUid = $processData['PRO_DYNAFORMS']['PROCESS'];
}
$_SESSION['_applicationFields'] = $applicationFields;
$_SESSION['_processData'] = $processData;
$_SESSION['APPLICATION'] = $httpData->appUid;
$_SESSION['INDEX'] = $httpData->delIndex;
$_SESSION['PROCESS'] = $applicationFields['PRO_UID'];
$_SESSION['TASK'] = $applicationFields['TAS_UID'];
$_SESSION['STEP_POSITION'] = '';
}
/**
* get the case summary data
* @param string $httpData->appUid
* @param string $httpData->delIndex
* @return array containg the case summary data
*/
function getSummary($httpData)
{
$labels = array();
$form = new Form('cases/cases_Resume', PATH_XMLFORM, SYS_LANG);
G::LoadClass('case');
$case = new Cases();
foreach($form->fields as $fieldName => $field) {
$labels[$fieldName] = $field->label;
}
if (isset($_SESSION['_applicationFields']) && $_SESSION['_processData']) {
$applicationFields = $_SESSION['_applicationFields'];
unset($_SESSION['_applicationFields']);
$processData = $_SESSION['_processData'];
unset($_SESSION['_processData']);
}
else {
$applicationFields = $case->loadCase($httpData->appUid, $httpData->delIndex);
$process = new Process();
$processData = $process->load($applicationFields['PRO_UID']);
}
$data = array();
$task = new Task();
$taskData = $task->load($applicationFields['TAS_UID']);
$currentUser = $applicationFields['CURRENT_USER'] != '' ? $applicationFields['CURRENT_USER'] : '[' . G::LoadTranslation('ID_UNASSIGNED') . ']';
$data[] = array('label'=>$labels['PRO_TITLE'] , 'value' => $processData['PRO_TITLE'], 'section'=>$labels['TITLE1']);
$data[] = array('label'=>$labels['TITLE'] , 'value' => $applicationFields['TITLE'], 'section'=>$labels['TITLE1']);
$data[] = array('label'=>$labels['APP_NUMBER'] , 'value' => $applicationFields['APP_NUMBER'], 'section'=>$labels['TITLE1']);
$data[] = array('label'=>$labels['STATUS'] , 'value' => $applicationFields['STATUS'], 'section'=>$labels['TITLE1']);
$data[] = array('label'=>$labels['APP_UID'] , 'value' => $applicationFields['APP_UID'], 'section'=>$labels['TITLE1']);
$data[] = array('label'=>$labels['CREATOR'] , 'value' => $applicationFields['CREATOR'], 'section'=>$labels['TITLE1']);
$data[] = array('label'=>$labels['CREATE_DATE'] , 'value' => $applicationFields['CREATE_DATE'],'section'=>$labels['TITLE1']);
$data[] = array('label'=>$labels['UPDATE_DATE'] , 'value' => $applicationFields['UPDATE_DATE'],'section'=>$labels['TITLE1']);
$data[] = array('label'=>$labels['DESCRIPTION'] , 'value' => $applicationFields['DESCRIPTION'],'section'=>$labels['TITLE1']);
// note added by krlos pacha carlos[at]colosa[dot]com
//getting this field if it doesn't exist. Related 7994 bug
$taskData['TAS_TITLE'] = (array_key_exists('TAS_TITLE', $taskData))?$taskData['TAS_TITLE']:Content::Load("TAS_TITLE", "", $applicationFields['TAS_UID'], SYS_LANG);
$data[] = array('label'=>$labels['TAS_TITLE'] , 'value' => $taskData['TAS_TITLE'], 'section'=>$labels['TITLE2']);
$data[] = array('label'=>$labels['CURRENT_USER'] , 'value' => $currentUser, 'section'=>$labels['TITLE2']);
$data[] = array('label'=>$labels['DEL_DELEGATE_DATE'] , 'value' => $applicationFields['DEL_DELEGATE_DATE'],'section'=>$labels['TITLE2']);
$data[] = array('label'=>$labels['DEL_INIT_DATE'] , 'value' => $applicationFields['DEL_INIT_DATE'], 'section'=>$labels['TITLE2']);
$data[] = array('label'=>$labels['DEL_TASK_DUE_DATE'] , 'value' => $applicationFields['DEL_TASK_DUE_DATE'],'section'=>$labels['TITLE2']);
$data[] = array('label'=>$labels['DEL_FINISH_DATE'] , 'value' => $applicationFields['DEL_FINISH_DATE'], 'section'=>$labels['TITLE2']);
//$data[] = array('label'=>$labels['DYN_UID'] , 'value' => $processData['PRO_DYNAFORMS']['PROCESS'];, 'section'=>$labels['DYN_UID']);
return $data;
}
}
<?php
/**
* App controller
*
* @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
* @herits Controller
* @access public
*/
class AppProxy extends HttpProxyController
{
/**
* Get Notes List
*
* @param int $httpData->start
* @param int $httpData->limit
* @param string $httpData->appUid (optionalif it is not passed try use $_SESSION['APPLICATION'])
* @return array containg the case notes
*/
function getNotesList ($httpData)
{
$appUid = null;
if (isset( $httpData->appUid ) && trim( $httpData->appUid ) != "") {
$appUid = $httpData->appUid;
} else {
if (isset( $_SESSION['APPLICATION'] )) {
$appUid = $_SESSION['APPLICATION'];
}
}
G::LoadClass( 'case' );
$case = new Cases();
$proUid = ($httpData->pro == '') ? $_SESSION['PROCESS'] : $httpData->pro;
$tasUid = ($httpData->tas == '') ? $_SESSION['TASK'] : $httpData->tas;
$usrUid = $_SESSION['USER_LOGGED'];
$respView = $case->getAllObjectsFrom( $proUid, $appUid, $tasUid, $usrUid, 'VIEW' );
$respBlock = $case->getAllObjectsFrom( $proUid, $appUid, $tasUid, $usrUid, 'BLOCK' );
if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) {
return array ('totalCount' => 0,'notes' => array (),'noPerms' => 1
);
}
require_once ("classes/model/AppNotes.php");
if (! isset( $appUid )) {
throw new Exception( 'Can\'t resolve the Apllication ID for this request.' );
}
$usrUid = isset( $_SESSION['USER_LOGGED'] ) ? $_SESSION['USER_LOGGED'] : "";
$appNotes = new AppNotes();
$response = $appNotes->getNotesList( $appUid, '', $httpData->start, $httpData->limit );
return $response['array'];
}
/**
* post Note Action
*
* @param string $httpData->appUid (optional, if it is not passed try use $_SESSION['APPLICATION'])
* @return array containg the case notes
*/
function postNote ($httpData)
{
//extract(getExtJSParams());
if (isset( $httpData->appUid ) && trim( $httpData->appUid ) != "") {
$appUid = $httpData->appUid;
} else {
$appUid = $_SESSION['APPLICATION'];
}
if (! isset( $appUid )) {
throw new Exception( 'Can\'t resolve the Apllication ID for this request.' );
}
$usrUid = (isset( $_SESSION['USER_LOGGED'] )) ? $_SESSION['USER_LOGGED'] : "";
require_once ("classes/model/AppNotes.php");
$appNotes = new AppNotes();
$noteContent = addslashes( $httpData->noteText );
$result = $appNotes->postNewNote( $appUid, $usrUid, $noteContent, false );
//Disabling the controller response because we handle a special behavior
$this->setSendResponse( false );
//Send the response to client
@ini_set( 'implicit_flush', 1 );
ob_start();
echo G::json_encode( $result );
@ob_flush();
@flush();
@ob_end_flush();
ob_implicit_flush( 1 );
//Send notification in background
if (intval( $httpData->swSendMail ) == 1) {
G::LoadClass( "case" );
$oCase = new Cases();
$p = $oCase->getUsersParticipatedInCase( $appUid );
$noteRecipientsList = array ();
foreach ($p["array"] as $key => $userParticipated) {
$noteRecipientsList[] = $key;
}
$noteRecipients = implode( ",", $noteRecipientsList );
$noteContent = stripslashes( $noteContent );
$appNotes->sendNoteNotification( $appUid, $usrUid, $noteContent, $noteRecipients );
}
}
/**
* request to open the case summary
*
* @param string $httpData->appUid
* @param string $httpData->delIndex
* @return object bool $result->succes, string $result->message(is an exception was thrown), string $result->dynUid
*/
function requestOpenSummary ($httpData)
{
global $RBAC;
$this->success = true;
$this->dynUid = '';
switch ($RBAC->userCanAccess( 'PM_CASES' )) {
case - 2:
throw new Exception( G::LoadTranslation( 'ID_USER_HAVENT_RIGHTS_SYSTEM' ) );
break;
case - 1:
throw new Exception( G::LoadTranslation( 'ID_USER_HAVENT_RIGHTS_PAGE' ) );
break;
}
G::LoadClass( 'case' );
$case = new Cases();
if ($RBAC->userCanAccess( 'PM_ALLCASES' ) < 0 && $case->userParticipatedInCase( $httpData->appUid, $_SESSION['USER_LOGGED'] ) == 0) {
throw new Exception( G::LoadTranslation( 'ID_NO_PERMISSION_NO_PARTICIPATED' ) );
}
$applicationFields = $case->loadCase( $httpData->appUid, $httpData->delIndex );
$process = new Process();
$processData = $process->load( $applicationFields['PRO_UID'] );
if (isset( $processData['PRO_DYNAFORMS']['PROCESS'] )) {
$this->dynUid = $processData['PRO_DYNAFORMS']['PROCESS'];
}
$_SESSION['_applicationFields'] = $applicationFields;
$_SESSION['_processData'] = $processData;
$_SESSION['APPLICATION'] = $httpData->appUid;
$_SESSION['INDEX'] = $httpData->delIndex;
$_SESSION['PROCESS'] = $applicationFields['PRO_UID'];
$_SESSION['TASK'] = $applicationFields['TAS_UID'];
$_SESSION['STEP_POSITION'] = '';
}
/**
* get the case summary data
*
* @param string $httpData->appUid
* @param string $httpData->delIndex
* @return array containg the case summary data
*/
function getSummary ($httpData)
{
$labels = array ();
$form = new Form( 'cases/cases_Resume', PATH_XMLFORM, SYS_LANG );
G::LoadClass( 'case' );
$case = new Cases();
foreach ($form->fields as $fieldName => $field) {
$labels[$fieldName] = $field->label;
}
if (isset( $_SESSION['_applicationFields'] ) && $_SESSION['_processData']) {
$applicationFields = $_SESSION['_applicationFields'];
unset( $_SESSION['_applicationFields'] );
$processData = $_SESSION['_processData'];
unset( $_SESSION['_processData'] );
} else {
$applicationFields = $case->loadCase( $httpData->appUid, $httpData->delIndex );
$process = new Process();
$processData = $process->load( $applicationFields['PRO_UID'] );
}
$data = array ();
$task = new Task();
$taskData = $task->load( $applicationFields['TAS_UID'] );
$currentUser = $applicationFields['CURRENT_USER'] != '' ? $applicationFields['CURRENT_USER'] : '[' . G::LoadTranslation( 'ID_UNASSIGNED' ) . ']';
$data[] = array ('label' => $labels['PRO_TITLE'],'value' => $processData['PRO_TITLE'],'section' => $labels['TITLE1']
);
$data[] = array ('label' => $labels['TITLE'],'value' => $applicationFields['TITLE'],'section' => $labels['TITLE1']
);
$data[] = array ('label' => $labels['APP_NUMBER'],'value' => $applicationFields['APP_NUMBER'],'section' => $labels['TITLE1']
);
$data[] = array ('label' => $labels['STATUS'],'value' => $applicationFields['STATUS'],'section' => $labels['TITLE1']
);
$data[] = array ('label' => $labels['APP_UID'],'value' => $applicationFields['APP_UID'],'section' => $labels['TITLE1']
);
$data[] = array ('label' => $labels['CREATOR'],'value' => $applicationFields['CREATOR'],'section' => $labels['TITLE1']
);
$data[] = array ('label' => $labels['CREATE_DATE'],'value' => $applicationFields['CREATE_DATE'],'section' => $labels['TITLE1']
);
$data[] = array ('label' => $labels['UPDATE_DATE'],'value' => $applicationFields['UPDATE_DATE'],'section' => $labels['TITLE1']
);
$data[] = array ('label' => $labels['DESCRIPTION'],'value' => $applicationFields['DESCRIPTION'],'section' => $labels['TITLE1']
);
// note added by krlos pacha carlos[at]colosa[dot]com
//getting this field if it doesn't exist. Related 7994 bug
$taskData['TAS_TITLE'] = (array_key_exists( 'TAS_TITLE', $taskData )) ? $taskData['TAS_TITLE'] : Content::Load( "TAS_TITLE", "", $applicationFields['TAS_UID'], SYS_LANG );
$data[] = array ('label' => $labels['TAS_TITLE'],'value' => $taskData['TAS_TITLE'],'section' => $labels['TITLE2']
);
$data[] = array ('label' => $labels['CURRENT_USER'],'value' => $currentUser,'section' => $labels['TITLE2']
);
$data[] = array ('label' => $labels['DEL_DELEGATE_DATE'],'value' => $applicationFields['DEL_DELEGATE_DATE'],'section' => $labels['TITLE2']
);
$data[] = array ('label' => $labels['DEL_INIT_DATE'],'value' => $applicationFields['DEL_INIT_DATE'],'section' => $labels['TITLE2']
);
$data[] = array ('label' => $labels['DEL_TASK_DUE_DATE'],'value' => $applicationFields['DEL_TASK_DUE_DATE'],'section' => $labels['TITLE2']
);
$data[] = array ('label' => $labels['DEL_FINISH_DATE'],'value' => $applicationFields['DEL_FINISH_DATE'],'section' => $labels['TITLE2']
);
//$data[] = array('label'=>$labels['DYN_UID'] , 'value' => $processData['PRO_DYNAFORMS']['PROCESS'];, 'section'=>$labels['DYN_UID']);
return $data;
}
}

View File

@@ -1,102 +1,81 @@
<?php
<?php
class authSourceProxy extends HttpProxyController
{
function testingOption ($params)
{
/*global $RBAC;
$fields = array('AUTH_SOURCE_PROVIDER' => $params->optionAuthS);
$G_PUBLISH = new Publisher();
$data=array();
$aCommonFields = array('AUTH_SOURCE_UID',
'AUTH_SOURCE_NAME',
'AUTH_SOURCE_PROVIDER',
'AUTH_SOURCE_SERVER_NAME',
'AUTH_SOURCE_PORT',
'AUTH_SOURCE_ENABLED_TLS',
'AUTH_ANONYMOUS',
'AUTH_SOURCE_SEARCH_USER',
'AUTH_SOURCE_PASSWORD',
'AUTH_SOURCE_VERSION',
'AUTH_SOURCE_BASE_DN',
'AUTH_SOURCE_OBJECT_CLASSES',
'AUTH_SOURCE_ATTRIBUTES');
$aFields = $aData = array();
class authSourceProxy extends HttpProxyController {
function testingOption($params){
/*global $RBAC;
$fields = array('AUTH_SOURCE_PROVIDER' => $params->optionAuthS);
$G_PUBLISH = new Publisher();
$data=array();
$aCommonFields = array('AUTH_SOURCE_UID',
'AUTH_SOURCE_NAME',
'AUTH_SOURCE_PROVIDER',
'AUTH_SOURCE_SERVER_NAME',
'AUTH_SOURCE_PORT',
'AUTH_SOURCE_ENABLED_TLS',
'AUTH_ANONYMOUS',
'AUTH_SOURCE_SEARCH_USER',
'AUTH_SOURCE_PASSWORD',
'AUTH_SOURCE_VERSION',
'AUTH_SOURCE_BASE_DN',
'AUTH_SOURCE_OBJECT_CLASSES',
'AUTH_SOURCE_ATTRIBUTES');
$aFields = $aData = array();
unset($params->PHPSESSID);
foreach ($params as $sField => $sValue) {
if (in_array($sField, $aCommonFields)) {
$aFields[$sField] = (($sField=='AUTH_SOURCE_ENABLED_TLS' || $sField=='AUTH_ANONYMOUS'))? ($sValue=='yes')?1:0 :$sValue;
}
else {
$aData[$sField] = $sValue;
}
}
$aFields['AUTH_SOURCE_DATA'] = $aData;
if (isset($aFields['AUTH_SOURCE_UID']) && $aFields['AUTH_SOURCE_UID'] != '') {
$RBAC->updateAuthSource($aFields);
}
else {
$aAuth = $RBAC->createAuthSource($aFields);
}*/
//G::pr($aAuth);die;
$data['success'] = true;
$data['optionAuthS'] = $params->optionAuthS;
//$data['sUID'] = $aAuth;
return $data;
}
function saveAuthSources($params){
global $RBAC;
if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) {
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
}
$aCommonFields = array('AUTH_SOURCE_UID',
'AUTH_SOURCE_NAME',
'AUTH_SOURCE_PROVIDER',
'AUTH_SOURCE_SERVER_NAME',
'AUTH_SOURCE_PORT',
'AUTH_SOURCE_ENABLED_TLS',
'AUTH_ANONYMOUS',
'AUTH_SOURCE_SEARCH_USER',
'AUTH_SOURCE_PASSWORD',
'AUTH_SOURCE_VERSION',
'AUTH_SOURCE_BASE_DN',
'AUTH_SOURCE_OBJECT_CLASSES',
'AUTH_SOURCE_ATTRIBUTES');
$aFields = $aData = array();
unset($params->PHPSESSID);
foreach ($params as $sField => $sValue) {
if (in_array($sField, $aCommonFields)) {
$aFields[$sField] = (($sField=='AUTH_SOURCE_ENABLED_TLS' || $sField=='AUTH_ANONYMOUS'))? ($sValue=='yes')?1:0 :$sValue;
}
else {
$aData[$sField] = $sValue;
}
}
$aFields['AUTH_SOURCE_DATA'] = $aData;
if ($aFields['AUTH_SOURCE_UID'] == '') {
$RBAC->createAuthSource($aFields);
}
else {
$RBAC->updateAuthSource($aFields);
}
$data=array();
$data['success'] = true;
return $data;
}//end saveAuthSoruces function
} //end authSourceProxy class
unset($params->PHPSESSID);
foreach ($params as $sField => $sValue) {
if (in_array($sField, $aCommonFields)) {
$aFields[$sField] = (($sField=='AUTH_SOURCE_ENABLED_TLS' || $sField=='AUTH_ANONYMOUS'))? ($sValue=='yes')?1:0 :$sValue;
}
else {
$aData[$sField] = $sValue;
}
}
$aFields['AUTH_SOURCE_DATA'] = $aData;
if (isset($aFields['AUTH_SOURCE_UID']) && $aFields['AUTH_SOURCE_UID'] != '') {
$RBAC->updateAuthSource($aFields);
}
else {
$aAuth = $RBAC->createAuthSource($aFields);
}*/
//G::pr($aAuth);die;
$data['success'] = true;
$data['optionAuthS'] = $params->optionAuthS;
//$data['sUID'] = $aAuth;
return $data;
}
function saveAuthSources ($params)
{
global $RBAC;
if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
}
$aCommonFields = array ('AUTH_SOURCE_UID','AUTH_SOURCE_NAME','AUTH_SOURCE_PROVIDER','AUTH_SOURCE_SERVER_NAME','AUTH_SOURCE_PORT','AUTH_SOURCE_ENABLED_TLS','AUTH_ANONYMOUS','AUTH_SOURCE_SEARCH_USER','AUTH_SOURCE_PASSWORD','AUTH_SOURCE_VERSION','AUTH_SOURCE_BASE_DN','AUTH_SOURCE_OBJECT_CLASSES','AUTH_SOURCE_ATTRIBUTES');
$aFields = $aData = array ();
unset( $params->PHPSESSID );
foreach ($params as $sField => $sValue) {
if (in_array( $sField, $aCommonFields )) {
$aFields[$sField] = (($sField == 'AUTH_SOURCE_ENABLED_TLS' || $sField == 'AUTH_ANONYMOUS')) ? ($sValue == 'yes') ? 1 : 0 : $sValue;
} else {
$aData[$sField] = $sValue;
}
}
$aFields['AUTH_SOURCE_DATA'] = $aData;
if ($aFields['AUTH_SOURCE_UID'] == '') {
$RBAC->createAuthSource( $aFields );
} else {
$RBAC->updateAuthSource( $aFields );
}
$data = array ();
$data['success'] = true;
return $data;
} //end saveAuthSoruces function
} //end authSourceProxy class