当前位置: 首页>>代码示例>>PHP>>正文


PHP Settings_Roles_Record_Model::getInstanceById方法代码示例

本文整理汇总了PHP中Settings_Roles_Record_Model::getInstanceById方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings_Roles_Record_Model::getInstanceById方法的具体用法?PHP Settings_Roles_Record_Model::getInstanceById怎么用?PHP Settings_Roles_Record_Model::getInstanceById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Settings_Roles_Record_Model的用法示例。


在下文中一共展示了Settings_Roles_Record_Model::getInstanceById方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
 }
开发者ID:JeRRimix,项目名称:YetiForceCRM,代码行数:31,代码来源:Edit.php

示例2: 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

示例3: process

	function process(Vtiger_Request $request)
	{
		$viewer = $this->getViewer($request);
		$moduleName = $request->getModule();
		$qualifiedModuleName = $request->getModule(false);

		$sourceRecord = $request->get('src_record');

		$companyDetails = Vtiger_CompanyDetails_Model::getInstanceById();
		$companyLogo = $companyDetails->getLogo();

		$sourceRole = Settings_Roles_Record_Model::getInstanceById($sourceRecord);
		$rootRole = Settings_Roles_Record_Model::getBaseRole();
		$allRoles = Settings_Roles_Record_Model::getAll();

		$viewer->assign('SOURCE_ROLE', $sourceRole);
		$viewer->assign('ROOT_ROLE', $rootRole);
		$viewer->assign('ROLES', $allRoles);
		$viewer->assign('VIEW', $request->get('view'));
		$viewer->assign('TYPE', $request->get('type'));
		$viewer->assign('MODULE_NAME', $moduleName);
		$viewer->assign('COMPANY_LOGO', $companyLogo);

		$viewer->view('Popup.tpl', $qualifiedModuleName);
	}
开发者ID:rubichcube,项目名称:YetiForceCRM,代码行数:25,代码来源:Popup.php

