/** * @see Page::readData() */ public function readData() { parent::readData(); // create chart object $this->data = new OpenFlashChart(WCF::getLanguage()->get('cms.acp.statistics.chart.page.title')); // create element $element = new OpenFlashChartElement($this->type); // set special options $element->tip = WCF::getLanguage()->get('cms.acp.statistics.chart.page.tip'); // read data from db $sql = "SELECT\n\t\t\t\t\tstats.requestCount AS requestCount,\n\t\t\t\t\tpage.title AS title\n\t\t\t\tFROM\n\t\t\t\t\tcms" . CMS_N . "_statistic_page stats\n\t\t\t\tLEFT JOIN\n\t\t\t\t\twcf" . WCF_N . "_page page\n\t\t\t\tON\n\t\t\t\t\tstats.pageID = page.pageID"; $result = WCF::getDB()->sendQuery($sql); $items = array(); // get available colours $colours = array(); while ($row = WCF::getDB()->fetchArray($result)) { $colours[] = "#" . substr(sha1($row['title']), 0, 6); $items[] = $row; } // add colours to element $element->colours = $colours; // load data foreach ($items as $row) { switch ($this->type) { case 'pie': $element->addValue(intval($row['requestCount']), $row['title']); break; } } // add element to chart $this->data->addElement($element); }
/** * @see Page::readData() */ public function readData() { parent::readData(); // create chart object $this->data = new OpenFlashChart(WCF::getLanguage()->get('cms.acp.statistics.chart.referer.title')); // create element $element = new OpenFlashChartElement($this->type); // set special options $element->tip = WCF::getLanguage()->get('cms.acp.statistics.chart.referer.tip'); // read data from db $sql = "SELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\tcms" . CMS_N . "_statistic_referer_host\n\t\t\t\tORDER BY\n\t\t\t\t\thostname ASC"; $result = WCF::getDB()->sendQuery($sql); $items = array(); // get available colours $colours = array(); while ($row = WCF::getDB()->fetchArray($result)) { $colours[] = "#" . substr(sha1($row['hostname']), 0, 6); $items[] = $row; } // add colours to element $element->colours = $colours; // create needed arrays $labels = array(); // load data foreach ($items as $row) { switch ($this->type) { case 'bar_3d': $element->addValue(intval($row['count'])); $lables[] = $row['hostname']; break; } } // set additional options $element->x_axis = array('3d' => 40, 'labels' => $labels); // add element to chart $this->data->addElement($element); }