[ 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 require_once ('Smarty_setup.php'); 17 require_once ("data/Tracker.php"); 18 require_once ('modules/Quotes/Quotes.php'); 19 require_once('themes/'.$theme.'/layout_utils.php'); 20 require_once ('include/logging.php'); 21 require_once ('include/ListView/ListView.php'); 22 require_once ('include/database/PearDatabase.php'); 23 require_once ('include/ComboUtil.php'); 24 require_once ('include/utils/utils.php'); 25 require_once ('modules/CustomView/CustomView.php'); 26 27 28 global $app_strings,$list_max_entries_per_page,$currentModule,$theme; 29 30 $log = LoggerManager::getLogger('quote_list'); 31 32 if (!isset($where)) $where = ""; 33 34 $url_string = ''; 35 36 $focus = new Quotes(); 37 $smarty = new vtigerCRM_Smarty; 38 $other_text = Array(); 39 40 if(!$_SESSION['lvs'][$currentModule]) 41 { 42 unset($_SESSION['lvs']); 43 $modObj = new ListViewSession(); 44 $modObj->sorder = $sorder; 45 $modObj->sortby = $order_by; 46 $_SESSION['lvs'][$currentModule] = get_object_vars($modObj); 47 } 48 49 if($_REQUEST['errormsg'] != '') 50 { 51 $errormsg = $_REQUEST['errormsg']; 52 $smarty->assign("ERROR","The User does not have permission to Change/Delete ".$errormsg." ".$currentModule); 53 }else 54 { 55 $smarty->assign("ERROR",""); 56 } 57 //<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>> 58 $sorder = $focus->getSortOrder(); 59 $order_by = $focus->getOrderBy(); 60 61 $_SESSION['QUOTES_ORDER_BY'] = $order_by; 62 $_SESSION['QUOTES_SORT_ORDER'] = $sorder; 63 //<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>> 64 65 if(isset($_REQUEST['query']) && $_REQUEST['query'] == 'true') 66 { 67 list($where, $ustring) = split("#@@#",getWhereCondition($currentModule)); 68 // we have a query 69 $url_string .="&query=true".$ustring; 70 $log->info("Here is the where clause for the list view: $where"); 71 $smarty->assign("SEARCH_URL",$url_string); 72 73 } 74 75 //<<<<cutomview>>>>>>> 76 $oCustomView = new CustomView("Quotes"); 77 $viewid = $oCustomView->getViewId($currentModule); 78 $customviewcombo_html = $oCustomView->getCustomViewCombo($viewid); 79 $viewnamedesc = $oCustomView->getCustomViewByCvid($viewid); 80 //<<<<<customview>>>>> 81 $smarty->assign("CHANGE_OWNER",getUserslist()); 82 $smarty->assign("CHANGE_GROUP_OWNER",getGroupslist()); 83 84 if(isPermitted('Quotes','Delete','') == 'yes') 85 { 86 $other_text['del'] = $app_strings[LBL_MASS_DELETE]; 87 } 88 if(isPermitted('Quotes','EditView','') == 'yes') 89 { 90 $other_text['c_owner'] = $app_strings[LBL_CHANGE_OWNER]; 91 } 92 if($viewnamedesc['viewname'] == 'All') 93 { 94 $smarty->assign("ALL", 'All'); 95 } 96 97 $theme_path="themes/".$theme."/"; 98 $image_path=$theme_path."images/"; 99 $smarty->assign("MOD", $mod_strings); 100 $smarty->assign("APP", $app_strings); 101 $smarty->assign("IMAGE_PATH",$image_path); 102 $smarty->assign("MODULE",$currentModule); 103 $smarty->assign("SINGLE_MOD",'Quote'); 104 $smarty->assign("CUSTOMVIEW_OPTION",$customviewcombo_html); 105 $smarty->assign("VIEWID", $viewid); 106 $smarty->assign("BUTTONS", $other_text); 107 $category = getParentTab(); 108 $smarty->assign("CATEGORY",$category); 109 110 //Retreive the list from Database 111 //<<<<<<<<<customview>>>>>>>>> 112 if($viewid != "0") 113 { 114 $listquery = getListQuery("Quotes"); 115 $query = $oCustomView->getModifiedCvListQuery($viewid,$listquery,"Quotes"); 116 }else 117 { 118 $query = getListQuery("Quotes"); 119 } 120 //<<<<<<<<customview>>>>>>>>> 121 122 if(isset($where) && $where != '') 123 { 124 $query .= ' and '.$where; 125 } 126 127 if(isset($order_by) && $order_by != '') 128 { 129 if($order_by == 'smownerid') 130 { 131 $query .= ' ORDER BY user_name '.$sorder; 132 } 133 else 134 { 135 $tablename = getTableNameForField('Quotes',$order_by); 136 $tablename = (($tablename != '')?($tablename."."):''); 137 138 $query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder; 139 } 140 } 141 142 //Retreiving the no of rows 143 $count_result = $adb->query("select count(*) count ".substr($query, strpos($query,'FROM'),strlen($query))); 144 $noofrows = $adb->query_result($count_result,0,"count"); 145 146 //Storing Listview session object 147 if($_SESSION['lvs'][$currentModule]) 148 { 149 setSessionVar($_SESSION['lvs'][$currentModule],$noofrows,$list_max_entries_per_page); 150 } 151 152 $start = $_SESSION['lvs'][$currentModule]['start']; 153 154 //Retreive the Navigation array 155 $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page); 156 157 158 // Setting the record count string 159 //modified by rdhital 160 $start_rec = $navigation_array['start']; 161 $end_rec = $navigation_array['end_val']; 162 //By Raju Ends 163 164 //limiting the query 165 if ($start_rec ==0) 166 $limit_start_rec = 0; 167 else 168 $limit_start_rec = $start_rec -1; 169 170 $list_result = $adb->query($query. " limit ".$limit_start_rec.",".$list_max_entries_per_page); 171 172 $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows; 173 174 //Retreive the List View Table Header 175 if($viewid !='') 176 $url_string .="&viewname=".$viewid; 177 178 $listview_header = getListViewHeader($focus,"Quotes",$url_string,$sorder,$order_by,"",$oCustomView); 179 $smarty->assign("LISTHEADER", $listview_header); 180 181 $listview_header_search = getSearchListHeaderValues($focus,"Quotes",$url_string,$sorder,$order_by,"",$oCustomView); 182 $smarty->assign("SEARCHLISTHEADER",$listview_header_search); 183 184 $listview_entries = getListViewEntries($focus,"Quotes",$list_result,$navigation_array,"","","EditView","Delete",$oCustomView); 185 $smarty->assign("LISTENTITY", $listview_entries); 186 $smarty->assign("SELECT_SCRIPT", $view_script); 187 188 $navigationOutput = getTableHeaderNavigation($navigation_array, $url_string,"Quotes","index",$viewid); 189 $alphabetical = AlphabeticalSearch($currentModule,'index','subject','true','basic',"","","","",$viewid); 190 $fieldnames = getAdvSearchfields($module); 191 $criteria = getcriteria_options(); 192 $smarty->assign("CRITERIA", $criteria); 193 $smarty->assign("FIELDNAMES", $fieldnames); 194 $smarty->assign("ALPHABETICAL", $alphabetical); 195 $smarty->assign("NAVIGATION", $navigationOutput); 196 $smarty->assign("RECORD_COUNTS", $record_string); 197 $smarty->assign("CUSTOMVIEW_OPTION",$customviewcombo_html); 198 $smarty->assign("VIEWID", $viewid); 199 $smarty->assign("BUTTONS", $other_text); 200 201 $check_button = Button_Check($module); 202 $smarty->assign("CHECK", $check_button); 203 if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '') 204 $smarty->display("ListViewEntries.tpl"); 205 else 206 $smarty->display("ListView.tpl"); 207 ?>
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 |