[ Index ]
 

Code source de vtiger CRM 5.0.2

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

title

Body

[fermer]

/modules/Reports/ -> ReportGrouping.php (source)

   1  <?php
   2  /*********************************************************************************
   3  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9  *
  10   ********************************************************************************/
  11  require_once ('Smarty_setup.php');
  12  require_once ("data/Tracker.php");
  13  require_once('themes/'.$theme.'/layout_utils.php');
  14  require_once ('include/logging.php');
  15  require_once ('include/utils/utils.php');
  16  require_once ('modules/Reports/Reports.php');
  17  require_once ('include/database/PearDatabase.php');
  18  
  19  global $app_strings;
  20  global $app_list_strings;
  21  global $mod_strings;
  22  $current_module_strings = return_module_language($current_language, 'Reports');
  23  
  24  global $list_max_entries_per_page;
  25  global $urlPrefix;
  26  
  27  $log = LoggerManager::getLogger('report_type');
  28  
  29  global $currentModule;
  30  global $image_path;
  31  global $theme;
  32  $report_group=new vtigerCRM_Smarty;
  33  $report_group->assign("MOD", $mod_strings);
  34  $report_group->assign("APP", $app_strings);
  35  $report_group->assign("IMAGE_PATH",$image_path);
  36  
  37  if(isset($_REQUEST["record"]))
  38  {
  39      $reportid = $_REQUEST["record"];
  40      $oReport = new Reports($reportid);
  41      $list_array = $oReport->getSelctedSortingColumns($reportid);
  42  
  43      $BLOCK1 = getPrimaryColumns_GroupingHTML($oReport->primodule,$list_array[0]);
  44      $BLOCK1 .= getSecondaryColumns_GroupingHTML($oReport->secmodule,$list_array[0]);
  45      $report_group->assign("BLOCK1",$BLOCK1);
  46  
  47      $BLOCK2 = getPrimaryColumns_GroupingHTML($oReport->primodule,$list_array[1]);
  48      $BLOCK2 .= getSecondaryColumns_GroupingHTML($oReport->secmodule,$list_array[1]);
  49      $report_group->assign("BLOCK2",$BLOCK2);
  50  
  51      $BLOCK3 = getPrimaryColumns_GroupingHTML($oReport->primodule,$list_array[2]);
  52      $BLOCK3 .= getSecondaryColumns_GroupingHTML($oReport->secmodule,$list_array[2]);
  53      $report_group->assign("BLOCK3",$BLOCK3);
  54  
  55      $sortorder = $oReport->ascdescorder;
  56  
  57  }else
  58  {
  59      $primarymodule = $_REQUEST["primarymodule"];
  60      $secondarymodule = $_REQUEST["secondarymodule"];
  61      $BLOCK1 = getPrimaryColumns_GroupingHTML($primarymodule);
  62      $BLOCK1 .= getSecondaryColumns_GroupingHTML($secondarymodule);
  63      $report_group->assign("BLOCK1",$BLOCK1);
  64      $report_group->assign("BLOCK2",$BLOCK1);
  65      $report_group->assign("BLOCK3",$BLOCK1);
  66  }
  67  
  68  
  69      /** Function to get the combo values for the Primary module Columns 
  70       *  @ param $module(module name) :: Type String
  71       *  @ param $selected (<selected or ''>) :: Type String
  72       *  This function generates the combo values for the columns  for the given module 
  73       *  and return a HTML string 
  74       */
  75  
  76  function getPrimaryColumns_GroupingHTML($module,$selected="")
  77  {
  78          global $ogReport;
  79      
  80      global $app_list_strings;
  81          global $current_language;
  82  
  83          $mod_strings = return_module_language($current_language,$module);
  84  
  85          foreach($ogReport->module_list[$module] as $key=>$value)
  86          {
  87              $shtml .= "<optgroup label=\"".$app_list_strings['moduleList'][$module]." ".$key."\" class=\"select\" style=\"border:none\">";
  88          if(isset($ogReport->pri_module_columnslist[$module][$key]))
  89          {
  90          foreach($ogReport->pri_module_columnslist[$module][$key] as $field=>$fieldlabel)
  91          {
  92              if(isset($mod_strings[$fieldlabel]))
  93              {
  94                  if($selected == $field)
  95                  {
  96                      $shtml .= "<option selected value=\"".$field."\">".$mod_strings[$fieldlabel]."</option>";
  97                  }else
  98                  {
  99                      $shtml .= "<option value=\"".$field."\">".$mod_strings[$fieldlabel]."</option>";
 100                  }
 101              }else
 102              {
 103                  if($selected == $field)
 104                  {
 105                      $shtml .= "<option selected value=\"".$field."\">".$fieldlabel."</option>";
 106                  }else
 107                  {
 108                      $shtml .= "<option value=\"".$field."\">".$fieldlabel."</option>";
 109                  }
 110  
 111              }
 112          }
 113             }
 114          }
 115          return $shtml;
 116  }
 117  
 118      /** Function to get the combo values for the Secondary module Columns 
 119       *  @ param $module(module name) :: Type String
 120       *  @ param $selected (<selected or ''>) :: Type String
 121       *  This function generates the combo values for the columns for the given module 
 122       *  and return a HTML string 
 123       */
 124  function getSecondaryColumns_GroupingHTML($module,$selected="")
 125  {
 126          global $ogReport;
 127      global $app_list_strings;
 128          global $current_language;
 129  
 130          if($module != "")
 131          {
 132          $secmodule = explode(":",$module);
 133          for($i=0;$i < count($secmodule) ;$i++)
 134          {
 135                  $mod_strings = return_module_language($current_language,$secmodule[$i]);
 136          foreach($ogReport->module_list[$secmodule[$i]] as $key=>$value)
 137                  {
 138                          $shtml .= "<optgroup label=\"".$app_list_strings['moduleList'][$secmodule[$i]]." ".$key."\" class=\"select\" style=\"border:none\">";
 139              if(isset($ogReport->sec_module_columnslist[$secmodule[$i]][$key]))
 140              {
 141                  foreach($ogReport->sec_module_columnslist[$secmodule[$i]][$key] as $field=>$fieldlabel)
 142                  {
 143                      if(isset($mod_strings[$fieldlabel]))
 144                      {
 145                          if($selected == $field)
 146                          {
 147                              $shtml .= "<option selected value=\"".$field."\">".$mod_strings[$fieldlabel]."</option>";
 148                          }else
 149                          {
 150                              $shtml .= "<option value=\"".$field."\">".$mod_strings[$fieldlabel]."</option>";
 151                          }
 152                      }else
 153                      {
 154                          if($selected == $field)
 155                          {
 156                              $shtml .= "<option selected value=\"".$field."\">".$fieldlabel."</option>";
 157                          }else
 158                          {
 159                              $shtml .= "<option value=\"".$field."\">".$fieldlabel."</option>";
 160                          }
 161                      }
 162  
 163  
 164                  }
 165              }
 166                  }
 167          }
 168          }
 169          return $shtml;
 170  }
 171  
 172  if($sortorder[0] != "Descending")
 173  {
 174  $shtml = "<option selected value='Ascending'>Ascending</option>
 175       <option value='Descending'>Descending</option>";
 176  }else
 177  {
 178  $shtml = "<option value='Ascending'>Ascending</option>
 179        <option selected value='Descending'>Descending</option>";
 180  }
 181  $report_group->assign("ASCDESC1",$shtml);
 182  
 183  if($sortorder[1] != "Descending")
 184  {
 185  $shtml = "<option selected value='Ascending'>Ascending</option>
 186            <option value='Descending'>Descending</option>";
 187  }else
 188  {
 189  $shtml = "<option value='Ascending'>Ascending</option>
 190            <option selected value='Descending'>Descending</option>";
 191  }
 192  $report_group->assign("ASCDESC2",$shtml);
 193  
 194  if($sortorder[2] != "Descending")
 195  {
 196  $shtml = "<option selected value='Ascending'>Ascending</option>
 197        <option value='Descending'>Descending</option>";
 198  }else
 199  {
 200  $shtml =  "<option value='Ascending'>Ascending</option>
 201         <option selected value='Descending'>Descending</option>";
 202  }
 203  $report_group->assign("ASCDESC3",$shtml);
 204  $report_group->display("ReportGrouping.tpl");
 205  
 206  ?>


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