API16

JHtmlAccess/actions

From Joomla! Documentation

< API16:JHtmlAccess
Revision as of 17:34, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Returns a UL list of user groups with check boxes <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JHtmlAccess/actions|Edit Descript...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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.

Description[edit]

Returns a UL list of user groups with check boxes

[Edit Descripton]

Template:Description:JHtmlAccess/actions

Syntax[edit]

static actions($name, $selected, $component, $section= 'global')
Parameter Name Default Value Description
$name $name The name of the checkbox controls array
$selected $selected An array of the checked boxes
$component
$section 'global'

Returns[edit]

string

Defined in[edit]

libraries/joomla/html/html/access.php

Importing[edit]

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

Source Body[edit]

public static function actions($name, $selected, $component, $section = 'global')
{
        static $count;

        $count++;

        $actions        = JAccess::getActions($component, $section);

        $html           = array();
        $html[]         = '<ul class="checklist access-actions">';

        for ($i=0, $n=count($actions); $i < $n; $i++) {
                $item = &$actions[$i];

                // Setup  the variable attributes.
                $eid = $count.'action_'.$item->id;
                $checked = in_array($item->id, $selected) ? ' checked="checked"' : '';

                // Build the HTML for the item.
                $html[] = '     <li>';
                $html[] = '             <input type="checkbox" name="'.$name.'[]" value="'.$item->id.'" id="'.$eid.'"';
                $html[] = '                     '.$checked.' />';
                $html[] = '             <label for="'.$eid.'">';
                $html[] = '                     '.JText::_($item->title);
                $html[] = '             </label>';
                $html[] = '     </li>';
        }
        $html[] = '</ul>';

        return implode("\n", $html);
}

[Edit See Also] Template:SeeAlso:JHtmlAccess/actions

Examples[edit]

<CodeExamplesForm />