<?php


/**
 * @package     pkg_dearflip
 * @subpackage  com_dearflip
 * @since       1.0.0
 * @copyright   Copyright © 2007 Free Software Foundation, Inc. All rights reserved.
 * @license   GNU General Public License version 3 or later; see https://www.gnu.org/licenses/gpl-3.0.en.html
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Document\Document;


/**
 * Dearflipsettings View
 *
 * @since  0.0.1
 */
class DearflipViewDearflipsettings extends JViewLegacy
{
    /**
     * Display the Dearflipsettings 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 application
        $app     = JFactory::getApplication();
        $context = "dearflip.list.admin.dearflipsetting";
        // Get data from the model
        $this->items        = $this->get('Items');
        $this->pagination   = $this->get('Pagination');
        $this->state        = $this->get('State');
      
        $this->addToolBar();


        // Display the template
        parent::display($tpl);


    }

    protected function addToolBar()
    {
        $title = JText::_('COM_DEARFLIP_MANAGER_DEARFLIP_SETTING');

        /* if ($this->pagination->total)
         {
           $title .= "<span style='font-size: 0.5em; vertical-align: middle;'>(" . $this->pagination->total . ")</span>";
         }*/

        JToolBarHelper::title($title, 'dearflipsetting');
   
      /*  JToolBarHelper::editList('dearflipsetting.edit','Edit Global Setting');*/
        /*JToolBarHelper::deleteList('', 'dearflipsettings.delete');*/

        if(method_exists('JToolBarHelper' , 'link')){
      JToolbarHelper::link(JRoute::_('index.php?option=com_dearflip&view=dearflipsetting&layout=edit&id=1'), 'Edit Global Setting', 'goto_edit_globalsettings');

        JToolbarHelper::link(JRoute::_('index.php?option=com_dearflip&view=dearflips'), 'Books', 'goto_books');


        }
        else{
            JToolbarHelper::back('Edit Global Setting', JRoute::_('index.php?option=com_dearflip&view=dearflipsetting&layout=edit&id=1'));

            JToolbarHelper::back('Books', JRoute::_('index.php?option=com_dearflip&view=dearflips') );

        }
    }


    /**
     * Method to set up the document properties
     *
     * @return void
     */
    public function setDocument(Document $document): void
    {
        $document = JFactory::getDocument();
        $document->setTitle(JText::_('COM_DEARFLIP_ADMINISTRATION'));
    }


}