本文整理汇总了PHP中Settings_Roles_Record_Model::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings_Roles_Record_Model::set方法的具体用法?PHP Settings_Roles_Record_Model::set怎么用?PHP Settings_Roles_Record_Model::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings_Roles_Record_Model
的用法示例。
在下文中一共展示了Settings_Roles_Record_Model::set方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
$recordId = $request->get('record');
$roleName = $request->get('rolename');
$allowassignedrecordsto = $request->get('allowassignedrecordsto');
$moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
if (!empty($recordId)) {
$recordModel = Settings_Roles_Record_Model::getInstanceById($recordId);
} else {
$recordModel = new Settings_Roles_Record_Model();
}
if ($request->get('profile_directly_related_to_role') == '1') {
$profileId = $request->get('profile_directly_related_to_role_id');
$profileName = $request->get('profilename');
if (empty($profileName)) {
$profileName = $roleName . '+' . vtranslate('LBL_PROFILE', $qualifiedModuleName);
}
if ($profileId) {
$profileRecordModel = Settings_Profiles_Record_Model::getInstanceById($profileId);
} else {
$profileRecordModel = Settings_Profiles_Record_Model::getInstanceByName($profileName, true);
if (empty($profileRecordModel)) {
$profileRecordModel = new Settings_Profiles_Record_Model();
}
}
$profileRecordModel->set('directly_related_to_role', '1');
$profileRecordModel->set('profilename', $profileName)->set('profile_permissions', $request->get('permissions'));
$profileRecordModel->set('viewall', $request->get('viewall'));
$profileRecordModel->set('editall', $request->get('editall'));
$savedProfileId = $profileRecordModel->save();
$roleProfiles = array($savedProfileId);
} else {
$roleProfiles = $request->get('profiles');
}
$parentRoleId = $request->get('parent_roleid');
if ($recordModel && !empty($parentRoleId)) {
$parentRole = Settings_Roles_Record_Model::getInstanceById($parentRoleId);
$recordModel->set('change_owner', $request->get('change_owner'))->set('searchunpriv', $request->get('searchunpriv'))->set('clendarallorecords', $request->get('clendarallorecords'));
if (!empty($allowassignedrecordsto)) {
$recordModel->set('allowassignedrecordsto', $allowassignedrecordsto);
}
// set the value of assigned records to
if ($parentRole && !empty($roleName) && !empty($roleProfiles)) {
$recordModel->set('rolename', $roleName);
$recordModel->set('profileIds', $roleProfiles);
$parentRole->addChildRole($recordModel);
}
//After role updation recreating user privilege files
if ($roleProfiles) {
foreach ($roleProfiles as $profileId) {
$profileRecordModel = Settings_Profiles_Record_Model::getInstanceById($profileId);
$profileRecordModel->recalculate(array($recordId));
}
}
}
$redirectUrl = $moduleModel->getDefaultUrl();
header("Location: {$redirectUrl}");
}
示例2: getDisplayValue
/**
* Function to get display value
* @param <String> $value
* @param <Number> $recordId
* @return <String> display value
*/
public function getDisplayValue($value, $recordId)
{
$displayValue = $this->getEditViewDisplayValue($value);
$currentUserModel = Users_Record_Model::getCurrentUserModel();
if ($currentUserModel->isAdminUser()) {
$roleRecordModel = new Settings_Roles_Record_Model();
$roleRecordModel->set('roleid', $value);
return '<a href="' . $roleRecordModel->getEditViewUrl() . '">' . textlength_check($displayValue) . '</a>';
}
return $displayValue;
}
示例3: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
$recordId = $request->get('record');
$roleName = $request->get('rolename');
$allowassignedrecordsto = $request->get('allowassignedrecordsto');
$moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
if (!empty($recordId)) {
$recordModel = Settings_Roles_Record_Model::getInstanceById($recordId);
} else {
$recordModel = new Settings_Roles_Record_Model();
}
$roleProfiles = $request->get('profiles');
$parentRoleId = $request->get('parent_roleid');
if ($recordModel && !empty($parentRoleId)) {
$parentRole = Settings_Roles_Record_Model::getInstanceById($parentRoleId);
$recordModel->set('change_owner', $request->get('change_owner'))->set('searchunpriv', $request->get('searchunpriv'))->set('listrelatedrecord', $request->get('listRelatedRecord'))->set('previewrelatedrecord', $request->get('previewRelatedRecord'))->set('editrelatedrecord', $request->get('editRelatedRecord'))->set('permissionsrelatedfield', $request->get('permissionsRelatedField'))->set('globalsearchadv', $request->get('globalSearchAdvanced'))->set('clendarallorecords', $request->get('clendarallorecords'));
if (!empty($allowassignedrecordsto)) {
$recordModel->set('allowassignedrecordsto', $allowassignedrecordsto);
}
// set the value of assigned records to
if ($parentRole && !empty($roleName) && !empty($roleProfiles)) {
$recordModel->set('rolename', $roleName);
$recordModel->set('profileIds', $roleProfiles);
$parentRole->addChildRole($recordModel);
}
//After role updation recreating user privilege files
if ($roleProfiles) {
foreach ($roleProfiles as $profileId) {
$profileRecordModel = Settings_Profiles_Record_Model::getInstanceById($profileId);
$profileRecordModel->recalculate(array($recordId));
}
}
}
$redirectUrl = $moduleModel->getDefaultUrl();
header("Location: {$redirectUrl}");
}
示例4: getDetailViewUrl
/**
* Function to get Detail View Url of this member
* return <String> url
*/
public function getDetailViewUrl()
{
list($type, $recordId) = self::getIdComponentsFromQualifiedId($this->getId());
switch ($type) {
case 'Users':
$recordModel = Users_Record_Model::getCleanInstance($type);
$recordModel->setId($recordId);
return $recordModel->getDetailViewUrl();
case 'RoleAndSubordinates':
case 'Roles':
$recordModel = new Settings_Roles_Record_Model();
$recordModel->set('roleid', $recordId);
return $recordModel->getEditViewUrl();
case 'Groups':
$recordModel = new Settings_Groups_Record_Model();
$recordModel->setId($recordId);
return $recordModel->getDetailViewUrl();
}
}
示例5: 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;
}