Your IP : 216.73.216.170


Current Path : /var/www/iplanru/data/www/i-plan.ru/administrator/components/com_poll/views/questions/
Upload File :
Current File : /var/www/iplanru/data/www/i-plan.ru/administrator/components/com_poll/views/questions/view.html.php

<?php
// No direct access
defined( '_JEXEC' ) or die;

/**
 * View for  current element
 * @author kirdinyuri
 */
class PollViewQuestions extends JViewLegacy
{

	
	
	protected $items;
	protected $pagination;
	protected $state;
	protected $user;
	protected $canDo;

	/*protected $authors;*/

	/**
	 * Method to display the current pattern
	 * @param type $tpl
	 */
	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->user = JFactory::getUser();
		$this->loadHelper( 'poll' );
		$this->_setToolBar();
		$this->sidebar = JHtmlSidebar::render();
		parent::display( $tpl );
	}

	/**
	 * Method to display the toolbar
	 */
	protected function _setToolBar()
	{
		JToolBarHelper::title( JText::_( 'COM_POLL' ) );
		$canDo = pollHelper::getActions( 'question' );

		if ( $canDo->get( 'core.create' ) || ( count( $this->user->getAuthorisedCategories( 'com_poll', '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::divider();
			JToolBarHelper::publish( 'questions.publish', 'Включить', true );
			JToolBarHelper::unpublish( 'questions.unpublish', 'Выключить', true );
			JToolBarHelper::divider();

			if ( $canDo->get( 'core.delete' ) ) {
				JToolBarHelper::deleteList( 'DELETE_QUERY_STRING', 'questions.delete', 'JTOOLBAR_DELETE' );
				JToolBarHelper::divider();
			}

			if ( $canDo->get( 'core.admin' ) ) {
				JToolBarHelper::preferences( 'com_poll' );
				JToolBarHelper::divider();
			}
		}

		pollHelper::addSubmenu( 'questions' );

		/*JHtmlSidebar::addFilter(
			JText::_('По методу'),'filter_method',
			JHtml::_('select.options', PollHelper::getMethodOptions(), 'value', 'text', $this->state->get('filter.method'))
		);
		
		JHtmlSidebar::addFilter(
			JText::_('По признаку'),'filter_pr',
			JHtml::_('select.options', PollHelper::getPrOptions(), 'value', 'text', $this->state->get('filter.pr'))
		);*/
	}

	protected function getSortFields()
	{
		return array(
			'state' => JText::_( 'state' ),
			'type' => JText::_( 'type' ),
			'question' => JText::_( 'question' ),
			'answers' => JText::_( 'answers' ),
			'ordering' => JText::_( 'ordering' )
			);
	}

}