本文整理汇总了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;
}