Пример #1
0
 public static function getAddForm()
 {
     $form = new \Ip\Form();
     $field = new \Ip\Form\Field\Hidden(array('name' => 'aa', 'value' => 'Languages.addLanguage'));
     $form->addField($field);
     $field = new \Ip\Form\Field\Select(array('name' => 'languageCode', 'values' => self::getLanguageSelectValues()));
     $form->addField($field);
     return $form;
 }
Пример #2
0
 public function adminHtmlSnippet()
 {
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
     $form->addField(new \Ip\Form\Field\Text(array('name' => 'title', 'label' => __('Title', 'Portfolio'), 'value' => null)));
     $form->addField(new \Ip\Form\Field\RichText(array('name' => 'description', 'label' => __('Description', 'Portfolio'), 'value' => null)));
     $form->addField(new \Ip\Form\Field\RepositoryFile(array('name' => 'imagelink', 'label' => __('Image', 'Portfolio'), 'fileLimit' => 1, 'value' => empty($item['imagelink']) ? null : array($item['imagelink']))));
     $form->addField(new \Ip\Form\Field\Url(array('name' => 'pagelink', 'label' => __('Page Url', 'Portfolio'), 'value' => null)));
     return ipView('snippet/edit.php', array('form' => $form))->render();
 }
Пример #3
0
 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;
 }
Пример #4
0
 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
 }
Пример #5
0
 protected function managementForm($widgetData = array())
 {
     $form = new \Ip\Form();
     $form->setEnvironment('admin');
     $form->addField(new \Ip\Form\Field\Hidden(array('name' => 'aa', 'value' => 'Block.checkForm', 'validator' => array("Required"))));
     $fieldset = new \Ip\Form\Fieldset();
     $fieldset->addField(new \Ip\Form\Field\Color(array('label' => __('Text Color', 'Block'), 'name' => 'color', 'validator' => array("Required"), 'value' => isset($widgetData['color']) ? $widgetData['color'] : ipGetThemeOption('ipTextColor', '000000'))));
     $form->addFieldset($fieldset);
     $fieldset = new \Ip\Form\Fieldset("Background");
     $fieldset->addField(new \Ip\Form\Field\Color(array('label' => __('Background color', 'Block'), 'name' => 'background_color', 'validator' => array("Required"), 'value' => isset($widgetData['background_color']) ? $widgetData['background_color'] : 'dedede')));
     $fieldset->addField(new \Ip\Form\Field\Number(array('label' => __('Background color transparency in percent', 'Block'), 'name' => 'transparency', 'validator' => array("Required"), 'value' => isset($widgetData['transparency']) ? $widgetData['transparency'] : 0)));
     $fieldset->addField(new \Ip\Form\Field\Checkbox(array('label' => __('Background image', 'Block'), 'name' => 'show_background_image', 'validator' => array("Required"), 'value' => isset($widgetData['show_background_image']) ? $widgetData['show_background_image'] : false)));
     $fieldset->addField(new \Ip\Form\Field\Hidden(array('name' => 'background_image', 'value' => isset($widgetData['background_image']) ? $widgetData['background_image'] : null)));
     $fieldset->addField(new \Ip\Form\Field\Info(array('html' => ' <div class="ipsEditScreen"></div>')));
     $form->addFieldset($fieldset);
     $fieldset = new \Ip\Form\Fieldset("Advanced");
     $fieldset->addField(new \Ip\Form\Field\Checkbox(array('label' => __('Fixed background', 'Block'), 'name' => 'fixed_background', 'validator' => array("Required"), 'value' => isset($widgetData['fixed_background']) ? $widgetData['fixed_background'] : false, 'hint' => __('Fixed background image will be fixed to viewport causing parallax effect.', 'Block'))));
     $fieldset->addField(new \Ip\Form\Field\Checkbox(array('label' => __('Blur background image', 'Block'), 'name' => 'blur_background_image', 'validator' => array("Required"), 'value' => isset($widgetData['blur_background_image']) ? $widgetData['blur_background_image'] : false)));
     $fieldset->addField(new \Ip\Form\Field\Number(array('label' => __('Blur radius(pixels)', 'Block'), 'name' => 'blur_radius', 'validator' => array("Required"), 'value' => isset($widgetData['blur_radius']) ? $widgetData['blur_radius'] : 5)));
     $fieldset->addField(new \Ip\Form\Field\Checkbox(array('label' => __('Text shadow', 'Block'), 'name' => 'text_shadow', 'validator' => array("Required"), 'value' => isset($widgetData['text_shadow']) ? $widgetData['text_shadow'] : false)));
     $values = array(array('cover', 'Cover'), array('contain', 'Contain'), array('auto', 'Auto'), array('100% auto', 'Fit width'), array('auto 100%', 'Fit height'));
     $fieldset->addField(new \Ip\Form\Field\Select(array('label' => __('Background size', 'Block'), 'name' => 'background_size', 'values' => $values, 'value' => isset($widgetData['background_size']) ? $widgetData['background_size'] : 'cover', 'hint' => __('Cover: Scale the background image to be as large as possible so that the background area is completely covered by the background image. Some parts of the background image may not be in view within the background positioning area. Contain: Scale the image to the largest size such that both its width and its height can fit inside the content area. Auto: The background-image contains its width and height. Fit width: will scale image to match width. Fit height: will scale image to match height.', 'Block'))));
     $fieldset->addField(new \Ip\Form\Field\Checkbox(array('label' => __('Background repeat', 'Block'), 'name' => 'background_repeat', 'validator' => array("Required"), 'value' => isset($widgetData['background_repeat']) ? $widgetData['background_repeat'] : true)));
     $fieldset->addField(new \Ip\Form\Field\Number(array('label' => __('Image width', 'Block'), 'hint' => __('If you want to optimize background image you can change the size of it. Beware that big images slows down page load speed, but small images will look bad if background is big. You can try to change size, repeat and blur to improve quality of lower resolution images.', 'Block'), 'name' => 'width', 'validator' => array("Required"), 'value' => isset($widgetData['width']) ? $widgetData['width'] : 960)));
     $fieldset->addField(new \Ip\Form\Field\Number(array('label' => __('Image height', 'Block'), 'name' => 'height', 'validator' => array("Required"), 'value' => isset($widgetData['height']) ? $widgetData['height'] : 640)));
     $form->addFieldset($fieldset);
     return $form;
 }
