[ 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 Leads_LeadsBySource_Dashboard extends Vtiger_IndexAjax_View { 12 13 function getSearchParams($value,$assignedto,$dates) { 14 $listSearchParams = array(); 15 $conditions = array(array('leadsource','e',$value)); 16 if($assignedto != '') array_push($conditions,array('assigned_user_id','e',getUserFullName($assignedto))); 17 if(!empty($dates)){ 18 array_push($conditions,array('createdtime','bw',$dates['start'].' 00:00:00,'.$dates['end'].' 23:59:59')); 19 } 20 $listSearchParams[] = $conditions; 21 return '&search_params='. json_encode($listSearchParams); 22 } 23 24 public function process(Vtiger_Request $request) { 25 $currentUser = Users_Record_Model::getCurrentUserModel(); 26 $viewer = $this->getViewer($request); 27 $moduleName = $request->getModule(); 28 29 $linkId = $request->get('linkid'); 30 $data = $request->get('data'); 31 $createdTime = $request->get('createdtime'); 32 33 //Date conversion from user to database format 34 if(!empty($createdTime)) { 35 $dates['start'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['start']); 36 $dates['end'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['end']); 37 } 38 39 $moduleModel = Vtiger_Module_Model::getInstance($moduleName); 40 $data = $moduleModel->getLeadsBySource($request->get('smownerid'),$dates); 41 $listViewUrl = $moduleModel->getListViewUrl(); 42 for($i = 0;$i<count($data);$i++){ 43 $data[$i]["links"] = $listViewUrl.$this->getSearchParams($data[$i][1],$request->get('smownerid'),$dates); 44 } 45 46 $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId()); 47 48 //Include special script and css needed for this widget 49 50 $viewer->assign('WIDGET', $widget); 51 $viewer->assign('MODULE_NAME', $moduleName); 52 $viewer->assign('DATA', $data); 53 $viewer->assign('CURRENTUSER', $currentUser); 54 55 $accessibleUsers = $currentUser->getAccessibleUsersForModule('Leads'); 56 $viewer->assign('ACCESSIBLE_USERS', $accessibleUsers); 57 $content = $request->get('content'); 58 if(!empty($content)) { 59 $viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName); 60 } else { 61 $viewer->view('dashboards/LeadsBySource.tpl', $moduleName); 62 } 63 } 64 }
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 |