public function alphaindex() { // get request vars $page = YRequest::getInt('page', 1); $this->alpha_char = YRequest::getString('alpha_char', ''); // get params $params = $this->application->getParams('site'); $items_per_page = $params->get('config.items_per_page', 15); $this->item_order = $this->_getItemOrder($params->get('config.item_order')); $add_alpha_index = $params->get('config.alpha_index', 0); // get categories $this->categories = $add_alpha_index == 1 || $add_alpha_index == 3 ? $this->application->getCategoryTree(true, $this->user, true) : array(); // set alphaindex $this->alpha_index = $this->_getAlphaindex(); $this->alpha_char = empty($this->alpha_char) ? $this->alpha_index->getOther() : $this->alpha_index->getChar($this->alpha_char); // get items $this->items = array(); if ($add_alpha_index == 2 || $add_alpha_index == 3) { $table = YTable::getInstance('item'); if ($this->alpha_char == $this->alpha_index->getOther()) { $this->items = $table->getByCharacter($this->application->id, $this->alpha_index->getIndex(), true, true, null, $this->item_order); } else { $this->items = $table->getByCharacter($this->application->id, $this->alpha_char, false, true, null, $this->item_order); } } // get item pagination $this->pagination = new YPagination('page', count($this->items), $page, $items_per_page); $this->pagination->setShowAll($items_per_page == 0); $this->pagination_link = RouteHelper::getAlphaIndexRoute($this->application->id, $this->alpha_char); // slice out items if (!$this->pagination->getShowAll()) { $this->items = array_slice($this->items, $this->pagination->limitStart(), $items_per_page); } // set category and categories to display if (isset($this->categories[0])) { $this->category = $this->categories[0]; } $this->selected_categories = $this->alpha_index->getObjects($this->alpha_char, 'category'); // create pathway $link = JRoute::_(RouteHelper::getAlphaIndexRoute($this->application->id, $this->alpha_char)); $this->pathway->addItem(JText::_('Alpha Index'), $link); // set template and params if (!($this->template = $this->application->getTemplate())) { JError::raiseError(500, JText::_('No template selected')); return; } $this->params = $params; // set renderer $this->renderer = new ItemRenderer(); $this->renderer->addPath(array($this->template->getPath(), ZOO_SITE_PATH)); // display view $this->getView('alphaindex')->addTemplatePath($this->template->getPath())->setLayout('alphaindex')->display(); }