当前位置: 首页>>代码示例>>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;未经允许,请勿转载。