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;

/**
 * Dearflipcats View
 *
 * @since  0.0.1
 */
class DearflipViewDearflipcats extends JViewLegacy {
  /**
   * Display the Dearflipcats 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.dearflipcat";
    // 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', 'cat_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_CATEGORY_MANAGER_DEARFLIPS' );
    
    /* if ($this->pagination->total)
     {
       $title .= "<span style='font-size: 0.5em; vertical-align: middle;'>(" . $this->pagination->total . ")</span>";
     }*/
    
    JToolBarHelper::title( $title, 'dearflipcat' );
    JToolBarHelper::addNew( 'dearflipcat.add', 'Add New Category' );
    JToolBarHelper::editList( 'dearflipcat.edit' );
    JToolBarHelper::deleteList( '', 'dearflipcats.delete' );

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

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

      }
      else{
          JToolbarHelper::back('Books', JRoute::_('index.php?option=com_dearflip&view=dearflips'));
          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