Your IP : 216.73.216.84


Current Path : /home/helpink/www/administrator/components/com_jbusinessdirectory/views/offers/
Upload File :
Current File : /home/helpink/www/administrator/components/com_jbusinessdirectory/views/offers/view.html.php

<?php
/**
 * @package     JBusinessDirectory
 *
 * @author CMSJunkie http://www.cmsjunkie.com/
 * @copyright  Copyright (C) 2007 - 2022 CMSJunkie. All rights reserved.
 * @license   https://www.gnu.org/licenses/agpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

/**
 * The HTML Menus Menu Menus View.
 *
 * @package     JBusinessDirectory
 * @subpackage  com_jbusinessdirectory
 */

require_once HELPERS_PATH.'/helper.php';

class JBusinessDirectoryViewOffers extends JBusinessDirectoryAdminView {
	protected $items;
	protected $pagination;
	protected $state;

	/**
	 * Display the view
	 */
	public function display($tpl = null) {
		$this->items		= $this->get('Items');
		$this->pagination	= $this->get('Pagination');
		$this->state		= $this->get('State');

		$this->filterForm    = $this->get('FilterForm');
		$this->activeFilters = $this->get('ActiveFilters');
		
		$this->statuses		= $this->get('Statuses');
		$this->states		= $this->get('States');
		
		JBusinessDirectoryHelper::addSubmenu('offers');

		// Check for errors.
		if (count($errors = $this->get('Errors'))) {
			throw new Exception(implode("\n", $errors), 500);
			return false;
		}

		$this->addToolbar();
		parent::display($tpl);
	}

	/**
	 * Add the page title and toolbar.
	 *
	 * @since   1.6
	 */
	protected function addToolbar() {
		$canDo = JBusinessDirectoryHelper::getActions();
		$bar = JToolBar::getInstance('toolbar');

		$itemType = $this->state->get('filter.type');
		if ($itemType == OFFER_TYPE_PRODUCT) {
			$text    = 'LNG_PRODUCTS';
		} else {
			$text    = 'LNG_OFFERS';
		}

		JToolBarHelper::title('J-BusinessDirectory : '.JText::_($text), 'generic.png');
		
		if ($canDo->get('core.create')) {
			JToolbarHelper::addNew('offer.add');
		}
		
		if (($canDo->get('core.edit'))) {
			JToolbarHelper::editList('offer.edit');
		}

		if ($canDo->get('core.create')) {
			$dhtml = '<joomla-toolbar-button><button data-toggle="modal" onclick="jQuery( \'#collapseModal\' ).jbdModal({attachTo: \'adminForm\'});" class="btn btn-small">
			<i class="icon-checkbox-partial" title="'.JText::_('JTOOLBAR_BATCH').'"></i>'.JText::_('JTOOLBAR_BATCH').'</button></joomla-toolbar-button>';
			$bar->appendButton('Custom', $dhtml, 'batch');
		}

		if ($canDo->get('core.delete')) {
			JToolbarHelper::divider();
			JToolbarHelper::deleteList('', 'offers.delete');
		}

		JToolbarHelper::divider();

		$dhtml = '<joomla-toolbar-button><button data-toggle="modal" onclick="jQuery( \'#import-model\' ).jbdModal({attachTo: \'adminForm\'});" class="btn btn-small">
		<i class="icon-upload" title="'.JText::_('LNG_IMPORT_CSV').'"></i>'.JText::_('LNG_IMPORT_CSV').'</button></joomla-toolbar-button>';
		$bar->appendButton('Custom', $dhtml, 'offers.importFromCsv');

		$dhtml = '<joomla-toolbar-button><button data-toggle="modal" onclick="jQuery( \'#export-model\' ).jbdModal({attachTo: \'adminForm\'});" class="btn btn-small">
		<i class="icon-download" title="'.JText::_('LNG_EXPORT_CSV').'"></i>'.JText::_('LNG_EXPORT_CSV').'</button></joomla-toolbar-button>';
		$bar->appendButton('Custom', $dhtml, 'offers.showExportCsv');

		if ($canDo->get('core.admin')) {
			JToolbarHelper::preferences('com_jbusinessdirectory');
		}
		
		JToolbarHelper::divider();
		JToolBarHelper::custom('offers.back', 'dashboard', 'dashboard', JText::_("LNG_CONTROL_PANEL"), false, false);
		JToolBarHelper::help('', false, DOCUMENTATION_URL.'businessdiradmin.html#offers');
	}
}