[ 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 /** function used to get the top 5 quotes from the ListView query 17 * @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 18 */ 19 function getTopQuotes() 20 { 21 require_once ("data/Tracker.php"); 22 require_once ('modules/Quotes/Quotes.php'); 23 require_once ('include/logging.php'); 24 require_once ('include/ListView/ListView.php'); 25 require_once ('include/database/PearDatabase.php'); 26 require_once ('include/ComboUtil.php'); 27 require_once ('include/utils/utils.php'); 28 require_once ('modules/CustomView/CustomView.php'); 29 30 global $app_strings,$current_language,$current_user; 31 $current_module_strings = return_module_language($current_language, 'Quotes'); 32 33 global $list_max_entries_per_page,$adb,$theme,$mod_strings; 34 $log = LoggerManager::getLogger('quote_list'); 35 36 // Get _dom arrays from Database 37 $comboFieldNames = Array('quotestage'=>'quotestage_dom'); 38 $comboFieldArray = getComboArray($comboFieldNames); 39 40 $url_string = ''; 41 $sorder = ''; 42 $oCustomView = new CustomView("Quotes"); 43 $customviewcombo_html = $oCustomView->getCustomViewCombo(); 44 if(isset($_REQUEST['viewname']) == false || $_REQUEST['viewname']=='') 45 { 46 if($oCustomView->setdefaultviewid != "") 47 { 48 $viewid = $oCustomView->setdefaultviewid; 49 }else 50 { 51 $viewid = "0"; 52 } 53 } 54 $focus = new Quotes(); 55 56 $theme_path="themes/".$theme."/"; 57 $image_path=$theme_path."images/"; 58 59 //Retreive the list from Database 60 //<<<<<<<<<customview>>>>>>>>> 61 $date_var = date('Y-m-d'); 62 63 $where = ' and vtiger_crmentity.smownerid='.$current_user->id.' and vtiger_quotes.validtill >= \''.$date_var.'\''; 64 $query = getListQuery("Quotes",$where); 65 $query .=" ORDER BY total DESC"; 66 //<<<<<<<<customview>>>>>>>>> 67 68 $list_result = $adb->limitQuery($query,0,5); 69 70 //Retreiving the no of rows 71 $noofrows = $adb->num_rows($list_result); 72 73 //Retreiving the start value from request 74 if(isset($_REQUEST['start']) && $_REQUEST['start'] != '') 75 { 76 $start = $_REQUEST['start']; 77 } 78 else 79 { 80 81 $start = 1; 82 } 83 84 //Retreive the Navigation array 85 $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page); 86 87 if ($navigation_array['start'] == 1) 88 { 89 if($noofrows != 0) 90 $start_rec = $navigation_array['start']; 91 else 92 $start_rec = 0; 93 if($noofrows > $list_max_entries_per_page) 94 { 95 $end_rec = $navigation_array['start'] + $list_max_entries_per_page - 1; 96 } 97 else 98 { 99 $end_rec = $noofrows; 100 } 101 102 } 103 else 104 { 105 if($navigation_array['next'] > $list_max_entries_per_page) 106 { 107 $start_rec = $navigation_array['next'] - $list_max_entries_per_page; 108 $end_rec = $navigation_array['next'] - 1; 109 } 110 else 111 { 112 $start_rec = $navigation_array['prev'] + $list_max_entries_per_page; 113 $end_rec = $noofrows; 114 } 115 } 116 117 118 $title=array('TopOpenQuotes.gif',$current_module_strings['LBL_MY_TOP_QUOTE'],'home_mytopquote'); 119 //Retreive the List View Table Header 120 $listview_header = getListViewHeader($focus,"Quotes",$url_string,$sorder,$order_by,"HomePage",$oCustomView); 121 122 123 $listview_entries = getListViewEntries($focus,"Quotes",$list_result,$navigation_array,"HomePage","","EditView","Delete",$oCustomView); 124 125 $values=Array('Title'=>$title,'Header'=>$listview_header,'Entries'=>$listview_entries); 126 127 if ( ($display_empty_home_blocks && $noofrows == 0 ) || ($noofrows>0) ) 128 return $values; 129 } 130 ?>
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 |