joomla/com_wk1/admin/views/wk1/view.html.php
<?php
/**
* @package Joomla.Administrator
* @subpackage com_wk1
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* wk1 View
*
* @since 0.0.1
*/
class Wk1ViewWk1 extends JViewLegacy
{
/**
* View form
*
* @var form
*/
protected $form = null;
/**
* Display the wk1 view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
public function display($tpl = null)
{
// Get the Data
$this->form = $this->get('Form');
$this->item = $this->get('Item');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode('<br />', $errors));
return false;
}
// Set the toolbar
$this->addToolBar();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolBar()
{
$input = JFactory::getApplication()->input;
// Hide Joomla Administrator Main menu
$input->set('hidemainmenu', true);
$isNew = ($this->item->id == 0);
if ($isNew)
{
$title = JText::_('COM_WK1_MANAGER_WK1_NEW');
}
else
{
$title = JText::_('COM_WK1_MANAGER_WK1_EDIT');
}
JToolbarHelper::title($title, 'wk1');
JToolbarHelper::save('wk1.save');
JToolbarHelper::cancel(
'wk1.cancel',
$isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE'
);
}
}