示例4: process

 public function process(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $qualifiedModuleName = $request->getModule(false);
     $recordId = $request->get('record');
     $recordModel = Settings_Roles_Record_Model::getInstanceById($recordId);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
     $viewer->assign('RECORD_MODEL', $recordModel);
     echo $viewer->view('DeleteTransferForm.tpl', $qualifiedModuleName, true);
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:12,代码来源:DeleteAjax.php

示例5: process

 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $qualifiedModuleName = $request->getModule(false);
     $recordId = $request->get('record');
     $transferRecordId = $request->get('transfer_record');
     $moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
     $recordModel = Settings_Roles_Record_Model::getInstanceById($recordId);
     $transferToRole = Settings_Roles_Record_Model::getInstanceById($transferRecordId);
     if ($recordModel && $transferToRole) {
         $recordModel->delete($transferToRole);
     }
     $redirectUrl = $moduleModel->getDefaultUrl();
     header("Location: {$redirectUrl}");
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:15,代码来源:Delete.php

示例6: process

 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     $parentRoleId = $request->get('parent_roleid');
     $parentRole = Settings_Roles_Record_Model::getInstanceById($parentRoleId);
     $recordModel = Settings_Roles_Record_Model::getInstanceById($recordId);
     $response = new Vtiger_Response();
     $response->setEmitType(Vtiger_Response::$EMIT_JSON);
     try {
         $recordModel->moveTo($parentRole);
     } catch (AppException $e) {
         $response->setError('Move Role Failed');
     }
     $response->emit();
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:16,代码来源:MoveAjax.php

示例7: getGroupsList

 function getGroupsList(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $roleInstance = Settings_Roles_Record_Model::getInstanceById($currentUser->get('roleid'));
     $clendarallorecords = $roleInstance->get('clendarallorecords');
     switch ($clendarallorecords) {
         case 1:
             $groups = [];
             break;
         case 2:
         case 3:
         default:
             $groups = $currentUser->getAccessibleGroups();
             break;
     }
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('ALL_ACTIVEGROUP_LIST', $groups);
     $viewer->view('RightPanel.tpl', $moduleName);
 }
开发者ID:rcrrich,项目名称:YetiForceCRM,代码行数:21,代码来源:RightPanel.php

示例8: 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

示例9: getRoleBasedSubordinateUsers

 /**
  * Function to get subordinates Users
  * @return <array> Users
  */
 public function getRoleBasedSubordinateUsers()
 {
     $currentUserRoleModel = Settings_Roles_Record_Model::getInstanceById($this->getRole());
     $childernRoles = $currentUserRoleModel->getAllChildren();
     $users = $this->getAllUsersOnRoles($childernRoles);
     $currentUserDetail = array($this->getId() => $this->get('first_name') . ' ' . $this->get('last_name'));
     $users = $currentUserDetail + $users;
     return $users;
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:13,代码来源:Record.php

示例10: saveentity

 /** Function to save the user information into the database
  * @param $module -- module name:: Type varchar
  *
  */
 function saveentity($module)
 {
     global $current_user;
     //$adb added by raju for mass mailing
     $insertion_mode = $this->mode;
     if (empty($this->column_fields['time_zone'])) {
         $dbDefaultTimeZone = DateTimeField::getDBTimeZone();
         $this->column_fields['time_zone'] = $dbDefaultTimeZone;
         $this->time_zone = $dbDefaultTimeZone;
     }
     if (empty($this->column_fields['currency_id'])) {
         $this->column_fields['currency_id'] = CurrencyField::getDBCurrencyId();
     }
     if (empty($this->column_fields['date_format'])) {
         $this->column_fields['date_format'] = 'yyyy-mm-dd';
     }
     if (empty($this->column_fields['start_hour'])) {
         $this->column_fields['start_hour'] = '08:00';
     }
     if (empty($this->column_fields['dayoftheweek'])) {
         $this->column_fields['dayoftheweek'] = 'Monday';
     }
     if (empty($this->column_fields['callduration'])) {
         $this->column_fields['callduration'] = 5;
     }
     if (empty($this->column_fields['othereventduration'])) {
         $this->column_fields['othereventduration'] = 5;
     }
     if (empty($this->column_fields['hour_format'])) {
         $this->column_fields['hour_format'] = 24;
     }
     if (empty($this->column_fields['activity_view'])) {
         $this->column_fields['activity_view'] = 'This Month';
     }
     if (empty($this->column_fields['calendarsharedtype'])) {
         $this->column_fields['calendarsharedtype'] = 'public';
     }
     if (empty($this->column_fields['default_record_view'])) {
         $this->column_fields['default_record_view'] = 'Summary';
     }
     if (empty($this->column_fields['status'])) {
         $this->column_fields['status'] = 'Active';
     }
     if (empty($this->column_fields['currency_decimal_separator']) && $this->column_fields['currency_decimal_separator'] != ' ') {
         $this->column_fields['currency_decimal_separator'] = '.';
     }
     if (empty($this->column_fields['currency_grouping_separator']) && $this->column_fields['currency_grouping_separator'] != ' ') {
         $this->column_fields['currency_grouping_separator'] = ' ';
     }
     $this->db->println("TRANS saveentity starts {$module}");
     $this->db->startTransaction();
     foreach ($this->tab_name as $table_name) {
         if ($table_name == 'vtiger_attachments') {
             $this->insertIntoAttachment($this->id, $module);
         } else {
             $this->insertIntoEntityTable($table_name, $module);
         }
     }
     if (Settings_Roles_Record_Model::getInstanceById($this->column_fields['roleid']) == null) {
         $roleid = Settings_Roles_Record_Model::getInstanceByName($this->column_fields['roleid']);
         if ($roleid) {
             $this->column_fields['roleid'] = $roleid->getId();
         } else {
             $roles = Settings_Roles_Record_Model::getAll();
             $this->column_fields['roleid'] = key($roles);
         }
     }
     require_once 'modules/Users/CreateUserPrivilegeFile.php';
     createUserPrivilegesfile($this->id);
     unset($_SESSION['next_reminder_interval']);
     unset($_SESSION['next_reminder_time']);
     if ($insertion_mode != 'edit') {
         $this->createAccessKey();
     }
     $this->db->completeTransaction();
     $this->db->println("TRANS saveentity ends");
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:81,代码来源:Users.php

示例11: getSearchResult

 /**
  * Static Function to get the list of records matching the search key
  * @param <String> $searchKey
  * @return <Array> - List of Vtiger_Record_Model or Module Specific Record Model instances
  */
 public static function getSearchResult($searchKey, $module = false, $limit = false)
 {
     global $max_number_search_result;
     $db = PearDatabase::getInstance();
     $query = 'SELECT label, searchlabel, crmid, setype, createdtime, smownerid FROM vtiger_crmentity crm INNER JOIN vtiger_entityname e ON crm.setype = e.modulename WHERE searchlabel LIKE ? AND turn_off = ? AND crm.deleted = 0';
     $params = array("%{$searchKey}%", 1);
     if ($module !== false) {
         $query .= ' AND setype = ?';
         $params[] = $module;
     }
     $query .= ' ORDER BY sequence ASC, createdtime DESC';
     $result = $db->pquery($query, $params);
     $noOfRows = $db->num_rows($result);
     $moduleModels = $matchingRecords = $leadIdsList = array();
     for ($i = 0; $i < $noOfRows; ++$i) {
         $row = $db->query_result_rowdata($result, $i);
         if ($row['setype'] === 'Leads') {
             $leadIdsList[] = $row['crmid'];
         }
     }
     $convertedInfo = Leads_Module_Model::getConvertedInfo($leadIdsList);
     $user = Users_Record_Model::getCurrentUserModel();
     $roleInstance = Settings_Roles_Record_Model::getInstanceById($user->get('roleid'));
     $searchunpriv = $roleInstance->get('searchunpriv');
     for ($i = 0, $recordsCount = 0; $i < $noOfRows && $recordsCount < $max_number_search_result; ++$i) {
         $row = $db->query_result_rowdata($result, $i);
         if ($row['setype'] === 'Leads' && $convertedInfo[$row['crmid']]) {
             continue;
         }
         $recordPermitted = $permitted = Users_Privileges_Model::isPermitted($row['setype'], 'DetailView', $row['crmid']);
         if (!empty($searchunpriv)) {
             if (in_array($row['setype'], explode(',', $searchunpriv))) {
                 $recordPermitted = true;
             }
         }
         if ($recordPermitted) {
             $row['id'] = $row['crmid'];
             $row['permitted'] = $permitted;
             $moduleName = $row['setype'];
             if (!array_key_exists($moduleName, $moduleModels)) {
                 $moduleModels[$moduleName] = Vtiger_Module_Model::getInstance($moduleName);
             }
             $moduleModel = $moduleModels[$moduleName];
             $modelClassName = Vtiger_Loader::getComponentClassName('Model', 'Record', $moduleName);
             $recordInstance = new $modelClassName();
             $matchingRecords[$moduleName][$row['id']] = $recordInstance->setData($row)->setModuleFromInstance($moduleModel);
             $recordsCount++;
         }
         if ($limit && $limit == $recordsCount) {
             return $matchingRecords;
         }
     }
     return $matchingRecords;
 }
开发者ID:noclav,项目名称:UpdatePackages,代码行数:59,代码来源:Record.php

示例12: getSearchResult

 /**
  * Static Function to get the list of records matching the search key
  * @param <String> $searchKey
  * @return <Array> - List of Vtiger_Record_Model or Module Specific Record Model instances
  */
 public static function getSearchResult($searchKey, $module = false, $limit = false)
 {
     $db = PearDatabase::getInstance();
     $params = ["%{$searchKey}%"];
     $sortColumns = $join = $where = '';
     if ($module !== false) {
         $where .= ' AND vtiger_crmentity.setype = ?';
         $params[] = $module;
     } else {
         $join = 'INNER JOIN vtiger_entityname ON vtiger_crmentity.setype = vtiger_entityname.modulename';
         $where .= ' AND vtiger_entityname.turn_off = ?';
         $sortColumns .= 'vtiger_entityname.sequence ASC,';
         $params[] = 1;
     }
     if (PerformancePrefs::getBoolean('SORT_SEARCH_RESULTS')) {
         $sortColumns .= 'vtiger_crmentity.label ASC,';
     }
     $query = 'SELECT label, searchlabel, crmid, setype, createdtime, smownerid FROM vtiger_crmentity ' . $join . ' WHERE vtiger_crmentity.searchlabel LIKE ? AND vtiger_crmentity.deleted = 0' . $where;
     if (!empty($sortColumns)) {
         $query .= ' ORDER BY ' . $sortColumns;
         $query = rtrim($query, ',');
     }
     $result = $db->pquery($query, $params);
     $noOfRows = $db->num_rows($result);
     $moduleModels = $matchingRecords = $leadIdsList = array();
     for ($i = 0; $i < $noOfRows; ++$i) {
         $row = $db->query_result_rowdata($result, $i);
         if ($row['setype'] === 'Leads') {
             $leadIdsList[] = $row['crmid'];
         }
     }
     $convertedInfo = Leads_Module_Model::getConvertedInfo($leadIdsList);
     $user = Users_Record_Model::getCurrentUserModel();
     $roleInstance = Settings_Roles_Record_Model::getInstanceById($user->get('roleid'));
     $searchunpriv = $roleInstance->get('searchunpriv');
     for ($i = 0, $recordsCount = 0; $i < $noOfRows && $recordsCount < vglobal('max_number_search_result'); ++$i) {
         $row = $db->query_result_rowdata($result, $i);
         if ($row['setype'] === 'Leads' && $convertedInfo[$row['crmid']]) {
             continue;
         }
         $recordPermitted = $permitted = Users_Privileges_Model::isPermitted($row['setype'], 'DetailView', $row['crmid']);
         if (!empty($searchunpriv)) {
             if (in_array($row['setype'], explode(',', $searchunpriv))) {
                 $recordPermitted = true;
             }
         }
         if ($recordPermitted) {
             $row['id'] = $row['crmid'];
             $row['permitted'] = $permitted;
             $moduleName = $row['setype'];
             if (!array_key_exists($moduleName, $moduleModels)) {
                 $moduleModels[$moduleName] = Vtiger_Module_Model::getInstance($moduleName);
             }
             $moduleModel = $moduleModels[$moduleName];
             $modelClassName = Vtiger_Loader::getComponentClassName('Model', 'Record', $moduleName);
             $recordInstance = new $modelClassName();
             $matchingRecords[$moduleName][$row['id']] = $recordInstance->setData($row)->setModuleFromInstance($moduleModel);
             $recordsCount++;
         }
         if ($limit && $limit == $recordsCount) {
             return $matchingRecords;
         }
     }
     return $matchingRecords;
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:70,代码来源:Record.php


注:本文中的Settings_Roles_Record_Model::getInstanceById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。