[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /*+*********************************************************************************** 3 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 *************************************************************************************/ 10 11 class Reports_DetailView_Model extends Vtiger_DetailView_Model { 12 /** 13 * Function to get the instance 14 * @param <String> $moduleName - module name 15 * @param <String> $recordId - record id 16 * @return <Vtiger_DetailView_Model> 17 */ 18 public static function getInstance($moduleName,$recordId) { 19 $modelClassName = Vtiger_Loader::getComponentClassName('Model', 'DetailView', $moduleName); 20 $instance = new $modelClassName(); 21 22 $moduleModel = Vtiger_Module_Model::getInstance($moduleName); 23 $recordModel = Reports_Record_Model::getCleanInstance($recordId, $moduleName); 24 25 return $instance->setModule($moduleModel)->setRecord($recordModel); 26 } 27 28 /** 29 * Function to get the detail view links (links and widgets) 30 * @param <array> $linkParams - parameters which will be used to calicaulate the params 31 * @return <array> - array of link models in the format as below 32 * array('linktype'=>list of link models); 33 */ 34 public function getDetailViewLinks($linkParams='') { 35 $currentUserModel = Users_Privileges_Model::getCurrentUserPrivilegesModel(); 36 37 $moduleModel = $this->getModule(); 38 $recordModel = $this->getRecord(); 39 $moduleName = $moduleModel->getName(); 40 41 $detailViewLinks = array(); 42 $printPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'Print'); 43 if($printPermission) { 44 $detailViewLinks[] = array( 45 'linklabel' => vtranslate('LBL_REPORT_PRINT', $moduleName), 46 'linkurl' => $recordModel->getReportPrintURL(), 47 'linkicon' => 'print.png' 48 ); 49 } 50 51 $exportPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'Export'); 52 if($exportPermission) { 53 $detailViewLinks[] = array( 54 'linklabel' => vtranslate('LBL_REPORT_CSV', $moduleName), 55 'linkurl' => $recordModel->getReportCSVURL(), 56 'linkicon' => 'csv.png' 57 ); 58 59 60 $detailViewLinks[] = array( 61 'linklabel' => vtranslate('LBL_REPORT_EXPORT_EXCEL', $moduleName), 62 'linkurl' => $recordModel->getReportExcelURL(), 63 'linkicon' => 'xlsx.png' 64 ); 65 } 66 67 $linkModelList = array(); 68 foreach($detailViewLinks as $detailViewLinkEntry) { 69 $linkModelList[] = Vtiger_Link_Model::getInstanceFromValues($detailViewLinkEntry); 70 } 71 72 return $linkModelList; 73 } 74 75 76 77 /** 78 * Function to get the detail view widgets 79 * @return <Array> - List of widgets , where each widget is an Vtiger_Link_Model 80 */ 81 public function getWidgets() { 82 $moduleModel = $this->getModule(); 83 $widgets = array(); 84 85 if($moduleModel->isTrackingEnabled()) { 86 $widgets[] = array( 87 'linktype' => 'DETAILVIEWWIDGET', 88 'linklabel' => 'LBL_RECENT_ACTIVITIES', 89 'linkurl' => 'module='.$this->getModuleName().'&view=Detail&record='.$this->getRecord()->getId(). 90 '&mode=showRecentActivities&page=1&limit=5', 91 ); 92 } 93 94 $widgetLinks = array(); 95 foreach ($widgets as $widgetDetails){ 96 $widgetLinks[] = Vtiger_Link_Model::getInstanceFromValues($widgetDetails); 97 } 98 return $widgetLinks; 99 } 100 101 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |