OXID eShop CE  4.10.7
 All Classes Namespaces 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')) {
34  class Report_base extends oxAdminView
35  {
36 
42  protected $_oSmarty = null;
43 
49  public function render()
50  {
51  return $this->_sThisTemplate;
52  }
53 
59  public function setSmarty($oSmarty)
60  {
61  $this->_oSmarty = $oSmarty;
62  }
63 
69  public function getSmarty()
70  {
71  return $this->_oSmarty;
72  }
73 
79  public function getWeekRange()
80  {
81  $myConfig = $this->getConfig();
82 
83  // initializing one week before current..
84  $iFrom = oxRegistry::get("oxUtilsDate")->getWeekNumber($myConfig->getConfigParam('iFirstWeekDay'), strtotime(oxRegistry::getConfig()->getRequestParameter("time_from")));
85  $iTo = oxRegistry::get("oxUtilsDate")->getWeekNumber($myConfig->getConfigParam('iFirstWeekDay'), strtotime(oxRegistry::getConfig()->getRequestParameter("time_to")));
86 
87  return array($iFrom - 1, $iTo + 1);
88  }
89 
100  public function getGraph($iXSize, $iYSize, $sBackgroundImg = null, $sScaleType = "textlin")
101  {
102  $sBackgroundImg = $sBackgroundImg ? $sBackgroundImg : $this->getConfig()->getImageDir(true) . "/reportbgrnd.jpg";
103 
104  // New graph with a drop shadow
105  $oGraph = new Graph($iXSize, $iYSize);
106 
107  $oGraph->setBackgroundImage($sBackgroundImg, BGIMG_FILLFRAME);
108 
109  // Use a "text" X-scale
110  $oGraph->setScale($sScaleType);
111 
112  // Label align for X-axis
113  $oGraph->xaxis->setLabelAlign('center', 'top', 'right');
114 
115  // Label align for Y-axis
116  $oGraph->yaxis->setLabelAlign('right', 'bottom');
117 
118  // shadow
119  $oGraph->setShadow();
120 
121  // Use built in font
122  $oGraph->title->setFont(FF_FONT1, FS_BOLD);
123 
124  return $oGraph;
125  }
126  }
127 }