[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 /********************************************************************************* 3 * The contents of this file are subject to the SugarCRM Public License Version 1.1.2 4 * ("License"); You may not use this file except in compliance with the 5 * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL 6 * Software distributed under the License is distributed on an "AS IS" basis, 7 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for 8 * the specific language governing rights and limitations under the License. 9 * The Original Code is: SugarCRM Open Source 10 * The Initial Developer of the Original Code is SugarCRM, Inc. 11 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.; 12 * All Rights Reserved. 13 * Contributor(s): ______________________________________. 14 ********************************************************************************/ 15 /********************************************************************************* 16 * $Header$ 17 * Description: TODO: To be written. 18 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. 19 * All Rights Reserved. 20 * Contributor(s): ______________________________________.. 21 ********************************************************************************/ 22 23 /** to get the details of a KeyMetrics on Home page 24 * @returns $customviewlist Array in the following format 25 * $values = Array('Title'=>Array(0=>'image name', 26 * 1=>'Key Metrics', 27 * 2=>'home_metrics' 28 * ), 29 * 'Header'=>Array(0=>'Metrics', 30 * 1=>'Count' 31 * ), 32 * 'Entries'=>Array($cvid=>Array( 33 * 0=>$customview name, 34 * 1=>$no of records for the view 35 * ), 36 * $cvid=>Array( 37 * 0=>$customview name, 38 * 1=>$no of records for the view 39 * ), 40 * | 41 * | 42 * $cvid=>Array( 43 * 0=>$customview name, 44 * 1=>$no of records for the view 45 * ) 46 * ) 47 * 48 */ 49 function getKeyMetrics() 50 { 51 require_once ("data/Tracker.php"); 52 require_once ('modules/CustomView/CustomView.php'); 53 require_once ('include/logging.php'); 54 require_once ('include/ListView/ListView.php'); 55 56 global $app_strings; 57 global $adb; 58 global $log; 59 global $current_language; 60 $metricviewnames = "'Hot Leads'"; 61 62 $current_module_strings = return_module_language($current_language, "CustomView"); 63 $log = LoggerManager::getLogger('metrics'); 64 65 $metriclists = getMetricList(); 66 $log->info("Metrics :: Successfully got MetricList to be displayed"); 67 if(isset($metriclists)) 68 { 69 foreach ($metriclists as $key => $metriclist) 70 { 71 $listquery = getListQuery($metriclist['module']); 72 $oCustomView = new CustomView($metriclist['module']); 73 $metricsql = $oCustomView->getMetricsCvListQuery($metriclist['id'],$listquery,$metriclist['module']); 74 $metricresult = $adb->query($metricsql); 75 if($metricresult) 76 { 77 $rowcount = $adb->fetch_array($metricresult); 78 if(isset($rowcount)) 79 { 80 $metriclists[$key]['count'] = $rowcount['count']; 81 } 82 } 83 } 84 $log->info("Metrics :: Successfully build the Metrics"); 85 } 86 $title=array(); 87 $title[]='keyMetrics.gif'; 88 $title[]=$app_strings['LBL_HOME_KEY_METRICS']; 89 $title[]='home_metrics'; 90 $header=Array(); 91 $header[]=$app_strings['LBL_HOME_METRICS']; 92 $header[]=$app_strings['LBL_HOME_COUNT']; 93 $entries=Array(); 94 if(isset($metriclists)) 95 { 96 $oddRow = true; 97 foreach($metriclists as $metriclist) 98 { 99 $value=array(); 100 $metric_fields = array( 101 'ID' => $metriclist['id'], 102 'NAME' => $metriclist['name'], 103 'COUNT' => $metriclist['count'], 104 'MODULE' => $metriclist['module'] 105 ); 106 107 $value[]='<a href="index.php?action=index&module='.$metriclist['module'].'&viewname='.$metriclist['id'].'">'.$metriclist['name'].'</a>'; 108 $value[]='<a href="index.php?action=index&module='.$metriclist['module'].'&viewname='.$metriclist['id'].'">'.$metriclist['count'].'</a>'; 109 $entries[$metriclist['id']]=$value; 110 } 111 112 } 113 $values=Array('Title'=>$title,'Header'=>$header,'Entries'=>$entries); 114 if ( ($display_empty_home_blocks ) || (count($value)!= 0) ) 115 return $values; 116 117 } 118 119 /** to get the details of a customview Entries 120 * @returns $metriclists Array in the following format 121 * $customviewlist []= Array('id'=>custom view id, 122 * 'name'=>custom view name, 123 * 'module'=>modulename, 124 'count'=>'' 125 ) 126 */ 127 function getMetricList() 128 { 129 global $adb; 130 $ssql = "select vtiger_customview.* from vtiger_customview inner join vtiger_tab on vtiger_tab.name = vtiger_customview.entitytype"; 131 $ssql .= " where vtiger_customview.setmetrics = 1 order by vtiger_customview.entitytype"; 132 $result = $adb->query($ssql); 133 while($cvrow=$adb->fetch_array($result)) 134 { 135 $metricslist = Array(); 136 137 $metricslist['id'] = $cvrow['cvid']; 138 $metricslist['name'] = $cvrow['viewname']; 139 $metricslist['module'] = $cvrow['entitytype']; 140 $metricslist['count'] = ''; 141 if(isPermitted($cvrow['entitytype'],"index") == "yes") 142 $metriclists[] = $metricslist; 143 } 144 145 return $metriclists; 146 } 147 148 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |