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


PHP Users_Privileges_Model::getInstanceById方法代码示例

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


在下文中一共展示了Users_Privileges_Model::getInstanceById方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: preProcess

 public function preProcess(Vtiger_Request $request)
 {
     $mode = $request->get('mode');
     if ($mode == "ChangeSteps") {
         $display = false;
     } else {
         $display = true;
     }
     parent::preProcess($request, $display);
     $viewer = $this->getViewer($request);
     $record = $request->get('record');
     $reportModel = ITS4YouReports_Record_Model::getCleanInstance($record);
     $primaryModule = $reportModel->getPrimaryModule();
     $primaryModuleModel = Vtiger_Module_Model::getInstance($primaryModule);
     if ($primaryModuleModel) {
         $currentUser = Users_Record_Model::getCurrentUserModel();
         $userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
         $permission = $userPrivilegesModel->hasModulePermission($primaryModuleModel->getId());
         if (!$permission) {
             $viewer->assign('MODULE', $primaryModule);
             $viewer->assign('MESSAGE', 'LBL_PERMISSION_DENIED');
             $viewer->view('OperationNotPermitted.tpl', $primaryModule);
             exit;
         }
     }
     $viewer->assign('RECORD_MODE', $mode);
 }
开发者ID:cin-system,项目名称:cinrepo,代码行数:27,代码来源:Edit.php

