API16:JHtmlJGrid/published
From Joomla! Documentation
<! removed transcluded page call, red link never existed >
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 transcluded page call, red link never existed >
Examples
Code Examples