Your IP : 216.73.216.84


Current Path : /home/helpink/www/administrator/components/com_jbusinessdirectory/views/announcement/
Upload File :
Current File : /home/helpink/www/administrator/components/com_jbusinessdirectory/views/announcement/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  View.
 */

JBusinessUtil::loadJQueryUI();
JBusinessUtil::enqueueScript('libraries/chosen/ajax-chosen.min.js');

JBusinessUtil::includeValidation();

require_once HELPERS_PATH.'/helper.php';

class JBusinessDirectoryViewAnnouncement extends JBusinessDirectoryAdminView {
	protected $item;
	protected $state;

	/**
	 * Display the view
	 */
	public function display($tpl = null) {
		$this->item	 = $this->get('Item');
		$this->state = $this->get('State');
		$this->actions = JBusinessUtil::getAnnouncementActions();
		$this->translations = JBusinessDirectoryTranslations::getAllTranslations(ANNOUNCEMENT_DESCRIPTION_TRANSLATION, $this->item->id);
		$this->languages    = JBusinessUtil::getLanguages();

		$this->companyOptions = JBusinessUtil::getCompaniesOptions($this->item->company_id);
		
		// 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();
		$input = JFactory::getApplication()->input;
		$input->set('hidemainmenu', true);
		$isNew = ($this->item->id == 0);

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

		if ($canDo->get('core.edit')) {
			JToolbarHelper::apply('announcement.apply');
			JToolbarHelper::save('announcement.save');
		}

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

		JToolbarHelper::divider();
		JToolbarHelper::help('JHELP_JBUSINESSDIRECTORY_ANNOUNCEMENT_EDIT');
	}
}