$sDataBase = 'database_' . strtolower(DB_ADAPTER); if (G::LoadSystemExist($sDataBase)) { G::LoadSystem($sDataBase); $oDataBase = new database(); $oCriteria->addAsColumn('USR_COMPLETENAME', $oDataBase->concatString("USR_LASTNAME", "' '", "USR_FIRSTNAME")); //$oCriteria->addAsColumn('USR_PHOTO', $oDataBase->concatString("'".PATH_IMAGES_ENVIRONMENT_USERS."'", "USR_UID","'.gif'")); } $oCriteria->addSelectColumn(UsersPeer::USR_USERNAME); $oCriteria->addSelectColumn(UsersPeer::USR_EMAIL); $oCriteria->addSelectColumn(UsersPeer::USR_ROLE); $oCriteria->addSelectColumn(UsersPeer::USR_DUE_DATE); //$oCriteria->addAsColumn('USR_VIEW', $sDelimiter . G::LoadTranslation('ID_DETAIL') . $sDelimiter); //$oCriteria->addAsColumn('USR_EDIT', $sDelimiter . G::LoadTranslation('ID_EDIT') . $sDelimiter); //$oCriteria->addAsColumn('USR_DELETE', $sDelimiter . G::LoadTranslation('ID_DELETE') . $sDelimiter); //$oCriteria->addAsColumn('USR_AUTH', $sDelimiter . G::LoadTranslation('ID_AUTHENTICATION') . $sDelimiter); //$oCriteria->addAsColumn('USR_REASSIGN', $sDelimiter . G::LoadTranslation('ID_REASSIGN_CASES') . $sDelimiter); $oCriteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN); if ($filter != '') { $cc = $oCriteria->getNewCriterion(UsersPeer::USR_USERNAME, '%' . $filter . '%', Criteria::LIKE)->addOr($oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME, '%' . $filter . '%', Criteria::LIKE)->addOr($oCriteria->getNewCriterion(UsersPeer::USR_LASTNAME, '%' . $filter . '%', Criteria::LIKE))); $oCriteria->add($cc); //echo $oCriteria->toString(); } $rs = UsersPeer::DoSelectRs($oCriteria); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rows = array(); while ($rs->next()) { $rows[] = $rs->getRow(); // if (!file_exists($aux['USR_PHOTO'])) $aux['USR_PHOTO'] = 'public_html/images/user.gif'; // $rows[] = $aux; } echo '{users: ' . G::json_encode($rows) . '}';
* */ try { global $RBAC; if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) { G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header('location: ../login/login'); die; } switch ($_REQUEST['action']) { case 'searchUsers': require_once 'classes/model/Users.php'; $criteria = new Criteria('workflow'); $criteria->addSelectColumn(UsersPeer::USR_USERNAME); $criteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN); $dataset = UsersPeer::DoSelectRs($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); $pmUsers = array(); while ($row = $dataset->getRow()) { $pmUsers[] = $row['USR_USERNAME']; $dataset->next(); } $aFields = $RBAC->getAuthSource($_POST['sUID']); G::LoadThirdParty('pear/json', 'class.json'); $oJSON = new Services_JSON(); $i = 0; $oUser = new Users(); $aAux = $RBAC->searchUsers($_POST['sUID'], $_POST['sKeyword']); $aUsers = array(); // note added by gustavo cruz gustavo-at-colosa.com
$oDataset->next(); $uUIDs = array(); while ($aRow = $oDataset->getRow()) { $uUIDs[] = $aRow['USR_UID']; $oDataset->next(); } $aUsers = array(); $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn('COUNT(*) AS CNT'); $oCriteria->add(UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL); $oCriteria->add(UsersPeer::USR_UID, $uUIDs, Criteria::NOT_IN); $filter = isset($_POST['textFilter']) ? $_POST['textFilter'] : ''; if ($filter != '') { $oCriteria->add($oCriteria->getNewCriterion(UsersPeer::USR_USERNAME, '%' . $filter . '%', Criteria::LIKE)->addOr($oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME, '%' . $filter . '%', Criteria::LIKE)->addOr($oCriteria->getNewCriterion(UsersPeer::USR_LASTNAME, '%' . $filter . '%', Criteria::LIKE)))); } $oDataset = UsersPeer::DoSelectRs($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $row = $oDataset->getRow(); $totalRows = $row['CNT']; $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(UsersPeer::USR_UID); $oCriteria->addSelectColumn(UsersPeer::USR_USERNAME); $oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); $oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME); $oCriteria->addSelectColumn(UsersPeer::USR_EMAIL); $oCriteria->addSelectColumn(UsersPeer::USR_STATUS); $oCriteria->add(UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL); $oCriteria->add(UsersPeer::USR_UID, $uUIDs, Criteria::NOT_IN); $filter = isset($_POST['textFilter']) ? $_POST['textFilter'] : ''; if ($filter != '') {