本文整理汇总了PHP中Roles::loadByCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Roles::loadByCode方法的具体用法?PHP Roles::loadByCode怎么用?PHP Roles::loadByCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Roles
的用法示例。
在下文中一共展示了Roles::loadByCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LoginLog
$oDataset = UsersPeer::DoSelectRs($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$Login = new LoginLog();
$aLogin = $Login->getLastLoginAllUsers();
$Cases = new AppCacheView();
$aCases = $Cases->getTotalCasesByAllUsers();
$Department = new Department();
$aDepart = $Department->getAllDepartmentsByUser();
$aAuthSources = $RBAC->getAllAuthSourcesByUser();
require_once PATH_CONTROLLERS . 'adminProxy.php';
$uxList = adminProxy::getUxTypesList();
$oRoles = new Roles();
$rows = array();
while ($oDataset->next()) {
$row = $oDataset->getRow();
$uRole = $oRoles->loadByCode($row['USR_ROLE']);
$row['USR_ROLE'] = isset($uRole['ROL_NAME']) ? $uRole['ROL_NAME'] != '' ? $uRole['ROL_NAME'] : $uRole['USR_ROLE'] : $uRole['USR_ROLE'];
$row['DUE_DATE_OK'] = date('Y-m-d') > date('Y-m-d', strtotime($row['USR_DUE_DATE'])) ? 0 : 1;
$row['LAST_LOGIN'] = isset($aLogin[$row['USR_UID']]) ? $aLogin[$row['USR_UID']] : '';
$row['TOTAL_CASES'] = isset($aCases[$row['USR_UID']]) ? $aCases[$row['USR_UID']] : 0;
$row['DEP_TITLE'] = isset($aDepart[$row['USR_UID']]) ? $aDepart[$row['USR_UID']] : '';
$row['USR_UX'] = isset($uxList[$row['USR_UX']]) ? $uxList[$row['USR_UX']] : $uxList['NORMAL'];
$row['USR_AUTH_SOURCE'] = isset($aAuthSources[$row['USR_UID']]) ? $aAuthSources[$row['USR_UID']] : 'ProcessMaker (MYSQL)';
$rows[] = $row;
}
echo '{users: ' . G::json_encode($rows) . ', total_users: ' . $totalRows . '}';
break;
case 'updatePageSize':
G::LoadClass('configuration');
$c = new Configurations();
$arr['pageSize'] = $_REQUEST['size'];
示例2: uxUserUpdate
public function uxUserUpdate($httpData)
{
require_once 'classes/model/Users.php';
$data = G::json_decode($httpData->users);
$list = array();
if (!is_array($data)) {
$list[0] = (array) $data;
} else {
$list = $data;
}
$oRoles = new Roles();
$rows = array();
foreach ($list as $value) {
$value = (array) $value;
$user = UsersPeer::retrieveByPK($value['USR_UID']);
$user->setUsrUx($value['USR_UX']);
$user->save();
$row = $user->toArray(BasePeer::TYPE_FIELDNAME);
try {
$uRole = $oRoles->loadByCode($row['USR_ROLE']);
} catch (exception $oError) {
$uRole['ROL_NAME'] = G::loadTranslation('ID_DELETED');
}
$row['USR_ROLE_ID'] = $row['USR_ROLE'];
$row['USR_ROLE'] = isset($uRole['ROL_NAME']) ? $uRole['ROL_NAME'] != '' ? $uRole['ROL_NAME'] : $uRole['USR_ROLE'] : $uRole['USR_ROLE'];
$uxList = self::getUxTypesList();
$row['USR_UX'] = $uxList[$user->getUsrUx()];
$rows[] = $row;
}
if (count($rows) == 1) {
$retRow = $rows[0];
} else {
$retRow = $rows;
}
return array('success' => true, 'message' => 'done', 'users' => $retRow);
}
示例3: loadDetailed
public function loadDetailed ($UsrUid)
{
try {
$result = array ();
$oUser = UsersPeer::retrieveByPK( $UsrUid );
if (! is_null( $oUser )) {
$aFields = $oUser->toArray( BasePeer::TYPE_FIELDNAME );
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
$this->setNew( false );
$aIsoCountry = IsoCountry::findById( $aFields['USR_COUNTRY'] );
$aIsoSubdivision = IsoSubdivision::findById( $aFields['USR_COUNTRY'], $aFields['USR_CITY'] );
$aIsoLocation = IsoLocation::findById( $aFields['USR_COUNTRY'], $aFields['USR_CITY'], $aFields['USR_LOCATION'] );
$aFields["USR_COUNTRY_NAME"] = (!empty($aIsoCountry["IC_NAME"]))? $aIsoCountry["IC_NAME"] : "";
$aFields["USR_CITY_NAME"] = (!empty($aIsoSubdivision["IS_NAME"]))? $aIsoSubdivision["IS_NAME"] : "";
$aFields["USR_LOCATION_NAME"] = (!empty($aIsoLocation["IL_NAME"]))? $aIsoLocation["IL_NAME"] : "";
require_once PATH_RBAC . "model/Roles.php";
$roles = new Roles();
$role = $roles->loadByCode($aFields['USR_ROLE']);
$aFields['USR_ROLE_NAME'] = $role['ROL_NAME'];
$result = $aFields;
return $result;
} else {
//return $result;
throw (new Exception(G::LoadTranslation("ID_USER_UID_DOESNT_EXIST", SYS_LANG, array("USR_UID" => $UsrUid))));
}
} catch (Exception $oError) {
throw ($oError);
}
}