Ejemplo n.º 1
0
 /**
  * Prepare chart data
  *
  * @return void
  */
 protected function _prepareData()
 {
     $this->setDataHelperName('adminhtml/dashboard_order');
     $this->getDataHelper()->setParam('store', $this->getRequest()->getParam('store'));
     $this->getDataHelper()->setParam('website', $this->getRequest()->getParam('website'));
     $this->getDataHelper()->setParam('group', $this->getRequest()->getParam('group'));
     $this->setDataRows('revenue');
     $this->_axisMaps = array('x' => 'range', 'y' => 'revenue');
     parent::_prepareData();
 }
Ejemplo n.º 2
0
 /**
  * Prepare chart data
  *
  * @return void
  */
 protected function _prepareData()
 {
     $this->setDataHelperName('Mage_Adminhtml_Helper_Dashboard_Order');
     $this->getDataHelper()->setParam('store', $this->getRequest()->getParam('store'));
     $this->getDataHelper()->setParam('website', $this->getRequest()->getParam('website'));
     $this->getDataHelper()->setParam('group', $this->getRequest()->getParam('group'));
     $this->setDataRows('quantity');
     $this->_axisMaps = array('x' => 'range', 'y' => 'quantity');
     parent::_prepareData();
 }
Ejemplo n.º 3
0
 public function __construct()
 {
     $data = $this->getDataLifetime();
     $this->_rate_chart_money = round($data['totals_money'] * 2 / $data['totals_qty']);
     Mage::register('rate_chart_money', $this->_rate_chart_money);
     $currency = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getBaseCurrencyCode())->getSymbol();
     $this->_google_chart_params = array('cht' => 'lc', 'chf' => 'bg,s,f4f4f4|c,lg,90,ffffff,0.1,ededed,0', 'chdl' => $this->__('Number of items') . '|' . $this->__('Total Sales(%s)', $currency), 'chco' => '2424ff,db4814', 'chxt' => 'x,y,y,r,r', 'chxlexpend' => '|2:||' . $this->__('# Items') . '|4:||' . $this->__('Total Sales(%s)', $currency));
     $this->setHtmlId('report_brand_sales');
     parent::__construct();
     $this->setTemplate('shopbybrand/report/graph.phtml');
 }
Ejemplo n.º 4
0
 public function __construct()
 {
     parent::__construct();
     $this->setTemplate('affiliateplusstatistic/graph.phtml');
 }
Ejemplo n.º 5
0
 /**
  * (non-PHPdoc)
  * @see app/code/core/Mage/Adminhtml/Block/Dashboard/Mage_Adminhtml_Block_Dashboard_Graph#getChartUrl($directUrl = true)
  */
 public function getChartUrl($directUrl = true)
 {
     // check if google chart API should be used or internal chart library
     if (Mage::getStoreConfig('piwik/piwik_chart/google')) {
         return parent::getChartUrl($directUrl);
     }
     // load the data for the series
     $this->_allSeries = $this->getRowsData($this->_dataRows);
     // initialize the axis labels
     foreach ($this->_axisMaps as $axis => $attr) {
         $this->setAxisLabels($axis, $this->getRowsData($attr, true));
     }
     // load the start and the end date
     list($dateStart, $dateEnd) = Mage::getResourceModel('reports/order_collection')->getDateRange($this->getDataHelper()->getParam('period'), '', '', true);
     // initialize the arrays for the data
     $dates = array();
     $datas = array();
     // assemble the arrays with the data and the dates
     while ($dateStart->compare($dateEnd) < 0) {
         switch ($this->getDataHelper()->getParam('period')) {
             case '24h':
                 $d = $dateStart->toString('yyyy-MM-dd HH:00');
                 $dateStart->addHour(1);
                 break;
             case '7d':
             case '1m':
                 $d = $dateStart->toString('yyyy-MM-dd');
                 $dateStart->addDay(1);
                 break;
             case '1y':
             case '2y':
                 $d = $dateStart->toString('yyyy-MM');
                 $dateStart->addMonth(1);
                 break;
         }
         foreach ($this->getAllSeries() as $index => $serie) {
             if (in_array($d, $this->_axisLabels['x'])) {
                 $datas[$index][] = (double) array_shift($this->_allSeries[$index]);
             } else {
                 $datas[$index][] = 0;
             }
         }
         $dates[] = $d;
     }
     // initialize the array for the assembled data
     $params = array();
     // iterate over the dates
     foreach ($dates as $key => $date) {
         // format the date
         switch ($this->getDataHelper()->getParam('period')) {
             case '24h':
                 $date = $this->formatTime($date, 'short', false);
                 break;
             case '7d':
             case '1m':
                 $date = $this->formatDate($date);
                 break;
             case '1y':
             case '2y':
                 $formats = Mage::app()->getLocale()->getTranslationList('datetime');
                 $format = isset($formats['yyMM']) ? $formats['yyMM'] : 'MM/yyyy';
                 $format = str_replace(array("yyyy", "yy", "MM"), array("Y", "y", "m"), $format);
                 $date = date($format, strtotime($date));
                 break;
         }
         // assemble the date and the apropriate data
         foreach ($datas as $name => $values) {
             $params[] = array($date, $key, $datas[$name][$key]);
         }
     }
     // return the encoded data
     if ($directUrl) {
         $p = array();
         foreach ($params as $name => $value) {
             $p[] = $name . '=' . urlencode($value);
         }
         return self::API_URL . '?' . implode('&', $p);
     } else {
         $gaData = urlencode(base64_encode(serialize($params)));
         $gaHash = Mage::helper('piwik')->getChartDataHash($gaData);
         $params = array('ga' => $gaData, 'h' => $gaHash);
         return $this->getUrl('piwik/adminhtml_dashboard/tunnel', array('_query' => $params));
     }
 }
Ejemplo n.º 6
0
 public function __construct()
 {
     parent::__construct();
     $this->setTemplate('customercredit/report/template.phtml');
 }
Ejemplo n.º 7
0
 public function testGetChartUrl()
 {
     $this->assertStringStartsWith('http://chart.apis.google.com/chart', $this->_block->getChartUrl());
 }
Ejemplo n.º 8
0
 public function __construct()
 {
     parent::__construct();
     //$this->setTemplate('rewardpoints/dashboard/graph.phtml');
     $this->setTemplate('dashboard/graph.phtml');
 }