Actions

API16

JHtmlJGrid/published

From Joomla! Documentation

< API16:JHtmlJGrid
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Contents

Syntax

static published($value=0, $i, $taskPrefix= '', $canChange=true)
Parameter Name Default Value Description
$value 0 $value The state value.
$i $i
$taskPrefix An optional prefix for the task.
$canChange true An optional setting for access control on the action.

Defined in

libraries/joomla/html/html/jgrid.php

Importing

jimport( 'joomla.html.html.jgrid' );

Source Body

public static function published($value = 0, $i, $taskPrefix = '', $canChange = true)
{
        // Array of image, task, title, action
        $states = array(
                1       => array('tick.png',            $taskPrefix.'unpublish',        'JState_Published',             'JState_UnPublish_Item'),
                0       => array('publish_x.png',       $taskPrefix.'publish',          'JState_UnPublished',   'JState_Publish_Item'),
                -1      => array('disabled.png',        $taskPrefix.'unpublish',        'JState_Archived',              'JState_UnPublish_Item'),
                -2      => array('trash.png',           $taskPrefix.'publish',          'JState_Trashed',               'JState_Publish_Item'),
        );
        $state  = JArrayHelper::getValue($states, (int) $value, $states[0]);
        $html   = JHTML::_('image','admin/'.$state[0], JText::_($state[2]), NULL, true);
        if ($canChange) {
                $html   = '<a href="javascript:void(0);" onclick="return listItemTask(\'cb'.$i.'\',\''.$state[1].'\')" title="'.JText::_($state[3]).'">'
                                . $html.'</a>';
        }
 
        return $html;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />