示例#1
0
<?php

/**
 * Created by IntelliJ IDEA.
 * User: mohammad
 * Date: 4/4/14
 * Time: 1:21 AM
 */
namespace sarhan\survey\web\admin;

require_once __DIR__ . "/../../import.php";
use sarhan\survey\Survey;
use sarhan\survey\SurveyManager;
$surveyId = $_REQUEST['id'];
$manager = new SurveyManager();
$survey = null;
$surveyName = "";
$desc = "";
$thankyouMsg = "";
$submitText = "Add Survey";
if ($surveyId && is_numeric($surveyId)) {
    $survey = $manager->getSurvey($surveyId);
    if (!$survey || is_null($survey)) {
        header("Location: index.php");
    }
    $surveyName = $survey->getSurveyName();
    $desc = $survey->getDescription();
    $thankyouMsg = $survey->getThankYouMessage();
    $submitText = "Update Survey";
}
if ($_REQUEST['submit']) {
示例#2
0
<?php

/**
 * Created by IntelliJ IDEA.
 * User: mohammad
 * Date: 4/4/14
 * Time: 12:30 AM
 */
namespace sarhan\survey\web\admin;

use sarhan\survey\SurveyManager;
use sarhan\survey\SurveyStatus;
require_once __DIR__ . "/../../import.php";
$manager = new SurveyManager();
$surveys = $manager->getSurveys();
class TableData
{
    public $id;
    public $surveyName;
    public $description;
    public $created;
    public $status;
    public $action;
    /**
     * @param $id
     * @param $status
     * @param $surveyName
     * @param $created
     * @param $description
     */
    function __construct($id, SurveyStatus $status, $surveyName, $created, $description)
示例#3
0
<?php

/**
 * Created by IntelliJ IDEA.
 * User: mohammad
 * 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);
    }