Exemplo n.º 1
0
 public function searchField($searchVariables)
 {
     $values = array(array(null, ''), array('1', __('Yes', 'Ip-admin', false)), array('0', __('No', 'Ip-admin', false)));
     $field = new \Ip\Form\Field\Select(array('label' => $this->label, 'name' => $this->field, 'values' => $values, 'value' => null, 'layout' => $this->layout, 'attributes' => $this->attributes));
     if (isset($searchVariables[$this->field])) {
         $field->setValue($searchVariables[$this->field]);
     }
     return $field;
 }
Exemplo n.º 2
0
 public function searchField($searchVariables)
 {
     $values = array(array(null, 'Any'));
     $values = array_merge($values, $this->values);
     $field = new \Ip\Form\Field\Select(array('label' => $this->label, 'name' => $this->field, 'values' => $values, 'layout' => $this->layout, 'attributes' => $this->attributes));
     if (!empty($searchVariables[$this->field])) {
         $field->setValue($searchVariables[$this->field]);
     }
     return $field;
 }
Exemplo n.º 3
0
 public static function getLanguageSelectForm()
 {
     //create form object
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
     $form->addClass('ipsLanguageSelect');
     //add text field to form object
     $field = new \Ip\Form\Field\Select(array('name' => 'languageCode', 'values' => self::getAvailableLocales()));
     $field->setValue(ipConfig()->adminLocale());
     $form->addfield($field);
     return $form;
 }
Exemplo n.º 4
0
 protected function optionsForm()
 {
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
     $field = new \Ip\Form\Field\RichText(array('name' => 'success', 'label' => __('Thank you message', 'Ip-admin', false)));
     $form->addfield($field);
     $field = new \Ip\Form\Field\Select(array('name' => 'sendTo', 'label' => __('Recipient', 'Ip-admin', false)));
     $values = array(array('default', __('Website\'s email', 'Ip-admin', false) . ' (' . ipGetOptionLang('Config.websiteEmail') . ')'), array('custom', __('Custom emails separated by space', 'Ip-admin', false)));
     $field->setValues($values);
     $form->addfield($field);
     $field = new \Ip\Form\Field\Text(array('name' => 'emails', 'label' => __('Custom emails separated by space', 'Ip-admin', false)));
     $form->addField($field);
     $field = new \Ip\Form\Field\Text(array('name' => 'buttonText', 'label' => __('Submit button text (leave empty for default)', 'Ip-admin', false)));
     $form->addField($field);
     return $form;
     // Output a string with generated HTML form
 }
Exemplo n.º 5
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;
 }
Exemplo n.º 6
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;
 }
Exemplo n.º 7
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
 }
Exemplo n.º 8
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
 }