name : view.html.php
<?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;

/**
 * Dearflips View
 *
 * @since  0.0.1
 */
class DearflipViewDearflips extends JViewLegacy {
  /**
   * Display the Dearflips 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.dearflip";
    // Get data from the model
    $this->items      = $this->get( 'Items' );
    $this->pagination = $this->get( 'Pagination' );
    $this->state			= $this->get('State');
    $this->filter_order 	= $app->getUserStateFromRequest($context.'filter_order', 'filter_order', 'book_title', 'cmd');
    
    $this->filter_order_Dir = $app->getUserStateFromRequest($context.'filter_order_Dir', 'filter_order_Dir', 'asc', 'cmd');
    $this->filterForm    	= $this->get('FilterForm');
    $this->activeFilters 	= $this->get('ActiveFilters');
    
    // Check for errors.
    if ( count( $errors = $this->get( 'Errors' ) ) ) {
      JFactory::getApplication()->enqueueMessage();
      
      return false;
    }
    /*JHtml::_('behavior.framework');*/ // Adding this line fix the error ReferenceError: Joomla is not defined
    // Set the toolbar
    // Set the toolbar and number of found items
    $this->addToolBar();
    
    
    
    // Display the template
    parent::display( $tpl );
 
    
    
  }
  
  protected function addToolBar()
  {$title = JText::_('COM_DEARFLIP_MANAGER_DEARFLIPS');
    
    if ($this->pagination->total)
    {
      $title .= "<span style='font-size: 0.5em; vertical-align: middle;'>(" . $this->pagination->total . ")</span>";
    }
    
    JToolBarHelper::title($title, 'dearflip');
    JToolBarHelper::addNew('dearflip.add', 'Add New Book');
    JToolBarHelper::editList('dearflip.edit');
    JToolBarHelper::deleteList('', 'dearflips.delete');

      if(method_exists('JToolBarHelper' , 'link')){

    JToolbarHelper::link(JRoute::_('index.php?option=com_dearflip&view=dearflipcats'), 'Categories', 'goto_categories');
    JToolbarHelper::link(JRoute::_('index.php?option=com_dearflip&view=dearflipsetting&layout=edit&id=1'), 'Global Settings', 'goto_globalsettings');


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

      }
 
  }

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


}





© 2025 Cubjrnet7