<?php namespace Qnet\Controller; require_once dirname(__FILE__) . '\\..\\..\\util.php'; require_dao('queryDAO'); require_dao('answersDAO'); use Qnet\Dao\QueryDAO; use Qnet\Dao\AnswersDAO; $uid = getUID(); $qid = $_POST['qid']; $dao = new AnswersDAO(); $qdao = new QueryDAO(); $questions = $qdao->getQuestionsByQueryId($qid); $aid = $dao->persistAnswer($uid, $qid); foreach (array_keys($questions) as $id) { $dao->persistAnswerOption($aid, $_POST['question' . $id]); } header("Location: /Qnet/target/classes/php/qnet/ui/answerquery.php?qid=" . $qid . "&commit=ok");
<?php require_once dirname(__FILE__) . '\\..\\util.php'; require_dao('answersDAO'); require_abs('images/graphs/phpgraphlib.php'); require_abs('images/graphs/phpgraphlib_pie.php'); use Qnet\Dao\AnswersDAO; $questionId = $_GET['qid']; $title = $_GET['title']; $dao = new AnswersDAO(); $dao->selectAnswersByQuestionId($questionId); $graph = new PHPGraphLibPie(400, 200); $data = array(); foreach ($dao->getLabelsAndCountsMap() as $label => $count) { $data[$label] = $count; } $graph->addData($data); if ($title != null) { $graph->setTitle($title); } //$graph->setLabelTextColor('50,50,50'); //$graph->setLegendTextColor('50,50,50'); $graph->createGraph();