[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Emails/ -> ListView.php (source)

   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: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Emails/ListView.php,v 1.12 2005/04/18 10:37:49 samk 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  require_once ('Smarty_setup.php');
  24  require_once ("data/Tracker.php");
  25  require_once ('modules/Emails/Emails.php');
  26  require_once('themes/'.$theme.'/layout_utils.php');
  27  require_once ('include/logging.php');
  28  require_once ('include/utils/utils.php');
  29  require_once ('modules/CustomView/CustomView.php');
  30  global $current_user;
  31  global $app_strings;
  32  global $mod_strings;
  33  
  34  global $list_max_entries_per_page;
  35  
  36  $log = LoggerManager::getLogger('email_list');
  37  
  38  global $currentModule;
  39  
  40  global $image_path;
  41  global $theme;
  42  
  43  $url_string = ''; // assigning http url string
  44  
  45  $focus = new Emails();
  46  $smarty = new vtigerCRM_Smarty;
  47  $other_text = Array();
  48  
  49  //<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>>
  50  if($_REQUEST['order_by'] != '')
  51      $order_by = $_REQUEST['order_by'];
  52  else
  53      $order_by = (($_SESSION['EMAILS_ORDER_BY'] != '')?($_SESSION['EMAILS_ORDER_BY']):($focus->default_order_by));
  54  
  55  if($_REQUEST['sorder'] != '')
  56      $sorder = $_REQUEST['sorder'];
  57  else
  58      $sorder = (($_SESSION['EMAILS_SORT_ORDER'] != '')?($_SESSION['EMAILS_SORT_ORDER']):($focus->default_sort_order));
  59  
  60  $_SESSION['EMAILS_ORDER_BY'] = $order_by;
  61  $_SESSION['EMAILS_SORT_ORDER'] = $sorder;
  62  //<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>>
  63  
  64  
  65  // focus_list is the means of passing data to a ListView.
  66  global $focus_list;
  67  
  68  //<<<<cutomview>>>>>>>
  69  $oCustomView = new CustomView("Emails");
  70  $viewid = $oCustomView->getViewId($currentModule);
  71  $customviewcombo_html = $oCustomView->getCustomViewCombo($viewid);
  72  $viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
  73  
  74  //<<<<<customview>>>>>
  75  
  76  // Buttons and View options
  77  if(isPermitted('Emails','Delete','') == 'yes')
  78  {
  79      $other_text['del'] = $app_strings[LBL_MASS_DELETE];
  80  }
  81  
  82  if($viewnamedesc['viewname'] == 'All')
  83  {
  84      $smarty->assign("ALL", 'All');
  85  }
  86  
  87  global $email_title;
  88  $display_title = $mod_strings['LBL_LIST_FORM_TITLE'];
  89  if($email_title)$display_title = $email_title;
  90  
  91  //to get the search vtiger_field if exists
  92  if(isset($_REQUEST['search']) && $_REQUEST['search'] != '' && $_REQUEST['search_text'] != '')
  93  {
  94      $url_string .= "&search=".$_REQUEST['search']."&search_field=".$_REQUEST['search_field']."&search_text=".$_REQUEST['search_text'];
  95      if($_REQUEST['search_field'] != 'join')
  96          $where = $_REQUEST['search_field']." like '%".$_REQUEST['search_text']."%'";    
  97      else
  98          $where = "(subject like '%".$_REQUEST['search_text']."%' OR vtiger_users.user_name like '%".$_REQUEST['search_text']."%')";    
  99  }
 100  
 101  
 102  //Retreive the list from Database
 103  //<<<<<<<<<customview>>>>>>>>>
 104  if($viewid != "0")
 105  {
 106      $listquery = getListQuery("Emails");
 107      $list_query = $oCustomView->getModifiedCvListQuery($viewid,$listquery,"Emails");
 108  }
 109  else
 110  {
 111      $list_query = getListQuery("Emails");
 112  }
 113  //<<<<<<<<customview>>>>>>>>>
 114  
 115  if(isset($where) && $where != '')
 116  {
 117      $list_query .= " AND " .$where;
 118  }
 119  if($_REQUEST['folderid'] =='2')
 120  {
 121      $list_query .= "AND vtiger_seactivityrel.crmid in (select contactid from vtiger_contactdetails) AND vtiger_emaildetails.email_flag !='WEBMAIL'";
 122  }
 123  if($_REQUEST['folderid'] =='3')
 124  {
 125      $list_query .= "AND vtiger_seactivityrel.crmid in (select accountid from vtiger_account)";    
 126  }
 127  if($_REQUEST['folderid'] =='4')
 128  {
 129      $list_query .= "AND vtiger_seactivityrel.crmid in (select leadid from vtiger_leaddetails)";    
 130  }
 131  if($_REQUEST['folderid'] =='5')
 132  {
 133      $list_query .= "AND vtiger_salesmanactivityrel.smid in (select id from vtiger_users)";    
 134  }
 135  if($_REQUEST['folderid'] =='6')
 136  {
 137      $list_query .= "AND vtiger_emaildetails.email_flag ='WEBMAIL'";    
 138  }
 139  if(isset($order_by) && $order_by != '')
 140  {
 141      $tablename = getTableNameForField('Emails',$order_by);
 142      $tablename = (($tablename != '')?($tablename."."):'');
 143      $list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
 144  }
 145  
 146  $list_result = $adb->query($list_query);
 147  
 148  //Constructing the list view
 149  $smarty->assign("CUSTOMVIEW_OPTION",$customviewcombo_html);
 150  $smarty->assign("VIEWID", $viewid);
 151  $smarty->assign("MOD", $mod_strings);
 152  $smarty->assign("APP", $app_strings);
 153  $smarty->assign("IMAGE_PATH",$image_path);
 154  $smarty->assign("MODULE",$currentModule);
 155  $smarty->assign("SINGLE_MOD",'Email');
 156  $smarty->assign("BUTTONS",$other_text);
 157  $category = getParentTab();
 158  $smarty->assign("CATEGORY",$category);
 159  
 160  //Retreiving the no of rows
 161  $noofrows = $adb->num_rows($list_result);
 162  
 163  //Retreive the Navigation array
 164  $_REQUEST['allflag'] = 'All';
 165  $navigation_array = getNavigationValues(1, $noofrows, $noofrows);
 166  
 167  //Retreive the List View Table Header
 168  if($viewid !='')
 169      $url_string .="&viewname=".$viewid;
 170  if(isset($_REQUEST['folderid']) && $_REQUEST['folderid'] != '')
 171      $url_string .= "&folderid=".$_REQUEST['folderid'];
 172  $listview_header = getListViewHeader($focus,"Emails",$url_string,$sorder,$order_by,"",$oCustomView);
 173  $smarty->assign("LISTHEADER", $listview_header);
 174  
 175  $listview_entries = getListViewEntries($focus,"Emails",$list_result,$navigation_array,"","","EditView","Delete",$oCustomView);
 176  $smarty->assign("LISTENTITY", $listview_entries);                                                  
 177  $smarty->assign("SELECT_SCRIPT", $view_script);
 178  
 179  $smarty->assign("USERID", $current_user->id);
 180  
 181  $check_button = Button_Check($module);
 182  $smarty->assign("CHECK", $check_button);
 183  if($_REQUEST['ajax'] != '')
 184      $smarty->display("EmailContents.tpl");
 185  else
 186      $smarty->display("Emails.tpl");
 187  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7