/** * vraci true v pripade, ze byla tato volba zvolena * @return bool * @access public */ public function isSelected() { try { return array_search($this->getValue(), (array) $this->control->getValue()) !== FALSE; } catch (Exception $e) { throw $e; } }
/** * naplni control optiony * @param LBoxFormControlChoose $control * @param LBoxConfigItemStructure $root * @param string $pre */ protected function fillControlChooseMoveBefore(LBoxFormControlChoose $control) { try { $iterator = $this->getPage() && $this->getPage()->config->hasParent() ? $this->getPage()->config->getParent()->getChildNodesIterator() : LBoxConfigManagerStructure::getInstance()->getIterator(); $control->addOption(new LBoxFormControlOption(0, " ")); foreach ($iterator as $page) { if ($this->getPage() && $page->id == $this->getPage()->id) { continue; } $control->addOption(new LBoxFormControlOption($page->id, $page->heading . " - " . $page->url)); } } catch (Exception $e) { throw $e; } }
/** * pretezuje o nacitani options z records * @return array */ public function getOptions() { try { if (count($this->options) < 1) { $colnameValue = $this->colnameValue; $colnameLabel = $this->colnameLabel; $colnameTitle = $this->colnameTitle; foreach ($this->optionsPrepend as $optionValue => $optionLabel) { $option = new LBoxFormControlOption($optionValue, $optionLabel); $this->addOption($option); } foreach ($this->records as $record) { $option = new LBoxFormControlOption($record->{$colnameValue}, $record->{$colnameLabel}); $option->title = strlen($colnameTitle) > 0 ? $record->{$colnameTitle} : ""; $this->addOption($option); } foreach ($this->optionsAppend as $optionValue => $optionLabel) { $option = new LBoxFormControlOption($optionValue, $optionLabel); $this->addOption($option); } } return parent::getOptions(); } catch (Exception $e) { throw $e; } }