/**
  * Method to get the user group field input markup.
  *
  * @return  string  The field input markup.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     $options = array();
     $attr = '';
     // Initialize some field attributes.
     $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
     $attr .= (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
     $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     $attr .= $this->multiple ? ' multiple="multiple"' : '';
     // Initialize JavaScript field attributes.
     $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
     // Iterate through the children and build an array of options.
     foreach ($this->element->children() as $option) {
         // Only add <option /> elements.
         if ($option->getName() != 'option') {
             continue;
         }
         // Create a new option object based on the <option /> element.
         $tmp = Html::_('select.option', (string) $option['value'], trim((string) $option), 'value', 'text', (string) $option['disabled'] == 'true');
         // Set some option attributes.
         $tmp->class = (string) $option['class'];
         // Set some JavaScript option attributes.
         $tmp->onclick = (string) $option['onclick'];
         // Add the option object to the result set.
         $options[] = $tmp;
     }
     return Html::_('access.usergroup', $this->name, $this->value, $attr, $options, $this->id);
 }
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $options = array();
     // Initialize some field attributes.
     $first = (int) $this->element['first'];
     $last = (int) $this->element['last'];
     $step = (int) $this->element['step'];
     // Sanity checks.
     if ($step == 0) {
         // Step of 0 will create an endless loop.
         return $options;
     } elseif ($first < $last && $step < 0) {
         // A negative step will never reach the last number.
         return $options;
     } elseif ($first > $last && $step > 0) {
         // A position step will never reach the last number.
         return $options;
     } elseif ($step < 0) {
         // Build the options array backwards.
         for ($i = $first; $i >= $last; $i += $step) {
             $options[] = Html::_('select.option', $i);
         }
     } else {
         // Build the options array.
         for ($i = $first; $i <= $last; $i += $step) {
             $options[] = Html::_('select.option', $i);
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
 /**
  * Method to get the custom field options.
  * Use the query attribute to supply a query to generate the list.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $options = array();
     // Initialize some field attributes.
     $key = $this->element['key_field'] ? (string) $this->element['key_field'] : 'value';
     $value = $this->element['value_field'] ? (string) $this->element['value_field'] : (string) $this->element['name'];
     $translate = $this->element['translate'] ? (string) $this->element['translate'] : false;
     $query = (string) $this->element['query'];
     // Get the database object.
     $db = Factory::getDBO();
     // Set the query and get the result list.
     $db->setQuery($query);
     $items = $db->loadObjectlist();
     // Build the field options.
     if (!empty($items)) {
         foreach ($items as $item) {
             if ($translate == true) {
                 $options[] = Html::_('select.option', $item->{$key}, JText::_($item->{$value}));
             } else {
                 $options[] = Html::_('select.option', $item->{$key}, $item->{$value});
             }
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
 /**
  * Method to get the field input markup for a combo box field.
  *
  * @return  string   The field input markup.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     $html = array();
     $attr = '';
     // Initialize some field attributes.
     $attr .= $this->element['class'] ? ' class="combobox ' . (string) $this->element['class'] . '"' : ' class="combobox"';
     $attr .= (string) $this->element['readonly'] == 'true' ? ' readonly="readonly"' : '';
     $attr .= (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
     $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     // Initialize JavaScript field attributes.
     $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
     // Get the field options.
     $options = $this->getOptions();
     // Load the combobox behavior.
     Html::_('behavior.combobox');
     // Build the input for the combo box.
     $html[] = '<input type="text" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . $attr . '/>';
     // Build the list for the combo box.
     $html[] = '<ul id="combobox-' . $this->id . '" style="display:none;">';
     foreach ($options as $option) {
         $html[] = '<li>' . $option->text . '</li>';
     }
     $html[] = '</ul>';
     return implode($html);
 }
    /**
     * Method to get the field input markup for password.
     *
     * @return  string  The field input markup.
     *
     * @since   11.1
     */
    protected function getInput()
    {
        // Initialize some field attributes.
        $size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
        $maxLength = $this->element['maxlength'] ? ' maxlength="' . (int) $this->element['maxlength'] . '"' : '';
        $class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
        $auto = (string) $this->element['autocomplete'] == 'off' ? ' autocomplete="off"' : '';
        $readonly = (string) $this->element['readonly'] == 'true' ? ' readonly="readonly"' : '';
        $disabled = (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
        $meter = (string) $this->element['strengthmeter'] == 'true';
        $threshold = $this->element['threshold'] ? (int) $this->element['threshold'] : 66;
        $script = '';
        if ($meter) {
            Html::_('script', 'system/passwordstrength.js', true, true);
            $script = '<script type="text/javascript">new Form.PasswordStrength("' . $this->id . '",
				{
					threshold: ' . $threshold . ',
					onUpdate: function(element, strength, threshold) {
						element.set("data-passwordstrength", strength);
					}
				}
			);</script>';
        }
        return '<input type="password" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . $auto . $class . $readonly . $disabled . $size . $maxLength . '/>' . $script;
    }
 /**
  * Displays a list of user groups.
  *
  * @param   boolean  $includeSuperAdmin  true to include super admin groups, false to exclude them
  *
  * @return  array  An array containing a list of user groups.
  *
  * @since   11.4
  */
 public static function groups($includeSuperAdmin = false)
 {
     $db = Factory::getDbo();
     $query = $db->getQuery(true);
     $query->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level');
     $query->from($db->quoteName('#__usergroups') . ' AS a');
     $query->join('LEFT', $db->quoteName('#__usergroups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
     $query->group('a.id, a.title, a.lft, a.rgt');
     $query->order('a.lft ASC');
     $db->setQuery($query);
     $options = $db->loadObjectList();
     for ($i = 0, $n = count($options); $i < $n; $i++) {
         $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
         $groups[] = Html::_('select.option', $options[$i]->value, $options[$i]->text);
     }
     // Exclude super admin groups if requested
     if (!$includeSuperAdmin) {
         $filteredGroups = array();
         foreach ($groups as $group) {
             if (!AccessAccess::checkGroup($group->value, 'core.admin')) {
                 $filteredGroups[] = $group;
             }
         }
         $groups = $filteredGroups;
     }
     return $groups;
 }
 /**
  * Method to get the field options.
  *
  * @return  array    The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $options = array();
     // Convert to name => name array.
     foreach (Cache::getStores() as $store) {
         $options[] = Html::_('select.option', $store, Text::_('JLIB_FORM_VALUE_CACHE_' . $store), 'value', 'text');
     }
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
 /**
  * Method to get the session handler field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $options = array();
     // Get the options from JSession.
     foreach (Session::getStores() as $store) {
         $options[] = Html::_('select.option', $store, Text::_('JLIB_FORM_VALUE_SESSION_' . $store), 'value', 'text');
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
 /**
  * Method to get the field input markup.
  *
  * @return  string   The field input markup.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     $attr = '';
     // Initialize some field attributes.
     $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
     $attr .= (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
     $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     $attr .= $this->multiple ? ' multiple="multiple"' : '';
     // Initialize JavaScript field attributes.
     $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
     // Get the field options.
     $options = $this->getOptions();
     return Html::_('access.level', $this->name, $this->value, $attr, $options, $this->id);
 }
 /**
  * Method to get the field input markup.
  *
  * @return  string  The field input markup.
  *
  * @since   11.3
  */
 protected function getInput()
 {
     // Initialize some field attributes.
     $size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     $classes = (string) $this->element['class'];
     $disabled = (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
     if (!$disabled) {
         Html::_('behavior.colorpicker');
         $classes .= ' input-colorpicker';
     }
     if (empty($this->value)) {
         // A color field can't be empty, we default to black. This is the same as the HTML5 spec.
         $this->value = '#000000';
     }
     // Initialize JavaScript field attributes.
     $onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
     $class = $classes ? ' class="' . trim($classes) . '"' : '';
     return '<input type="text" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . $class . $size . $disabled . $onchange . '/>';
 }
 /**
  * Method to get the list of files for the field options.
  * Specify the target directory with a directory attribute
  * Attributes allow an exclude mask and stripping of extensions from file name.
  * Default attribute may optionally be set to null (no file) or -1 (use a default).
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $options = array();
     // Initialize some field attributes.
     $filter = (string) $this->element['filter'];
     $exclude = (string) $this->element['exclude'];
     $stripExt = (string) $this->element['stripext'];
     $hideNone = (string) $this->element['hide_none'];
     $hideDefault = (string) $this->element['hide_default'];
     // Get the path in which to search for file options.
     $path = (string) $this->element['directory'];
     if (!is_dir($path)) {
         $path = JPATH_ROOT . '/' . $path;
     }
     // Prepend some default options based on field attributes.
     if (!$hideNone) {
         $options[] = Html::_('select.option', '-1', Text::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)));
     }
     if (!$hideDefault) {
         $options[] = Html::_('select.option', '', Text::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)));
     }
     // Get a list of files in the search path with the given filter.
     $files = Folder::files($path, $filter);
     // Build the options list from the list of files.
     if (is_array($files)) {
         foreach ($files as $file) {
             // Check to see if the file is in the exclude mask.
             if ($exclude) {
                 if (preg_match(chr(1) . $exclude . chr(1), $file)) {
                     continue;
                 }
             }
             // If the extension is to be stripped, do it.
             if ($stripExt) {
                 $file = File::stripExt($file);
             }
             $options[] = Html::_('select.option', $file, $file);
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $options = array();
     foreach ($this->element->children() as $option) {
         // Only add <option /> elements.
         if ($option->getName() != 'option') {
             continue;
         }
         // Create a new option object based on the <option /> element.
         $tmp = Html::_('select.option', (string) $option['value'], Text::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', (string) $option['disabled'] == 'true');
         // Set some option attributes.
         $tmp->class = (string) $option['class'];
         // Set some JavaScript option attributes.
         $tmp->onclick = (string) $option['onclick'];
         // Add the option object to the result set.
         $options[] = $tmp;
     }
     reset($options);
     return $options;
 }
 /**
  * Method to get the time zone field option groups.
  *
  * @return  array  The field option objects as a nested array in groups.
  *
  * @since   11.1
  */
 protected function getGroups()
 {
     $groups = array();
     $keyField = $this->element['key_field'] ? (string) $this->element['key_field'] : 'id';
     $keyValue = $this->form->getValue($keyField);
     // If the timezone is not set use the server setting.
     if (strlen($this->value) == 0 && empty($keyValue)) {
         $this->value = Factory::getConfig()->get('offset');
     }
     // Get the list of time zones from the server.
     $zones = DateTimeZone::listIdentifiers();
     // Build the group lists.
     foreach ($zones as $zone) {
         // Time zones not in a group we will ignore.
         if (strpos($zone, '/') === false) {
             continue;
         }
         // Get the group/locale from the timezone.
         list($group, $locale) = explode('/', $zone, 2);
         // Only use known groups.
         if (in_array($group, self::$zones)) {
             // Initialize the group if necessary.
             if (!isset($groups[$group])) {
                 $groups[$group] = array();
             }
             // Only add options where a locale exists.
             if (!empty($locale)) {
                 $groups[$group][$zone] = Html::_('select.option', $zone, str_replace('_', ' ', $locale), 'value', 'text', false);
             }
         }
     }
     // Sort the group lists.
     ksort($groups);
     foreach ($groups as $zone => &$location) {
         sort($location);
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
 /**
  * Function to convert a static time into a relative measurement
  *
  * @param   string  $date  The date to convert
  * @param   string  $unit  The optional unit of measurement to return
  *                         if the value of the diff is greater than one
  * @param   string  $time  An optional time to compare to, defaults to now
  *
  * @return  string  The converted time string
  *
  * @since   11.3
  */
 public static function relative($date, $unit = null, $time = null)
 {
     if (is_null($time)) {
         // Get now
         $time = Factory::getDate('now');
     }
     // Get the difference in seconds between now and the time
     $diff = strtotime($time) - strtotime($date);
     // Less than a minute
     if ($diff < 60) {
         return Text::_('JLIB_HTML_DATE_RELATIVE_LESSTHANAMINUTE');
     }
     // Round to minutes
     $diff = round($diff / 60);
     // 1 to 59 minutes
     if ($diff < 60 || $unit == 'minute') {
         return Text::plural('JLIB_HTML_DATE_RELATIVE_MINUTES', $diff);
     }
     // Round to hours
     $diff = round($diff / 60);
     // 1 to 23 hours
     if ($diff < 24 || $unit == 'hour') {
         return Text::plural('JLIB_HTML_DATE_RELATIVE_HOURS', $diff);
     }
     // Round to days
     $diff = round($diff / 24);
     // 1 to 6 days
     if ($diff < 7 || $unit == 'day') {
         return Text::plural('JLIB_HTML_DATE_RELATIVE_DAYS', $diff);
     }
     // Round to weeks
     $diff = round($diff / 7);
     // 1 to 4 weeks
     if ($diff <= 4 || $unit == 'week') {
         return Text::plural('JLIB_HTML_DATE_RELATIVE_WEEKS', $diff);
     }
     // Over a month, return the absolute time
     return Html::_('date', $date);
 }
    /**
     * Load the JavaScript behavior.
     *
     * @param   string  $group   The pane identifier.
     * @param   array   $params  Array of options.
     *
     * @return  void
     *
     * @since   11.1
     */
    protected static function _loadBehavior($group, $params = array())
    {
        static $loaded = array();
        if (!array_key_exists((string) $group, $loaded)) {
            // Include MooTools framework
            Html::_('behavior.framework', true);
            $opt['onActive'] = isset($params['onActive']) ? '\\' . $params['onActive'] : null;
            $opt['onBackground'] = isset($params['onBackground']) ? '\\' . $params['onBackground'] : null;
            $opt['display'] = isset($params['startOffset']) ? (int) $params['startOffset'] : null;
            $opt['useStorage'] = isset($params['useCookie']) && $params['useCookie'] ? 'true' : 'false';
            $opt['titleSelector'] = "dt.tabs";
            $opt['descriptionSelector'] = "dd.tabs";
            $options = Html::getJSObject($opt);
            $js = '	window.addEvent(\'domready\', function(){
						$$(\'dl#' . $group . '.tabs\').each(function(tabs){
							new JTabs(tabs, ' . $options . ');
						});
					});';
            $document = Factory::getDocument();
            $document->addScriptDeclaration($js);
            Html::_('script', 'system/tabs.js', false, true);
            $loaded[(string) $group] = true;
        }
    }
 /**
  * Method to get the field input markup for Access Control Lists.
  * Optionally can be associated with a specific component and section.
  *
  * TODO: Add access check.
  *
  * @return  string  The field input markup.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     Html::_('behavior.tooltip');
     // Initialise some field attributes.
     $section = $this->element['section'] ? (string) $this->element['section'] : '';
     $component = $this->element['component'] ? (string) $this->element['component'] : '';
     $assetField = $this->element['asset_field'] ? (string) $this->element['asset_field'] : 'asset_id';
     // Get the actions for the asset.
     $actions = Access::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/' . $component . '/access.xml', "/access/section[@name='" . $section . "']/");
     // Iterate over the children and add to the actions.
     foreach ($this->element->children() as $el) {
         if ($el->getName() == 'action') {
             $actions[] = (object) array('name' => (string) $el['name'], 'title' => (string) $el['title'], 'description' => (string) $el['description']);
         }
     }
     // Get the explicit rules for this asset.
     if ($section == 'component') {
         // Need to find the asset id by the name of the component.
         $db = Factory::getDbo();
         $query = $db->getQuery(true);
         $query->select($db->quoteName('id'));
         $query->from($db->quoteName('#__assets'));
         $query->where($db->quoteName('name') . ' = ' . $db->quote($component));
         $db->setQuery($query);
         $assetId = (int) $db->loadResult();
     } else {
         // Find the asset id of the content.
         // Note that for global configuration, com_config injects asset_id = 1 into the form.
         $assetId = $this->form->getValue($assetField);
     }
     // Use the compact form for the content rules (deprecated).
     /* @todo remove code:
     		if (!empty($component) && $section != 'component') {
     			return Html::_('rules.assetFormWidget', $actions, $assetId, $assetId ? null : $component, $this->name, $this->id);
     		}
     		 */
     // Full width format.
     // Get the rules for just this asset (non-recursive).
     $assetRules = Access::getAssetRules($assetId);
     // Get the available user groups.
     $groups = $this->getUserGroups();
     // Build the form control.
     $curLevel = 0;
     // Prepare output
     $html = array();
     $html[] = '<div id="permissions-sliders" class="pane-sliders">';
     $html[] = '<p class="rule-desc">' . Text::_('JLIB_RULES_SETTINGS_DESC') . '</p>';
     $html[] = '<ul id="rules">';
     // Start a row for each user group.
     foreach ($groups as $group) {
         $difLevel = $group->level - $curLevel;
         if ($difLevel > 0) {
             $html[] = '<li><ul>';
         } elseif ($difLevel < 0) {
             $html[] = str_repeat('</ul></li>', -$difLevel);
         }
         $html[] = '<li>';
         $html[] = '<div class="panel">';
         $html[] = '<h3 class="pane-toggler title"><a href="javascript:void(0);"><span>';
         $html[] = str_repeat('<span class="level">|&ndash;</span> ', $curLevel = $group->level) . $group->text;
         $html[] = '</span></a></h3>';
         $html[] = '<div class="pane-slider content pane-hide">';
         $html[] = '<div class="mypanel">';
         $html[] = '<table class="group-rules">';
         $html[] = '<thead>';
         $html[] = '<tr>';
         $html[] = '<th class="actions" id="actions-th' . $group->value . '">';
         $html[] = '<span class="acl-action">' . Text::_('JLIB_RULES_ACTION') . '</span>';
         $html[] = '</th>';
         $html[] = '<th class="settings" id="settings-th' . $group->value . '">';
         $html[] = '<span class="acl-action">' . Text::_('JLIB_RULES_SELECT_SETTING') . '</span>';
         $html[] = '</th>';
         // The calculated setting is not shown for the root group of global configuration.
         $canCalculateSettings = $group->parent_id || !empty($component);
         if ($canCalculateSettings) {
             $html[] = '<th id="aclactionth' . $group->value . '">';
             $html[] = '<span class="acl-action">' . Text::_('JLIB_RULES_CALCULATED_SETTING') . '</span>';
             $html[] = '</th>';
         }
         $html[] = '</tr>';
         $html[] = '</thead>';
         $html[] = '<tbody>';
         foreach ($actions as $action) {
             $html[] = '<tr>';
             $html[] = '<td headers="actions-th' . $group->value . '">';
             $html[] = '<label class="hasTip" for="' . $this->id . '_' . $action->name . '_' . $group->value . '" title="' . htmlspecialchars(Text::_($action->title) . '::' . Text::_($action->description), ENT_COMPAT, 'UTF-8') . '">';
             $html[] = Text::_($action->title);
             $html[] = '</label>';
             $html[] = '</td>';
             $html[] = '<td headers="settings-th' . $group->value . '">';
             $html[] = '<select name="' . $this->name . '[' . $action->name . '][' . $group->value . ']" id="' . $this->id . '_' . $action->name . '_' . $group->value . '" title="' . Text::sprintf('JLIB_RULES_SELECT_ALLOW_DENY_GROUP', Text::_($action->title), trim($group->text)) . '">';
             $inheritedRule = Access::checkGroup($group->value, $action->name, $assetId);
             // Get the actual setting for the action for this group.
             $assetRule = $assetRules->allow($action->name, $group->value);
             // Build the dropdowns for the permissions sliders
             // The parent group has "Not Set", all children can rightly "Inherit" from that.
             $html[] = '<option value=""' . ($assetRule === null ? ' selected="selected"' : '') . '>' . Text::_(empty($group->parent_id) && empty($component) ? 'JLIB_RULES_NOT_SET' : 'JLIB_RULES_INHERITED') . '</option>';
             $html[] = '<option value="1"' . ($assetRule === true ? ' selected="selected"' : '') . '>' . Text::_('JLIB_RULES_ALLOWED') . '</option>';
             $html[] = '<option value="0"' . ($assetRule === false ? ' selected="selected"' : '') . '>' . Text::_('JLIB_RULES_DENIED') . '</option>';
             $html[] = '</select>&#160; ';
             // If this asset's rule is allowed, but the inherited rule is deny, we have a conflict.
             if ($assetRule === true && $inheritedRule === false) {
                 $html[] = Text::_('JLIB_RULES_CONFLICT');
             }
             $html[] = '</td>';
             // Build the Calculated Settings column.
             // The inherited settings column is not displayed for the root group in global configuration.
             if ($canCalculateSettings) {
                 $html[] = '<td headers="aclactionth' . $group->value . '">';
                 // This is where we show the current effective settings considering currrent group, path and cascade.
                 // Check whether this is a component or global. Change the text slightly.
                 if (Access::checkGroup($group->value, 'core.admin') !== true) {
                     if ($inheritedRule === null) {
                         $html[] = '<span class="icon-16-unset">' . Text::_('JLIB_RULES_NOT_ALLOWED') . '</span>';
                     } elseif ($inheritedRule === true) {
                         $html[] = '<span class="icon-16-allowed">' . Text::_('JLIB_RULES_ALLOWED') . '</span>';
                     } elseif ($inheritedRule === false) {
                         if ($assetRule === false) {
                             $html[] = '<span class="icon-16-denied">' . Text::_('JLIB_RULES_NOT_ALLOWED') . '</span>';
                         } else {
                             $html[] = '<span class="icon-16-denied"><span class="icon-16-locked">' . Text::_('JLIB_RULES_NOT_ALLOWED_LOCKED') . '</span></span>';
                         }
                     }
                 } elseif (!empty($component)) {
                     $html[] = '<span class="icon-16-allowed"><span class="icon-16-locked">' . Text::_('JLIB_RULES_ALLOWED_ADMIN') . '</span></span>';
                 } else {
                     // Special handling for  groups that have global admin because they can't  be denied.
                     // The admin rights can be changed.
                     if ($action->name === 'core.admin') {
                         $html[] = '<span class="icon-16-allowed">' . Text::_('JLIB_RULES_ALLOWED') . '</span>';
                     } elseif ($inheritedRule === false) {
                         // Other actions cannot be changed.
                         $html[] = '<span class="icon-16-denied"><span class="icon-16-locked">' . Text::_('JLIB_RULES_NOT_ALLOWED_ADMIN_CONFLICT') . '</span></span>';
                     } else {
                         $html[] = '<span class="icon-16-allowed"><span class="icon-16-locked">' . Text::_('JLIB_RULES_ALLOWED_ADMIN') . '</span></span>';
                     }
                 }
                 $html[] = '</td>';
             }
             $html[] = '</tr>';
         }
         $html[] = '</tbody>';
         $html[] = '</table></div>';
         $html[] = '</div></div>';
         $html[] = '</li>';
     }
     $html[] = str_repeat('</ul></li>', $curLevel);
     $html[] = '</ul><div class="rule-notes">';
     if ($section == 'component' || $section == null) {
         $html[] = Text::_('JLIB_RULES_SETTING_NOTES');
     } else {
         $html[] = Text::_('JLIB_RULES_SETTING_NOTES_ITEM');
     }
     $html[] = '</div></div>';
     // Get the JInput object
     $input = Factory::getApplication()->input;
     $js = "window.addEvent('domready', function(){ new Fx.Accordion(\$\$('div#permissions-sliders.pane-sliders .panel h3.pane-toggler')," . "\$\$('div#permissions-sliders.pane-sliders .panel div.pane-slider'), {onActive: function(toggler, i) {toggler.addClass('pane-toggler-down');" . "toggler.removeClass('pane-toggler');i.addClass('pane-down');i.removeClass('pane-hide');Cookie.write('jpanesliders_permissions-sliders" . $component . "',\$\$('div#permissions-sliders.pane-sliders .panel h3').indexOf(toggler));}," . "onBackground: function(toggler, i) {toggler.addClass('pane-toggler');toggler.removeClass('pane-toggler-down');i.addClass('pane-hide');" . "i.removeClass('pane-down');}, duration: 300, display: " . $input->cookie->get('jpanesliders_permissions-sliders' . $component, 0, 'integer') . ", show: " . $input->cookie->get('jpanesliders_permissions-sliders' . $component, 0, 'integer') . ", alwaysHide:true, opacity: false}); });";
     Factory::getDocument()->addScriptDeclaration($js);
     return implode("\n", $html);
 }
 /**
  * Internal method to get a JavaScript object notation string from an array
  *
  * @param   array  $array  The array to convert to JavaScript object notation
  *
  * @return  string  JavaScript object notation representation of the array
  *
  * @since   11.1
  * @deprecated  13.3 Use JHtml::getJSObject() instead.
  */
 protected static function _getJSObject($array = array())
 {
     Log::add('JHtmlBehavior::_getJSObject() is deprecated. JHtml::getJSObject() instead..', Log::WARNING, 'deprecated');
     Html::getJSObject($array);
 }
 /**
  * Method to get the field input markup.
  *
  * @return  string   The field input markup.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     // Initialize some field attributes.
     $format = $this->element['format'] ? (string) $this->element['format'] : '%Y-%m-%d';
     // Build the attributes array.
     $attributes = array();
     if ($this->element['size']) {
         $attributes['size'] = (int) $this->element['size'];
     }
     if ($this->element['maxlength']) {
         $attributes['maxlength'] = (int) $this->element['maxlength'];
     }
     if ($this->element['class']) {
         $attributes['class'] = (string) $this->element['class'];
     }
     if ((string) $this->element['readonly'] == 'true') {
         $attributes['readonly'] = 'readonly';
     }
     if ((string) $this->element['disabled'] == 'true') {
         $attributes['disabled'] = 'disabled';
     }
     if ($this->element['onchange']) {
         $attributes['onchange'] = (string) $this->element['onchange'];
     }
     // Handle the special case for "now".
     if (strtoupper($this->value) == 'NOW') {
         $this->value = strftime($format);
     }
     // Get some system objects.
     $config = Factory::getConfig();
     $user = Factory::getUser();
     // If a known filter is given use it.
     switch (strtoupper((string) $this->element['filter'])) {
         case 'SERVER_UTC':
             // Convert a date to UTC based on the server timezone.
             if ((int) $this->value) {
                 // Get a date object based on the correct timezone.
                 $date = Factory::getDate($this->value, 'UTC');
                 $date->setTimezone(new DateTimeZone($config->get('offset')));
                 // Transform the date string.
                 $this->value = $date->format('Y-m-d H:i:s', true, false);
             }
             break;
         case 'USER_UTC':
             // Convert a date to UTC based on the user timezone.
             if ((int) $this->value) {
                 // Get a date object based on the correct timezone.
                 $date = Factory::getDate($this->value, 'UTC');
                 $date->setTimezone(new DateTimeZone($user->getParam('timezone', $config->get('offset'))));
                 // Transform the date string.
                 $this->value = $date->format('Y-m-d H:i:s', true, false);
             }
             break;
     }
     return Html::_('calendar', $this->value, $this->name, $this->id, $format, $attributes);
 }
 /**
  * Creates the HTML for the permissions widget
  *
  * @param   array    $actions   Array of action objects
  * @param   integer  $assetId   Id of a specific asset to  create a widget for.
  * @param   integer  $parent    Id of the parent of the asset
  * @param   string   $control   The form control
  * @param   string   $idPrefix  Prefix for the ids assigned to specific action-group pairs
  *
  * @return  string   HTML for the permissions widget
  *
  * @since   11.1
  *
  * @see     JAccess
  * @see     JFormFieldRules
  */
 public static function assetFormWidget($actions, $assetId = null, $parent = null, $control = 'jform[rules]', $idPrefix = 'jform_rules')
 {
     $images = self::_getImagesArray();
     // Get the user groups.
     $groups = self::_getUserGroups();
     // Get the incoming inherited rules as well as the asset specific rules.
     $inheriting = Access::getAssetRules($parent ? $parent : self::_getParentAssetId($assetId), true);
     $inherited = Access::getAssetRules($assetId, true);
     $rules = Access::getAssetRules($assetId);
     $html = array();
     $html[] = '<div class="acl-options">';
     $html[] = Html::_('tabs.start', 'acl-rules-' . $assetId, array('useCookie' => 1));
     $html[] = Html::_('tabs.panel', Text::_('JLIB_HTML_ACCESS_SUMMARY'), 'summary');
     $html[] = '			<p>' . Text::_('JLIB_HTML_ACCESS_SUMMARY_DESC') . '</p>';
     $html[] = '			<table class="aclsummary-table" summary="' . Text::_('JLIB_HTML_ACCESS_SUMMARY_DESC') . '">';
     $html[] = '			<caption>' . Text::_('JLIB_HTML_ACCESS_SUMMARY_DESC_CAPTION') . '</caption>';
     $html[] = '			<tr>';
     $html[] = '				<th class="col1 hidelabeltxt">' . Text::_('JLIB_RULES_GROUPS') . '</th>';
     foreach ($actions as $i => $action) {
         $html[] = '				<th class="col' . ($i + 2) . '">' . Text::_($action->title) . '</th>';
     }
     $html[] = '			</tr>';
     foreach ($groups as $i => $group) {
         $html[] = '			<tr class="row' . $i % 2 . '">';
         $html[] = '				<td class="col1">' . $group->text . '</td>';
         foreach ($actions as $j => $action) {
             $html[] = '				<td class="col' . ($j + 2) . '">' . ($assetId ? $inherited->allow($action->name, $group->identities) ? $images['allow'] : $images['deny'] : ($inheriting->allow($action->name, $group->identities) ? $images['allow'] : $images['deny'])) . '</td>';
         }
         $html[] = '			</tr>';
     }
     $html[] = ' 		</table>';
     foreach ($actions as $action) {
         $actionTitle = Text::_($action->title);
         $actionDesc = Text::_($action->description);
         $html[] = Html::_('tabs.panel', $actionTitle, $action->name);
         $html[] = '			<p>' . $actionDesc . '</p>';
         $html[] = '			<table class="aclmodify-table" summary="' . strip_tags($actionDesc) . '">';
         $html[] = '			<caption>' . Text::_('JLIB_HTML_ACCESS_MODIFY_DESC_CAPTION_ACL') . ' ' . $actionTitle . ' ' . Text::_('JLIB_HTML_ACCESS_MODIFY_DESC_CAPTION_TABLE') . '</caption>';
         $html[] = '			<tr>';
         $html[] = '				<th class="col1 hidelabeltxt">' . Text::_('JLIB_RULES_GROUP') . '</th>';
         $html[] = '				<th class="col2">' . Text::_('JLIB_RULES_INHERIT') . '</th>';
         $html[] = '				<th class="col3 hidelabeltxt">' . Text::_('JMODIFY') . '</th>';
         $html[] = '				<th class="col4">' . Text::_('JCURRENT') . '</th>';
         $html[] = '			</tr>';
         foreach ($groups as $i => $group) {
             $selected = $rules->allow($action->name, $group->value);
             $html[] = '			<tr class="row' . $i % 2 . '">';
             $html[] = '				<td class="col1">' . $group->text . '</td>';
             $html[] = '				<td class="col2">' . ($inheriting->allow($action->name, $group->identities) ? $images['allow-i'] : $images['deny-i']) . '</td>';
             $html[] = '				<td class="col3">';
             $html[] = '					<select id="' . $idPrefix . '_' . $action->name . '_' . $group->value . '" class="inputbox" size="1" name="' . $control . '[' . $action->name . '][' . $group->value . ']" title="' . Text::sprintf('JLIB_RULES_SELECT_ALLOW_DENY_GROUP', $actionTitle, $group->text) . '">';
             $html[] = '						<option value=""' . ($selected === null ? ' selected="selected"' : '') . '>' . Text::_('JLIB_RULES_INHERIT') . '</option>';
             $html[] = '						<option value="1"' . ($selected === true ? ' selected="selected"' : '') . '>' . Text::_('JLIB_RULES_ALLOWED') . '</option>';
             $html[] = '						<option value="0"' . ($selected === false ? ' selected="selected"' : '') . '>' . Text::_('JLIB_RULES_DENIED') . '</option>';
             $html[] = '					</select>';
             $html[] = '				</td>';
             $html[] = '				<td class="col4">' . ($assetId ? $inherited->allow($action->name, $group->identities) ? $images['allow'] : $images['deny'] : ($inheriting->allow($action->name, $group->identities) ? $images['allow'] : $images['deny'])) . '</td>';
             $html[] = '			</tr>';
         }
         $html[] = '			</table>';
     }
     $html[] = Html::_('tabs.end');
     // Build the footer with legend and special purpose buttons.
     $html[] = '	<div class="clr"></div>';
     $html[] = '	<ul class="acllegend fltlft">';
     $html[] = '		<li class="acl-allowed">' . Text::_('JLIB_RULES_ALLOWED') . '</li>';
     $html[] = '		<li class="acl-denied">' . Text::_('JLIB_RULES_DENIED') . '</li>';
     $html[] = '	</ul>';
     $html[] = '</div>';
     return implode("\n", $html);
 }
 /**
  * Method to extend the truncate method to more complex situations
  *
  * The goal is to get the proper length plain text string with as much of
  * the html intact as possible with all tags properly closed.
  *
  * @param   string   $html       The content of the introtext to be truncated
  * @param   integer  $maxLength  The maximum number of characters to render
  * @param   boolean  $noSplit    Don't split a word if that is where the cutoff occurs (default: true).
  *
  * @return  string  The truncated string. If the string is truncated an ellipsis
  *                  (...) will be appended.
  *
  * @note: If a maximum length of 3 or less is selected and the text has more than
  *        that number of characters an ellipsis will be displayed.
  *        This method will not create valid HTML from malformed HTML.
  *
  * @since   12.2
  */
 public static function truncateComplex($html, $maxLength = 0, $noSplit = true)
 {
     // Start with some basic rules.
     $baseLength = strlen($html);
     // If the original HTML string is shorter than the $maxLength do nothing and return that.
     if ($baseLength <= $maxLength || $maxLength == 0) {
         return $html;
     }
     // Take care of short simple cases.
     if ($maxLength <= 3 && substr($html, 0, 1) != '<' && strpos(substr($html, 0, $maxLength - 1), '<') === false && $baseLength > $maxLength) {
         return '...';
     }
     // Deal with maximum length of 1 where the string starts with a tag.
     if ($maxLength == 1 && substr($html, 0, 1) == '<') {
         $endTagPos = strlen(strstr($html, '>', true));
         $tag = substr($html, 1, $endTagPos);
         $l = $endTagPos + 1;
         if ($noSplit) {
             return substr($html, 0, $l) . '</' . $tag . '...';
         }
         $character = substr(strip_tags($html), 0, 1);
         return substr($html, 0, $l) . '</' . $tag . '...';
     }
     // First get the truncated plain text string. This is the rendered text we want to end up with.
     $ptString = Html::_('string.truncate', $html, $maxLength, $noSplit, $allowHtml = false);
     // It's all HTML, just return it.
     if (strlen($ptString) == 0) {
         return $html;
     }
     // If the plain text is shorter than the max length the variable will not end in ...
     // In that case we use the whole string.
     if (substr($ptString, -3) != '...') {
         return $html;
     }
     // Regular truncate gives us the ellipsis but we want to go back for text and tags.
     if ($ptString == '...') {
         $stripped = substr(strip_tags($html), 0, $maxLength);
         $ptString = Html::_('string.truncate', $stripped, $maxLength, $noSplit, $allowHtml = false);
     }
     // We need to trim the ellipsis that truncate adds.
     $ptString = rtrim($ptString, '.');
     // Now deal with more complex truncation.
     $diffLength = 0;
     while ($maxLength <= $baseLength) {
         // Get the truncated string assuming HTML is allowed.
         $htmlString = Html::_('string.truncate', $html, $maxLength, $noSplit, $allowHtml = true);
         if ($htmlString == '...' && strlen($ptString) + 3 > $maxLength) {
             return $htmlString;
         }
         $htmlString = rtrim($htmlString, '.');
         // Now get the plain text from the HTML string and trim it.
         $htmlStringToPtString = Html::_('string.truncate', $htmlString, $maxLength, $noSplit, $allowHtml = false);
         $htmlStringToPtString = rtrim($htmlStringToPtString, '.');
         // If the new plain text string matches the original plain text string we are done.
         if ($ptString == $htmlStringToPtString) {
             return $htmlString . '...';
         }
         // Get the number of HTML tag characters in the first $maxLength characters
         $diffLength = strlen($ptString) - strlen($htmlStringToPtString);
         if ($diffLength <= 0) {
             return $htmlString . '...';
         }
         // Set new $maxlength that adjusts for the HTML tags
         $maxLength += $diffLength;
     }
 }
 /**
  * Method to create a checked out icon with optional overlib in a grid.
  *
  * @param   object   &$row     The row object
  * @param   boolean  $overlib  True if an overlib with checkout information should be created.
  *
  * @return  string   HTMl for the icon and overlib
  *
  * @since   11.1
  */
 protected static function _checkedOut(&$row, $overlib = true)
 {
     $hover = '';
     if ($overlib) {
         $text = addslashes(htmlspecialchars($row->editor, ENT_COMPAT, 'UTF-8'));
         $date = Html::_('date', $row->checked_out_time, Text::_('DATE_FORMAT_LC1'));
         $time = Html::_('date', $row->checked_out_time, 'H:i');
         $hover = '<span class="editlinktip hasTip" title="' . Text::_('JLIB_HTML_CHECKED_OUT') . '::' . $text . '<br />' . $date . '<br />' . $time . '">';
     }
     $checked = $hover . Html::_('image', 'admin/checked_out.png', null, null, true) . '</span>';
     return $checked;
 }
 /**
  * Displays a Select list of the available asset groups
  *
  * @param   string  $name      The name of the select element
  * @param   mixed   $selected  The selected asset group id
  * @param   string  $attribs   Optional attributes for the select field
  * @param   array   $config    An array of options for the control
  *
  * @return  mixed  An HTML string or null if an error occurs
  *
  * @since   11.1
  */
 public static function assetgrouplist($name, $selected, $attribs = null, $config = array())
 {
     static $count;
     $options = self::assetgroups();
     if (isset($config['title'])) {
         array_unshift($options, Html::_('select.option', '', $config['title']));
     }
     return Html::_('select.genericlist', $options, $name, array('id' => isset($config['id']) ? $config['id'] : 'assetgroups_' . ++$count, 'list.attr' => is_null($attribs) ? 'class="inputbox" size="3"' : $attribs, 'list.select' => (int) $selected));
 }
 /**
  * Load the JavaScript behavior.
  *
  * @param   string  $group   The pane identifier.
  * @param   array   $params  Array of options.
  *
  * @return  void
  *
  * @since   11.1
  */
 protected static function _loadBehavior($group, $params = array())
 {
     static $loaded = array();
     if (!array_key_exists($group, $loaded)) {
         // Get the JInput object
         $input = Factory::getApplication()->input;
         $loaded[$group] = true;
         // Include mootools framework.
         Html::_('behavior.framework', true);
         $document = Factory::getDocument();
         $display = isset($params['startOffset']) && isset($params['startTransition']) && $params['startTransition'] ? (int) $params['startOffset'] : null;
         $show = isset($params['startOffset']) && !(isset($params['startTransition']) && $params['startTransition']) ? (int) $params['startOffset'] : null;
         $opt['onActive'] = "\\function(toggler, i) {toggler.addClass('pane-toggler-down');" . "toggler.removeClass('pane-toggler');i.addClass('pane-down');i.removeClass('pane-hide');Cookie.write('jpanesliders_" . $group . "',\$\$('div#" . $group . ".pane-sliders > .panel > h3').indexOf(toggler));}";
         $opt['onBackground'] = "\\function(toggler, i) {toggler.addClass('pane-toggler');" . "toggler.removeClass('pane-toggler-down');i.addClass('pane-hide');i.removeClass('pane-down');if(\$\$('div#" . $group . ".pane-sliders > .panel > h3').length==\$\$('div#" . $group . ".pane-sliders > .panel > h3.pane-toggler').length) Cookie.write('jpanesliders_" . $group . "',-1);}";
         $opt['duration'] = isset($params['duration']) ? (int) $params['duration'] : 300;
         $opt['display'] = isset($params['useCookie']) && $params['useCookie'] ? $input->cookie->get('jpanesliders_' . $group, $display, 'integer') : $display;
         $opt['show'] = isset($params['useCookie']) && $params['useCookie'] ? $input->cookie->get('jpanesliders_' . $group, $show, 'integer') : $show;
         $opt['opacity'] = isset($params['opacityTransition']) && $params['opacityTransition'] ? 'true' : 'false';
         $opt['alwaysHide'] = isset($params['allowAllClose']) && !$params['allowAllClose'] ? 'false' : 'true';
         $options = Html::getJSObject($opt);
         $js = "window.addEvent('domready', function(){ new Fx.Accordion(\$\$('div#" . $group . ".pane-sliders > .panel > h3.pane-toggler'), \$\$('div#" . $group . ".pane-sliders > .panel > div.pane-slider'), " . $options . "); });";
         $document->addScriptDeclaration($js);
     }
 }
 /**
  * Method to get the field input markup fora grouped list.
  * Multiselect is enabled by using the multiple attribute.
  *
  * @return  string  The field input markup.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     $html = array();
     $attr = '';
     // Initialize some field attributes.
     $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
     $attr .= (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
     $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     $attr .= $this->multiple ? ' multiple="multiple"' : '';
     // Initialize JavaScript field attributes.
     $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
     // Get the field groups.
     $groups = (array) $this->getGroups();
     // Create a read-only list (no name) with a hidden input to store the value.
     if ((string) $this->element['readonly'] == 'true') {
         $html[] = Html::_('select.groupedlist', $groups, null, array('list.attr' => $attr, 'id' => $this->id, 'list.select' => $this->value, 'group.items' => null, 'option.key.toHtml' => false, 'option.text.toHtml' => false));
         $html[] = '<input type="hidden" name="' . $this->name . '" value="' . $this->value . '"/>';
     } else {
         $html[] = Html::_('select.groupedlist', $groups, $this->name, array('list.attr' => $attr, 'id' => $this->id, 'list.select' => $this->value, 'group.items' => null, 'option.key.toHtml' => false, 'option.text.toHtml' => false));
     }
     return implode($html);
 }
 /**
  * Generates a selection list of integers.
  *
  * @param   integer  $start     The start integer
  * @param   integer  $end       The end integer
  * @param   integer  $inc       The increment
  * @param   string   $name      The value of the HTML name attribute
  * @param   mixed    $attribs   Additional HTML attributes for the <select> tag, an array of
  *                              attributes, or an array of options. Treated as options if it is the last
  *                              argument passed.
  * @param   mixed    $selected  The key that is selected
  * @param   string   $format    The printf format to be applied to the number
  *
  * @return  string   HTML for the select list
  *
  * @since    11.1
  */
 public static function integerlist($start, $end, $inc, $name, $attribs = null, $selected = null, $format = '')
 {
     // Set default options
     $options = array_merge(Html::$formatOptions, array('format.depth' => 0, 'option.format' => '', 'id' => null));
     if (is_array($attribs) && func_num_args() == 5) {
         // Assume we have an options array
         $options = array_merge($options, $attribs);
         // Extract the format and remove it from downstream options
         $format = $options['option.format'];
         unset($options['option.format']);
     } else {
         // Get options from the parameters
         $options['list.attr'] = $attribs;
         $options['list.select'] = $selected;
     }
     $start = (int) $start;
     $end = (int) $end;
     $inc = (int) $inc;
     $data = array();
     for ($i = $start; $i <= $end; $i += $inc) {
         $data[$i] = $format ? sprintf($format, $i) : $i;
     }
     // Tell genericlist() to use array keys
     $options['option.key'] = null;
     return Html::_('select.genericlist', $data, $name, $options);
 }
 /**
  * Returns a checked-out icon
  *
  * @param   integer       $i           The row index.
  * @param   string        $editorName  The name of the editor.
  * @param   string        $time        The time that the object was checked out.
  * @param   string|array  $prefix      An optional task prefix or an array of options
  * @param   boolean       $enabled     True to enable the action.
  * @param   string        $checkbox    An optional prefix for checkboxes.
  *
  * @return  string  The required HTML.
  *
  * @since   11.1
  */
 public static function checkedout($i, $editorName, $time, $prefix = '', $enabled = false, $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'] : '';
     }
     $text = addslashes(htmlspecialchars($editorName, ENT_COMPAT, 'UTF-8'));
     $date = addslashes(htmlspecialchars(Html::_('date', $time, Text::_('DATE_FORMAT_LC')), ENT_COMPAT, 'UTF-8'));
     $time = addslashes(htmlspecialchars(Html::_('date', $time, 'H:i'), ENT_COMPAT, 'UTF-8'));
     $active_title = Text::_('JLIB_HTML_CHECKIN') . '::' . $text . '<br />' . $date . '<br />' . $time;
     $inactive_title = Text::_('JLIB_HTML_CHECKED_OUT') . '::' . $text . '<br />' . $date . '<br />' . $time;
     return self::action($i, 'checkin', $prefix, Text::_('JLIB_HTML_CHECKED_OUT'), $active_title, $inactive_title, true, 'checkedout', 'checkedout', $enabled, false, $checkbox);
 }
 /**
  * Select list of positions - generally used for location of images
  *
  * @param   string   $name        Name of the field
  * @param   string   $active      The active value
  * @param   string   $javascript  Alternative javascript
  * @param   boolean  $none        Null if not assigned
  * @param   boolean  $center      Null if not assigned
  * @param   boolean  $left        Null if not assigned
  * @param   boolean  $right       Null if not assigned
  * @param   boolean  $id          Null if not assigned
  *
  * @return  array  The positions
  *
  * @since   11.1
  */
 public static function positions($name, $active = null, $javascript = null, $none = true, $center = true, $left = true, $right = true, $id = false)
 {
     $pos = array();
     if ($none) {
         $pos[''] = Text::_('JNONE');
     }
     if ($center) {
         $pos['center'] = Text::_('JGLOBAL_CENTER');
     }
     if ($left) {
         $pos['left'] = Text::_('JGLOBAL_LEFT');
     }
     if ($right) {
         $pos['right'] = Text::_('JGLOBAL_RIGHT');
     }
     $positions = Html::_('select.genericlist', $pos, $name, array('id' => $id, 'list.attr' => 'class="inputbox" size="1"' . $javascript, 'list.select' => $active, 'option.key' => null));
     return $positions;
 }
 /**
  * Return the icon to move an item DOWN.
  *
  * @param   integer  $i          The row index.
  * @param   integer  $n          The number of items in the list.
  * @param   boolean  $condition  True to show the icon.
  * @param   string   $task       The task to fire.
  * @param   string   $alt        The image alternative text string.
  * @param   boolean  $enabled    An optional setting for access control on the action.
  * @param   string   $checkbox   An optional prefix for checkboxes.
  *
  * @return  string   Either the icon to move an item down or a space.
  *
  * @since   11.1
  */
 public function orderDownIcon($i, $n, $condition = true, $task = 'orderdown', $alt = 'JLIB_HTML_MOVE_DOWN', $enabled = true, $checkbox = 'cb')
 {
     if (($i < $n - 1 || $i + $this->limitstart < $this->total - 1) && $condition) {
         return Html::_('jgrid.orderDown', $i, $task, '', $alt, $enabled, $checkbox);
     } else {
         return '&#160;';
     }
 }