Пример #6
0
 public static function getAdvancedForm()
 {
     $form = new \Ip\Form();
     $form->addClass('ipsConfigForm');
     $form->addClass('ipsConfigFormAdvanced');
     $form->addClass('hidden');
     $form->setAjaxSubmit(0);
     $field = new \Ip\Form\Field\Checkbox(array('name' => 'automaticCron', 'value' => ipGetOption('Config.automaticCron', 1), 'label' => __('Execute cron automatically', 'Ip-admin', false), 'hint' => __('ImpressPages execute cron once every hour on randomly selected visitor page load. I you have setup cron manually, you can disable automatic cron functionality.', 'Ip-admin')));
     $field->addClass('ipsAutoSave');
     $field->addAttribute('data-fieldid', $field->getName());
     $field->addAttribute('id', $field->getName());
     $field->addAttribute('data-fieldname', $field->getName());
     $form->addField($field);
     $field = new \Ip\Form\Field\Text(array('name' => 'cronPassword', 'value' => ipGetOption('Config.cronPassword', 1), 'label' => __('Cron password', 'Ip-admin', false), 'hint' => __('Protect cron from being abusively executed by the strangers.', 'Ip-admin', false), 'note' => '<span class="ipsUrlLabel">' . __('Cron URL: ', 'Ip-admin') . '</span><a target="_blank" class="ipsUrl"></a>'));
     $field->addClass('ipsAutoSave');
     $field->addAttribute('data-fieldid', $field->getName());
     $field->addAttribute('id', $field->getName());
     $field->addAttribute('data-fieldname', $field->getName());
     $form->addField($field);
     $field = new \Ip\Form\Field\Checkbox(array('name' => 'removeOldEmails', 'value' => ipGetOption('Config.removeOldEmails', 0), 'label' => __('Remove old emails from the log', 'Ip-admin', false)));
     $field->addClass('ipsAutoSave');
     $field->addAttribute('data-fieldid', $field->getName());
     $field->addAttribute('id', $field->getName());
     $field->addAttribute('data-fieldname', $field->getName());
     $form->addField($field);
     $field = new \Ip\Form\Field\Text(array('name' => 'removeOldEmailsDays', 'value' => ipGetOption('Config.removeOldEmailsDays', 720), 'label' => __('Days to keep emails', 'Ip-admin', false), 'hint' => __('Meaningful only if "Remove old emails" is on.', 'Ip-admin', false)));
     $field->addClass('ipsAutoSave');
     $field->addAttribute('data-fieldid', $field->getName());
     $field->addAttribute('id', $field->getName());
     $field->addAttribute('data-fieldname', $field->getName());
     $form->addField($field);
     $field = new \Ip\Form\Field\Checkbox(array('name' => 'removeOldRevisions', 'value' => ipGetOption('Config.removeOldRevisions', 0), 'label' => __('Remove old page revisions', 'Ip-admin', false)));
     $field->addClass('ipsAutoSave');
     $field->addAttribute('data-fieldid', $field->getName());
     $field->addAttribute('id', $field->getName());
     $field->addAttribute('data-fieldname', $field->getName());
     $form->addField($field);
     $field = new \Ip\Form\Field\Text(array('name' => 'removeOldRevisionsDays', 'value' => ipGetOption('Config.removeOldRevisionsDays', 720), 'label' => __('Days to keep revisions', 'Ip-admin', false), 'hint' => __('Meaningful only if "Remove old page revisions" is on.', 'Ip-admin', false)));
     $field->addClass('ipsAutoSave');
     $field->addAttribute('data-fieldid', $field->getName());
     $field->addAttribute('id', $field->getName());
     $field->addAttribute('data-fieldname', $field->getName());
     $form->addField($field);
     $field = new \Ip\Form\Field\Checkbox(array('name' => 'allowAnonymousUploads', 'value' => ipGetOption('Config.allowAnonymousUploads', 1), 'label' => __('Allow anonymous uploads', 'Ip-admin', false), 'hint' => __('Disabling this feature will prevent users from uploading files to your website. E.g. in contact forms.', 'Ip-admin')));
     $field->addClass('ipsAutoSave');
     $field->addAttribute('data-fieldid', $field->getName());
     $field->addAttribute('id', $field->getName());
     $field->addAttribute('data-fieldname', $field->getName());
     $form->addField($field);
     $field = new \Ip\Form\Field\Checkbox(array('name' => 'trailingSlash', 'value' => ipGetOption('Config.trailingSlash', 1), 'label' => __('Add trailing slash at the end of page URL', 'Ip-admin', false), 'hint' => __('This won\'t change existing URLs. Only new and updated pages will get slash at the end.', 'Ip-admin')));
     $field->addClass('ipsAutoSave');
     $field->addAttribute('data-fieldid', $field->getName());
     $field->addAttribute('id', $field->getName());
     $field->addAttribute('data-fieldname', $field->getName());
     $form->addField($field);
     return $form;
 }
