admin.helloworld.php

By Hiveminds
Created 2008-05-07 20:23

<?php

/**
* @package HelloWorld
* @version 1.0
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* Joomla! is free software and parts of it may contain or be derived from the
* GNU General Public License or other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
/*
 * DEVNOTE: This is the 'main' file.
 * It's the one that will be called when we go to the HELLOWORD component.
 */
// no direct access
defined'_JEXEC' ) or die( 'Restricted access' );
/*
 * Make sure the user is authorized to view this page
 */
/* get rid of it...must be changed in libraries\joomla\user\authorization.php
$user = & JFactory::getUser();
if (!$user->authorize( 'com_helloword', 'manage' )) {
    $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') );
}
*/
// Load the html class
// DEVNOTE: This will include the admin.helloworld.html.php file,
// so now we can use anything that it provides!
//require_once( JApplicationHelper::getPath( 'admin_html' ) );
//No more helpers. these funcions were moved to controlers an views.
// specific controller?
 
if($controller JRequest::getVar('controller'))
// Require specific controller if requested
  
{
   require_once (
JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php');
   require_once( 
JPATH_COMPONENT.DS.'models'.DS.'helloworld.php' );
   require_once( 
JPATH_COMPONENT.DS.'views'.DS.$controller.DS.'view.php' );
  }
 else
// Require the base controller - default
  
{
  require_once (
JPATH_COMPONENT.DS.'controllers'.DS.'default.php');
  require_once( 
JPATH_COMPONENT.DS.'models'.DS.'helloworld.php' );
  require_once (
JPATH_COMPONENT.DS.'views'.DS.'default'.DS.'view.php');
  }
// Create the controller
$classname  'HelloWorldController_'.$controller;
//echo $classname;
//echo JRequest::getVar('task' );
//exit;
$controller = new $classname( array('default_task' => 'display') );
//$controller = new $classname();
// Perform the Request task
$controller->executeJRequest::getVar('task' ));
// Redirect if set by the controller
$controller->redirect();

?>

Source URL: http://www.hiveminds.co.uk/content/admin-helloworld-php.html