function getResult() { $this->updateData(); $q = $this->tables['questions']->getItem(CUtils::_postVar('vote_question', true, 0) ? CUtils::_postVar('vote_question', true, 0) : "publish='on' AND date_beg<'" . date('Y-m-d H:i:s') . "' AND date_end>'" . date('Y-m-d H:i:s') . "'"); if ($q) { $a = $this->tables['answers']->getArraysWhere('question_id=' . $q['id'] . " AND publish='on'"); $rows = array(); foreach ($a as $k => $v) { $a[$k]['percent'] = round($v['quantity'] ? intval($v['quantity']) / intval($q['quantity']) * 100 : 0, 2); if ($a[$k]['quantity']) { $rows[] = array(intval(360 * $a[$k]['percent'] / 100), $a[$k]['color']); } } if ($q['is_dia']) { inc_lib('tools/CDiagram.php'); $dia = new CDiagram(); $dia->bgcolor = 'EAEAEA'; if ($dia->draw($rows)) { $this->smarty->assign('vote_dia', '<img src="' . $dia->fname . '" width="' . $dia->width . '" height="' . $dia->height . '">'); } } $this->smarty->assign('a', $a); $this->smarty->assign('q', $q); return $this->smarty->fetch('service/' . $this->props['lang'] . '/vote.result.tpl'); } else { return ''; } }
include_once './tools.php'; ##########################################################3 # Make sure cdiagram library is included ##########################################################3 require_once "./cdiagram/class/diagram.php"; require_once "DB.php"; ########################################################## # Create the new graph with the specified size. If smallsize is set use it # to create small graphs that show up on the main utilization page ########################################################## if (isset($_GET['smallsize'])) { $size = explode(",", $smallgraph); $image = new CDiagram($size[0], $size[1], "PNG"); } else { $size = explode(",", $largegraph); $image = new CDiagram($size[0], $size[1], "PNG"); } $image->setDiagramType("Line"); # Balken"); $image->setBackground(255, 255, 255); $image->setTextcolor(0, 0, 0); $image->setLinecolor(0, 0, 0); $image->setGraphcolor(0, 255, 0); $image->setValuecolor(255, 0, 0); $image->paintHeader(htmlspecialchars($_GET['feature']), 4); ################################################################ # Connect to the database # Use persistent connections ################################################################ $db = DB::connect($dsn, true); if (DB::isError($db)) {
include_once './tools.php'; ##########################################################3 # Make sure cdiagram library is included ##########################################################3 require_once "cdiagram/class/diagram.php"; require_once "DB.php"; ########################################################## # Create the new graph with the specified size. If smallsize is set use it # to create small graphs that show up on the main utilization page ########################################################## if (isset($_GET['smallsize']) && $_GET['smallsize'] == 1) { $size = explode(",", $smallgraph); $image = new CDiagram($size[0], $size[1], "PNG"); } else { $size = explode(",", $largegraph); $image = new CDiagram($size[0], $size[1], "PNG"); } $image->setDiagramType("Balken"); $image->setBackground(255, 255, 255); $image->setTextcolor(0, 0, 0); $image->setLinecolor(0, 0, 0); $image->setGraphcolor(0, 255, 0); $image->setValuecolor(255, 0, 0); $image->paintHeader(htmlspecialchars($_GET['feature']), 4); ################################################################ # Connect to the database # Use persistent connections ################################################################ $db = DB::connect($dsn, true); if (DB::isError($db)) { die($db->getMessage());