Пример #7
0
 private static function wysiwygForm()
 {
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
     $field = new \Ip\Form\Field\RichText(array('name' => 'text'));
     $form->addField($field);
     return $form;
 }
Пример #8
0
 public function adminHtmlSnippet()
 {
     $list = array();
     $mailingLists = \Plugin\AsdMailChimp\Model::call('lists/list');
     if ($mailingLists) {
         foreach ($mailingLists['data'] as $mailingList) {
             $list[] = array($mailingList['id'], $mailingList['name'] . " ({$mailingList['stats']['member_count']} " . __('subscribers', 'AsdMailChimp') . ")");
         }
     }
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
     $field = new \Ip\Form\Field\Select(array('name' => 'listId', 'label' => __('Choose mailing list', 'AsdMailChimp'), 'values' => $list));
     $form->addField($field);
     $field = new \Ip\Form\Field\Text(array('name' => 'data[successMessage]', 'label' => __('Successful subscription message', 'AsdMailChimp'), 'note' => __('Default message is: ', 'AsdMailChimp') . ' ' . __('Email successfully added to mailing list.', 'AsdMailChimp')));
     $form->addField($field);
     return ipView('snippet/edit.php', array('form' => $form))->render();
 }
Пример #9
0
 protected function optionsForm()
 {
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
     $field = new \Ip\Form\Field\Text(array('name' => 'address', 'label' => __('Address', 'AdvancedGoogleMaps', false)));
     $form->addField($field);
     $field = new \Ip\Form\Field\Number(array('name' => 'zoom', 'label' => __('Zoom', 'AdvancedGoogleMaps', false)));
     $form->addField($field);
     $field = new \Ip\Form\Field\Checkbox(array('name' => 'scrollWheel', 'label' => __('Scroll Wheel', 'AdvancedGoogleMaps', false)));
     $form->addField($field);
     $field = new \Ip\Form\Field\Checkbox(array('name' => 'zoomControl', 'label' => __('Zoom Control', 'AdvancedGoogleMaps', false), 'checked' => true));
     $form->addField($field);
     $values = array(array('ROADMAP', 'Roadmap'), array('SATELLITE', 'Satellite'), array('HYBRID', 'Hybrid'), array('TERRAIN', 'Terrain'));
     $field = new \Ip\Form\Field\Select(array('name' => 'mapType', 'label' => __('Map Type', 'AdvancedGoogleMaps', false), 'values' => $values, 'value' => 'MapTypeId.HYBRID'));
     $form->addField($field);
     return $form;
     // Output a string with generated HTML form
 }
Пример #10
0
 public static function updateForm()
 {
     $form = new \Ip\Form();
     $form->addAttribute('autocomplete', 'off');
     $field = new \Ip\Form\Field\Text(array('name' => 'username', 'label' => __('User name', 'Ip-admin', false), 'value' => '{{activeAdministrator.username}}'));
     $field->addValidator("Required");
     $form->addField($field);
     $field = new \Ip\Form\Field\Email(array('name' => 'email', 'label' => __('Email', 'Ip-admin', false), 'value' => '{{activeAdministratorEmail}}'));
     $field->addValidator("Required");
     $form->addField($field);
     $field = new \Ip\Form\Field\Password(array('name' => 'password', 'label' => __('New password (optional)', 'Ip-admin', false), 'value' => ''));
     $form->addField($field);
     $field = new \Ip\Form\Field\Hidden(array('name' => 'aa', 'value' => 'Administrators.update'));
     $form->addField($field);
     $field = new \Ip\Form\Field\Hidden(array('name' => 'id', 'value' => ''));
     $form->addField($field);
     return $form;
 }
