function __construct($id, $question, QuestionType $type) { global $surveyId; $this->id = $id; $this->question = $question; foreach ($type->toArray() as $key => $val) { if ($val == $type->getValue()) { $this->type = $key; } } $this->action = '<a href="update.php?id=' . $surveyId . '&qid=' . $id . '&delete=true">Delete</a>'; $this->action .= " | <a href=\"editQuestion.php?id={$surveyId}&qid={$id}\">Edit</a>"; }
$questionText = $_REQUEST['questionText']; $type = $_REQUEST['type']; if ($questionText && $type && is_numeric($type)) { $question->setQuestion($questionText); $question->setType(new \sarhan\survey\QuestionType($type)); $manager->updateSurvey($survey); header("Location:update.php?id={$surveyId}"); } else { $error = "Failed!!"; } } else { $questionText = $question->getQuestion(); $type = $question->getType()->getValue(); } $typeDropdown = '<select name="type">'; foreach (\sarhan\survey\QuestionType::toArray() as $key => $val) { $selected = $val == $type ? 'selected="selected"' : ""; $typeDropdown .= "<option value=\"{$val}\" {$selected}>{$key}</option>"; } $typeDropdown .= '</select>'; ?> <html> <head> <link rel="stylesheet" href="http://yui.yahooapis.com/combo?3.15.0/build/cssreset/reset-min.css&3.15.0/build/cssfonts/fonts-min.css&3.15.0/build/cssbase/base-min.css"> <script src="http://yui.yahooapis.com/3.15.0/build/yui/yui-min.js"></script> </head> <body class="yui3-skin-sam"> <h3><?php echo $survey->getSurveyName(); ?> : Question Id <?php