示例#1
0
     if (isset($_POST['USR_UID'])) {
         $oCriteria->add(UsersPeer::USR_UID, $_POST['USR_UID'], Criteria::NOT_EQUAL);
     }
     $oDataset = UsersPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     G::loadClass('configuration');
     $oConf = new Configurations();
     $oConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS', '');
     $defaultOption = isset($oConf->aConfig['format']) ? $oConf->aConfig['format'] : '';
     $aUserInfo = array();
     if (isset($_POST['addNone']) && $_POST['addNone'] == '1') {
         $aUserInfo[] = array('USR_UID' => '', 'USER_FULLNAME' => '- ' . G::LoadTranslation('ID_NONE') . ' -');
     }
     while ($oDataset->next()) {
         $aRow1 = $oDataset->getRow();
         $infoUser = G::getFormatUserList($defaultOption, $aRow1);
         $aUserInfo[] = array('USR_UID' => $aRow1['USR_UID'], 'USER_FULLNAME' => $infoUser);
     }
     print G::json_encode($aUserInfo);
     break;
 case 'availableCalendars':
     G::LoadClass('calendar');
     $calendar = new Calendar();
     $calendarObj = $calendar->getCalendarList(true, true);
     $oData[] = array('CALENDAR_UID' => '', 'CALENDAR_NAME' => '- None -');
     foreach ($calendarObj['array'] as $rowid => $row) {
         if ($rowid > 0) {
             $oData[] = array('CALENDAR_UID' => $row['CALENDAR_UID'], 'CALENDAR_NAME' => $row['CALENDAR_NAME']);
         }
     }
     print G::json_encode($oData);
示例#2
0
 public function getFormatedUser($sFormat, $aCaseUser, $userIndex)
 {
     require_once 'classes/model/Users.php';
     $oUser = new Users();
     try {
         $aCaseUserRecord = $oUser->load($aCaseUser[$userIndex]);
         $sCaseUser = G::getFormatUserList($sFormat, $aCaseUserRecord);
         // . ' (' . $aCaseUserRecord['USR_USERNAME'] . ')';]
     } catch (Exception $e) {
         $sCaseUser = '';
     }
     return $sCaseUser;
 }
示例#3
0
 /**
  * @covers G::getFormatUserList
  * @todo   Implement testGetFormatUserList().
  */
 public function testGetFormatUserList()
 {
     $aUserInfo['USR_USERNAME'] = '******';
     $aUserInfo['USR_FIRSTNAME'] = 'Fernando';
     $aUserInfo['USR_LASTNAME'] = 'Ontiveros';
     $response = G::getFormatUserList('@firstName @lastName', $aUserInfo);
     $this->assertEquals('Fernando Ontiveros', $response);
     $response = G::getFormatUserList('@firstName @lastName (@userName)', $aUserInfo);
     $this->assertEquals('Fernando Ontiveros (fontiveros)', $response);
     $response = G::getFormatUserList('@userName', $aUserInfo);
     $this->assertEquals('fontiveros', $response);
     $response = G::getFormatUserList('@userName (@firstName @lastName)', $aUserInfo);
     $this->assertEquals('fontiveros (Fernando Ontiveros)', $response);
     $response = G::getFormatUserList('@lastName @firstName', $aUserInfo);
     $this->assertEquals('Ontiveros Fernando', $response);
     $response = G::getFormatUserList('@lastName, @firstName', $aUserInfo);
     $this->assertEquals('Ontiveros, Fernando', $response);
     $response = G::getFormatUserList('@lastName, @firstName (@userName)', $aUserInfo);
     $this->assertEquals('Ontiveros, Fernando (fontiveros)', $response);
     $response = G::getFormatUserList('test', $aUserInfo);
     $this->assertEquals('fontiveros', $response);
 }
$aCaseGroups = $oTasks->getGroupsOfTask($aCase['TAS_UID'], 1);
$oConf = new Configurations();
$ConfEnv = $oConf->getFormats();
foreach ($aCaseGroups as $aCaseGroup) {
    $aCaseUsers = $oGroups->getUsersOfGroup($aCaseGroup['GRP_UID']);
    foreach ($aCaseUsers as $aCaseUser) {
        if ($aCaseUser['USR_UID'] != $sReassignFromUser) {
            $aCaseUserRecord = $oUser->load($aCaseUser['USR_UID']);
            $sCaseUser = G::getFormatUserList($ConfEnv['format'], $aCaseUserRecord);
            //                        $aUsersInvolved[] = array ( 'userUid' => $aCaseUser['USR_UID'] , 'userFullname' => $aCaseUserRecord['USR_FIRSTNAME'] . ' ' . $aCaseUserRecord['USR_LASTNAME']); // . ' (' . $aCaseUserRecord['USR_USERNAME'] . ')';
            $aUsersInvolved[] = array('userUid' => $aCaseUser['USR_UID'], 'userFullname' => $sCaseUser);
            // . ' (' . $aCaseUserRecord['USR_USERNAME'] . ')';
        }
    }
}
$aCaseUsers = $oTasks->getUsersOfTask($aCase['TAS_UID'], 1);
foreach ($aCaseUsers as $aCaseUser) {
    if ($aCaseUser['USR_UID'] != $sReassignFromUser) {
        $aCaseUserRecord = $oUser->load($aCaseUser['USR_UID']);
        $sCaseUser = G::getFormatUserList($ConfEnv['format'], $aCaseUserRecord);
        //                    $aUsersInvolved[] = array ( 'userUid' => $aCaseUser['USR_UID'] , 'userFullname' => $aCaseUserRecord['USR_FIRSTNAME'] . ' ' . $aCaseUserRecord['USR_LASTNAME']); // . ' (' . $aCaseUserRecord['USR_USERNAME'] . ')';
        $aUsersInvolved[] = array('userUid' => $aCaseUser['USR_UID'], 'userFullname' => $sCaseUser);
        // . ' (' . $aCaseUserRecord['USR_USERNAME'] . ')';
    }
}
//            $oTmp = new stdClass();
//            $oTmp->items = $aUsersInvolved;
$result = array();
$aUsersInvolved = array_sort($aUsersInvolved, 'userFullname', SORT_ASC, $query);
$result['data'] = $aUsersInvolved;
print G::json_encode($result);
//$processUid = isset($_POST['process'])     ? $_POST['process'] : '';
$TaskUid = isset( $_POST['task'] ) ? $_POST['task'] : '';
$sReassignFromUser = isset( $_POST['currentUser'] ) ? $_POST['currentUser'] : '';

G::LoadClass( 'case' );

$oCases = new Cases();
$oConf = new Configurations();

$aUsersInvolved = Array();

$ConfEnv = $oConf->getFormats();
if ($TaskUid != '') {
    G::LoadClass( 'tasks' );
    $task = new Task();
    $tasks = $task->load($TaskUid);
    $rows = $oCases->getUsersToReassign($TaskUid, $_SESSION['USER_LOGGED'], $tasks['PRO_UID']);
    foreach ($rows as $row) {
        $sCaseUser = G::getFormatUserList( $ConfEnv['format'], $row );
        $aUsersInvolved[] = array ('userUid' => $row['USR_UID'], 'userFullname' => $sCaseUser);
    }
}

//            $oTmp = new stdClass();
//            $oTmp->items = $aUsersInvolved;
$result = array ();
$aUsersInvolved = array_sort( $aUsersInvolved, 'userFullname', SORT_ASC, $query );
$result['data'] = $aUsersInvolved;
print G::json_encode( $result );