Пример #11
0
 /**
  * Creates the widgets edit form
  *
  * @return \Ip\Form
  * @throws \Ip\Exception
  */
 public static function editForm()
 {
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
     $form->addFieldset(new \Ip\Form\Fieldset(__('Source data', 'DataTableWidget-admin', false)));
     $field = new SingleFile(array('name' => 'sourceFile', 'label' => __('File', 'DataTableWidget-admin', false) . ':'));
     $form->addField($field);
     $form->addFieldset(new \Ip\Form\Fieldset(__('View', 'DataTableWidget-admin', false)));
     $tableTypes = TableType::getAllAsArray();
     $values = array();
     foreach ($tableTypes as $tableType) {
         $values[] = array($tableType['id'], $tableType['name']);
     }
     $field = new \Ip\Form\Field\Select(array('name' => 'tableTypeId', 'label' => __('Table type', 'DataTableWidget-admin', false) . ':', 'values' => $values));
     $field->addValidator('Required');
     $form->addField($field);
     return $form;
 }
Пример #12
0
 public static function createForm($widgetId, $listId)
 {
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_PUBLIC);
     $field = new \Ip\Form\Field\Hidden(array('name' => 'data[listId]', 'value' => $listId));
     $field->addValidator('Required');
     $form->addField($field);
     $field = new \Ip\Form\Field\Text(array('name' => 'data[email]', 'label' => __('Enter your email to subscribe', 'AsdMailChimp')));
     $field->addValidator('Required');
     $field->addValidator('Email');
     $form->addField($field);
     $field = new \Ip\Form\Field\Hidden(array('name' => 'widgetId', 'value' => $widgetId));
     $form->addField($field);
     $field = new \Ip\Form\Field\Hidden(array('name' => 'sa', 'value' => 'AsdMailChimp.subscribeEmail'));
     $form->addField($field);
     $form->addField(new \Ip\Form\Field\Submit(array('value' => __('Submit', 'AsdMailChimp'))));
     return $form;
 }
Пример #13
0
 public static function emptyPageForm()
 {
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
     $pages = ipDb()->selectAll('page', 'id, title', array('isDeleted' => 1));
     foreach ($pages as $page) {
         $field = new \Ip\Form\Field\Checkbox(array('name' => 'page[]', 'label' => $page['title'], 'value' => true, 'postValue' => $page['id']));
         $form->addField($field);
     }
     return $form;
 }
Пример #14
0
 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;
 }
Пример #15
0
 public function adminHtmlSnippet()
 {
     $form = new \Ip\Form();
     $form->addField(new \Ip\Form\Field\Number(array('label' => 'Size (px)', 'name' => 'size')));
     $form->addField(new \Ip\Form\Field\Color(array('label' => 'Color', 'name' => 'color')));
     $form->addField(new \Ip\Form\Field\Color(array('label' => 'Shadow color', 'name' => 'shadow_color')));
     $form->addField(new \Ip\Form\Field\Number(array('label' => 'shadow_offset_top', 'name' => 'shadow_offset_top')));
     $form->addField(new \Ip\Form\Field\Number(array('label' => 'shadow_offset_left', 'name' => 'shadow_offset_left')));
     $form->addField(new \Ip\Form\Field\Number(array('label' => 'shadow_spread', 'name' => 'shadow_spread')));
     $form->addField(new \Plugin\FontAwesomeIcons\FontAwesomeField(array('label' => 'Icon', 'name' => 'icon')));
     return ipView('snippet/modal.php', array('form' => $form->render()))->render();
 }
Пример #16
0
 private static function createBaseForm($isSpecificColumnRequired)
 {
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
     // GENERAL
     $form->addFieldset(new \Ip\Form\Fieldset(__('General', 'Ip-admin', false)));
     $field = new \Ip\Form\Field\Text(array('name' => 'name', 'label' => __('Name', 'Ip-admin', false)));
     $field->addValidator("Required");
     $field->addAttribute('ng-model', 'editTableType.name');
     $form->addField($field);
     $languages = array();
     foreach (ipContent()->getLanguages() as $language) {
         $languages[] = array(intval($language->getId()), $language->getTitle());
     }
     $field = new \Ip\Form\Field\Select(array('name' => 'language', 'label' => __('Target language', 'DataTableWidget-admin', false), 'values' => $languages));
     $field->addValidator("Required");
     $form->addField($field);
     // DISPLAY OPTIONS
     $form->addFieldset(new \Ip\Form\Fieldset(__('Display options', 'DataTableWidget-admin', false)));
     $columnOptionsValues = array();
     foreach (TableType::getColumnOptions() as $key => $tableOption) {
         $columnOptionsValues[] = array($key, $tableOption['name']);
     }
     $field = new \Ip\Form\Field\Radio(array('name' => 'columnOption', 'label' => __('Columns and headings', 'DataTableWidget-admin', false), 'values' => $columnOptionsValues));
     $field->addAttribute('ng-model', 'editTableType.columnOption');
     $field->addAttribute('ng-change', 'selectedColumnOptionChanged()');
     $form->addField($field);
     $field = new SpecificColumn();
     $field->removeAttribute('id');
     if ($isSpecificColumnRequired) {
         $field->addValidator("Required");
     }
     $field->setLayout(\Ip\Form\Field::LAYOUT_NO_LABEL);
     $form->addField($field);
     return $form;
 }
