public function render($params = array()) { $countries = $this->_data->get('country', array()); $keys = array_flip($countries); $countries = array_intersect_key(self::getCountryArray(), $keys); $countries = array_map(create_function('$a', 'return JText::_($a);'), $countries); return ElementHelper::applySeparators($params['separated_by'], $countries); }
public function render($params = array()) { $linked = isset($params['linked']) && $params['linked']; $values = array(); foreach ($this->_item->getRelatedCategories(true) as $category) { $values[] = $linked ? '<a href="' . JRoute::_(RouteHelper::getCategoryRoute($category)) . '">' . $category->name . '</a>' : $category->name; } return ElementHelper::applySeparators($params['separated_by'], $values); }
public function render($params = array()) { $category_ids = $this->_data->get('category', array()); $category_links = array(); $categories = YTable::getInstance('category')->getById($category_ids, true); foreach ($categories as $category) { $category_links[] = '<a href="' . RouteHelper::getCategoryRoute($category) . '">' . $category->name . '</a>'; } return ElementHelper::applySeparators($params['separated_by'], $category_links); }
public function render($params = array()) { $options_from_config = $this->_config->get('options'); $selected_options = $this->_data->get('option', array()); $options = array(); foreach ($options_from_config as $option) { if (in_array($option['value'], $selected_options)) { $options[] = $option['name']; } } return ElementHelper::applySeparators($params['separated_by'], $options); }
public function render($params = array()) { $linked = isset($params['linked']) && $params['linked']; $values = array(); if ($linked) { foreach ($this->_item->getTags() as $tag) { $values[] = '<a href="' . JRoute::_(RouteHelper::getTagRoute($this->_item->application_id, $tag)) . '">' . $tag . '</a>'; } } else { $values = $this->_item->getTags(); } return ElementHelper::applySeparators($params['separated_by'], $values); }
public function render($params = array()) { $result = array(); foreach ($this as $self) { $result[] = $this->_render($params); } return ElementHelper::applySeparators($params['separated_by'], $result); }
public function render($params = array()) { $jplugins = $this->_config->get('jplugins'); $display = isset($params['display']) ? $params['display'] : 'all'; $result = array(); switch ($display) { case 'all': foreach ($this as $self) { if (($text = $this->_data->get('value', '')) && !empty($text)) { $result[] = $text; } } break; case 'first': $this->rewind(); if (($text = $this->_data->get('value', '')) && !empty($text)) { $result[] = $text; } break; case 'all_without_first': $this->rewind(); while ($this->next()) { if (($text = $this->_data->get('value', '')) && !empty($text)) { $result[] = $text; } } break; } // trigger joomla content plugins if ($jplugins) { for ($i = 0; $i < count($result); $i++) { $result[$i] = ZooHelper::triggerContentPlugins($result[$i]); } } return ElementHelper::applySeparators($params['separated_by'], $result); }
public function render($params = array()) { // init vars $params = new YArray($params); $items = array(); $output = array(); $layout_path = $params->get('layout_path'); $renderer = new ItemRenderer(); $renderer->addPath($layout_path); $layout = $params->get('layout'); $items = $this->_getRelatedItems(); // sort items $order = $params->get('order'); if (in_array($order, array('alpha', 'ralpha'))) { usort($items, create_function('$a,$b', 'return strcmp($a->name, $b->name);')); } elseif (in_array($order, array('date', 'rdate'))) { usort($items, create_function('$a,$b', 'return (strtotime($a->created) == strtotime($b->created)) ? 0 : (strtotime($a->created) < strtotime($b->created)) ? -1 : 1;')); } elseif (in_array($order, array('hits', 'rhits'))) { usort($items, create_function('$a,$b', 'return ($a->hits == $b->hits) ? 0 : ($a->hits < $b->hits) ? -1 : 1;')); } elseif ($order == 'random') { shuffle($items); } else { } if (in_array($order, array('ralpha', 'rdate', 'rhits'))) { $items = array_reverse($items); } // create output foreach ($items as $item) { $path = 'item'; $prefix = 'item.'; $type = $item->getType()->id; if ($renderer->pathExists($path . DIRECTORY_SEPARATOR . $type)) { $path .= DIRECTORY_SEPARATOR . $type; $prefix .= $type . '.'; } if (in_array($layout, $renderer->getLayouts($path))) { $output[] = $renderer->render($prefix . $layout, array('item' => $item)); } elseif ($params->get('link_to_item', false) && $item->getState()) { $url = RouteHelper::getItemRoute($item); $output[] = '<a href="' . JRoute::_($url) . '" title="' . $item->name . '">' . $item->name . '</a>'; } else { $output[] = $item->name; } } return ElementHelper::applySeparators($params->get('separated_by'), $output); }