Пример #1
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;
 }
Пример #2
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;
 }
Пример #3
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();
 }
Пример #4
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;
 }
Пример #5
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;
 }
Пример #6
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
 }
Пример #7
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();
 }
Пример #8
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;
 }
Пример #9
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;
 }
Пример #10
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
 }
Пример #11
0
 public static function getPasswordResetForm1()
 {
     //create form object
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
     //add text field to form object
     $field = new \Ip\Form\Field\Hidden(array('name' => 'sa', 'value' => 'Admin.passwordResetAjax'));
     $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\Text(array('name' => 'username', 'label' => __('Username or email', 'Ip-admin', false)));
     $field->addValidator('Required');
     $form->addField($field);
     //add text field to form object
     $field = new \Ip\Form\Field\Submit(array('value' => __('Reset', 'Ip-admin', false)));
     $field->addClass('ipsLoginButton');
     $form->addField($field);
     return $form;
 }
Пример #12
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;
 }
Пример #13
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;
 }
Пример #14
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;
 }
Пример #15
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;
 }
Пример #16
0
 protected function linkForm()
 {
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
     $field = new \Ip\Form\Field\Select(array('name' => 'type', 'label' => __('Mouse click action', 'Ip-admin', false)));
     $values = array(array('lightbox', __('Lightbox', 'Ip-admin', false)), array('link', __('URL', 'Ip-admin', false)), array('none', __('None', 'Ip-admin', false)));
     $field->setValues($values);
     $form->addfield($field);
     $field = new \Ip\Form\Field\Url(array('name' => 'url', 'label' => __('Url', '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);
     $field = new \Ip\Form\Field\Checkbox(array('name' => 'nofollow', 'label' => __('Set rel="nofollow" attribute', 'Ip-admin', false)));
     $form->addField($field);
     return $form;
     // Output a string with generated HTML form
 }
Пример #17
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
 }
Пример #18
0
 protected function settingsForm()
 {
     $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);
     $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
 }