Пример #17
0
 protected function managementForm($widgetData = array())
 {
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
     //setting hidden input field so that this form would be submitted to 'errorCheck' method of this controller. (http://www.impresspages.org/docs/controller)
     $field = new \Ip\Form\Field\Hidden(array('name' => 'aa', 'value' => 'GridWidget.checkForm'));
     $form->addField($field);
     //Input fields to adjust widget settings
     $field = new \Ip\Form\Field\Text(array('name' => 'title', 'label' => 'Title', 'value' => empty($widgetData['title']) ? null : $widgetData['title']));
     $field->addValidator('Required');
     $form->addField($field);
     $field = new \Ip\Form\Field\RichText(array('name' => 'text', 'label' => 'Text', 'value' => empty($widgetData['text']) ? null : $widgetData['text']));
     $form->addField($field);
     $field = new \Ip\Form\Field\Text(array('name' => 'url', 'label' => 'Url', 'value' => empty($widgetData['url']) ? null : $widgetData['url']));
     $form->addField($field);
     $field = new \Ip\Form\Field\RepositoryFile(array('name' => 'image', 'label' => 'Image', 'value' => empty($widgetData['image']) ? null : $widgetData['image']));
     $form->addField($field);
     $field = new \Ip\Form\Field\Checkbox(array('name' => 'isVisible', 'label' => 'Visible', 'checked' => 1, 'defaultValue' => 1));
     $form->addField($field);
     //ADD YOUR OWN FIELDS
     return $form;
 }
Пример #18
0
 public static function getPasswordResetForm2()
 {
     //create form object
     $form = new \Ip\Form();
     //add text field to form object
     $field = new \Ip\Form\Field\Hidden(array('name' => 'sa', 'value' => 'Admin.passwordResetAjax2'));
     $form->addfield($field);
     //add text field to form object
     $field = new \Ip\Form\Field\Hidden(array('name' => 'secret', 'value' => ipRequest()->getQuery('secret', '')));
     $form->addfield($field);
     //add text field to form object
     $field = new \Ip\Form\Field\Hidden(array('name' => 'userId', 'value' => ipRequest()->getQuery('id', '')));
     $form->addfield($field);
     //add text field to form object
     $field = new \Ip\Form\Field\Blank(array('name' => 'global_error'));
     $form->addfield($field);
     //add text field to form object
     $field = new \Ip\Form\Field\Password(array('name' => 'password', 'label' => __('New password', 'Ip-admin', false)));
     $field->addValidator('Required');
     $form->addField($field);
     //add text field to form object
     $field = new \Ip\Form\Field\Submit(array('value' => __('Save', 'Ip-admin', false)));
     $field->addClass('ipsLoginButton');
     $form->addField($field);
     $form->addClass('ipsPasswordResetForm2');
     return $form;
 }
Пример #19
0
 public function adminHtmlSnippet()
 {
     $form = new \Ip\Form();
     $results = Model::getMenusList();
     $yesNo = array(array(0, __('No', 'AsdMenuWidget')), array(1, __('Yes', 'AsdMenuWidget')));
     $form->addField(new \Ip\Form\Field\Select(array('name' => 'data[menu][name]', 'label' => __('Menu name', 'AsdMenuWidget'), 'values' => $results)));
     $visibilityOptions = array(array(0, __('All pages', 'AsdMenuWidget')), array(1, __('Parent page and its childrens', 'AsdMenuWidget')), array(2, __('Current page only', 'AsdMenuWidget')));
     $form->addField(new \Ip\Form\Field\Select(array('name' => 'data[menu][visibility]', 'label' => __('Visibility', 'AsdMenuWidget'), 'values' => $visibilityOptions)));
     $form->addField(new \Ip\Form\Field\Hidden(array('name' => 'data[menu][pageId]', 'value' => ipContent()->getCurrentPage()->getId())));
     $form->addFieldset(new \Ip\Form\Fieldset(__('Options', 'AsdMenuWidget')));
     $form->addField(new \Ip\Form\Field\Text(array('name' => 'data[menu][class]', 'label' => __('Class name', 'AsdMenuWidget'), 'value' => 'menu')));
     $form->addField(new \Ip\Form\Field\Text(array('name' => 'data[menu][parent]', 'label' => __('Parent class name', 'AsdMenuWidget'), 'value' => 'parent')));
     $form->addField(new \Ip\Form\Field\Text(array('name' => 'data[menu][active]', 'label' => __('Active class name', 'AsdMenuWidget'), 'value' => 'active')));
     $form->addField(new \Ip\Form\Field\Text(array('name' => 'data[menu][depth]', 'label' => __('Depth', 'AsdMenuWidget'), 'value' => '0', 'note' => __('empty or 0 value shows all menu levels', 'AsdMenuWidget'))));
     $form->addField(new \Ip\Form\Field\Select(array('name' => 'data[menu][nochild]', 'label' => __('Hide inactive menu child elements', 'AsdMenuWidget'), 'values' => $yesNo)));
     $form->addFieldset(new \Ip\Form\Fieldset('Icon options'));
     $form->addField(new \Ip\Form\Field\Select(array('name' => 'data[icon][enable]', 'label' => __('Enable icons', 'AsdMenuWidget'), 'values' => $yesNo)));
     $form->addField(new \Ip\Form\Field\Select(array('name' => 'data[icon][text]', 'label' => __('Show text', 'AsdMenuWidget'), 'values' => $yesNo)));
     $form->addField(new \Ip\Form\Field\Select(array('name' => 'data[icon][empty]', 'label' => __('Show empty image', 'AsdMenuWidget'), 'note' => __('If no image chosen, shows transparent image.', 'AsdMenuWidget'), 'values' => $yesNo)));
     $form->addField(new \Ip\Form\Field\Text(array('name' => 'data[icon][width]', 'label' => __('Icon width', 'AsdMenuWidget'), 'value' => '50')));
     $form->addField(new \Ip\Form\Field\Text(array('name' => 'data[icon][height]', 'label' => __('Icon height', 'AsdMenuWidget'), 'value' => '50')));
     return ipView('snippet/edit.php', array('form' => $form))->render();
 }
