/** * return choice options for response types that have them * Note that this is hard coded for now to reduce admin overhead etc * if the response types expand greatly, then it will be worth expanding * this functionality to have choices defined in models. * * @param string $datatype * * @return array $choices */ public function getChoices($datatype = null) { if ($datatype == null) { $datatype = $this->datatype; } if ($datatype == 'bool') { return array('0' => 'No', '1' => 'Yes'); } elseif ($datatype == 'va') { return OphCoTherapyapplication_Helper::getInstance()->getVaListForForm(); } return; }
/** * gets the valid VA values for use in a form. * * @return array key, value pair list */ public function getVaOptions() { if (is_null($this->_va_list)) { $va_list = OphCoTherapyapplication_Helper::getInstance()->getVaListForForm(); if (!$this->isNewRecord) { $start_seen = false; $end_seen = false; foreach ($va_list as $key => $val) { if ($this->start_va == $key) { $start_seen = true; } if ($this->end_va == $key) { $end_seen = true; } } if (!$start_seen) { $va_list[] = array($this->start_va => $this->start_va); } if (!$end_seen) { $va_list[] = array($this->end_va => $this->end_va); } } $this->_va_list = $va_list; } return $this->_va_list; }