public function appendSettingsInterface(XMLElement $wrapper, $field_name, StdClass $settings = null, MessageStack $errors)
 {
     // Select available drivers:
     $driv_wrap = new XMLElement('div');
     $driv_wrap->addClass('oembed-drivers');
     $driv_title = new XMLElement('label');
     $driv_title->setValue(__('Supported services <i>Select to enable the service in the publish page</i>'));
     $driv_title->appendChild(FieldOembed::generateDriversSelectOptions($settings, "{$field_name}[drivers][]"));
     if (isset($errors->{'drivers'})) {
         $driv_title = Widget::wrapFormElementWithError($driv_title, $errors->{'drivers'});
     }
     $driv_wrap->appendChild($driv_title);
     // Fixes issue #11 (Got a better description?)
     $par_wrap = new XMLElement('div');
     $par_wrap->addClass('oembed-params-settings');
     $par_title = new XMLElement('label');
     $par_title->setValue(__('Request URL Parameters (Appended to the query string) <i>Optional</i>'));
     $par_title->appendChild(Widget::Input("{$field_name}[parameters]", $settings->{'parameters'}));
     $par_wrap->appendChild($par_title);
     $wrapper->appendChild($driv_wrap);
     $wrapper->appendChild($par_wrap);
 }
 public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null)
 {
     if (class_exists('Administration') && Administration::instance()->Page) {
         Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/geocodingfield/assets/geocodingfield.publish.css', 'screen', 246);
     }
     $elementName = $this->get('element_name');
     if ($this->get('hide') != 'yes') {
         $frame = new XMLElement('div', null, array('class' => 'inline frame'));
         $map = new XMLElement('img', null, array('alt' => '', 'src' => sprintf('http://maps.google.com/maps/api/staticmap?zoom=7&size=180x100&sensor=false&markers=color:red|size:small|%s', implode(',', array($data['latitude'], $data['longitude'])))));
         $div = new XMLElement('div');
         $latitude = Widget::Label(__('Latitude'));
         $latitude->appendChild(Widget::Input("fields{$fieldnamePrefix}[{$elementName}][latitude]{$fieldnamePostfix}", $data['latitude'], 'text', array('disabled' => 'disabled')));
         $longitude = Widget::Label(__('Longitude'));
         $longitude->appendChild(Widget::Input("fields{$fieldnamePrefix}[{$elementName}][longitude]{$fieldnamePostfix}", $data['longitude'], 'text', array('disabled' => 'disabled')));
         $div->appendChild($latitude);
         $div->appendChild($longitude);
         $frame->appendChild($map);
         $frame->appendChild($div);
         $wrapper->appendChild(new XMLElement('label', $this->get('label'), array('class' => 'label')));
         $wrapper->appendChild($frame);
     } else {
         $wrapper->addClass('irrelevant');
     }
 }
 public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null)
 {
     $sortorder = $this->get('sortorder');
     $element_name = $this->get('element_name');
     $allow_override = null;
     if ($this->get('override') != 'yes') {
         $allow_override = array('disabled' => 'disabled');
     }
     if ($this->get('hide') != 'yes') {
         $value = isset($data['value_formatted']) ? $data['value_formatted'] : null;
         $label = Widget::Label($this->get('label'));
         $label->appendChild(Widget::Input("fields{$fieldnamePrefix}[{$element_name}]{$fieldnamePostfix}", $value, 'text', $allow_override));
         $wrapper->appendChild($label);
     } else {
         $wrapper->addClass('irrelevant');
     }
 }
 /**
  * Generates a XMLElement representation of a Symphony drawer widget.
  * A widget is identified by it's `$label`, and it's contents is defined
  * by the `XMLElement`, `$content`.
  *
  * @since Symphony 2.3
  * @param string $id
  *  The id attribute for this drawer
  * @param string $label
  *  A name for this drawer
  * @param XMLElement $content
  *  An XMLElement containing the HTML that should be contained inside
  *  the drawer.
  * @param string $default_state
  *  This parameter defines whether the drawer will be open or closed by
  *  default. It defaults to closed.
  * @param array $attributes (optional)
  *  Any additional attributes can be included in an associative array with
  *  the key being the name and the value being the value of the attribute.
  *  Attributes set from this array will override existing attributes
  *  set by previous params, except the `id` attribute.
  * @return XMLElement
  */
 public function Drawer($id = '', $label = '', XMLElement $content = null, $default_state = 'closed', $context = '', array $attributes = array())
 {
     $id = General::createHandle($id);
     $contents = new XMLElement('div', $content, array('class' => 'contents'));
     $contents->setElementStyle('html');
     $drawer = new XMLElement('div', $contents, $attributes);
     $drawer->setAttribute('data-default-state', $default_state);
     $drawer->setAttribute('data-context', $context);
     $drawer->setAttribute('data-label', $label);
     $drawer->addClass('drawer');
     $drawer->setAttribute('id', 'drawer-' . $id);
     return $drawer;
 }
 /**
  * Allows a Drawer element to added to the backend page in one of three
  * positions, `horizontal`, `vertical-left` or `vertical-right`. The button
  * to trigger the visibility of the drawer will be added after existing
  * actions by default.
  *
  * @since Symphony 2.3
  * @see core.Widget#Drawer
  * @param XMLElement $drawer
  *  An XMLElement representing the drawer, use `Widget::Drawer` to construct
  * @param string $position
  *  Where `$position` can be `horizontal`, `vertical-left` or
  *  `vertical-right`. Defaults to `horizontal`.
  * @param string $button
  *  If not passed, a button to open/close the drawer will not be added
  *  to the interface. Accepts 'prepend' or 'append' values, which will
  *  add the button before or after existing buttons. Defaults to `prepend`.
  *  If any other value is passed, no button will be added.
  */
 public function insertDrawer(XMLElement $drawer, $position = 'horizontal', $button = 'append')
 {
     $drawer->addClass($position);
     $drawer->setAttribute('data-position', $position);
     $this->Drawer[$position][] = $drawer;
     if (in_array($button, array('prepend', 'append'))) {
         $this->insertAction(Widget::Anchor($drawer->getAttribute('data-label'), '#' . $drawer->getAttribute('id'), null, 'button drawer ' . $position), $button === 'append' ? true : false);
     }
 }
 function displayPublishPanel(XMLElement &$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL, $entry_id = NULL)
 {
     $value = $this->getOrderValue($data);
     $max_position = Symphony::Database()->fetchRow(0, "SELECT max(value) AS max FROM tbl_entries_data_{$this->get('id')}");
     $inputs = new XMLElement('div');
     $isHidden = $this->get('hide') == 'yes';
     $label = Widget::Label($isHidden ? '' : $this->get('label'));
     // If data is an array there must be filtered values
     if (is_array($data) && !empty($data)) {
         foreach ($data as $col => $row) {
             if (!is_array($row)) {
                 $row = array($row);
             }
             foreach ($row as $key => $value) {
                 $input = Widget::Input('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . '][' . $col . '][' . $key . ']' . $fieldnamePostfix, strlen($value) !== 0 || $col != 'value' ? (string) $value : (string) ++$max_position["max"], $isHidden || $col != 'value' ? 'hidden' : 'text');
                 $inputs->appendChild($input);
             }
         }
         if ($isHidden) {
             $wrapper->addClass('irrelevant');
         }
         $label->appendChild($inputs);
     } else {
         $input = Widget::Input('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, strlen($value) !== 0 ? (string) $value : (string) ++$max_position["max"], $this->get('hide') == 'yes' ? 'hidden' : 'text');
         if (!$isHidden) {
             if ($this->get('required') != 'yes') {
                 $label->appendChild(new XMLElement('i', __('Optional')));
             }
         } else {
             $wrapper->addClass('irrelevant');
         }
         $label->appendChild($input);
     }
     if ($flagWithError != null) {
         $wrapper->appendChild(Widget::Error($label, $flagWithError));
     } else {
         $wrapper->appendChild($label);
     }
 }