[ Index ]
 

Code source de vtiger CRM 5.0.2

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

title

Body

[fermer]

/modules/Reports/ -> SaveAndRun.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  global $theme;
  12  $theme_path="themes/".$theme."/";
  13  $image_path=$theme_path."images/";
  14  require_once ($theme_path."layout_utils.php");
  15  require_once ("config.php");
  16  require_once ('modules/Reports/Reports.php');
  17  require_once ('include/logging.php');
  18  require_once ('include/database/PearDatabase.php');
  19  require_once ("modules/Reports/ReportRun.php");
  20  require_once ('include/utils/utils.php');
  21  require_once ('Smarty_setup.php');
  22  
  23  global $adb;
  24  global $mod_strings;
  25  
  26  $reportid = $_REQUEST["record"];
  27  $folderid = $_REQUEST["folderid"];
  28  $filtercolumn = $_REQUEST["stdDateFilterField"];
  29  $filter = $_REQUEST["stdDateFilter"];
  30  $startdate = $_REQUEST["startdate"];
  31  $enddate = $_REQUEST["enddate"];
  32  
  33  global $primarymodule;
  34  global $secondarymodule;
  35  global $orderbylistsql;
  36  global $orderbylistcolumns;
  37  global $ogReport;
  38  
  39  $ogReport = new Reports($reportid);
  40  $primarymodule = $ogReport->primodule;
  41  $secondarymodule = $ogReport->secmodule;
  42  $oReportRun = new ReportRun($reportid);
  43  $filterlist = $oReportRun->RunTimeFilter($filtercolumn,$filter,$startdate,$enddate);
  44  $sshtml = $oReportRun->GenerateReport("HTML",$filterlist);
  45  $totalhtml = $oReportRun->GenerateReport("TOTALHTML",$filterlist);
  46  if(isPermitted($primarymodule,'index') == "yes" && (isPermitted($secondarymodule,'index')== "yes"))
  47  {
  48  
  49      $list_report_form = new vtigerCRM_Smarty;
  50      $ogReport->getSelectedStandardCriteria($reportid);
  51      //commented to omit dashboards for vtiger_reports
  52      //require_once('modules/Dashboard/ReportsCharts.php');
  53      //$image = get_graph_by_type('Report','Report',$primarymodule,'',$sshtml[2]);
  54      //$list_report_form->assign("GRAPH", $image);
  55  
  56      $BLOCK1 = getPrimaryStdFilterHTML($ogReport->primodule,$ogReport->stdselectedcolumn);
  57      $BLOCK1 .= getSecondaryStdFilterHTML($ogReport->secmodule,$ogReport->stdselectedcolumn);
  58      $list_report_form->assign("BLOCK1",$BLOCK1);
  59      $BLOCKJS = $ogReport->getCriteriaJS();
  60      $list_report_form->assign("BLOCKJS",$BLOCKJS);
  61  
  62      $BLOCKCRITERIA = $ogReport->getSelectedStdFilterCriteria($ogReport->stdselectedfilter);
  63      $list_report_form->assign("BLOCKCRITERIA",$BLOCKCRITERIA);
  64  
  65      $startdate = $ogReport->startdate;
  66      $list_report_form->assign("STARTDATE",$startdate);    
  67  
  68      $enddate = $ogReport->enddate;
  69      $list_report_form->assign("ENDDATE",$enddate);
  70  
  71      $list_report_form->assign("MOD", $mod_strings);
  72      $list_report_form->assign("APP", $app_strings);
  73      $list_report_form->assign("IMAGE_PATH", $image_path);
  74      $list_report_form->assign("REPORTID", $reportid);
  75      $list_report_form->assign("REPORTNAME", $ogReport->reportname);
  76      $list_report_form->assign("REPORTHTML", $sshtml);
  77      $list_report_form->assign("REPORTTOTHTML", $totalhtml);
  78      $list_report_form->assign("FOLDERID", $folderid);
  79      if($_REQUEST['mode'] != 'ajax')
  80      {
  81          $list_report_form->assign("REPINFOLDER", getReportsinFolder($folderid));
  82          include('themes/'.$theme.'/header.php');
  83          $list_report_form->display('ReportRun.tpl');
  84      }
  85      else
  86      {
  87          $list_report_form->display('ReportRunContents.tpl');
  88      }
  89  }
  90  else
  91  {
  92      if($_REQUEST['mode'] != 'ajax')
  93      {
  94          include('themes/'.$theme.'/header.php');
  95      }    
  96      echo "<table border='0' cellpadding='5' cellspacing='0' width='100%' height='450px'><tr><td align='center'>";
  97      echo "<div style='border: 3px solid rgb(153, 153, 153); background-color: rgb(255, 255, 255); width: 80%; position: relative; z-index: 10000000;'>
  98  
  99          <table border='0' cellpadding='5' cellspacing='0' width='98%'>
 100          <tbody><tr>
 101          <td rowspan='2' width='11%'><img src='themes/$theme/images/denied.gif' ></td>
 102          <td style='border-bottom: 1px solid rgb(204, 204, 204);' nowrap='nowrap' width='70%'><span class='genHeaderSmall'>".$mod_strings['LBL_NO_PERMISSION']." ".$primarymodule." ".$secondarymodule."</span></td>
 103          </tr>
 104          <tr>
 105          <td class='small' align='right' nowrap='nowrap'>                   
 106          <a href='javascript:window.history.back();'>$app_strings[LBL_GO_BACK]</a><br>                                                </td>
 107          </tr>
 108          </tbody></table> 
 109          </div>";
 110      echo "</td></tr></table>";
 111  }
 112  
 113      /** Function to get the StdfilterHTML strings for the given  primary module 
 114       *  @ param $module : Type String
 115       *  @ param $selected : Type String(optional)    
 116       *  This Generates the HTML Combo strings for the standard filter for the given reports module  
 117       *  This Returns a HTML sring
 118       */
 119  function getPrimaryStdFilterHTML($module,$selected="")
 120  {
 121      global $app_list_strings;
 122      global $ogReport;
 123      global $current_language;
 124  
 125          $mod_strings = return_module_language($current_language,$module);
 126  
 127      $result = $ogReport->getStdCriteriaByModule($module);
 128      
 129      if(isset($result))
 130      {
 131          foreach($result as $key=>$value)
 132          {
 133              if(isset($mod_strings[$value]))
 134              {
 135                  if($key == $selected)
 136                  {
 137                      $shtml .= "<option selected value=\"".$key."\">".$app_list_strings['moduleList'][$module]." - ".$mod_strings[$value]."</option>";
 138                  }else
 139                  {
 140                      $shtml .= "<option value=\"".$key."\">".$app_list_strings['moduleList'][$module]." - ".$mod_strings[$value]."</option>";
 141                  }
 142              }else
 143              {
 144                  if($key == $selected)
 145                  {
 146                      $shtml .= "<option selected value=\"".$key."\">".$app_list_strings['moduleList'][$module]." - ".$value."</option>";
 147                  }else
 148                  {
 149                      $shtml .= "<option value=\"".$key."\">".$app_list_strings['moduleList'][$module]." - ".$value."</option>";
 150                  }
 151              }
 152          }
 153      }
 154      
 155      return $shtml;
 156  }
 157  
 158      /** Function to get the StdfilterHTML strings for the given secondary module 
 159       *  @ param $module : Type String
 160       *  @ param $selected : Type String(optional)    
 161       *  This Generates the HTML Combo strings for the standard filter for the given reports module  
 162       *  This Returns a HTML sring
 163       */
 164  function getSecondaryStdFilterHTML($module,$selected="")
 165  {
 166      global $app_list_strings;
 167      global $ogReport;
 168      global $current_language;
 169  
 170      if($module != "")
 171          {
 172              $secmodule = explode(":",$module);
 173              for($i=0;$i < count($secmodule) ;$i++)
 174              {
 175              $result = $ogReport->getStdCriteriaByModule($secmodule[$i]);
 176              $mod_strings = return_module_language($current_language,$secmodule[$i]);
 177                  if(isset($result))
 178                  {
 179                          foreach($result as $key=>$value)
 180                          {
 181                                  if(isset($mod_strings[$value]))
 182                                          {
 183                          if($key == $selected)
 184                          {
 185                              $shtml .= "<option selected value=\"".$key."\">".$app_list_strings['moduleList'][$secmodule[$i]]." - ".$mod_strings[$value]."</option>";
 186                          }else
 187                          {
 188                              $shtml .= "<option value=\"".$key."\">".$app_list_strings['moduleList'][$secmodule[$i]]." - ".$mod_strings[$value]."</option>";
 189                          }
 190                      }else
 191                      {
 192                          if($key == $selected)
 193                          {
 194                              $shtml .= "<option selected value=\"".$key."\">".$app_list_strings['moduleList'][$secmodule[$i]]." - ".$value."</option>";
 195                          }else
 196                          {
 197                              $shtml .= "<option value=\"".$key."\">".$app_list_strings['moduleList'][$secmodule[$i]]." - ".$value."</option>";
 198                          }
 199                      }
 200                          }
 201                  }
 202          
 203          }
 204      }
 205      return $shtml;
 206  }
 207      /** Function to get the reports under a report folder 
 208       *  @ param $folderid : Type Integer 
 209       *  This Returns $reports_array in the following format 
 210       *          $reports_array = array ($reportid=>$reportname,$reportid=>$reportname1,.............,$reportidn=>$reportname)
 211       */
 212  function getReportsinFolder($folderid)
 213  {
 214      global $adb;
 215      $query = 'select reportid,reportname from vtiger_report where folderid='.$folderid;
 216      $result = $adb->query($query);
 217      $reports_array = Array();
 218      for($i=0;$i < $adb->num_rows($result);$i++)    
 219      {
 220          $reportid = $adb->query_result($result,$i,'reportid');
 221          $reportname = $adb->query_result($result,$i,'reportname');
 222          $reports_array[$reportid] = $reportname; 
 223      }
 224      if(count($reports_array) > 0)
 225          return $reports_array;
 226      else
 227          return false;
 228  }
 229  ?>


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