* @copyright Copyright (C) 2007 - 2016 Prieco, S.A. All rights reserved. * @license http://http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL * @link http://www.extly.com http://support.extly.com */ // No direct access defined('_JEXEC') or die('Restricted access'); /** * Utility class for creating HTML Grids * * @package Extly.Library * @subpackage lib_extly - Extly Framework * @since 3.0 */ abstract class EHtmlGrid { const IMG_ICON_YES = ''; const IMG_ICON_NO = ''; /** * Method to create a clickable icon to change the state of an item * * @param mixed $value Either the scalar value or an object (for backward compatibility, deprecated) * @param integer $i The index * @param bool $withLink Param * * @return string */ public static function published($value, $i, $withLink = true) { return self::publishedWithIcons($value, $i, $withLink); } /** * Method to create a clickable icon to change the state of an item * * @param mixed $value Either the scalar value or an object (for backward compatibility, deprecated) * @param integer $i The index * @param bool $withLink Param * * @return string */ public static function publishedWithIcons($value, $i, $withLink = false) { if (is_object($value)) { $value = $value->published; } $img = $value ? self::IMG_ICON_YES : self::IMG_ICON_NO; if (!$withLink) { return $img; } $task = $value ? 'unpublish' : 'publish'; $alt = $value ? JText::_('JPUBLISHED') : JText::_('JUNPUBLISHED'); $action = $value ? JText::_('JLIB_HTML_UNPUBLISH_ITEM') : JText::_('JLIB_HTML_PUBLISH_ITEM'); $href = '' . $img . ''; return $href; } /** * Method to create a icon * * @param mixed $locked Param * @param string $img1 Param * @param string $img0 Param * @param bool $optimized Param * * @return string */ public static function lockedWithIcons($locked, $img1 = '', $img0 = '', $optimized = true) { if (($optimized) && (!$locked)) { return null; } $img = $locked ? $img1 : $img0; $alt = $locked ? JText::_('JLOCKED') : JText::_('JUNLOCKED'); // Return JHtml::_('image', $img, $alt, null, true); return $img; } /** * ajaxOrderingInit * * @param string $option Param * @param string $orderDir Param * @param string $listTableId Param * @param string $formId Param * * @return string */ public static function ajaxOrderingInit($option, $orderDir, $listTableId = 'itemsList', $formId = 'adminForm') { $saveOrderingUrl = 'index.php?option=' . $option . '&task=saveorder'; JHtml::_('sortablelist.sortable', $listTableId, $formId, strtolower($orderDir), $saveOrderingUrl); } /** * ajaxOrderingColumn * * @param bool $editstate Param * @param int $ordering Param * * @return string */ public static function ajaxOrderingColumn($editstate, $ordering) { $output = array(); $output[] = '
'; return implode('', $output); } /** * basicOrderingColumn * * @param string &$pagination Param * @param string $i Param * @param string $count Param * @param string $ordering Param * * @return string */ public static function basicOrderingColumn(&$pagination, $i, $count, $ordering) { $j3 = (EXTLY_J3); $output = array(); $output[] = '