Your IP : 216.73.216.84


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

<?php
/**
 * @package    J-BusinessDirectory
 *
 * @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');

JBusinessUtil::includeValidation();
require_once HELPERS_PATH.'/helper.php';

/**
 * The HTML  View.
 *
 */
class JBusinessDirectoryViewDiscount extends JBusinessDirectoryAdminView {
	protected $item;
	protected $state;

	/**
	 * Display the view
	 */
	public function display($tpl = null) {
		$this->item     = $this->get('Item');
		$this->packages = $this->get('Packages');
		$this->state    = $this->get('State');

		$this->companies    = $this->get('Companies');
		$this->states       = JBusinessDirectoryHelper::getStatuses();
		$this->claimDetails = $this->get('ClaimDetails');

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

		$layout = JFactory::getApplication()->input->get("layout");

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

	/**
	 * Add the page title and toolbar.
	 *
	 * @since   1.6
	 */
	protected function addToolbar($layout) {
		$canDo = JBusinessDirectoryHelper::getActions();
		$input = JFactory::getApplication()->input;
		$input->set('hidemainmenu', true);
		$isNew = ($this->item->id == 0);

		JToolbarHelper::title(JText::_($isNew ? 'COM_JBUSINESSDIRECTORY_NEW_DISCOUNT' : 'COM_JBUSINESSDIRECTORY_EDIT_DISCOUNT'), 'menu.png');

		if ($layout != "generate") {
			if ($canDo->get('core.edit')) {
				JToolbarHelper::apply('discount.apply');
				JToolbarHelper::save('discount.save');
			}
		} else {
			JToolBarHelper::custom('discount.generateDiscounts', 'plus', 'plus', JText::_("LNG_GENERATE"), false, false);
		}

		JToolbarHelper::cancel('discount.cancel', 'JTOOLBAR_CLOSE');

		JToolbarHelper::divider();
		JToolBarHelper::help('', false, DOCUMENTATION_URL . 'businessdiradmin.html#discounts');
	}
}