The JHtmlJGrid class is a utility class for the presentation of tabular data.




JHtmlJGrid::published($value, $i, $img1 = 'tick.png', $img0 = 'publish_x.png', $prefix = '')

The JHtmlGrid::published function generates the HTML required to display a clickable icon that indicates the publication status of the relevant data row.


$value is the present publication status;

$i is an index to the particular row of data to which the publication icon relates;

$img1 is the graphic to be displayed if publication is enabled for the relevant data row;

$img2 is the graphic to be displayed if publication is disabled for the relevant data row;

$prefix is the prefix to be used for generating the identifier for the task to be executed on a click event as follows: '<$prefix>.unpublish' and '<$prefix>.publish'.

{jcomments on}Overview

 The JHtml class is a utility class responsible for rendering HTML elements.



JHtml::$includePaths is an sequence of path directories that JHtml::_ traverses to locate the relevant JHtml sub-classes to import and call;


JHtml::_($key [, ...])

The JHtml::_ function is responsible for loading an abstract JHtml sub-class and executing a public static function within that sub-class, passing an arbitrary number of parameters passed in the call to JHtml::_ to the relevant function of the sub-class.

JHtml::_ uses JPath::find in conjunction with the array of include paths provided by JHtml::$includepaths to locate JHtml sub-classes.

JHtml::addIncludePath($path = '')

JHtml::addIncludePath adds a path, or an array of paths to the head of the array of include paths provided by JHtml::$includepaths.






{jcomments on}Overview

The JControllerForm class provides a controller framework for template based rendering and processing of form-based administrative views.

The constructor for JControllerForm registers the following additional tasks for the task map provided by the parent class, JControllerLegacy: 'apply', 'save2new' and 'save2copy' tasks, all of which are redirected to the JControllerForm::save method.






  1. check if the relevant descendant JControllerForm object allows new objects to be created using the abstract method JControllerForm::allowAdd;
  2. clear the session state entry relating to the key provided by <option>.edit.<context>.data[1] using JApplicationCms::setUserState which itself manipulates the JRegistry session object using JRegistry::set;
  3. set the redirect property of the JControllerForm object to the URL required to [edit the object?].[2]

[1] <option> is typically the component name, whereas <context> typically refers to the particular model / view / controller to which the JControllerForm::add operation relates. Note, resolution of the session state key is performed using the PHP double quote notation which expands variable references.

[2] actual redirection typically takes place in the <component>.php file on a call to JApplication::redirect().

{jcomments on}Overview

The JControllerAdmin class provides a framework for template based rendering, and processing of list-based administrative views.

The constructor for JControllerAdmin registers the following additional tasks for the task map provided by the parent class, JControllerLegacy:

  1. the 'unpublish', 'archive', 'trash', and 'report' tasks, which are redirected to the JControllerAdmin::publish method; and
  2. the 'orderup' and 'orderdown' tasks, which are redirected to the JControllerAdmin::reorder method.






{jcomments on}


Task map

JControllerLegacy implements a task map used by JControllerLegacy::execute to enable routing of the task to a method defined by a derivative class of JControllerLegacy such as JControllerAdmin and JControllerForm or their descendant classes.

Populating the Task map

The task map is populated by reference to the relative complementary public methods of the derivative class compared to JControllerLegacy. The public methods of the derivative class are secured using ReflectionClass::getMethods(ReflectionMethod::IS_PUBLIC) whereas the set of public methods of JControllerLegacy is determined more widely using the PHP API function get_class_methods. The resultant task map contains all of the public functions of the derivative class excluding any functions of the same name (irrespective of signature or parameter list) as JControllerLegacy.





























JControllerLegacy::__construct($config = array())

JControllerLegacy::__construct is the constructor or parent constructor for an instance of the JControllerLegacy class.

JControllerLegacy::createView($name, $prefix = '', $type = '', $config = array())

The JControllerLegacy::createView method searchs for and, if found, loads a JViewLegacy object given by the catenated values of the optional prefix, $prefix and the name, $name.

Pseudo code

  1. construct the JViewLegacy class definition file name using JControllerLegacy::createFileName according to the pattern, converted to lower case as follows: <$name>/view.<$type>.php; for example "view.html.php";
  2. search for the class definition file using JPath::find function and the path list provided by JControllerLegacy::$paths['view']; and
  3. if the class definition is found, load the class definition and instantiate a new instance of the JViewLegacy class.


Where a call is made to createView and the file name for the view is resolved using JControllerLegacy::createFileName, the path and file name generated is converted to lower case. Accordingly, a HTML view with the name 'DocumentList' is accessed from the directory 'documentlist/view.html.php'; this behaviour may create cross-platform issues depending on whether the underlying filesystem is case sensitive or case insensitive.

JControllerLegacy::getView($name = '', $type = '', $prefix = '', $config = array())

The JControllerLegacy::getView method returns a reference to current JViewLegacy object associated with the JControllerLegacy instance, or the named JViewLegacy instance which is loaded using JControllerLegacy::createView by reference to the provided, or default values of $name and $prefix which are as follows –

$name – the name of the controller, using JControllerLegacy::getName();

$prefix – the prefix of the view comprising the name of the controller provided by JControllerLegacy::getName() catenated with 'View'.


Psuedo code

  1. if a redirection URL has not been assigned to JControllerLegacy::$redirect, return false;
  2. otherwise –
  3. enqueue both a redirection message and message type to the application message queue using JApplicationCms<JApplicationWeb<JApplicationBase::enqueueMessage($message, $type);
  4. execute JApplicationCms<JApplicationWeb<JApplicationBase::redirect($url, $moved [false]) which, in turn –
    1. stores the contents of the application message queue provided by JApplicationCms<JApplicationWeb<JApplicationBase::$_messageQueue to the global JSession object; and
    2. makes a call to JApplicationWeb<JApplicationBase::redirect($url, $moved [false]) which –
      1. converts relative URLs to absolute URL references and performs basic checks on the resultant URL to ensure that it does not violate the HTTP protocol;
      2. if the HTTP protocol headers have been sent to the client or the user agent is Microsoft Internet Explorer (JApplicationWebClient::TRIDENT), injects a redirection script into the output;
      3. otherwise, output a HTTP 1.1 '301 Moved permanently', or a '303 See other' and the relevant URL to the client;
      4. close the application by calling JApplicationBase::close($code [0]) which calls the PHP function exit($code) to terminate the application;
      5. impliedly, by virtue of the call to exit($code), the session_write_close() function is called to serialize the session data to the persistent store.




Page 2 of 4