/** * @param $id * @param $status * @param $surveyName * @param $created * @param $description */ function __construct($id, SurveyStatus $status, $surveyName, $created, $description) { $this->created = $created; $this->description = $description; $this->id = $id; $this->status = $status->getName(); $this->surveyName = $surveyName; $this->action = '<a href="report.php?id=' . $id . '">View Report</a>'; if ($status->getValue() == SurveyStatus::active) { $sid = SurveyStatus::disabled; $this->action .= " | <a href=\"changeStatus.php?id={$id}&status={$sid}\">Disable</a>"; } else { $sid = SurveyStatus::active; $this->action .= " | <a href=\"changeStatus.php?id={$id}&status={$sid}\">Enable</a>"; } }
public function getName() { foreach (SurveyStatus::toArray() as $key => $val) { if ($this->value == $val) { return $key; } } return $this->getValue(); }
/** * @param SurveyStatus $status */ public function setStatus(SurveyStatus $status) { $this->status = $status->getValue(); }