/** * Get the image resource informations as an array * * @param string $name The image parameter name * * @return array The image informations * * @since 2.0 */ public function getImage($name) { if ($image = $this->params->get($name)) { return $this->app->html->_('zoo.image', $image, $this->params->get($name . '_width'), $this->params->get($name . '_height')); } return null; }
/** * Get the list of types for the submission * * @return array The list of types * * @since 2.0 */ public function getTypes() { if (empty($this->_types)) { foreach (array_keys($this->params->get('form.', array())) as $type_id) { if ($type = $this->getApplication()->getType($type_id)) { $this->_types[$type_id] = $type; } } } return $this->_types; }
/** * Init placeholder * @param $attrs * @return mixed */ protected function _addPlaceholder($attrs) { $isAutocomplete = (int) $this->_params->get('jbzoo_filter_autocomplete', 0); $placeholder = JString::trim($this->_params->get('jbzoo_filter_placeholder')); if (!empty($placeholder)) { $attrs['placeholder'] = $placeholder; } if ($isAutocomplete) { $attrs['class'][] = 'jsAutocomplete'; $attrs['placeholder'] = $this->_getPlaceholder(); } return $attrs; }
/** * @param $data * @param $status * @return null */ public function setShippingData($data, $status = 'undefined') { $data = $this->app->data->create($data); $shippings = $this->params->get(JBCart::ELEMENT_TYPE_SHIPPING); if (empty($shippings)) { return null; } $config = current($shippings); /** @type JBCartElementShipping $element */ if ($element = $this->app->jbcartelement->create($config['type'], JBCart::ELEMENT_TYPE_SHIPPING, $config)) { $element->bindData($data); $element->setOrder($this); $element->setStatus($status); $element->identifier = $config['identifier']; $this->_elements[JBCart::ELEMENT_TYPE_SHIPPING][$element->identifier] = $this->_shipping = $element; } }
/** * Get path for item render * @param $item * @param $layout * @return string */ private function _getItemLayout($item, $layout) { if ($this->_params) { if (!isset($this->_params['template.layout_' . $layout])) { $layout = $this->_params->get('template.layout_' . $layout, $layout); } else { $layout = $this->_params->get('global.template.layout_' . $layout, $layout); } } if ($item && $this->_view) { if ($this->_view->renderer->pathExists('item/' . $item->type) && JFile::exists($this->_rendererPath . '/' . 'item' . '/' . $item->type . '/' . $layout . '.php')) { return 'item.' . $item->type . '.' . $layout; } else { if (JFile::exists($this->_rendererPath . '/item/' . $layout . '.php')) { return 'item.' . $layout; } else { return 'item.teaser'; } } } return 'item.teaser'; }
/** * Get thumbnails * @param ParameterData $params * @return array */ protected function _getThumbnails($params) { $thumbs = array(); $width = $params->get('width'); $height = $params->get('height'); $resize = $params->get('resize', 1); $title = $this->_data->get('title', ''); $files = JFolder::files($this->_path, '.', false, true, array('.svn', 'CVS', '.DS_Store')); $files = array_filter($files, create_function('$file', 'return preg_match("#(\\.bmp|\\.gif|\\.jpg|\\.jpeg|\\.png)$#i", $file);')); // set default thumbnail size, if incorrect sizes defined $width = intval($width); $height = intval($height); if ($width < 1 && $height < 1) { $width = 100; $height = null; } foreach ($files as $file) { $filename = basename($file); $thumb = $this->app->jbimage->resize($file, $width, $height); // set image name or title if exsist $name = ''; if (isset($desc_array[$filename])) { $name = $desc_array[$filename]; } $thumbs[] = array('name' => htmlspecialchars($this->getItem()->name), 'filename' => $filename, 'img' => $this->app->jbimage->getUrl($file), 'img_file' => JPath::clean($file), 'thumb' => $thumb->url, 'thumb_width' => $thumb->width, 'thumb_height' => $thumb->height); } return $thumbs; }
/** * Get array id list * @param ParameterData $appParams * @param bool $isAdvance * @return array */ public function recount($appParams, $isAdvance = false) { $itemsPrice = array(); $count = 0; $total = 0; $items = $this->getAllItems(); $currencyConvert = $appParams->get('global.jbzoo_cart_config.currency', 'EUR'); foreach ($items as $hash => $item) { $item['price'] = $this->app->jbmoney->convert($item['currency'], $currencyConvert, $item['price']); $itemsPrice[$hash] = $item['price'] * $item['quantity']; $count += $item['quantity']; $total += $itemsPrice[$hash]; $itemsPrice[$hash] = $this->app->jbmoney->toFormat($itemsPrice[$hash], $currencyConvert); } return array('items' => $itemsPrice, 'count' => $count, 'total' => $this->app->jbmoney->toFormat($total, $currencyConvert)); }
/** * Get thumbnails * @param ParameterData $params * @return array */ protected function _getThumbnails($params) { $thumbs = array(); $width = $params->get('width'); $height = $params->get('height'); $resize = $params->get('resize', 1); $title = $this->_data->get('title', ''); $files = JFolder::files($this->_path, '.', false, true, array('.svn', 'CVS', '.DS_Store')); $files = array_filter($files, create_function('$file', 'return preg_match("#(\\.bmp|\\.gif|\\.jpg|\\.jpeg|\\.png)$#i", $file);')); // set default thumbnail size, if incorrect sizes defined $width = intval($width); $height = intval($height); if ($width < 1 && $height < 1) { $width = 100; $height = null; } foreach ($files as $file) { $filename = basename($file); $thumb = $this->app->zoo->resizeImage($file, $width, $height); // if thumbnail exists, add it to return value if (file_exists($thumb)) { // set image name or title if exsist $name = ''; if (isset($desc_array[$filename])) { $name = $desc_array[$filename]; } // get image info list($thumb_width, $thumb_height) = @getimagesize($thumb); $thumbs[] = array('name' => $name, 'filename' => $filename, 'img' => $this->_uri . $this->_getRelativePath($file), 'img_file' => $file, 'thumb' => $this->_uri . $this->_getRelativePath($thumb), 'thumb_width' => $thumb_width, 'thumb_height' => $thumb_height); } } return $thumbs; }