Esempio n. 1
0
 * Date: 4/5/14
 * Time: 3:03 AM
 */
require_once __DIR__ . "/../../import.php";
use sarhan\survey\ReportData;
use sarhan\survey\SurveyManager;
$surveyId = $_REQUEST['id'];
if (!$surveyId) {
    header("Location: index.php");
}
$manager = new SurveyManager();
$survey = $manager->getSurvey($surveyId);
if (!$survey || is_null($survey)) {
    header("Location: index.php");
}
$answers = $manager->getAnswers($surveyId);
/**
 * @var ReportData[] $reportData
 */
$reportData[] = array();
$index = 0;
foreach ($survey->getQuestions() as $q) {
    $ans = $answers->getAnswers($q->getId());
    if (!is_null($ans) && is_array($ans) && count($ans) > 0) {
        $reportData[$index] = new ReportData($ans, $q);
    }
    $index++;
}
?>
<html>
    <head>