コード例 #1
0
ファイル: field.textbox.php プロジェクト: hotdoy/EDclock
 public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null)
 {
     Extension_TextBoxField::appendHeaders(Extension_TextBoxField::PUBLISH_HEADERS);
     $sortorder = $this->get('sortorder');
     $element_name = $this->get('element_name');
     $classes = array();
     $label = Widget::Label($this->get('label'));
     $optional = '';
     if ($this->get('required') != 'yes') {
         if ((int) $this->get('text_length') > 0) {
             $optional = __('$1 of $2 remaining') . ' – ' . __('Optional');
         } else {
             $optional = __('Optional');
         }
     } else {
         if ((int) $this->get('text_length') > 0) {
             $optional = __('$1 of $2 remaining');
         }
     }
     if ($optional) {
         $label->appendChild(new XMLElement('i', $optional));
     }
     // Input box:
     if ($this->get('text_size') == 'single') {
         $input = Widget::Input("fields{$fieldnamePrefix}[{$element_name}]{$fieldnamePostfix}", General::sanitize($data['value']));
         ###
         # Delegate: ModifyTextBoxInlineFieldPublishWidget
         # Description: Allows developers modify the textbox before it is rendered in the publish forms
         $delegate = 'ModifyTextBoxInlineFieldPublishWidget';
     } else {
         $input = Widget::Textarea("fields{$fieldnamePrefix}[{$element_name}]{$fieldnamePostfix}", 20, 50, General::sanitize($data['value']));
         ###
         # Delegate: ModifyTextBoxFullFieldPublishWidget
         # Description: Allows developers modify the textbox before it is rendered in the publish forms
         $delegate = 'ModifyTextBoxFullFieldPublishWidget';
     }
     // Add classes:
     $classes[] = 'size-' . $this->get('text_size');
     if ($this->get('text_formatter') != 'none') {
         $classes[] = $this->get('text_formatter');
     }
     $input->setAttribute('class', implode(' ', $classes));
     $input->setAttribute('length', (int) $this->get('text_length'));
     Symphony::ExtensionManager()->notifyMembers($delegate, '/backend/', array('field' => $this, 'label' => $label, 'input' => $input, 'textarea' => $input));
     if (is_null($label)) {
         return;
     }
     $label->appendChild($input);
     if ($flagWithError != null) {
         $label = Widget::Error($label, $flagWithError);
     }
     $wrapper->appendChild($label);
 }
コード例 #2
0
 public function displayDatasourceFilterPanel(XMLElement &$wrapper, $data = null, $errors = null, $fieldnamePrefix = null, $fieldnamePostfix = null)
 {
     Extension_TextBoxField::appendHeaders(Extension_TextBoxField::FILTER_HEADERS);
     $field_id = $this->get('id');
     parent::displayDatasourceFilterPanel($wrapper, $data, $errors, $fieldnamePrefix, $fieldnamePostfix);
     $wrapper->setAttribute('class', $wrapper->getAttribute('class') . ' field-textbox');
     $filters = array(array('name' => 'boolean', 'filter' => 'boolean:', 'help' => __('Find values that match the given query. Can use operators <code>and</code> and <code>not</code>.')), array('name' => 'not-boolean', 'filter' => 'not-boolean:', 'help' => __('Find values that do not match the given query. Can use operators <code>and</code> and <code>not</code>.')), array('name' => 'regexp', 'filter' => 'regexp:', 'help' => __('Find values that match the given <a href="%s">MySQL regular expressions</a>.', array('http://dev.mysql.com/doc/mysql/en/Regexp.html'))), array('name' => 'not-regexp', 'filter' => 'not-regexp:', 'help' => __('Find values that do not match the given <a href="%s">MySQL regular expressions</a>.', array('http://dev.mysql.com/doc/mysql/en/Regexp.html'))), array('name' => 'contains', 'filter' => 'contains:', 'help' => __('Find values that contain the given string.')), array('name' => 'not-contains', 'filter' => 'not-contains:', 'help' => __('Find values that do not contain the given string.')), array('name' => 'starts-with', 'filter' => 'starts-with:', 'help' => __('Find values that start with the given string.')), array('name' => 'not-starts-with', 'filter' => 'not-starts-with:', 'help' => __('Find values that do not start with the given string.')), array('name' => 'ends-with', 'filter' => 'ends-with:', 'help' => __('Find values that end with the given string.')), array('name' => 'not-ends-with', 'filter' => 'not-ends-with:', 'help' => __('Find values that do not end with the given string.')));
     $list = new XMLElement('ul');
     $list->setAttribute('class', 'filter-prefix-suggestions');
     foreach ($filters as $value) {
         $item = new XMLElement('li', $value['name']);
         $item->setAttribute('title', $value['filter']);
         $item->setAttribute('alt', General::sanitize($value['help']));
         $list->appendChild($item);
     }
     $help = new XMLElement('p');
     $help->setAttribute('class', 'help');
     $help->setValue(__('Find values that are an exact match for the given string.'));
     $wrapper->appendChild($list);
     $wrapper->appendChild($help);
 }