mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-24 04:20:12 +01:00
Removed obsoleted chart controllers
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
parent
8d34bcdd3f
commit
f31ecfcbd2
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerStatChart extends Controller {
|
||||
private $error = array();
|
||||
|
||||
public function index(){
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
$db_history = Registry::get('db_history');
|
||||
|
||||
$this->load->model('user/user');
|
||||
|
||||
$this->load->model('stat/chart');
|
||||
|
||||
$this->load->helper('libchart/classes/libchart');
|
||||
|
||||
$this->data['username'] = Registry::get('username');
|
||||
|
||||
$timespan = @$this->request->get['timespan'];
|
||||
|
||||
$db->select_db($db->database);
|
||||
|
||||
$emails = "";
|
||||
|
||||
/* let the admin users see the whole statistics */
|
||||
|
||||
if(Registry::get('admin_user') == 0 && Registry::get('readonly_admin') == 0) {
|
||||
$uid = $this->model_user_user->get_uid_by_name($this->data['username']);
|
||||
$emails = "AND rcpt IN ('" . preg_replace("/\n/", "','", $this->model_user_user->get_emails_by_uid((int)$uid)) . "')";
|
||||
}
|
||||
else if(isset($this->request->get['uid']) && is_numeric($this->request->get['uid']) && $this->request->get['uid'] > 0){
|
||||
$emails = "AND rcpt IN ('" . preg_replace("/\n/", "','", $this->model_user_user->get_emails_by_uid((int)$this->request->get['uid'])) . "')";
|
||||
}
|
||||
|
||||
$aa = new ModelStatChart();
|
||||
$aa->pieChartHamSpam($emails, $timespan, $this->data['text_ham_and_spam_messages'], "");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerStatGraph extends Controller {
|
||||
private $error = array();
|
||||
|
||||
public function index(){
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
$db_history = Registry::get('db_history');
|
||||
|
||||
$this->load->model('user/user');
|
||||
|
||||
|
||||
$this->load->model('stat/chart');
|
||||
|
||||
$this->load->helper('libchart/classes/libchart');
|
||||
|
||||
$this->data['username'] = Registry::get('username');
|
||||
|
||||
$timespan = @$this->request->get['timespan'];
|
||||
|
||||
$db->select_db($db->database);
|
||||
|
||||
$aa = new ModelStatChart();
|
||||
|
||||
$aa->lineChartHamSpam($timespan, $this->data['text_archived_messages'], SIZE_X, SIZE_Y, "");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -53,38 +53,6 @@ class ModelStatChart extends Model {
|
||||
}
|
||||
|
||||
|
||||
public function pieChartHamSpam($emails = '', $timespan, $title, $output) {
|
||||
$ham = $spam = 0;
|
||||
|
||||
$range = $this->getRangeInSeconds($timespan);
|
||||
|
||||
$chart = new PieChart(SIZE_X, SIZE_Y);
|
||||
|
||||
$query = $this->db->query("SELECT COUNT(*) AS SPAM FROM " . TABLE_META . " WHERE $emails AND arrived > $range");
|
||||
if($query->num_rows > 0) { $spam = $query->row['SPAM']; }
|
||||
|
||||
$query = $this->db->query("SELECT COUNT(*) AS HAM FROM " . TABLE_META . " WHERE $emails AND arrived > $range");
|
||||
if($query->num_rows > 0) { $ham = $query->row['HAM']; }
|
||||
|
||||
if($ham > $spam) {
|
||||
$chart->getPlot()->getPalette()->setPieColor(array(new Color(26, 192, 144), new Color(208, 48, 128) ));
|
||||
} else {
|
||||
$chart->getPlot()->getPalette()->setPieColor(array(new Color(208, 48, 128), new Color(26, 192, 144) ));
|
||||
}
|
||||
|
||||
|
||||
$dataSet = new XYDataSet();
|
||||
|
||||
$dataSet->addPoint(new Point("HAM ($ham)", $ham));
|
||||
$dataSet->addPoint(new Point("SPAM ($spam)", $spam));
|
||||
|
||||
$chart->setDataSet($dataSet);
|
||||
$chart->setTitle($title);
|
||||
|
||||
@$this->sendOutput($chart, $output);
|
||||
}
|
||||
|
||||
|
||||
private function getRangeInSeconds($timespan) {
|
||||
$range = 0;
|
||||
|
||||
@ -95,29 +63,4 @@ class ModelStatChart extends Model {
|
||||
}
|
||||
|
||||
|
||||
private function getDataPoints($timespan) {
|
||||
|
||||
if($timespan == "daily") { return 24; }
|
||||
if($timespan == "weekly") { return 7; }
|
||||
|
||||
return 30;
|
||||
}
|
||||
|
||||
|
||||
private function sendOutput($chart, $output = '') {
|
||||
if($output == "") {
|
||||
header("Content-type: image/png");
|
||||
header("Expires: now");
|
||||
}
|
||||
|
||||
if($output) {
|
||||
$chart->render($output);
|
||||
}
|
||||
else {
|
||||
$chart->render();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user