Example #1
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);
}
Example #2
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);
}
Example #3
0
 /**
  * Select list of menus
  * @param string The control name
  * @param string Additional javascript
  * @return string A select list
  */
 function MenuSelect($name = 'menuselect', $javascript = NULL)
 {
     global $database;
     $query = "SELECT params" . "\n FROM #__modules" . "\n WHERE module = 'mod_mainmenu'";
     $database->setQuery($query);
     $menus = $database->loadObjectList();
     $total = count($menus);
     $menuselect = array();
     for ($i = 0; $i < $total; $i++) {
         $params = mosParseParams($menus[$i]->params);
         $menuselect[$i]->value = $params->menutype;
         $menuselect[$i]->text = $params->menutype;
     }
     // sort array of objects
     SortArrayObjects($menuselect, 'text', 1);
     $menus = mosHTML::selectList($menuselect, $name, 'class="inputbox" size="10" ' . $javascript, 'value', 'text');
     return $menus;
 }