joomla/com_wk1/admin/views/wk1s/view.html.php

<?php
/**
 * @package     walter
 * @subpackage  com_wk1
 */
 
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
 
/**
 * Wk1s View
 *
 * @since  0.0.1
 */
class Wk1ViewWk1s extends JViewLegacy
{
    /**
     * Display the wk1 view
     *
     * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
     *
     * @return  void
     */
    function display($tpl = null)
    {
        // Get data from the model
        $this->items        = $this->get('Items');
        $this->pagination    = $this->get('Pagination');
 
        // 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()    
    {
        JToolbarHelper::title(JText::_('COM_Wk1_MANAGER_WK1S'));
        JToolbarHelper::addNew('wk1.add');
        JToolbarHelper::editList('wk1.edit');
        JToolbarHelper::deleteList('', 'wk1s.delete');    
    }
}