| Current Path : /home/z/i/e/zieirix/www/administrator/components/com_faqbookpro/views/questions/ |
| Current File : /home/z/i/e/zieirix/www/administrator/components/com_faqbookpro/views/questions/view.html.php |
<?php
/**
* @title Minitek FAQ Book
* @copyright Copyright (C) 2011-2020 Minitek, All rights reserved.
* @license GNU General Public License version 3 or later.
* @author url https://www.minitek.gr/
* @developers Minitek.gr
*/
defined('_JEXEC') or die;
class FAQBookProViewQuestions extends JViewLegacy
{
protected $items;
protected $pagination;
protected $state;
/**
* Display the view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->authors = $this->get('Authors');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
$model = $this->getModel();
if ($this->getLayout() !== 'modal')
{
$this->utilities = new FAQBookProHelper();
$this->utilities->addSubmenu('questions');
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Get topics for batch operations
$this->topics = $model->getBatchTopics();
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
}
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
$canDo = FAQBookProHelper::getActions('com_faqbookpro', 'topic', $this->state->get('filter.topic_id'));
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
JToolbarHelper::title(JText::_('COM_FAQBOOKPRO_QUESTIONS_TITLE'), 'question');
if ($canDo->get('core.create') || count(FAQBookProHelper::getAuthorisedTopics('core.create')) > 0 )
{
JToolbarHelper::addNew('question.add');
}
if ($canDo->get('core.edit') || $canDo->get('core.edit.own'))
{
JToolbarHelper::editList('question.edit');
}
if ($canDo->get('core.edit.state'))
{
JToolbarHelper::publish('questions.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('questions.unpublish', 'JTOOLBAR_UNPUBLISH', true);
JToolbarHelper::archiveList('questions.archive');
JToolbarHelper::checkin('questions.checkin');
}
// Add a batch button
if ($canDo->get('core.create') && $canDo->get('core.edit') && $canDo->get('core.edit.state'))
{
$title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button
$layout = new JLayoutFile('joomla.toolbar.batch');
$dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete'))
{
JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'questions.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($canDo->get('core.edit.state'))
{
JToolbarHelper::trash('questions.trash');
}
if ($canDo->get('core.admin') || $canDo->get('core.options'))
{
JToolbarHelper::preferences('com_faqbookpro');
}
}
}