本文整理匯總了PHP中Settings_Roles_Record_Model::getUsers方法的典型用法代碼示例。如果您正苦於以下問題:PHP Settings_Roles_Record_Model::getUsers方法的具體用法?PHP Settings_Roles_Record_Model::getUsers怎麽用?PHP Settings_Roles_Record_Model::getUsers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Settings_Roles_Record_Model
的用法示例。
在下文中一共展示了Settings_Roles_Record_Model::getUsers方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: process
public function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
$record = $request->get('record');
$parentRoleId = $request->get('parent_roleid');
$roleDirectlyRelated = false;
if (!empty($record)) {
$recordModel = Settings_Roles_Record_Model::getInstanceById($record);
$viewer->assign('MODE', 'edit');
} else {
$recordModel = new Settings_Roles_Record_Model();
$recordModel->setParent(Settings_Roles_Record_Model::getInstanceById($parentRoleId));
$viewer->assign('MODE', '');
$roleDirectlyRelated = true;
}
$profileId = $recordModel->getDirectlyRelatedProfileId();
if ($profileId) {
$viewer->assign('PROFILE_ID', $profileId);
$roleDirectlyRelated = true;
}
$viewer->assign('PROFILE_DIRECTLY_RELATED_TO_ROLE', $roleDirectlyRelated);
$viewer->assign('ALL_PROFILES', Settings_Profiles_Record_Model::getAll());
$viewer->assign('ROLE_USERS', $recordModel->getUsers());
$viewer->assign('RECORD_MODEL', $recordModel);
$viewer->assign('RECORD_ID', $record);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->view('EditView.tpl', $qualifiedModuleName);
}
示例2: getUsersList
/**
* Function to get all users related to this group
* @param <Boolean> $nonAdmin true/false
* @return <Array> Users models list <Users_Record_Model>
*/
public function getUsersList($nonAdmin = false)
{
$userIdsList = $usersList = array();
$members = $this->getMembers();
foreach ($members['Users'] as $memberModel) {
$userId = $memberModel->get('userId');
$userIdsList[$userId] = $userId;
}
foreach ($members['Groups'] as $memberModel) {
$groupModel = Settings_Groups_Record_Model::getInstance($memberModel->get('groupId'));
$groupMembers = $groupModel->getMembers();
foreach ($groupMembers['Users'] as $groupMemberModel) {
$userId = $groupMemberModel->get('userId');
$userIdsList[$userId] = $userId;
}
}
foreach ($members['Roles'] as $memberModel) {
$roleModel = new Settings_Roles_Record_Model();
$roleModel->set('roleid', $memberModel->get('roleId'));
$roleUsers = $roleModel->getUsers();
foreach ($roleUsers as $userId => $userRecordModel) {
$userIdsList[$userId] = $userId;
}
}
foreach ($members['RoleAndSubordinates'] as $memberModel) {
$roleModel = new Settings_Roles_Record_Model();
$roleModel->set('roleid', $memberModel->get('roleId'));
$roleUsers = $roleModel->getUsers();
foreach ($roleUsers as $userId => $userRecordModel) {
$userIdsList[$userId] = $userId;
}
}
if (array_key_exists(1, $userIdsList)) {
unset($userIdsList[1]);
}
foreach ($userIdsList as $userId) {
$userRecordModel = Users_Record_Model::getInstanceById($userId, 'Users');
if ($nonAdmin && $userRecordModel->isAdminUser()) {
continue;
}
$usersList[$userId] = $userRecordModel;
}
return $usersList;
}