Пример #20
0
 protected function editForm()
 {
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
     $field = new \Ip\Form\Field\Text(array('name' => 'url', 'label' => __('Url', 'Ip-admin', false)));
     $form->addField($field);
     $field = new \Ip\Form\Field\Select(array('name' => 'size', 'label' => __('Size', 'Ip-admin', false)));
     $values = array(array('auto', __('Auto', 'Ip-admin', false)), array('custom', __('Custom', 'Ip-admin', false)));
     $field->setValues($values);
     $form->addField($field);
     $field = new \Ip\Form\Field\Number(array('name' => 'width', 'label' => __('Width', 'Ip-admin', false)));
     $form->addField($field);
     $field = new \Ip\Form\Field\Number(array('name' => 'height', 'label' => __('Height', 'Ip-admin', false)));
     $form->addField($field);
     $field = new \Ip\Form\Field\Select(array('name' => 'ratio', 'label' => __('Aspect ratio', 'Ip-admin', false)));
     $values = array(array('16:9', __('16:9', 'Ip-admin', false)), array('4:3', __('4:3', 'Ip-admin', false)));
     $field->setValues($values);
     $form->addField($field);
     return $form;
     // Output a string with generated HTML form
 }
Пример #21
0
 public function adminHtmlSnippet()
 {
     $form = new \Ip\Form();
     $yesNo = array(array(0, __('No', 'AsdBlog')), array(1, __('Yes', 'AsdBlog')));
     $default[] = array(0, __('Current page subpages', 'AsdBlog'));
     $results = array_merge($default, Model::getPagesList());
     $form->addField(new \Ip\Form\Field\Hidden(array('name' => 'data[blog][pageId]', 'value' => ipContent()->getCurrentPage()->getId())));
     $form->addField(new \Ip\Form\Field\Select(array('name' => 'data[blog][place]', 'label' => __('Blog posts source', 'AsdBlog'), 'values' => $results)));
     $form->addField(new \Ip\Form\Field\Select(array('name' => 'data[blog][parent]', 'label' => __('Make parent page act like post category', 'AsdBlog'), 'values' => $yesNo, 'note' => __('One level depth only', 'AsdBlog'))));
     $form->addFieldset(new \Ip\Form\Fieldset(__('Pagination', 'AsdBlog')));
     $paginationTypes = array(array(3, __('Show pagination', 'AsdBlog')), array(1, __('Show page numbers only', 'AsdBlog')), array(2, __('Show Prev/Next links only', 'AsdBlog')), array(0, __('Do not show pagination', 'AsdBlog')));
     $form->addField(new \Ip\Form\Field\Select(array('name' => 'data[blog][pagination][type]', 'label' => __('Type', 'AsdBlog'), 'values' => $paginationTypes)));
     $form->addField(new \Ip\Form\Field\Text(array('name' => 'data[blog][pagination][limit]', 'label' => __('Post limit per page', 'AsdBlog'), 'value' => ipGetOption('AsdBlog.postLimit'))));
     $form->addFieldset(new \Ip\Form\Fieldset(__('Options', 'AsdBlog')));
     $orderTypes = array(array(0, __('By date DESC', 'AsdBlog')), array(1, __('By date ASC', 'AsdBlog')), array(2, __('By page position DESC', 'AsdBlog')), array(3, __('By page position ASC', 'AsdBlog')));
     $form->addField(new \Ip\Form\Field\Select(array('name' => 'data[blog][options][order]', 'label' => __('Order by', 'AsdBlog'), 'values' => $orderTypes)));
     $form->addField(new \Ip\Form\Field\Text(array('name' => 'data[blog][options][introlimit]', 'label' => __('Intro limit (if seperator is not placed)', 'AsdBlog'), 'value' => ipGetOption('AsdBlog.introLimit'))));
     $form->addField(new \Ip\Form\Field\Text(array('name' => 'data[blog][options][allowedtags]', 'label' => __('Allowed tags', 'AsdBlog'), 'note' => 'All other will be stripped', 'value' => ipGetOption('AsdBlog.allowedTags'))));
     $form->addField(new \Ip\Form\Field\Select(array('name' => 'data[blog][options][readmore]', 'label' => __('Show read more link?', 'AsdBlog'), 'values' => $yesNo, 'value' => ipGetOption('AsdBlog.showReadMore') == 'Yes' ? 1 : 0)));
     $form->addField(new \Ip\Form\Field\Select(array('name' => 'data[blog][options][titlelink]', 'label' => __('Show title as link to post?', 'AsdBlog'), 'values' => $yesNo, 'value' => ipGetOption('AsdBlog.addTitlelink') == 'Yes' ? 1 : 0)));
     $form->addField(new \Ip\Form\Field\Text(array('name' => 'data[blog][options][blockname]', 'label' => __('Post block name', 'AsdBlog'), 'value' => ipGetOption('AsdBlog.blockName'))));
     $yesNoUpBot = array(array(0, __('No', 'AsdBlog')), array(1, __('Yes, top', 'AsdBlog')), array(2, __('Yes, bottom', 'AsdBlog')));
     $form->addFieldset(new \Ip\Form\Fieldset(__('Post aditional information', 'AsdBlog')));
     $form->addField(new \Ip\Form\Field\Select(array('name' => 'data[blog][info][date]', 'label' => __('Show post date', 'AsdBlog'), 'values' => $yesNoUpBot, 'value' => ipGetOption('AsdBlog.showDate') == 'Yes' ? 1 : 0)));
     //This functionality will be added later
     // $form->addField(new \Ip\Form\Field\Select(
     //     array(
     //         'name' => 'data[blog][info][time]',
     //         'label' => __( 'Show post time', 'AsdBlog' ),
     //         'values' => $yesNoUpBot,
     //         'value' => ipGetOption( 'AsdBlog.showTime' ) == 'Yes' ? 1 : 0
     //     )
     // ));
     //This functionality will be added later
     // $form->addField(new \Ip\Form\Field\Select(
     //     array(
     //         'name' => 'data[blog][info][author]',
     //         'label' => __( 'Show author name', 'AsdBlog' ),
     //         'values' => $yesNoUpBot,
     //     )
     // ));
     $form->addField(new \Ip\Form\Field\Select(array('name' => 'data[blog][info][category]', 'label' => __('Show category name', 'AsdBlog'), 'values' => $yesNoUpBot)));
     $form->addFieldset(new \Ip\Form\Fieldset(__('Image options', 'AsdBlog')));
     $form->addField(new \Ip\Form\Field\Select(array('name' => 'data[blog][image][enable]', 'label' => __('Enable image', 'AsdBlog'), 'values' => $yesNo, 'note' => __('First image of post will be displayed', 'AsdBlog'))));
     $form->addField(new \Ip\Form\Field\Text(array('name' => 'data[blog][image][width]', 'label' => __('Image width', 'AsdBlog'), 'value' => ipGetOption('AsdBlog.imageWidth'))));
     $form->addField(new \Ip\Form\Field\Text(array('name' => 'data[blog][image][height]', 'label' => __('Image height', 'AsdBlog'), 'value' => ipGetOption('AsdBlog.imageHeight'))));
     return ipView('snippet/edit.php', array('form' => $form))->render();
 }
