コード例 #1
0
ファイル: textarea.php プロジェクト: sedici/wpmu-istec
 public function render($output = '')
 {
     $type = $this->_args['renderer']['type'];
     $date = $append = false;
     // Set attributes
     $input_args = array();
     // Set textarea rows
     if (!empty($this->_args['renderer']['rows'])) {
         $input_args['rows'] = $this->_args['renderer']['rows'];
     }
     // Set textarea disabled
     if (!empty($this->_args['renderer']['disabled'])) {
         $input_args['disabled'] = $this->_args['renderer']['disabled'];
     }
     // Set textarea readonly
     if (!empty($this->_args['renderer']['readonly'])) {
         $input_args['readonly'] = $this->_args['renderer']['readonly'];
     }
     $args = array('id' => $this->_args['id'], 'label' => $this->_args['renderer']['label'], 'input_args' => $input_args, 'value' => $this->_args['value']);
     if (true === $append) {
         $args['append'] = $this->_args['renderer']['append'];
     }
     if (isset($this->_args['renderer']['help'])) {
         $args['help'] = $this->_args['renderer']['help'];
     }
     $loader = $this->_registry->get('theme.loader');
     $file = $loader->get_file('setting/textarea.twig', $args, true);
     return parent::render($file->get_content());
 }
コード例 #2
0
ファイル: cache.php プロジェクト: sedici/wpmu-istec
 public function render($output = '')
 {
     $args = $this->get_twig_cache_args();
     $loader = $this->_registry->get('theme.loader');
     $file = $loader->get_file('setting/twig_cache.twig', $args, true);
     return parent::render($file->get_content());
 }
コード例 #3
0
 public function render($output = '')
 {
     $label = $this->_args['renderer']['label'];
     $content = $this->_args['renderer']['content'];
     $loader = $this->_registry->get('theme.loader');
     $file = $loader->get_file('setting/custom.twig', array('label' => $label, 'content' => $content), true);
     return parent::render($file->get_content());
 }
コード例 #4
0
 public function render($output = '')
 {
     $system = $this->_registry->get('date.system');
     $type = $this->_args['renderer']['type'];
     $date = $append = false;
     $class = '';
     $input_type = 'text';
     switch ($type) {
         case 'date':
             $date = true;
             break;
         case 'append':
             $append = true;
             break;
         case 'email':
             $input_type = 'email';
             break;
         case 'url':
             $input_type = 'url';
             break;
         case 'number':
             $input_type = 'number';
             break;
         case 'checkbox':
             $input_type = 'checkbox';
             break;
     }
     $input_args = array('class' => $class);
     $settings = $this->_registry->get('model.settings');
     if (true === $date) {
         $input_args += array('data-date-weekstart' => $settings->get('week_start_day'), 'data-date-format' => $system->get_date_pattern_by_key($settings->get('input_date_format')), 'size' => 12);
     }
     $args = array('id' => $this->_args['id'], 'label' => $this->_args['renderer']['label'], 'input_args' => $input_args, 'input_type' => $input_type, 'value' => $this->_args['value']);
     if (isset($this->_args['renderer']['status'])) {
         $args['licence_valid'] = $settings->get($this->_args['renderer']['status']) === 'valid' ? true : false;
     }
     if (true === $append) {
         $args['append'] = $this->_args['renderer']['append'];
     }
     if (isset($this->_args['renderer']['help'])) {
         $args['help'] = $this->_args['renderer']['help'];
     }
     if (isset($this->_args['renderer']['group-class'])) {
         $args['group_class'] = $this->_args['renderer']['group-class'];
     }
     if (isset($this->_args['checked']) && true === $this->_args['checked']) {
         $args['input_args']['checked'] = $this->_args['checked'];
     }
     $loader = $this->_registry->get('theme.loader');
     $file = $loader->get_file('setting/input.twig', $args, true);
     if (isset($this->_args['type']) && 'hidden' === $this->_args['type']) {
         $hidden = true;
     } else {
         $hidden = false;
     }
     return parent::render($file->get_content(), true, $hidden);
 }
