Support Joomla!

Packages

Package: Joomla-Framework

License

Content on this site is copyright © 2005 - 2008 Open Source Matters Inc and can be used in accordance with the Joomla! Electronic Documentation License. Some parts of this website may be subject to other licenses.
Source code for file /joomla/document/html/renderer/module.php

Documentation is available at module.php

  1. <?php
  2. /**
  3. @version        $Id: module.php 10707 2008-08-21 09:52:47Z eddieajau $
  4. @package        Joomla.Framework
  5. @subpackage    Document
  6. @copyright    Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
  7. @license        GNU/GPL, see LICENSE.php
  8. *  Joomla! is free software. This version may have been modified pursuant
  9. *  to the GNU General Public License, and as distributed it includes or
  10. *  is derivative of works licensed under the GNU General Public License or
  11. *  other free or open source software licenses.
  12. *  See COPYRIGHT.php for copyright notices and details.
  13. */
  14.  
  15. // Check to ensure this file is within the rest of the framework
  16. defined('JPATH_BASE'or die();
  17.  
  18. /**
  19.  * JDocument Module renderer
  20.  *
  21.  * @package        Joomla.Framework
  22.  * @subpackage    Document
  23.  * @since        1.5
  24.  */
  25. {
  26.     /**
  27.      * Renders a module script and returns the results as a string
  28.      *
  29.      * @access public
  30.      * @param string     $name        The name of the module to render
  31.      * @param array         $params        Associative array of values
  32.      * @return string    The output of the script
  33.      */
  34.     function render$module$params array()$content null )
  35.     {
  36.         if (!is_object($module))
  37.         {
  38.             $title    = isset($params['title']$params['title'null;
  39.  
  40.             $module =JModuleHelper::getModule($module$title);
  41.  
  42.             if (!is_object($module))
  43.             {
  44.                 if (is_null($content)) {
  45.                     return '';
  46.                 else {
  47.                     /**
  48.                      * If module isn't found in the database but data has been pushed in the buffer
  49.                      * we want to render it
  50.                      */
  51.                     $tmp $module;
  52.                     $module new stdClass();
  53.                     $module->params null;
  54.                     $module->module $tmp;
  55.                     $module->id 0;
  56.                     $module->user 0;
  57.                 }
  58.             }
  59.         }
  60.  
  61.         // get the user and configuration object
  62.         $user =JFactory::getUser();
  63.         $conf =JFactory::getConfig();
  64.  
  65.         // set the module content
  66.         if (!is_null($content)) {
  67.             $module->content $content;
  68.         }
  69.  
  70.         //get module parameters
  71.         $mod_params new JParameter$module->params );
  72.  
  73.         $contents '';
  74.         if ($mod_params->get('cache'0&& $conf->getValue'config.caching' ))
  75.         {
  76.             $cache =JFactory::getCache$module->module );
  77.  
  78.             $cache->setLifeTime$mod_params->get'cache_time'$conf->getValue'config.cachetime' 60 ) );
  79.             $cache->setCacheValidation(true);
  80.  
  81.             $contents =  $cache->getarray('JModuleHelper''renderModule')array$module$params )$module->id$user->get('aid'0) );
  82.         else {
  83.             $contents JModuleHelper::renderModule($module$params);
  84.         }
  85.  
  86.         return $contents;
  87.     }
  88. }

Documentation generated on Mon, 22 Sep 2008 12:11:03 +0100 by phpDocumentor 1.3.1