protected function optionsForm() { $curUrl = \Ip\Internal\UrlHelper::getCurrentUrl(); $form = new \Ip\Form(); $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN); $field = new \Ip\Form\Field\Checkbox(array('name' => 'jumpmenu', 'label' => __('Show A-Z jumpmenu atop of keywordlist', 'Keywordlist'), 'checked' => 0)); $form->addField($field); $field = new \Ip\Form\Field\Checkbox(array('name' => 'tooltip', 'label' => __('Show description as tooltip of linked pages', 'Keywordlist'), 'checked' => 0)); $form->addField($field); $field = new \Ip\Form\Field\Select(array('name' => 'columns', 'label' => __('Number of columns', 'Keywordlist'), 'values' => array(array('1', __('One column', 'Keywordlist')), array('2', __('Two columns', 'Keywordlist')), array('3', __('Three columns', 'Keywordlist')), array('4', __('Four columns', 'Keywordlist'))), 'note' => __('List of keywords will be wraped to selected number of columns.', 'Keywordlist'), 'value' => 3)); $form->addField($field); return $form; }
protected function optionsForm() { $curUrl = \Ip\Internal\UrlHelper::getCurrentUrl(); $form = new \Ip\Form(); $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN); $field = new \Ip\Form\Field\Text(array('name' => 'anchor', 'label' => __('Anchor', 'Ip-admin', false), 'note' => __('Anchor', 'Ip-admin') . ' <span class="ipsAnchorPreview">' . $curUrl . '#</span>')); $form->addField($field); $field = new \Ip\Form\Field\Url(array('name' => 'link', 'label' => __('Link', 'Ip-admin', false))); $form->addField($field); $field = new \Ip\Form\Field\Checkbox(array('name' => 'blank', 'label' => __('Open in new window', 'Ip-admin', false))); $form->addField($field); return $form; // Output a string with generated HTML form }
private static function arrayToMenuItem($pages, $depth, $curDepth, $order) { $items = array(); foreach ($pages as $pageRow) { $page = new \Ip\Page($pageRow['id']); $item = new Item(); $subSelected = false; if ($curDepth < $depth) { $children = ipDb()->selectAll('page', '*', array('parentId' => $page->getId(), 'isVisible' => 1, 'isSecured' => 0, 'isDeleted' => 0), "ORDER BY {$order}"); if ($children) { $childrenItems = self::arrayToMenuItem($children, $depth, $curDepth + 1, $order); $item->setChildren($childrenItems); } } if ($page->isCurrent() || $page->getRedirectUrl() && $page->getLink() == \Ip\Internal\UrlHelper::getCurrentUrl()) { $item->markAsCurrent(true); } elseif ($page->isInCurrentBreadcrumb() || $subSelected || $page->getRedirectUrl() && self::existInBreadcrumb($page->getLink())) { $item->markAsInCurrentBreadcrumb(true); } if ($page->isDisabled()) { $item->setUrl(''); } elseif ($page->getRedirectUrl()) { $url = $page->getRedirectUrl(); if (!preg_match('/^((http|https):\\/\\/)/i', $url)) { $url = 'http://' . $url; } $item->setUrl($url); } else { $item->setUrl($page->getLink()); } $metaTitle = $page->getMetaTitle(); $item->setBlank($page->isBlank()); $item->setTitle($page->getTitle()); $item->setDepth($curDepth); $item->setDisabled($page->isDisabled()); $item->setId($page->getId()); $item->setAlias($page->getAlias()); $item->setPageTitle(empty($metaTitle) ? $page->getTitle() : $metaTitle); $items[] = $item; } return $items; }
public static function createForm() { $form = new \Ip\Form(); // Password input $field = new \Ip\Form\Field\Password(array('layout' => \Ip\Form\Field::LAYOUT_NO_LABEL, 'name' => 'pagePassword', 'label' => __('Password', 'PagePassword', false), 'validators' => array('Required'))); $field->addAttribute('id', 'auth_password'); $field->addClass('auth_password'); $form->addField($field); // Submit Button $field = new \Ip\Form\Field\Submit(array('value' => __('Authenticate', 'PagePassword', false))); $field->addAttribute('id', 'auth_submit'); $field->addClass('auth_submit'); $form->addField($field); $form->addAttribute('id', 'auth_form'); $form->addClass('auth_form'); $curUrl = \Ip\Internal\UrlHelper::getCurrentUrl(); $form->setAction($curUrl); $form->setAjaxSubmit(false); return $form; }