[ 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 * modules/Leads/ListViewTop.php,v 1.22 2005/04/19 17:00:30 ray Exp $ 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 /** Function to get the 5 New Leads 24 *return array $values - array with the title, header and entries like Array('Title'=>$title,'Header'=>$listview_header,'Entries'=>$listview_entries) where as listview_header and listview_entries are arrays of header and entity values which are returned from function getListViewHeader and getListViewEntries 25 */ 26 function getNewLeads() 27 { 28 global $log; 29 $log->debug("Entering getNewLeads() method ..."); 30 require_once ("data/Tracker.php"); 31 require_once ("include/utils/utils.php"); 32 33 global $currentModule; 34 35 global $theme; 36 global $focus; 37 global $action; 38 global $adb; 39 global $app_strings; 40 global $current_language; 41 global $current_user; 42 $current_module_strings = return_module_language($current_language, 'Leads'); 43 44 $theme_path="themes/".$theme."/"; 45 $image_path=$theme_path."images/"; 46 require_once ($theme_path.'layout_utils.php'); 47 if($_REQUEST['lead_view']=='') 48 { 49 $query = "select lead_view from vtiger_users where id ='$current_user->id'"; 50 $result=$adb->query($query); 51 $lead_view=$adb->query_result($result,0,'lead_view'); 52 } 53 else 54 $lead_view=$_REQUEST['lead_view']; 55 56 $today = date("Y-m-d", time()); 57 58 if($lead_view == 'Today') 59 { 60 $start_date = date("Y-m-d",strtotime("$today")); 61 } 62 else if($lead_view == 'Last 2 Days') 63 { 64 $start_date = date("Y-m-d", strtotime("-2 days")); 65 } 66 else if($lead_view == 'Last Week') 67 { 68 $start_date = date("Y-m-d", strtotime("-1 week")); 69 } 70 71 $list_query = 'select vtiger_leaddetails.*,vtiger_crmentity.createdtime,vtiger_crmentity.description from vtiger_leaddetails inner join vtiger_crmentity on vtiger_leaddetails.leadid = vtiger_crmentity.crmid where vtiger_crmentity.deleted =0 AND vtiger_leaddetails.converted =0 AND vtiger_crmentity.createdtime >='.$start_date.' AND vtiger_crmentity.smownerid = '.$current_user->id; 72 73 $list_result = $adb->query($list_query); 74 $noofrows = $adb->num_rows($list_result); 75 $open_lead_list =array(); 76 if ($noofrows > 0) 77 for($i=0;$i<$noofrows && $i<5;$i++) 78 { 79 $open_lead_list[] = Array('leadname' => $adb->query_result($list_result,$i,'firstname').' '.$adb->query_result($list_result,$i,'lastname'), 80 'company' => $adb->query_result($list_result,$i,'company'), 81 'annualrevenue' => $adb->query_result($list_result,$i,'annualrevenue'), 82 'leadstatus' => $adb->query_result($list_result,$i,'leadstatus'), 83 'leadsource' => $adb->query_result($list_result,$i,'leadsource'), 84 'id' => $adb->query_result($list_result,$i,'leadid'), 85 ); 86 } 87 88 $title=array(); 89 $title[]='Leads.gif'; 90 $title[]=$current_module_strings["LBL_NEW_LEADS"]; 91 $title[]='home_mynewlead'; 92 $title[]=getLeadView($lead_view); 93 $title[]='showLeadView'; 94 $title[]='MyNewLeadFrm'; 95 $title[]='lead_view'; 96 97 $header=array(); 98 $header[] =$current_module_strings['LBL_LIST_LEAD_NAME']; 99 $header[] =$current_module_strings['Company']; 100 $header[] =$current_module_strings['Annual Revenue']; 101 $header[] =$current_module_strings['Lead Status']; 102 $header[] =$current_module_strings['Lead Source']; 103 104 $entries=array(); 105 foreach($open_lead_list as $lead) 106 { 107 $value=array(); 108 $lead_fields = array( 109 'LEAD_NAME' => $lead['leadname'], 110 'COMPANY' => $lead['company'], 111 'ANNUAL_REVENUE' => $lead['annualrevenue'], 112 'LEAD_STATUS' => $lead['leadstatus'], 113 'LEAD_SOURCE' => $lead['leadsource'], 114 'LEAD_ID' => $lead['id'], 115 ); 116 117 $value[]= '<a href="index.php?action=DetailView&module=Leads&record='.$lead_fields['LEAD_ID'].'">'.$lead_fields['LEAD_NAME'].'</a>'; 118 $value[]=$lead_fields['COMPANY']; 119 $value[]=$lead_fields['ANNUAL_REVENUE']; 120 $value[]=$lead_fields['LEAD_STATUS']; 121 $value[]=$lead_fields['LEAD_SOURCE']; 122 123 $entries[$lead_fields['LEAD_ID']]=$value; 124 } 125 $values=Array('Title'=>$title,'Header'=>$header,'Entries'=>$entries); 126 $log->debug("Exiting getNewLeads method ..."); 127 if (($display_empty_home_blocks && count($entries) == 0 ) || (count($entries)>0)) 128 return $values; 129 } 130 /** Function to get the Lead View from the Combo List 131 * @param string $lead_view - (eg today, last 2 days) 132 * Returns the Lead view select option 133 */ 134 function getLeadView($lead_view) 135 { 136 global $log; 137 $log->debug("Entering getLeadView(".$lead_view.") method ..."); 138 $today = date("Y-m-d", time()); 139 140 if($lead_view == 'Today') 141 { 142 $selected1 = 'selected'; 143 } 144 else if($lead_view == 'Last 2 Days') 145 { 146 $selected2 = 'selected'; 147 } 148 else if($lead_view == 'Last Week') 149 { 150 $selected3 = 'selected'; 151 } 152 153 $LEAD_VIEW_SELECT_OPTION = '<select class=small name="lead_view" onchange="showLeadView(this)">'; 154 $LEAD_VIEW_SELECT_OPTION .= '<option value="Today" '.$selected1.'>'; 155 $LEAD_VIEW_SELECT_OPTION .= 'Today'; 156 $LEAD_VIEW_SELECT_OPTION .= '</option>'; 157 $LEAD_VIEW_SELECT_OPTION .= '<option value="Last 2 Days" '.$selected2.'>'; 158 $LEAD_VIEW_SELECT_OPTION .= 'Last 2 Days'; 159 $LEAD_VIEW_SELECT_OPTION .= '</option>'; 160 $LEAD_VIEW_SELECT_OPTION .= '<option value="Last Week" '.$selected3.'>'; 161 $LEAD_VIEW_SELECT_OPTION .= 'Last Week'; 162 $LEAD_VIEW_SELECT_OPTION .= '</option>'; 163 $LEAD_VIEW_SELECT_OPTION .= '</select>'; 164 165 $log->debug("Exiting getLeadView method ..."); 166 return $LEAD_VIEW_SELECT_OPTION; 167 } 168 ?>
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 |