示例2: preProcess

 public function preProcess(Vtiger_Request $request)
 {
     parent::preProcess($request);
     $viewer = $this->getViewer($request);
     $record = $request->get('record');
     $moduleName = $request->getModule();
     $reportModel = Reports_Record_Model::getCleanInstance($record);
     $primaryModule = $reportModel->getPrimaryModule();
     $primaryModuleModel = Vtiger_Module_Model::getInstance($primaryModule);
     if ($primaryModuleModel) {
         $currentUser = Users_Record_Model::getCurrentUserModel();
         $userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
         $permission = $userPrivilegesModel->hasModulePermission($primaryModuleModel->getId());
         if (!$permission) {
             $viewer->assign('MODULE', $primaryModule);
             $viewer->assign('MESSAGE', 'LBL_PERMISSION_DENIED');
             $viewer->view('OperationNotPermitted.tpl', $primaryModule);
             exit;
         }
     }
     $viewer->assign('REPORT_MODEL', $reportModel);
     $viewer->assign('RECORD_ID', $record);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('VIEW', 'ChartEdit');
     $viewer->assign('RECORD_MODE', $request->getMode());
     $viewer->view('EditChartHeader.tpl', $request->getModule());
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:27,代码来源:ChartEdit.php

示例3: preProcess

 public function preProcess(Vtiger_Request $request, $display = true)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $viewer->assign('QUALIFIED_MODULE', $moduleName);
     Vtiger_Basic_View::preProcess($request, false);
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     if (!empty($moduleName)) {
         //$moduleModel = PDFMaker_PDFMaker_Model::getInstance($moduleName);
         $moduleModel = new PDFMaker_PDFMaker_Model('PDFMaker');
         $currentUser = Users_Record_Model::getCurrentUserModel();
         $userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
         $permission = $userPrivilegesModel->hasModulePermission($moduleModel->getId());
         $viewer->assign('MODULE', $moduleName);
         if (!$permission) {
             $viewer->assign('MESSAGE', 'LBL_PERMISSION_DENIED');
             $viewer->view('OperationNotPermitted.tpl', $moduleName);
             exit;
         }
         $linkParams = array('MODULE' => $moduleName, 'ACTION' => $request->get('view'));
         $linkModels = $moduleModel->getSideBarLinks($linkParams);
         $viewer->assign('QUICK_LINKS', $linkModels);
     }
     $viewer->assign('CURRENT_USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('CURRENT_VIEW', $request->get('view'));
     if ($display) {
         $this->preProcessDisplay($request);
     }
 }
开发者ID:jmangarret,项目名称:vtigercrm,代码行数:30,代码来源:Edit.php

示例4: preProcess

 function preProcess(Vtiger_Request $request)
 {
     parent::preProcess($request);
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     $page = $request->get('page');
     $detailViewModel = Reports_DetailView_Model::getInstance($moduleName, $recordId);
     $reportModel = $detailViewModel->getRecord();
     $reportModel->setModule('Reports');
     $pagingModel = new Vtiger_Paging_Model();
     $pagingModel->set('page', $page);
     $pagingModel->set('limit', self::REPORT_LIMIT);
     $this->reportData = $reportModel->getReportData($pagingModel);
     $this->calculationFields = $reportModel->getReportCalulationData();
     $primaryModule = $reportModel->getPrimaryModule();
     $secondaryModules = $reportModel->getSecondaryModules();
     $primaryModuleModel = Vtiger_Module_Model::getInstance($primaryModule);
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
     $permission = $userPrivilegesModel->hasModulePermission($primaryModuleModel->getId());
     if (!$permission) {
         $viewer->assign('MODULE', $primaryModule);
         $viewer->assign('MESSAGE', 'LBL_PERMISSION_DENIED');
         $viewer->view('OperationNotPermitted.tpl', $primaryModule);
         exit;
     }
     $detailViewLinks = $detailViewModel->getDetailViewLinks();
     // Advanced filter conditions
     $viewer->assign('SELECTED_ADVANCED_FILTER_FIELDS', $reportModel->transformToNewAdvancedFilter());
     $viewer->assign('PRIMARY_MODULE', $primaryModule);
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($reportModel);
     $primaryModuleRecordStructure = $recordStructureInstance->getPrimaryModuleRecordStructure();
     $secondaryModuleRecordStructures = $recordStructureInstance->getSecondaryModuleRecordStructure();
     $viewer->assign('PRIMARY_MODULE_RECORD_STRUCTURE', $primaryModuleRecordStructure);
     $viewer->assign('SECONDARY_MODULE_RECORD_STRUCTURES', $secondaryModuleRecordStructures);
     $secondaryModuleIsCalendar = strpos($secondaryModules, 'Calendar');
     if ($primaryModule == 'Calendar' || $secondaryModuleIsCalendar !== FALSE) {
         $advanceFilterOpsByFieldType = Calendar_Field_Model::getAdvancedFilterOpsByFieldType();
     } else {
         $advanceFilterOpsByFieldType = Vtiger_Field_Model::getAdvancedFilterOpsByFieldType();
     }
     $viewer->assign('ADVANCED_FILTER_OPTIONS', Vtiger_Field_Model::getAdvancedFilterOptions());
     $viewer->assign('ADVANCED_FILTER_OPTIONS_BY_TYPE', $advanceFilterOpsByFieldType);
     $dateFilters = Vtiger_Field_Model::getDateFilterTypes();
     foreach ($dateFilters as $comparatorKey => $comparatorInfo) {
         $comparatorInfo['startdate'] = DateTimeField::convertToUserFormat($comparatorInfo['startdate']);
         $comparatorInfo['enddate'] = DateTimeField::convertToUserFormat($comparatorInfo['enddate']);
         $comparatorInfo['label'] = vtranslate($comparatorInfo['label'], $module);
         $dateFilters[$comparatorKey] = $comparatorInfo;
     }
     $viewer->assign('DATE_FILTERS', $dateFilters);
     $viewer->assign('LINEITEM_FIELD_IN_CALCULATION', $reportModel->showLineItemFieldsInFilter(false));
     $viewer->assign('DETAILVIEW_LINKS', $detailViewLinks);
     $viewer->assign('REPORT_MODEL', $reportModel);
     $viewer->assign('RECORD_ID', $recordId);
     $viewer->assign('COUNT', count($this->reportData));
     $viewer->assign('MODULE', $moduleName);
     $viewer->view('ReportHeader.tpl', $moduleName);
 }
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:60,代码来源:Detail.php

示例5: preProcess

 function preProcess(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     $this->record = $detailViewModel = Reports_DetailView_Model::getInstance($moduleName, $recordId);
     parent::preProcess($request);
     $reportModel = $detailViewModel->getRecord();
     $reportModel->setModule('Reports');
     $primaryModule = $reportModel->getPrimaryModule();
     $secondaryModules = $reportModel->getSecondaryModules();
     $primaryModuleModel = Vtiger_Module_Model::getInstance($primaryModule);
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
     $permission = $userPrivilegesModel->hasModulePermission($primaryModuleModel->getId());
     if (!$permission) {
         $viewer->assign('MODULE', $primaryModule);
         $viewer->assign('MESSAGE', 'LBL_PERMISSION_DENIED');
         $viewer->view('OperationNotPermitted.tpl', $primaryModule);
         exit;
     }
     $isAdmin = $currentUser->isAdminUser();
     $viewer->assign('isAdmin', $isAdmin);
     // Advanced filter conditions
     $viewer->assign('SELECTED_ADVANCED_FILTER_FIELDS', $reportModel->transformToNewAdvancedFilter());
     $viewer->assign('PRIMARY_MODULE', $primaryModule);
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($reportModel);
     $primaryModuleRecordStructure = $recordStructureInstance->getPrimaryModuleRecordStructure();
     $secondaryModuleRecordStructures = $recordStructureInstance->getSecondaryModuleRecordStructure();
     $viewer->assign('PRIMARY_MODULE_RECORD_STRUCTURE', $primaryModuleRecordStructure);
     $viewer->assign('SECONDARY_MODULE_RECORD_STRUCTURES', $secondaryModuleRecordStructures);
     $secondaryModuleIsCalendar = strpos($secondaryModules, 'Calendar');
     if ($primaryModule == 'Calendar' || $secondaryModuleIsCalendar !== FALSE) {
         $advanceFilterOpsByFieldType = Calendar_Field_Model::getAdvancedFilterOpsByFieldType();
     } else {
         $advanceFilterOpsByFieldType = Vtiger_Field_Model::getAdvancedFilterOpsByFieldType();
     }
     $viewer->assign('ADVANCED_FILTER_OPTIONS', Vtiger_Field_Model::getAdvancedFilterOptions());
     $viewer->assign('ADVANCED_FILTER_OPTIONS_BY_TYPE', $advanceFilterOpsByFieldType);
     $dateFilters = Vtiger_Field_Model::getDateFilterTypes();
     foreach ($dateFilters as $comparatorKey => $comparatorInfo) {
         $comparatorInfo['startdate'] = DateTimeField::convertToUserFormat($comparatorInfo['startdate']);
         $comparatorInfo['enddate'] = DateTimeField::convertToUserFormat($comparatorInfo['enddate']);
         $comparatorInfo['label'] = vtranslate($comparatorInfo['label'], $moduleName);
         $dateFilters[$comparatorKey] = $comparatorInfo;
     }
     $reportChartModel = Reports_Chart_Model::getInstanceById($reportModel);
     $viewer->assign('PRIMARY_MODULE_FIELDS', $reportModel->getPrimaryModuleFieldsForAdvancedReporting());
     $viewer->assign('SECONDARY_MODULE_FIELDS', $reportModel->getSecondaryModuleFieldsForAdvancedReporting());
     $viewer->assign('CALCULATION_FIELDS', $reportModel->getModuleCalculationFieldsForReport());
     $viewer->assign('DATE_FILTERS', $dateFilters);
     $viewer->assign('REPORT_MODEL', $reportModel);
     $viewer->assign('RECORD', $recordId);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('CHART_MODEL', $reportChartModel);
     $viewer->view('ChartReportHeader.tpl', $moduleName);
 }
开发者ID:wsLapshin,项目名称:charter_crm,代码行数:57,代码来源:ChartDetail.php

示例6: preProcess

 public function preProcess(Vtiger_Request $request, $display = true)
 {
     parent::preProcess($request, false);
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     if (!empty($moduleName)) {
         $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
         $currentUser = Users_Record_Model::getCurrentUserModel();
         $userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
         $viewer->assign('MODULE', $moduleName);
         //Dont check for module permissions since for non admin users module permission will not be there
         $linkParams = array('MODULE' => $moduleName, 'ACTION' => $request->get('view'));
         $linkModels = $moduleModel->getSideBarLinks($linkParams);
         $viewer->assign('QUICK_LINKS', $linkModels);
     }
     $viewer->assign('CURRENT_USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('CURRENT_VIEW', $request->get('view'));
     if ($display) {
         $this->preProcessDisplay($request);
     }
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:21,代码来源:ChangePassword.php

示例7: preProcess

 public function preProcess(Vtiger_Request $request, $display = true)
 {
     parent::preProcess($request, false);
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     if (!empty($moduleName)) {
         $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
         $currentUser = Users_Record_Model::getCurrentUserModel();
         $userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
         $permission = $userPrivilegesModel->hasModulePermission($moduleModel->getId());
         if (!$permission) {
             throw new NoPermittedException('LBL_PERMISSION_DENIED');
         }
         $linkParams = array('MODULE' => $moduleName, 'ACTION' => $request->get('view'));
         $linkModels = $moduleModel->getSideBarLinks($linkParams);
         $viewer->assign('QUICK_LINKS', $linkModels);
     }
     $viewer->assign('CURRENT_VIEW', $request->get('view'));
     if ($display) {
         $this->preProcessDisplay($request);
     }
 }
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:22,代码来源:Index.php

示例8: getPrivileges

 /**
  * Function to get privillage model
  * @return $privillage model
  */
 public function getPrivileges()
 {
     $privilegesModel = $this->get('privileges');
     if (empty($privilegesModel)) {
         $privilegesModel = Users_Privileges_Model::getInstanceById($this->getId());
         $this->set('privileges', $privilegesModel);
     }
     return $privilegesModel;
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:13,代码来源:Record.php

示例9: createSalesOpportunitiesFromRecords

 public function createSalesOpportunitiesFromRecords($from_module, $recordIds)
 {
     $log = vglobal('log');
     $current_user = vglobal('current_user');
     $log->info("Entering Into createSalesOpportunitiesFromRecords( {$from_module}, {$recordIds} )");
     $db = PearDatabase::getInstance();
     $numRecords = 0;
     $modulesSchema = array();
     $modulesSchema['OutsourcedProducts'] = array('potentialId' => 'potential', 'num' => 'asset_no', 'closingdate' => 'dateinservice', 'relateProduct' => false, 'theSame' => array('potentialname', 'assigned_user_id', 'related_to', 'forecast_amount'), 'fixed' => array('sales_stage' => 'Accepted for processing', 'opportunity_type' => 'Existing Business'));
     $modulesSchema['Assets'] = array('potentialId' => 'potential', 'num' => 'asset_no', 'closingdate' => 'dateinservice', 'relateProduct' => true, 'theSame' => array('potentialname', 'assigned_user_id', 'related_to', 'forecast_amount'), 'fixed' => array('sales_stage' => 'Accepted for processing', 'opportunity_type' => 'Existing Business'), 'updateField' => array('pot_renewal', 'vtiger_assets', 'assetsid'));
     $modulesSchema['OSSOutsourcedServices'] = array('potentialId' => 'potential', 'num' => 'osssoldservices_no', 'closingdate' => 'dateinservice', 'relateProduct' => false, 'theSame' => array('potentialname', 'assigned_user_id', 'related_to', 'forecast_amount'), 'fixed' => array('sales_stage' => 'Accepted for processing', 'opportunity_type' => 'Existing Business'));
     $modulesSchema['OSSSoldServices'] = array('potentialId' => 'potential', 'num' => 'asset_no', 'closingdate' => 'dateinservice', 'relateProduct' => true, 'theSame' => array('potentialname', 'assigned_user_id', 'related_to', 'forecast_amount'), 'fixed' => array('sales_stage' => 'Accepted for processing', 'opportunity_type' => 'Existing Business'), 'updateField' => array('pot_renewal', 'vtiger_osssoldservices', 'osssoldservicesid'));
     if (array_key_exists($from_module, $modulesSchema)) {
         $schema = $modulesSchema[$from_module];
         foreach ($recordIds as $recordId) {
             $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $from_module);
             $potentialId = $recordModel->get($schema['potentialId']);
             if ($potentialId != 0 && $potentialId != '') {
                 $potentialsRecordModel = Vtiger_Record_Model::getInstanceById($potentialId, 'Potentials');
                 $record = Vtiger_Record_Model::getCleanInstance('Potentials');
                 foreach ($schema['theSame'] as $name) {
                     $record->set($name, $potentialsRecordModel->get($name));
                     if ($name == 'assigned_user_id') {
                         $assigned_user_id = $potentialsRecordModel->get($name);
                         $ownerIdInfo = getRecordOwnerId($assigned_user_id);
                         if (!empty($ownerIdInfo['Users'])) {
                             $usersPrivileges = Users_Privileges_Model::getInstanceById($assigned_user_id);
                             if ($usersPrivileges->status != 'Active') {
                                 $record->set($name, $current_user->id);
                             }
                         }
                     }
                 }
                 foreach ($schema['fixed'] as $key => $val) {
                     $record->set($key, $val);
                 }
                 if ($schema['closingdate']) {
                     $closingdate = $recordModel->get($schema['closingdate']);
                     if (strtotime($closingdate) < strtotime(date("Y-m-d"))) {
                         $closingdate = date("Y-m-d", strtotime("+30 day", strtotime(date("Y-m-d"))));
                     }
                     $record->set('closingdate', $closingdate);
                 }
                 $record->save();
                 if ($record->getId() != '') {
                     $numRecords++;
                     $newId = $record->getId();
                     if (array_key_exists('updateField', $schema)) {
                         $updateField = $recordModel->get($schema['updateField'][0]);
                         if ($updateField == '' || $updateField == 0) {
                             $db->pquery('UPDATE ' . $schema['updateField'][1] . ' SET ' . $schema['updateField'][0] . ' = ? WHERE ' . $schema['updateField'][2] . ' = ?', array($newId, $recordId));
                         }
                     }
                     $product = $recordModel->get('product');
                     if ($schema['relateProduct'] && $product != '' && $product != 0) {
                         $db->pquery('INSERT INTO vtiger_seproductsrel (crmid, productid, setype) VALUES (?,?,?);', array($newId, $product, 'Potentials'));
                     }
                     $content = vtranslate('LBL_GENERATING_COMMENT', 'Potentials') . ' ' . vtranslate($from_module, $from_module) . ': ' . $recordModel->get($schema['num']);
                     $rekord = Vtiger_Record_Model::getCleanInstance('ModComments');
                     $rekord->set('commentcontent', $content);
                     $rekord->set('assigned_user_id', $current_user->id);
                     $rekord->set('related_to', $newId);
                     $rekord->save();
                 }
             }
         }
     }
     return $numRecords;
     $log->debug("Exiting createSalesOpportunitiesFromRecords() method ...");
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:70,代码来源:Record.php

示例10: respondToIncomingCall

 /**
  * Function to respond for incoming calls
  * @param <Vtiger_Request> $details 
  */
 public function respondToIncomingCall($details)
 {
     $current_user = vglobal('current_user');
     self::$NUMBERS = PBXManager_Record_Model::getUserNumbers();
     header("Content-type: text/xml; charset=utf-8");
     $response = '<?xml version="1.0" encoding="utf-8"?>';
     $response .= '<Response><Dial><Authentication>';
     $response .= 'Success</Authentication>';
     if (self::$NUMBERS) {
         foreach (self::$NUMBERS as $userId => $number) {
             $userInstance = Users_Privileges_Model::getInstanceById($userId);
             $current_user = $userInstance;
             $callPermission = Users_Privileges_Model::isPermitted('PBXManager', 'ReceiveIncomingCalls');
             if ($number != $details->get('callerIdNumber') && $callPermission) {
                 if (preg_match("/sip/", $number) || preg_match("/@/", $number)) {
                     $number = trim($number, "/sip:/");
                     $response .= '<Number>SIP/';
                     $response .= $number;
                     $response .= '</Number>';
                 } else {
                     $response .= '<Number>SIP/';
                     $response .= $number;
                     $response .= '</Number>';
                 }
             }
         }
     } else {
         $response .= '<ConfiguredNumber>empty</ConfiguredNumber>';
         $date = date('Y/m/d H:i:s');
         $params['callstatus'] = 'no-answer';
         $params['starttime'] = $date;
         $params['endtime'] = $date;
         $recordModel = PBXManager_Record_Model::getInstanceBySourceUUID($details->get('callUUID'));
         $recordModel->updateCallDetails($params);
     }
     $response .= '</Dial></Response>';
     echo $response;
 }
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:42,代码来源:PBXManager.php

示例11: getAllCommentsForTimeline

 public static function getAllCommentsForTimeline($parentId)
 {
     $pagingModel = new Vtiger_Paging_Model();
     $pagingModel->set('limit', 'no_limit');
     $parentComments = self::getRecentComments($parentId, $pagingModel);
     $allComments = [];
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $formatDate = $currentUser->get('date_format');
     $formatDate .= $currentUser->get('hour_format') == 24 ? ' HH:MM:ss' : ' hh:MM:ss TT';
     if (count($parentComments)) {
         foreach ($parentComments as $comment) {
             $createdTime = $comment->get('createdtime');
             $date = DateTime::createFromFormat('Y-m-d H:i:s', $createdTime);
             $ownerComment = Users_Privileges_Model::getInstanceById($comment->get('userid'));
             $icon = $ownerComment->getImageDetails();
             if (empty($icon[0]['path'])) {
                 $iconPath = 'layouts/basic/skins/images/DefaultUserIcon.png';
             } else {
                 $iconPath = $icon[0]['path'] . '_' . $icon[0]['orgname'];
             }
             $allComments["events"][] = ["start_date" => ["year" => $date->format('Y'), "month" => $date->format('m'), "day" => $date->format('d'), "hour" => $date->format('H'), "minute" => $date->format('i'), "second" => $date->format('s'), "format" => $formatDate], "media" => ["caption" => $ownerComment->getName(), "url" => $iconPath, "thumbnail" => $iconPath], "text" => ["headline" => $comment->get('commentcontent')], "unique_id" => 'Id' . $comment->get('modcommentsid')];
         }
     }
     return $allComments;
 }
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:25,代码来源:Record.php

示例12: preProcess

 function preProcess(Vtiger_Request $request)
 {
     parent::preProcess($request);
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     $page = $request->get('page');
     $detailViewModel = Reports_DetailView_Model::getInstance($moduleName, $recordId);
     $reportModel = $detailViewModel->getRecord();
     $reportModel->setModule('Reports');
     $pagingModel = new Vtiger_Paging_Model();
     $pagingModel->set('page', $page);
     $pagingModel->set('limit', self::REPORT_LIMIT);
     $reportData = $reportModel->getReportData($pagingModel);
     $this->reportData = $reportData['data'];
     $this->calculationFields = $reportModel->getReportCalulationData();
     $count = $reportData['count'];
     if ($count < 1000) {
         $this->count = $count;
     } else {
         $query = $reportModel->getReportSQL(false, 'PDF');
         $countQuery = $reportModel->generateCountQuery($query);
         $this->count = $reportModel->getReportsCount($countQuery);
     }
     $primaryModule = $reportModel->getPrimaryModule();
     $secondaryModules = $reportModel->getSecondaryModules();
     $primaryModuleModel = Vtiger_Module_Model::getInstance($primaryModule);
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
     $permission = $userPrivilegesModel->hasModulePermission($primaryModuleModel->getId());
     if (!$permission) {
         $viewer->assign('MODULE', $primaryModule);
         $viewer->assign('MESSAGE', 'LBL_PERMISSION_DENIED');
         $viewer->view('OperationNotPermitted.tpl', $primaryModule);
         exit;
     }
     $detailViewLinks = $detailViewModel->getDetailViewLinks();
     // Advanced filter conditions
     $viewer->assign('SELECTED_ADVANCED_FILTER_FIELDS', $reportModel->transformToNewAdvancedFilter());
     $viewer->assign('PRIMARY_MODULE', $primaryModule);
     $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($reportModel);
     $primaryModuleRecordStructure = $recordStructureInstance->getPrimaryModuleRecordStructure();
     $secondaryModuleRecordStructures = $recordStructureInstance->getSecondaryModuleRecordStructure();
     //TODO : We need to remove "update_log" field from "HelpDesk" module in New Look
     // after removing old look we need to remove this field from crm
     if ($primaryModule == 'HelpDesk') {
         foreach ($primaryModuleRecordStructure as $blockLabel => $blockFields) {
             foreach ($blockFields as $field => $object) {
                 if ($field == 'update_log') {
                     unset($primaryModuleRecordStructure[$blockLabel][$field]);
                 }
             }
         }
     }
     if (!empty($secondaryModuleRecordStructures)) {
         foreach ($secondaryModuleRecordStructures as $module => $structure) {
             if ($module == 'HelpDesk') {
                 foreach ($structure as $blockLabel => $blockFields) {
                     foreach ($blockFields as $field => $object) {
                         if ($field == 'update_log') {
                             unset($secondaryModuleRecordStructures[$module][$blockLabel][$field]);
                         }
                     }
                 }
             }
         }
     }
     // End
     $viewer->assign('PRIMARY_MODULE_RECORD_STRUCTURE', $primaryModuleRecordStructure);
     $viewer->assign('SECONDARY_MODULE_RECORD_STRUCTURES', $secondaryModuleRecordStructures);
     $secondaryModuleIsCalendar = strpos($secondaryModules, 'Calendar');
     if ($primaryModule == 'Calendar' || $secondaryModuleIsCalendar !== FALSE) {
         $advanceFilterOpsByFieldType = Calendar_Field_Model::getAdvancedFilterOpsByFieldType();
     } else {
         $advanceFilterOpsByFieldType = Vtiger_Field_Model::getAdvancedFilterOpsByFieldType();
     }
     $viewer->assign('ADVANCED_FILTER_OPTIONS', Vtiger_Field_Model::getAdvancedFilterOptions());
     $viewer->assign('ADVANCED_FILTER_OPTIONS_BY_TYPE', $advanceFilterOpsByFieldType);
     $dateFilters = Vtiger_Field_Model::getDateFilterTypes();
     foreach ($dateFilters as $comparatorKey => $comparatorInfo) {
         $comparatorInfo['startdate'] = DateTimeField::convertToUserFormat($comparatorInfo['startdate']);
         $comparatorInfo['enddate'] = DateTimeField::convertToUserFormat($comparatorInfo['enddate']);
         $comparatorInfo['label'] = vtranslate($comparatorInfo['label'], $module);
         $dateFilters[$comparatorKey] = $comparatorInfo;
     }
     $viewer->assign('DATE_FILTERS', $dateFilters);
     $viewer->assign('LINEITEM_FIELD_IN_CALCULATION', $reportModel->showLineItemFieldsInFilter(false));
     $viewer->assign('DETAILVIEW_LINKS', $detailViewLinks);
     $viewer->assign('REPORT_MODEL', $reportModel);
     $viewer->assign('RECORD_ID', $recordId);
     $viewer->assign('COUNT', $this->count);
     $viewer->assign('MODULE', $moduleName);
     // SalesPlatform.ru begin
     // If it is a custom report
     if (in_array($reportModel->getReportType(), getCustomReportsList())) {
         // Only equals filter
         $customAdvanceFilterOpsByFieldType = array('V' => array('e'), 'N' => array('e'), 'T' => array('e'), 'I' => array('e'), 'C' => array('e'), 'D' => array('e'), 'DT' => array('e'), 'I' => array('e'), 'NN' => array('e'), 'E' => array('e'));
         $spPaymentsRecordStructure = $recordStructureInstance->getStructure('SPPayments');
         foreach ($spPaymentsRecordStructure as $blockLabel => $blockFields) {
             foreach ($blockFields as $field => $object) {
//.........这里部分代码省略.........
开发者ID:gitter-badger,项目名称:openshift-salesplatform,代码行数:101,代码来源:Detail.php


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