Your IP : 216.73.216.170


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

<?php

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

/**
 * View to display a list of items
 * @author kirdinyuri
 */
class PollViewAnswers extends JViewLegacy
{

	protected $items;
	protected $pagination;
	protected $state;
	protected $user;
	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->filterForm    = $this->get('FilterForm');
		$this->activeFilters = $this->get('ActiveFilters');
		$this->loadHelper( 'poll' );
		if ( $this->getLayout() !== 'modal' ) {
			$this->addToolbar();
			pollHelper::addSubmenu( 'answers' );
			$this->sidebar = JHtmlSidebar::render();
		}
		parent::display( $tpl );
	}

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

		if ( $canDo->get( 'core.create' ) || ( count( $this->user->getAuthorisedCategories( 'com_poll', 'core.create' ) ) ) > 0 ) {
			JToolBarHelper::addNew( 'answer.add' );
		}

		if ( ( $canDo->get( 'core.edit' ) ) || ( $canDo->get( 'core.edit.own' ) ) ) {
			JToolBarHelper::editList( 'answer.edit' );
		}

		if ( $canDo->get( 'core.edit.state' ) ) {
			JToolBarHelper::divider();
			JToolBarHelper::publish( 'answers.publish', 'JTOOLBAR_PUBLISH', true );
			JToolBarHelper::unpublish( 'answers.unpublish', 'JTOOLBAR_UNPUBLISH', true );
			JToolBarHelper::divider();

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

			if ( $canDo->get( 'core.admin' ) ) {
				JToolBarHelper::preferences( 'com_poll' );
				JToolBarHelper::divider();
			}
		}
		
		if ( $canDo->get( 'core.create' ))
		{
			JToolBarHelper::custom( 'answers.export', 'icon', '', 'Экспорт', true, true );
			JToolBarHelper::custom( 'answers.exportall', 'icon', '', 'Экспорт всего', true, true );
		}		
	}

	protected function getSortFields()
	{
		return array(
			'ip' => JText::_( 'ip' ),
			'cookie' => JText::_( 'cookie' ),
			'mail' => JText::_( 'mail' ),
			'fio' => JText::_( 'fio' ),
			'tel' => JText::_( 'tel' ),
			'date' => JText::_( 'date' ),
			'code' => JText::_( 'code' ),
			'discount' => JText::_( 'discount' ),
			'discount_time' => JText::_( 'discount_time' )
		);
	}
}