API16

JHtmlJGrid/published

From Joomla! Documentation

< API16:JHtmlJGrid
Revision as of 17:51, 22 March 2010 by Doxiki (talk | contribs) (New page: <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> </span> {{Description:JHtmlJGrid/publishe...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

[Edit Descripton]

Template:Description:JHtmlJGrid/published

Syntax[edit]

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[edit]

libraries/joomla/html/html/jgrid.php

Importing[edit]

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

Source Body[edit]

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;
}

[Edit See Also] Template:SeeAlso:JHtmlJGrid/published

Examples[edit]

<CodeExamplesForm />