| Current Path : /var/www/iplanru/data/www/i-plan.ru/administrator/components/com_pay/views/discounts/ |
| Current File : /var/www/iplanru/data/www/i-plan.ru/administrator/components/com_pay/views/discounts/view.html.php |
<?php
// No direct access
defined( '_JEXEC' ) or die;
/**
* View to display a list of items
* @author kirdinyuri
*/
class PayViewDiscounts extends JViewLegacy
{
protected $items;
protected $pagination;
protected $state;
protected $user;
/**
* 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->user = JFactory::getUser();
$this->loadHelper( 'pay' );
$this->_setToolBar();
$this->sidebar = JHtmlSidebar::render();
parent::display( $tpl );
}
/**
* Method to display the toolbar
*/
protected function _setToolBar()
{
JToolBarHelper::title( JText::_( 'COM_PAY' ) );
$canDo = payHelper::getActions( 'discount' );
if ( $canDo->get( 'core.create' ) || ( count( $this->user->getAuthorisedCategories( 'com_pay', 'core.create' ) ) ) > 0 ) {
JToolBarHelper::addNew( 'discount.add' );
}
if ( ( $canDo->get( 'core.edit' ) ) || ( $canDo->get( 'core.edit.own' ) ) ) {
JToolBarHelper::editList( 'discount.edit' );
}
if ( $canDo->get( 'core.edit.state' ) ) {
JToolBarHelper::divider();
JToolBarHelper::publish( 'discounts.publish', 'JTOOLBAR_PUBLISH', true );
JToolBarHelper::unpublish( 'discounts.unpublish', 'JTOOLBAR_UNPUBLISH', true );
JToolBarHelper::divider();
if ( $canDo->get( 'core.delete' ) ) {
JToolBarHelper::deleteList( 'DELETE_QUERY_STRING', 'discounts.delete', 'JTOOLBAR_DELETE' );
JToolBarHelper::divider();
}
if ( $canDo->get( 'core.admin' ) ) {
JToolBarHelper::preferences( 'com_pay' );
JToolBarHelper::divider();
}
}
if ( $canDo->get( 'core.create' ))
{
JToolBarHelper::custom( 'discounts.certificate', 'icon', '', 'Сертификат', true, true );
}
payHelper::addSubmenu( 'discounts' );
}
protected function getSortFields()
{
return array(
'id1' => JText::_( 'ID1' ),
'id2' => JText::_( 'ID2' ),
'date_issue' => JText::_( 'Дата выдачи' ),
'date_use' => JText::_( 'Дата использования' ),
'date_finish' => JText::_( 'Дата окончания' ),
'discount' => JText::_( 'Размер скидки' ),
'id' => JText::_( 'JGRID_HEADING_ID' )
);
}
}