[ Index ]
 

Code source de vtiger CRM 5.0.2

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

title

Body

[fermer]

/modules/Dashboard/ -> ReportsCharts.php (source)

   1  
   2  <?php
   3  
   4  /*********************************************************************************
   5  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
   6   * ("License"); You may not use this file except in compliance with the License
   7   * The Original Code is:  vtiger CRM Open Source
   8   * The Initial Developer of the Original Code is vtiger.
   9   * Portions created by vtiger are Copyright (C) vtiger.
  10   * All Rights Reserved.
  11  *
  12   ********************************************************************************/
  13  
  14      include ("modules/Dashboard/Entity_charts.php");
  15          include ("modules/Dashboard/horizontal_bargraph.php");
  16          //include("modules/Dashboard/vertical_bargraph.php");
  17          include ("modules/Dashboard/pie_graph.php");
  18      
  19  global $tmp_dir;
  20  function get_graph_by_type($graph_by,$graph_title,$module,$where,$query)
  21  {
  22      global $user_id,$date_start,$end_date,$type;
  23  
  24      //Giving the Cached image name    
  25      $cache_file_name=abs(crc32($user_id))."_".$type."_".crc32($date_start.$end_date).".png";
  26          $html_imagename=$graph_by; //Html image name for the graph
  27  
  28          $graph_details=module_Chart($user_id,$date_start,$end_date,$query,$graph_by,$graph_title,$where,$module,$type);
  29  
  30          if($graph_details!=0)
  31          {
  32                  $name_val=$graph_details[0];
  33                  $cnt_val=$graph_details[1];
  34                  $graph_title=$graph_details[2];
  35                  $target_val=$graph_details[3];
  36                  $graph_date=$graph_details[4];
  37                  $urlstring=$graph_details[5];
  38                  $cnt_table=$graph_details[6];
  39                 $test_target_val=$graph_details[7];
  40  
  41  
  42                  $width=600;
  43                  $height=400;
  44                  $top=30;
  45                  $left=140;
  46                  $bottom=120;
  47                  $title=$graph_title;
  48  
  49                  return get_graph($cache_file_name,$html_imagename,$cnt_val,$name_val,$width,$height,$left,$right,$top,$bottom,$title,$target_val,$graph_date,$urlstring,$test_target_val,$date_start,$end_date);
  50          }
  51      else
  52      {
  53      
  54      }
  55   
  56  }
  57  
  58  /** Returns  the Horizontal,vertical, pie graphs and Accumulated Graphs 
  59  for the details
  60  * Portions created by vtiger are Copyright (C) vtiger.
  61  * All Rights Reserved.
  62  * Contributor(s): ______________________________________..
  63  */
  64  
  65  
  66  // Function for get graphs
  67  function get_graph($cache_file_name,$html_imagename,$cnt_val,$name_val,$width,$height,$left,$right,$top,$bottom,$title,$target_val,$graph_date,$urlstring,$test_target_val,$date_start,$end_date)
  68  {
  69  
  70      global $tmp_dir;
  71       global $graph_title;
  72      $val=explode(":",$title);         
  73      $display_title=$val[0];    
  74              
  75      
  76  $sHTML .= "<tr>
  77         <td><table width=20%  border=0 cellspacing=0 cellpadding=0 align=left>
  78             <tr>
  79             <td rowspan=2 valign=top><span class=dashSerial>1</span></td>
  80              <td nowrap><span class=genHeaderSmall>".$graph_title."</span></td>
  81            </tr>
  82              <tr>
  83             <td><span class=big>Horizontal Bar Chart</span> </td>
  84           </tr>
  85          </table>
  86           </td>
  87      </tr>
  88      <tr>
  89         <td height=200>"; 
  90  
  91         $sHTML .= render_graph($tmp_dir."hor_".$cache_file_name,$html_imagename."_hor",$cnt_val,$name_val,$width,$height,$left,$right,$top,$bottom,$title,$target_val,"horizontal");
  92  //Commented by Minnie -- same content displayed in to graphs
  93  /*$sHTML .= "</td>
  94      </tr>
  95      <tr>
  96         <td><hr noshade='noshade' size='1' /></td>
  97      </tr>";
  98      
  99  $sHTML .= "<tr>
 100         <td><table width=20%  border=0 cellspacing=0 cellpadding=0 align=left>
 101             <tr>
 102             <td rowspan=2 valign=top><span class=dashSerial>2</span></td>
 103              <td nowrap><span class=genHeaderSmall>".$graph_title."</span></td>
 104            </tr>
 105              <tr>
 106             <td><span class=big>Vertical Bar Chart</span> </td>
 107           </tr>
 108          </table>
 109           </td>
 110      </tr>
 111      <tr>
 112         <td height=200>"; 
 113  
 114         $sHTML .= render_graph($tmp_dir."vert_".$cache_file_name,$html_imagename."_vert",$cnt_val,$name_val,$width,$height,$left,$right,$top,$bottom,$title,$target_val,"vertical");*/
 115  
 116  $sHTML .= "</td>
 117      </tr>
 118      <tr>
 119         <td><hr noshade='noshade' size='1' /></td>
 120      </tr>";
 121  
 122  $sHTML .= "<tr>
 123         <td><table width=20%  border=0 cellspacing=0 cellpadding=0 align=left>
 124             <tr>
 125             <td rowspan=2 valign=top><span class=dashSerial>2</span></td>
 126              <td nowrap><span class=genHeaderSmall>".$graph_title."</span></td>
 127            </tr>
 128              <tr>
 129             <td><span class=big>Pie Chart</span> </td>
 130           </tr>
 131          </table>
 132           </td>
 133      </tr>
 134      <tr>
 135         <td height=200>"; 
 136  
 137         $sHTML .= render_graph($tmp_dir."pie_".$cache_file_name,$html_imagename."_pie",$cnt_val,$name_val,$width,$height,40,$right,$top,$bottom,$title,$target_val,"pie");
 138  
 139  $sHTML .= "</td>
 140      </tr>
 141      <tr>
 142         <td><hr noshade='noshade' size='1' /></td>
 143      </tr>";
 144  
 145      return $sHTML;
 146  }
 147  
 148  /** Returns graph, if the cached image is present it'll display that image,
 149  otherwise it will render the graph with the given details    
 150  * Portions created by vtiger are Copyright (C) vtiger.
 151  * All Rights Reserved.
 152  * Contributor(s): ______________________________________..
 153  */
 154  
 155  // Function to get the chached image if exists
 156  function render_graph($cache_file_name,$html_imagename,$cnt_val,$name_val,$width,$height,$left,$right,$top,$bottom,$title,$target_val,$graph_type)
 157  {
 158  
 159      //Checks whether the cached image is present or not
 160      if(file_exists($cahce_file_name))
 161      {
 162          unlink($cache_file_name);
 163      }
 164      if(file_exists($cache_file_name.'.map'))
 165      {
 166          unlink($cache_file_name.'.map');
 167      }    
 168      if (!file_exists($cache_file_name) || !file_exists($cache_file_name.'.map')) 
 169      {
 170          //If the Cached image is not present
 171          if($graph_type=="horizontal")
 172          {
 173               return horizontal_graph($cnt_val,$name_val,$width,$height,$left,$right,$top,$bottom,$title,$target_val,$cache_file_name,$html_imagename);
 174          }
 175          else if($graph_type=="vertical")    
 176          {
 177              return vertical_graph($cnt_val,$name_val,$width,$height,$left,$right,$top,$bottom,$title,$target_val,$cache_file_name,$html_imagename);
 178          }
 179          else if($graph_type=="pie")
 180          {
 181              return pie_chart($cnt_val,$name_val,$width,$height,$left,$right,$top,$bottom,$title,$target_val,$cache_file_name,$html_imagename);
 182              
 183          }
 184      }
 185      else
 186      {
 187          //Getting the cached image
 188          $imgMap_fp = fopen($cache_file_name.'.map', "rb");
 189          $imgMap = fread($imgMap_fp, vtiger_filesize($cache_file_name.'.map'));
 190          fclose($imgMap_fp);
 191          $base_name_cache_file=basename($cache_file_name);
 192          $ccc="cache/images/".$base_name_cache_file;
 193          $return = "\n$imgMap\n";
 194          $return .= "<img src=$ccc ismap usemap=#$html_imagename border='0'>";
 195          return $return;
 196      }
 197  }


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