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>"; }