OXID eShop CE  4.9.7
 All Classes Files Functions Variables Pages
report_base.php
Go to the documentation of this file.
1 <?php
2 
7 
11 $sIncPath = $myConfig->getConfigParam('sShopDir');
12 
16 DEFINE('USE_CACHE', false);
17 DEFINE('CACHE_DIR', $myConfig->getConfigParam('sCompileDir'));
18 
22 require_once "$sIncPath/core/jpgraph/jpgraph.php";
23 require_once "$sIncPath/core/jpgraph/jpgraph_bar.php";
24 require_once "$sIncPath/core/jpgraph/jpgraph_line.php";
25 require_once "$sIncPath/core/jpgraph/jpgraph_pie.php";
26 require_once "$sIncPath/core/jpgraph/jpgraph_pie3d.php";
27 
28 if (!class_exists('report_base')) {
32  class Report_base extends oxAdminView
33  {
34 
40  protected $_oSmarty = null;
41 
47  public function render()
48  {
49  return $this->_sThisTemplate;
50  }
51 
57  public function setSmarty($oSmarty)
58  {
59  $this->_oSmarty = $oSmarty;
60  }
61 
67  public function getSmarty()
68  {
69  return $this->_oSmarty;
70  }
71 
77  public function getWeekRange()
78  {
79  $myConfig = $this->getConfig();
80 
81  // initializing one week before current..
82  $iFrom = oxRegistry::get("oxUtilsDate")->getWeekNumber($myConfig->getConfigParam('iFirstWeekDay'), strtotime(oxRegistry::getConfig()->getRequestParameter("time_from")));
83  $iTo = oxRegistry::get("oxUtilsDate")->getWeekNumber($myConfig->getConfigParam('iFirstWeekDay'), strtotime(oxRegistry::getConfig()->getRequestParameter("time_to")));
84 
85  return array($iFrom - 1, $iTo + 1);
86  }
87 
98  public function getGraph($iXSize, $iYSize, $sBackgroundImg = null, $sScaleType = "textlin")
99  {
100  $sBackgroundImg = $sBackgroundImg ? $sBackgroundImg : $this->getConfig()->getImageDir(true) . "/reportbgrnd.jpg";
101 
102  // New graph with a drop shadow
103  $oGraph = new Graph($iXSize, $iYSize);
104 
105  $oGraph->setBackgroundImage($sBackgroundImg, BGIMG_FILLFRAME);
106 
107  // Use a "text" X-scale
108  $oGraph->setScale($sScaleType);
109 
110  // Label align for X-axis
111  $oGraph->xaxis->setLabelAlign('center', 'top', 'right');
112 
113  // Label align for Y-axis
114  $oGraph->yaxis->setLabelAlign('right', 'bottom');
115 
116  // shadow
117  $oGraph->setShadow();
118 
119  // Use built in font
120  $oGraph->title->setFont(FF_FONT1, FS_BOLD);
121 
122  return $oGraph;
123  }
124  }
125 }