/** * Element render * @param $identifier * @param bool $value * @param array $params * @return bool */ public function elementRender($identifier, $value = null, $params = array()) { //get configs $showCount = (int) $params['moduleParams']->get('count', 1); $isDepend = (int) $params['moduleParams']->get('depend', 1); $isDependCat = (int) $params['moduleParams']->get('depend_category', 0); $elements = $isDepend ? $this->app->jbrequest->getElements() : array(); if ($isDependCat) { $categoryId = $this->app->jbrequest->getSystem('category'); if ($categoryId > 0 && !isset($elements['_itemcategory'])) { $elements['_itemcategory'] = $categoryId; } } $propsValues = JBModelValues::model()->getPropsValues($identifier, $params['moduleParams']->get('type'), $params['moduleParams']->get('application'), $elements); $jbrouter = $this->app->jbrouter; if (!empty($propsValues)) { $html = array(); foreach ($propsValues as $propsValue) { $class = ''; if ($this->_isActive($identifier, $propsValue['value'])) { $link = $jbrouter->filter($identifier, $propsValue['value'], $params['moduleParams'], 2); $class = ' class="active"'; } else { $link = $jbrouter->filter($identifier, $propsValue['value'], $params['moduleParams'], $isDepend ? 1 : 0); } // render html list item $html[] = '<li' . $class . '><a href="' . $link . '" title="' . $this->_escape($propsValue['value']) . '" rel="nofollow"><span>' . $this->_escape($propsValue['value']) . ' ' . ($showCount ? '<span class="element-count">(' . $propsValue['count'] . ')</span>' : '') . '</span></a>' . ($class ? '<a rel="nofollow" href="' . $link . '" class="cancel"> </a>' : '') . '</li>'; } return '<!--noindex--><ul class="jbzoo-props-list">' . implode(PHP_EOL, $html) . '</ul><!--/noindex-->'; } return ''; }
/** * Get data from db index table by element identifier * @return array */ protected function _getDbValues() { $isCatDepend = (int) $this->_params->moduleParams->get('depend_category'); $categoryId = null; if ($isCatDepend) { $categoryId = $this->app->jbrequest->getSystem('category'); } return JBModelValues::model()->getParamsValues($this->_jbprice->identifier, $this->_identifier, $this->_params->get('item_type', null), $this->_params->get('item_application_id', null), $categoryId, -1); }
/** * Render HTML * @return string */ public function html() { $value = isset($this->_value['range']) ? $this->_value['range'] : null; $params = array('auto' => (int) $this->_params->get('jbzoo_filter_slider_auto', 0), 'min' => $this->_params->get('jbzoo_filter_slider_min', 0), 'max' => $this->_params->get('jbzoo_filter_slider_max', 10000), 'step' => $this->_params->get('jbzoo_filter_slider_step', 100)); if ($params['auto']) { $applicationId = (int) $this->_params->get('item_application_id', 0); $itemType = $this->_params->get('item_type', null); $ranges = (array) JBModelValues::model()->getRangeByPrice($this->_jbprice->identifier, $itemType, $applicationId); $params = array_merge($params, $ranges); } return $this->_html->slider($params, $value, $this->_getName(), $this->_getId(null, true)); }
/** * @return array */ protected function _getSliderParams() { $categoryId = $min = $max = null; $to = $this->_getCurrency(); $params = array('auto' => (int) $this->_params->get('jbzoo_filter_slider_auto', 0), 'min' => $this->_params->get('jbzoo_filter_slider_min', 0), 'max' => $this->_params->get('jbzoo_filter_slider_max', 10000), 'step' => $this->_params->get('jbzoo_filter_slider_step', 100)); if ($params['auto']) { $applicationId = (int) $this->_params->get('item_application_id', 0); $isCatDepend = (int) $this->_params->moduleParams->get('depend_category'); $itemType = $this->_params->get('item_type', null); if ($isCatDepend) { $categoryId = $this->app->jbrequest->getSystem('category'); } $rangesData = (array) JBModelValues::model()->getRangeByPrice($this->_jbprice->identifier, $itemType, $applicationId, $categoryId); $cur = JBModelConfig::model()->getCurrency(); $params['min'] = JBCart::val($rangesData['total_min'], $cur)->val($to); $params['max'] = JBCart::val($rangesData['total_max'], $cur)->val($to); } return $params; }
/** * Render HTML * @return string */ public function html() { $html = array(); $value = $this->_prepareValues(); $categoryId = $min = $max = null; $params = array('auto' => (int) $this->_params->get('jbzoo_filter_slider_auto', 0), 'min' => $this->_params->get('jbzoo_filter_slider_min', 0), 'max' => $this->_params->get('jbzoo_filter_slider_max', 10000), 'step' => $this->_params->get('jbzoo_filter_slider_step', 100)); $to = $this->_params->get('jbzoo_filter_currency_default', 'default_cur'); if ($params['auto']) { $applicationId = (int) $this->_params->get('item_application_id', 0); $isCatDepend = (int) $this->_params->moduleParams->get('depend_category'); $itemType = $this->_params->get('item_type', null); if ($isCatDepend) { $categoryId = $this->app->jbrequest->getSystem('category'); } $rangesData = (array) JBModelValues::model()->getRangeByPrice($this->_jbprice->identifier, $itemType, $applicationId, $categoryId); $cur = JBModelConfig::model()->getCurrency(); $params['min'] = JBCart::val($rangesData['total_min'] ? $rangesData['total_min'] . $cur : $params['min'])->val($to); $params['max'] = JBCart::val($rangesData['total_max'] ? $rangesData['total_max'] . $cur : $params['max'])->val($to); } $html[] = $this->_html->sliderInput($params, $value['range'], $this->_getName('range'), $this->app->jbstring->getId('jsSlider-'), $to); $html[] = $this->renderCurrency(); return implode(PHP_EOL, $html); }
/** * Get tags values * @param null $type * @return array */ protected function _getValues($type = null) { $applicationId = (int) $this->_params->get('item_application_id', 0); $itemType = $this->_params->get('item_type', null); return JBModelValues::model()->getTagValues($applicationId, $itemType); }
/** * Get DB values * @param null $type * @return array */ protected function _getValues($type = null) { $applicationId = (int) $this->_params->get('item_application_id', 0); return JBModelValues::model()->getNameValues($applicationId); }
/** * Get data from db index table by element identifier * @return array */ protected function _getDbValues() { $elements = array(); $isCatDepend = (int) $this->_params->moduleParams->get('depend_category'); if ($isCatDepend) { $categoryId = $this->app->jbrequest->getSystem('category'); if ($categoryId > 0) { $elements['_itemcategory'] = $categoryId; } } return JBModelValues::model()->getPropsValues($this->_identifier, $this->_params->get('item_type', null), $this->_params->get('item_application_id', null), $elements); }