當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Settings_Roles_Record_Model::set方法代碼示例

本文整理匯總了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}");
 }
開發者ID:rcrrich,項目名稱:UpdatePackages,代碼行數:60,代碼來源:Save.php

示例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;
 }
開發者ID:cannking,項目名稱:vtigercrm-debug,代碼行數:17,代碼來源:UserRole.php

示例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}");
 }
開發者ID:Bergdahls,項目名稱:YetiForceCRM,代碼行數:38,代碼來源:Save.php

示例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();
     }
 }
開發者ID:cannking,項目名稱:vtigercrm-debug,代碼行數:23,代碼來源:Member.php

示例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;
 }
開發者ID:JeRRimix,項目名稱:YetiForceCRM,代碼行數:49,代碼來源:Record.php


注:本文中的Settings_Roles_Record_Model::set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。