コード例 #5
0
ファイル: html.php プロジェクト: newmight2015/psmpsm
 public function render($output = '')
 {
     $file = $this->_args['id'] . '.twig';
     $method = 'get_' . $this->_args['id'] . '_args';
     $args = array();
     if (method_exists($this, $method)) {
         $args = $this->{$method}();
     }
     $loader = $this->_registry->get('theme.loader');
     $file = $loader->get_file('setting/' . $file, $args, true);
     return parent::render($file->get_content());
 }
コード例 #6
0
ファイル: checkbox.php プロジェクト: sedici/wpmu-istec
 public function render($output = '')
 {
     $attributes = array('class' => 'checkbox');
     if (true === $this->_args['value']) {
         $attributes['checked'] = 'checked';
     }
     $args = $this->_args;
     $args['attributes'] = $attributes;
     $loader = $this->_registry->get('theme.loader');
     $file = $loader->get_file('setting/checkbox.twig', $args, true);
     return parent::render($file->get_content());
 }
 public function render($output = '')
 {
     if (isset($this->_args['renderer']['condition'])) {
         $callback = explode(':', $this->_args['renderer']['condition']);
         $render = $this->_registry->dispatch($callback[0], $callback[1]);
         if (!$render) {
             return '';
         }
     }
     $options = $this->_args['renderer']['options'];
     if (!is_array($options)) {
         $callback = explode(':', $options);
         if (!isset($callback[1])) {
             $options = $this->{$options}();
         } else {
             $value = $this->_args['value'];
             if (false === is_array($this->_args['value'])) {
                 $value = array($this->_args['value']);
             }
             $options = $this->_registry->dispatch($callback[0], $callback[1]);
         }
     }
     foreach ($options as $key => &$option) {
         // if the key is a string, it's an optgroup
         if (is_string($key)) {
             foreach ($option as &$opt) {
                 $opt = $this->_set_selected_value($opt);
             }
         } else {
             $option = $this->_set_selected_value($option);
         }
     }
     $select_args = array();
     $args = array('id' => $this->_args['id'], 'label' => $this->_args['renderer']['label'], 'attributes' => $select_args, 'options' => $options);
     $loader = $this->_registry->get('theme.loader');
     $file = $loader->get_file('setting/select.twig', $args, true);
     return parent::render($file->get_content());
 }
コード例 #8
0
 /**
  * Generate HTML snippet for inclusion in settings page.
  *
  * @param string $snippet Particle to append to result.
  *
  * @return string HTML snippet for page selection.
  */
 public function render($snippet = '')
 {
     $output = '<label class="ai1ec-control-label ai1ec-col-sm-5" for="' . self::ELEMENT_ID . '">' . Ai1ec_I18n::__('Calendar page') . '</label>' . '<div class="ai1ec-col-sm-7">' . $this->_get_pages_selector() . $this->_get_page_view_link() . '</div>';
     return parent::render($output);
 }
コード例 #9
0
ファイル: select.php プロジェクト: sedici/wpmu-istec
 /**
  * Renders fieldset with options for selected item.
  *
  * @param array  $settings  Settings structure.
  * @param string $parent_id Option value from parent Html select element.
  * @param string $select_id Html Select element id.
  * @param bool   $visible   Whether fieldset is visible or not.
  *
  * @return string Html content.
  *
  * @throws Ai1ec_Bootstrap_Exception
  */
 protected function _render_fieldset(array $settings, $parent_id, $select_id, $visible = false)
 {
     $setting_renderer = $this->_registry->get('html.element.setting-renderer');
     $global_settings = $this->_registry->get('model.settings');
     $content = '';
     foreach ($settings as $id => $setting) {
         $setting['id'] = $id;
         // fetch value from real setting as this one is some kind of
         // mockup.
         $setting['value'] = $global_settings->get($id);
         $content .= $setting_renderer->render($setting);
     }
     $args = array('parent_id' => $parent_id, 'contents' => $content, 'select_id' => $select_id, 'visible' => $visible);
     $loader = $this->_registry->get('theme.loader');
     $file = $loader->get_file('setting/select-fieldsets.twig', $args, true);
     return parent::render($file->get_content(), false);
 }