[ Index ]
 

Code source de vtiger CRM 5.0.2

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

title

Body

[fermer]

/modules/Dashboard/ -> Chart_lead_source_by_outcome.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$
  17   * Description:  returns HTML for client-side image map.
  18   * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
  19   * All Rights Reserved.
  20   * Contributor(s): ______________________________________..
  21   ********************************************************************************/
  22  
  23  require_once ('include/utils/utils.php');
  24  require_once ('include/logging.php');
  25  require_once ("modules/Potentials/Charts.php");
  26  require_once ('include/ComboUtil.php');
  27  global $current_language, $tmp_dir, $currentModule, $action;
  28  $current_module_strings = return_module_language($current_language, 'Dashboard');
  29  
  30  // Get _dom arrays from Database
  31  $comboFieldNames = Array('leadsource'=>'lead_source_dom');
  32  $comboFieldArray = getComboArray($comboFieldNames);
  33  
  34  $log = LoggerManager::getLogger('lead_source_by_outcome');
  35  
  36  if (isset($_REQUEST['lsbo_refresh'])) { $refresh = $_REQUEST['lsbo_refresh']; }
  37  else { $refresh = false; }
  38  
  39  // added for auto refresh
  40  $refresh = true;
  41  //
  42  
  43  $tempx = array();
  44  $datax = array();
  45  //get list of sales stage keys to display
  46  if (isset($_SESSION['lsbo_lead_sources']) && count($_SESSION['lsbo_lead_sources']) > 0 && !isset($_REQUEST['lsbo_lead_sources'])) {
  47      $tempx = $_SESSION['lsbo_lead_sources'];
  48      $log->debug("_SESSION['lsbo_lead_sources'] is:");
  49      $log->debug($_SESSION['lsbo_lead_sources']);
  50  }
  51  elseif (isset($_REQUEST['lsbo_lead_sources']) && count($_REQUEST['lsbo_lead_sources']) > 0) {
  52      $tempx = $_REQUEST['lsbo_lead_sources'];
  53      $current_user->setPreference('lsbo_lead_sources', $_REQUEST['lsbo_lead_sources']);
  54      $log->debug("_REQUEST['lsbo_lead_sources'] is:");
  55      $log->debug($_REQUEST['lsbo_lead_sources']);
  56      $log->debug("_SESSION['lsbo_lead_sources'] is:");
  57      $log->debug($_SESSION['lsbo_lead_sources']);
  58  }
  59  
  60  //set $datax using selected sales stage keys 
  61  if (count($tempx) > 0) {
  62      foreach ($tempx as $key) {
  63          $datax[$key] = $comboFieldArray['lead_source_dom'][$key];
  64      }
  65  }
  66  else {
  67      $datax = $comboFieldArray['lead_source_dom'];
  68  }
  69  $log->debug("datax is:");
  70  $log->debug($datax);
  71  
  72  $ids = array();
  73  //get list of user ids for which to display data
  74  if (isset($_SESSION['lsbo_ids']) && count($_SESSION['lsbo_ids']) != 0 && !isset($_REQUEST['lsbo_ids'])) {
  75      $ids = $_SESSION['lsbo_ids'];
  76      $log->debug("_SESSION['lsbo_ids'] is:");
  77      $log->debug($_SESSION['lsbo_ids']);
  78  }
  79  elseif (isset($_REQUEST['lsbo_ids']) && count($_REQUEST['lsbo_ids']) > 0) {
  80      $ids = $_REQUEST['lsbo_ids'];
  81      $current_user->setPreference('lsbo_ids', $_REQUEST['lsbo_ids']);
  82      $log->debug("_REQUEST['lsbo_ids'] is:");
  83      $log->debug($_REQUEST['lsbo_ids']);
  84      $log->debug("_SESSION['lsbo_ids'] is:");
  85      $log->debug($_SESSION['lsbo_ids']);
  86  }
  87  else {
  88      $ids = get_user_array(false);
  89      $ids = array_keys($ids);
  90  }
  91  
  92  //create unique prefix based on selected vtiger_users for image vtiger_files
  93  $id_hash = '';
  94  if (isset($ids)) {
  95      sort($ids);
  96      $id_hash = crc32(implode('',$ids));
  97  }
  98  $log->debug("ids is:");
  99  $log->debug($ids);
 100  
 101  $cache_file_name = $id_hash."_lead_source_by_outcome_".$current_language."_".crc32(implode('',$datax)).".png";
 102  $log->debug("cache file name is: $cache_file_name");
 103  
 104  if(isPermitted('Potentials','index')=="yes")
 105  {
 106  $draw_this = new jpgraph();
 107  $width = 850;
 108  $height = 500;
 109  if(isset($_REQUEST['display_view']) && $_REQUEST['display_view'] == 'MATRIX')
 110  {
 111      $width = 350;
 112      $height = 250;
 113  }
 114  
 115  echo $draw_this->lead_source_by_outcome($datax, $ids, $tmp_dir.$cache_file_name, $refresh,$width,$height);
 116  echo "<P><font size='1'><em>".$current_module_strings['LBL_LEAD_SOURCE_BY_OUTCOME_DESC']."</em></font></P>";
 117  if (isset($_REQUEST['lsbo_edit']) && $_REQUEST['lsbo_edit'] == 'true') {
 118  ?>
 119  <form action="index.php" method="post" >
 120  <input type="hidden" name="module" value="<?php echo $currentModule;?>">
 121  <input type="hidden" name="action" value="<?php echo $action;?>">
 122  <input type="hidden" name="lsbo_refresh" value="true">
 123  <table cellpadding="2" border="0"><tbody>
 124  <tr>
 125  <td valign='top' nowrap><?php echo $current_module_strings['LBL_LEAD_SOURCES'];?></strong></td>
 126  <td valign='top'><select name="lsbo_lead_sources[]" multiple size='3'><?php echo get_select_options_with_id($comboFieldArray['lead_source_dom'],$_SESSION['lsbo_lead_sources']); ?></select></td>
 127  </tr><tr>
 128  <td valign='top' nowrap><?php echo $current_module_strings['LBL_USERS'];?></td>
 129  <td valign='top'><select name="lsbo_ids[]" multiple size='3'><?php echo get_select_options_with_id(get_user_array(false),$_SESSION['lsbo_ids']); ?></select></td>
 130  </tr><tr>
 131  <td align="right"><br /> <input class="button" type="submit" title="<?php echo $app_strings['LBL_SELECT_BUTTON_TITLE']; ?>" accessKey="<?php echo $app_strings['LBL_SELECT_BUTTON_KEY']; ?>" value="<?php echo $app_strings['LBL_SELECT_BUTTON_LABEL']?>" /></td>
 132  </tr></table>
 133  </form>
 134  <?php } 
 135  else {
 136      if (file_exists($tmp_dir.$cache_file_name)) {
 137          $file_date = getDisplayDate(date('Y-m-d H:i', filemtime($tmp_dir.$cache_file_name)));
 138      }
 139      else {
 140          $file_date = '';
 141      }
 142  ?>
 143  <div align=right><FONT size='1'>
 144  <em><?php  echo $current_module_strings['LBL_CREATED_ON'].' '.$file_date; ?> 
 145  </em>[<a href="javascript:;" onClick="changeView('DashboardHome','NORMAL');"><?php echo $current_module_strings['LBL_REFRESH'];?></a>]
 146  [<a href="index.php?module=<?php echo $currentModule;?>&action=index&lsbo_edit=true"><?php echo $current_module_strings['LBL_EDIT'];?></a>]
 147  </FONT></div>
 148  <?php } 
 149  }
 150  else
 151  {
 152          echo $mod_strings['LBL_NO_PERMISSION'];
 153  }
 154  ?>


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