public function __construct($name, BOL_MenuItem $menu) { parent::__construct($name); $language = OW_Language::getInstance(); $plugin = OW::getPluginManager()->getPlugin('base'); $adminPlugin = OW::getPluginManager()->getPlugin('admin'); $nameTextField = new TextField('name'); $this->addElement($nameTextField->setValue($language->text($plugin->getKey(), $menu->getKey()))->setLabel(OW::getLanguage()->text('admin', 'pages_edit_external_menu_name_label'))->setRequired(true)); $urlTextField = new TextField('url'); $urlTextField->addValidator(new ADMIN_CLASS_ExternalPageUrlValidator()); $this->addElement($urlTextField->setValue($menu->getExternalUrl())->setLabel(OW::getLanguage()->text('admin', 'pages_edit_external_url_label'))->setRequired(true)); $extOpenInNewWindow = new CheckboxField('ext-open-in-new-window'); $this->addElement($extOpenInNewWindow->setLabel(OW::getLanguage()->text('admin', 'pages_edit_external_url_open_in_new_window'))->setValue($menu->getNewWindow())); $visibleForCheckboxGroup = new CheckboxGroup('visible-for'); $visibleFor = $menu->getVisibleFor(); $options = array('1' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_guests'), '2' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_members')); $values = array(); foreach ($options as $value => $option) { if (!($value & $visibleFor)) { continue; } $values[] = $value; } $this->addElement($visibleForCheckboxGroup->setOptions($options)->setValue($values)->setLabel(OW::getLanguage()->text('admin', 'pages_edit_external_visible_for'))); $saveSubmit = new Submit('save'); $this->addElement($saveSubmit->setValue($language->text($adminPlugin->getKey(), 'save_btn_label'))); }