Ejemplo n.º 1
0
/**
* Displays a selection list for menu item types
*/
function addMenuItem(&$cid, $menutype, $option)
{
    global $database, $mosConfig_absolute_path;
    $types = array();
    $dirs = mosReadDirectory($mosConfig_absolute_path . '/administrator/components/com_menus');
    foreach ($dirs as $dir) {
        $dir = $mosConfig_absolute_path . '/administrator/components/com_menus/' . $dir;
        if (is_dir($dir)) {
            $files = mosReadDirectory($dir, ".\\.menu\\.php\$");
            foreach ($files as $file) {
                require_once "{$dir}/{$file}";
            }
        }
    }
    // renames menu names
    $i = 0;
    foreach ($types as $type) {
        $text = RenameMenu($type->value);
        $types[$i]->text = $text;
        $i++;
    }
    // sort array of objects
    SortArrayObjects($types, 'text', 1);
    $lists['select'] = mosHTML::selectList($types, 'type', 'class="inputbox" size="20"', 'value', 'text');
    HTML_menusections::addMenuItem($cid, $lists, $menutype, $option);
}
Ejemplo n.º 2
0
/**
* Displays a selection list for menu item types
*/
function addMenuItem(&$cid, $menutype, $option, $task)
{
    global $mosConfig_absolute_path;
    $types = array();
    // list of directories
    $dirs = mosReadDirectory($mosConfig_absolute_path . '/administrator/components/com_menus');
    // load files for menu types
    foreach ($dirs as $dir) {
        // needed within menu type .php files
        $type = $dir;
        $dir = $mosConfig_absolute_path . '/administrator/components/com_menus/' . $dir;
        if (is_dir($dir)) {
            $files = mosReadDirectory($dir, ".\\.menu\\.php\$");
            foreach ($files as $file) {
                require_once "{$dir}/{$file}";
                // type of menu type
                $types[]->type = $type;
            }
        }
    }
    $i = 0;
    foreach ($types as $type) {
        // pulls name and description from menu type xml
        $row = ReadMenuXML($type->type);
        $types[$i]->name = $row[0];
        $types[$i]->descrip = $row[1];
        $types[$i]->group = $row[2];
        $i++;
    }
    // sort array of objects alphabetically by name of menu type
    SortArrayObjects($types, 'name', 1);
    // split into Content
    $i = 0;
    foreach ($types as $type) {
        if (strstr($type->group, 'Content')) {
            $types_content[] = $types[$i];
        }
        $i++;
    }
    // split into Links
    $i = 0;
    foreach ($types as $type) {
        if (strstr($type->group, 'Link')) {
            $types_link[] = $types[$i];
        }
        $i++;
    }
    // split into Component
    $i = 0;
    foreach ($types as $type) {
        if (strstr($type->group, 'Component')) {
            $types_component[] = $types[$i];
        }
        $i++;
    }
    // split into Other
    $i = 0;
    foreach ($types as $type) {
        if (strstr($type->group, 'Other') || !$type->group) {
            $types_other[] = $types[$i];
        }
        $i++;
    }
    HTML_menusections::addMenuItem($cid, $menutype, $option, $types_content, $types_component, $types_link, $types_other);
}