Пример #22
0
 public function moveForm()
 {
     $form = new \Ip\Form();
     $field = new \Ip\Form\Field\Integer(array('name' => 'position', 'value' => ''));
     $form->addField($field);
     $field = new \Ip\Form\Field\Hidden(array('name' => 'id', 'value' => ''));
     $form->addField($field);
     return $form;
 }
Пример #23
0
 /**
  *
  *
  * @param int $widgetId
  * @param array $data
  * @return \Ip\Form
  */
 protected function createForm($widgetId, $data)
 {
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_PUBLIC);
     if (empty($data['fields']) || !is_array($data['fields'])) {
         $data['fields'] = array();
     }
     foreach ($data['fields'] as $fieldKey => $field) {
         if (!isset($field['type']) || !isset($field['label'])) {
             continue;
         }
         if ($field['type'] == 'Fieldset') {
             $label = empty($field['label']) ? '' : $field['label'];
             $form->addFieldset(new \Ip\Form\Fieldset($label));
             continue;
         }
         if (!isset($field['options'])) {
             $field['options'] = array();
         }
         if (!isset($field['options']) || !is_array($field['options'])) {
             $field['options'] = array();
         }
         if (!isset($field['required'])) {
             $field['required'] = false;
         }
         $fieldType = Model::getFieldType($field['type']);
         if ($fieldType) {
             $fieldData = array('label' => $field['label'], 'name' => 'ipForm_field_' . $fieldKey, 'required' => $field['required'], 'options' => $field['options']);
             try {
                 $newField = $fieldType->createField($fieldData);
                 $form->addField($newField);
             } catch (\Ip\Exception\Content $e) {
                 ipLog()->error('FormWidget.failedAddField: Widget failed to add field.', array('widget' => 'Form', 'exception' => $e, 'fieldData' => $fieldData));
             }
         }
     }
     //special variable to post to widget controller
     $field = new \Ip\Form\Field\Hidden(array('name' => 'sa', 'value' => 'Content.widgetPost'));
     $form->addField($field);
     $field = new \Ip\Form\Field\Hidden(array('name' => 'widgetId', 'value' => $widgetId));
     $form->addField($field);
     //antispam
     $field = new \Ip\Form\Field\Antispam(array('name' => 'checkField'));
     $form->addField($field);
     //submit
     if (!empty($data['buttonText'])) {
         $value = $data['buttonText'];
     } else {
         $value = __('Send', 'Ip', false);
     }
     $field = new \Ip\Form\Field\Submit(array('value' => $value));
     $form->addField($field);
     return $form;
 }
