예제 #1
0
 /**
  * Render position
  * @param string $position
  * @param array  $args
  * @return string
  */
 public function renderPosition($position, $args = array())
 {
     // init vars
     $output = array();
     $i = 0;
     $this->app->jbdebug->mark('filter::position-' . $position . '::start');
     // TODO check file exists
     $style = isset($args['style']) && $args['style'] ? $args['style'] : 'filter.block';
     $elementsConfig = $this->_getConfigPosition($position);
     foreach ($elementsConfig as $data) {
         $element = $this->app->jbfilter->getElement($data['element']);
         if ($element && $element->canAccess()) {
             $i++;
             $params = array_merge(array('first' => $i == 1, 'last' => $i == count($elementsConfig) - 1, 'item_type' => $this->_type, 'item_template' => $this->_template, 'item_application_id' => $this->_application->id, 'moduleParams' => $this->_moduleParams), $data, $args);
             $attrs = array('id' => 'jbfilter-id-' . trim($element->identifier, '_'), 'class' => array('jbfilter-element-' . strtolower($element->getElementType()), 'jbfilter-element-tmpl-' . trim($params['jbzoo_filter_render'], '_')));
             $value = $this->_getRequest($element->identifier);
             $elementHTML = $this->app->jbfilter->elementRender($element->identifier, $value, $params, $attrs);
             $elementHTML = JString::trim($elementHTML);
             if (empty($elementHTML)) {
                 continue;
             }
             if ($style) {
                 $output[$i] = parent::render($style, array('element' => $element, 'params' => $params, 'attrs' => $attrs, 'value' => $value, 'config' => $element->getConfig(), 'elementHTML' => $elementHTML));
             } else {
                 $output[$i] = $elementHTML;
             }
         }
     }
     $this->app->jbdebug->mark('filter::position-' . $position . '::end');
     return implode(PHP_EOL, $output);
 }
예제 #2
0
 /**
  * Render position
  * @param string $position
  * @param array  $args
  * @return string
  */
 public function renderPosition($position, $args = array())
 {
     // init vars
     $output = array();
     $i = 0;
     // TODO check file exists
     $style = isset($args['style']) && $args['style'] ? $args['style'] : 'filter.block';
     $elementsConfig = $this->_getConfigPosition($position);
     foreach ($elementsConfig as $data) {
         $element = $this->app->jbfilter->getElement($data['element']);
         if ($element && $element->canAccess()) {
             $i++;
             $params = array_merge(array('first' => $i == 1, 'last' => $i == count($elementsConfig) - 1, 'item_type' => $this->_type, 'item_template' => $this->_template, 'item_application_id' => $this->_application->id, 'moduleParams' => $this->_moduleParams), $data, $args);
             $value = $this->getElementRequest($element->identifier);
             $elementHTML = $this->app->jbfilterprops->elementRender($element->identifier, $value, $params);
             if (empty($elementHTML)) {
                 continue;
             }
             if ($style) {
                 $output[$i] = parent::render($style, array('element' => $element, 'params' => $params, 'value' => $value, 'config' => $element->getConfig(), 'elementHTML' => $elementHTML));
             } else {
                 $output[$i] = $elementHTML;
             }
         }
     }
     return implode(PHP_EOL, $output);
 }