/** * Returns a published state on a grid * * @param integer $value The state value. * @param integer $i The row index * @param string|array $prefix An optional task prefix or an array of options * @param boolean $enabled An optional setting for access control on the action. * @param string $checkbox An optional prefix for checkboxes. * * @return string The Html code * * @see JHtmlJGrid::state * @since 11.1 */ public static function published($i, $value, $prefix = '', $enabled = true, $checkbox = 'cb') { if (is_array($prefix)) { $options = $prefix; $enabled = array_key_exists('enabled', $options) ? $options['enabled'] : $enabled; $checkbox = array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox; $prefix = array_key_exists('prefix', $options) ? $options['prefix'] : ''; } $states = array(1 => array('unpublish', 'JPUBLISHED', 'JLIB_HTML_UNPUBLISH_ITEM', 'JPUBLISHED', true, 'publish', 'publish'), 0 => array('publish', 'JUNPUBLISHED', 'JLIB_HTML_PUBLISH_ITEM', 'JUNPUBLISHED', true, 'unpublish', 'unpublish'), 2 => array('unpublish', 'JARCHIVED', 'JLIB_HTML_UNPUBLISH_ITEM', 'JARCHIVED', true, 'archive', 'archive'), -2 => array('publish', 'JTRASHED', 'JLIB_HTML_PUBLISH_ITEM', 'JTRASHED', true, 'trash', 'trash')); return JHtmlJGrid::state($states, $value, $i, $prefix, $enabled, true, $checkbox); }
/** * Returns a published state on a grid * * @param integer $value The state value. * @param integer $i The row index * @param string|array $prefix An optional task prefix or an array of options * @param boolean $enabled An optional setting for access control on the action. * @param string $checkbox An optional prefix for checkboxes. * * @return string The HTML markup * * @see JHtmlJGrid::state * @since 1.6 */ public static function published($value, $i, $prefix = '', $enabled = true, $checkbox = 'cb') { if (is_array($prefix)) { $options = $prefix; $enabled = array_key_exists('enabled', $options) ? $options['enabled'] : $enabled; $checkbox = array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox; $prefix = array_key_exists('prefix', $options) ? $options['prefix'] : ''; } $states = array(1 => array('unpublish', 'COM_DZPRODUCT_OPTION_CONFIRMED', 'COM_DZPRODUCT_HTML_UNPUBLISH_ITEM', 'COM_DZPRODUCT_OPTION_CONFIRMED', true, 'publish', 'publish'), 0 => array('publish', 'COM_DZPRODUCT_OPTION_PENDING', 'COM_DZPRODUCT_HTML_PUBLISH_ITEM', 'COM_DZPRODUCT_OPTION_PENDING', true, 'unpublish', 'unpublish'), 2 => array('unpublish', 'COM_DZPRODUCT_OPTION_ARCHIVED', 'COM_DZPRODUCT_HTML_UNPUBLISH_ITEM', 'COM_DZPRODUCT_OPTION_ARCHIVED', true, 'archive', 'archive'), -2 => array('publish', 'COM_DZPRODUCT_OPTION_CANCELLED', 'COM_DZPRODUCT_HTML_PUBLISH_ITEM', 'COM_DZPRODUCT_OPTION_CANCELLED', true, 'trash', 'trash')); return JHtmlJGrid::state($states, $value, $i, $prefix, $enabled, true, $checkbox); }
/** * Check-out button. * * @param string $taskPrefix The task prefix. * * @return string Check-out button html code. */ public function checkoutButton($taskPrefix = null) { $item = $this->current; $field = $this->config->get('field.checked_out', 'checked_out'); $authorNameField = $this->config->get('field.author_name'); $chkTimeField = $this->config->get('field.checked_out_time'); $canCheckin = $this->state->get('access.canCheckin', true); $taskPrefix = $taskPrefix ?: $this->config->get('view_list') . '.check.'; if (!$item->{$field}) { return ''; } return \JHtmlJGrid::checkedout($this->row, $item->{$authorNameField}, $item->{$chkTimeField}, $taskPrefix, $canCheckin); }