Пример #24
0
 public static function createForm()
 {
     $userId = Null;
     $userName = '';
     $userMail = '';
     $vCode = md5(uniqid(rand(), true));
     $pageId = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $pageId = 'http://' . parse_url($pageId, PHP_URL_HOST) . parse_url($pageId, PHP_URL_PATH);
     if (ipUser()->isLoggedIn()) {
         $userData = ipUser()->data();
         $userId = $userData['id'];
         $userName = $userData['username'];
         $userMail = $userData['email'];
     }
     $form = new \Ip\Form();
     $form->addClass('commentForm');
     $field = new \Ip\Form\Field\Text(array('name' => 'name', 'label' => __('Name', 'Comments'), 'validators' => array('Required'), 'value' => $userName));
     $form->addField($field);
     $field = new \Ip\Form\Field\Email(array('name' => 'email', 'label' => __('Email', 'Comments'), 'validators' => array('Required'), 'value' => $userMail));
     $form->addField($field);
     $field = new \Ip\Form\Field\Text(array('name' => 'link', 'label' => __('Website', 'Comments')));
     $form->addField($field);
     $field = new \Ip\Form\Field\Textarea(array('name' => 'text', 'label' => __('Comment', 'Comments'), 'validators' => array('Required')));
     $fileValLimits = new ValidateLimits();
     $field->addValidator($fileValLimits);
     $form->addField($field);
     $field = new \Ip\Form\Field\Hidden(array('name' => 'id', 'value' => $userId));
     $form->addField($field);
     $field = new \Ip\Form\Field\Hidden(array('name' => 'ip', 'value' => $_SERVER['REMOTE_ADDR']));
     $form->addField($field);
     if (ipGetOption('Comments.requireEmailConfirmation') == 'Yes') {
         $aprFree = 0;
     } else {
         $aprFree = 1;
     }
     $field = new \Ip\Form\Field\Hidden(array('name' => 'approved', 'value' => !empty($userId) ? '1' : $aprFree));
     $form->addField($field);
     $field = new \Ip\Form\Field\Hidden(array('name' => 'verification_code', 'value' => $vCode));
     $form->addField($field);
     $field = new \Ip\Form\Field\Hidden(array('name' => 'session_id', 'value' => session_id()));
     $form->addField($field);
     $field = new \Ip\Form\Field\Hidden(array('name' => 'zone_name', 'value' => $pageId));
     $form->addField($field);
     $field = new \Ip\Form\Field\Hidden(array('name' => 'language_id', 'value' => ipContent()->getCurrentLanguage()->getId()));
     $form->addField($field);
     $field = new \Ip\Form\Field\Hidden(array('name' => 'wgetId', 'value' => isset($_COOKIE['widGetId']) ? $_COOKIE['widGetId'] : ''));
     $form->addField($field);
     //FIXED NOW 05/26/15
     if (ipGetOption('Comments.requireAdminPermission') == 'Yes') {
         $aFree = 0;
     } else {
         $aFree = 1;
     }
     $field = new \Ip\Form\Field\Hidden(array('name' => 'active', 'value' => $aFree));
     $form->addField($field);
     $field = new \Ip\Form\Field\Hidden(array('name' => 'sa', 'value' => 'Comments.save'));
     $form->addField($field);
     $field = new \Ip\Form\Field\Submit(array('value' => __('Send', 'Comments')));
     $field->addAttribute('onsubmit', 'parent.scrollTo(0, 0); return true');
     $form->addField($field);
     //$form->addField(new \Ip\Form\Field\Submit(array('value' => __('Send', 'Comments'))));
     return $form;
 }
Пример #25
0
 protected function settingsForm()
 {
     $form = new \Ip\Form();
     $field = new \Ip\Form\Field\Text(array('name' => 'title', 'label' => __('Title', 'Ip-admin', false)));
     $form->addField($field);
     $field = new \Ip\Form\Field\Textarea(array('name' => 'description', 'label' => __('Description', 'Ip-admin', false)));
     $form->addField($field);
     return $form;
     // Output a string with generated HTML form
 }
Пример #26
0
 public static function addMenuForm()
 {
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
     $field = new \Ip\Form\Field\Text(array('name' => 'title', 'label' => __('Title', 'Ip-admin', false)));
     $form->addField($field);
     $values = array(array('tree', __('Tree (for menu)', 'Ip-admin', false)), array('list', __('List (for blogs)', 'Ip-admin', false)));
     $field = new \Ip\Form\Field\Select(array('name' => 'type', 'label' => __('Type', 'Ip-admin', false), 'values' => $values));
     $form->addField($field);
     return $form;
 }