-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.php
83 lines (62 loc) · 2.11 KB
/
helper.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
//ini_set('include_path', './ezc/trunk');
//require_once "./ezc/trunk/Base/src/base.php";
ini_set('include_path', '.:./ezc');
require_once "./ezc/Base/src/base.php";
function __autoload( $className )
{
ezcBase::autoload( $className );
}
class VersionGraph extends ezcGraphPieChart
{
protected $pdo;
protected $filter;
public function __construct(PDO $pdo, $title, $query, $filter = "")
{
parent::__construct();
$this->pdo = $pdo;
$this->title = $title;
$this->filter = $filter;
$this->setDataQuery($query);
$this->renderer = new ezcGraphRenderer3d();
}
public function setDataQuery($sql)
{
$sql = str_replace('{filter}', $this->filter ? $this->filter : 1, $sql);
$this->data['data'] = new ezcGraphArrayDataSet(new StatResulIterator($this->pdo->query($sql)));
}
public function render($w, $h, $f = null)
{
// $this->renderer = new ezcGraphRenderer3d();
$this->renderer->options->moveOut = .2;
$this->renderer->options->pieChartOffset = 63;
$this->renderer->options->pieChartGleam = .3;
$this->renderer->options->pieChartGleamColor = '#FFFFFF';
$this->renderer->options->pieChartGleamBorder = 2;
$this->renderer->options->pieChartShadowSize = 3;
$this->renderer->options->pieChartShadowColor = '#000000';
$this->renderer->options->legendSymbolGleam = .5;
$this->renderer->options->legendSymbolGleamSize = .9;
$this->renderer->options->legendSymbolGleamColor = '#FFFFFF';
$this->renderer->options->pieChartSymbolColor = '#000000';
parent::render($w, $h, $f);
}
}
######################################
class PDODebug extends PDO
{
private $queries = array();
public function __construct($dsn, $user, $pw)
{
parent::__construct($dsn, $user, $pw);
$this->queries &= $_SESSION['queries'];
}
public function query($sql)
{
$_SESSION['queries'][] = $sql;
return parent::query($sql);
}
public function getQueries() {
return $_SESSION['queries'];
}
}