Example #1
0
 function setUp()
 {
     parent::setUp();
     require_code('menus2');
     $this->menu_id = add_menu_item('Test', 1, NULL, 'testing menu', 'www.ocportal.com', 1, 'downloads', 0, 1, 'testing');
     // Test the forum was actually created
     $this->assertTrue('Test' == $GLOBALS['SITE_DB']->query_value('menu_items', 'i_menu', array('id' => $this->menu_id)));
 }
Example #2
0
function xml_to_menu($menu_name, $menus_xml)
{
    $html = "";
    $html .= "<hr style=\"clear: both;\"/>";
    $html .= "<ul class=\"Smaller_Left_Padding Smaller_Top_Margin\">";
    foreach ($menus_xml->{$menu_name}->children() as $key => $value) {
        $html .= add_menu_item($value) . "\n";
    }
    $html .= "</ul>";
    return $html;
}
function modgearmanxi_component_addmenu($arg = null)
{
    global $modgearmanxi_component_name;
    $urlbase = get_component_url_base($modgearmanxi_component_name);
    $mi = find_menu_item(MENU_ADMIN, "menu-admin-managesystemconfig", "id");
    if ($mi == null) {
        return;
    }
    $order = grab_array_var($mi, "order", "");
    if ($order == "") {
        return;
    }
    $neworder = $order + 1;
    add_menu_item(MENU_ADMIN, array("type" => "link", "title" => "ModGearman XI Manager", "id" => "menu-admin-modgearmanxi", "order" => $neworder, "opts" => array("href" => $urlbase . "/modgearmanxi.php")));
}
Example #4
0
function bpi_component_addmenu($arg = null)
{
    global $bpi_component_name;
    $urlbase = get_component_url_base($bpi_component_name);
    $mi = find_menu_item(MENU_HOME, "menu-home-servicegroupgrid", "id");
    if ($mi == null) {
        return;
    }
    $order = grab_array_var($mi, "order", "");
    if ($order == "") {
        return;
    }
    $neworder = $order + 0.1;
    add_menu_item(MENU_HOME, array("type" => "linkspacer", "title" => "", "id" => "menu-home-bpa_spacer", "order" => $neworder, "opts" => array()));
    $neworder = $neworder + 0.1;
    add_menu_item(MENU_HOME, array("type" => "link", "title" => "Nagios BPI", "id" => "menu-home-bpi", "order" => $neworder, "opts" => array("href" => $urlbase . "/index.php")));
}
function add_menu_items($name, $items)
{
    if (is_array($items)) {
        foreach ($items as $item) {
            add_menu_item($name, $item);
        }
    }
}
Example #6
0
 /**
  * Setting other things
  */
 function setting_other_things()
 {
     global $userquery, $Cbucket;
     // Search type
     if (isSectionEnabled('photos')) {
         $Cbucket->search_types['photos'] = "cbphoto";
     }
     // My account links
     $accountLinks = array();
     $accountLinks = array(lang('manage_photos') => "manage_photos.php", lang('manage_favorite_photos') => "manage_photos.php?mode=favorite", lang('Manage Avatars') => "manage_photos.php?mode=avatars", lang('manage_my_album') => "manage_photos.php?mode=my_album");
     if (isSectionEnabled('photos')) {
         $userquery->user_account[lang('Photos')] = $accountLinks;
     }
     //Setting Cbucket links
     $Cbucket->links['photos'] = array('photos.php', 'photos/');
     $Cbucket->links['manage_photos'] = array('manage_photos.php', 'manage_photos.php');
     $Cbucket->links['edit_photo'] = array('edit_photo.php?photo=', 'edit_photo.php?photo=');
     $Cbucket->links['photo_upload'] = array('photo_upload.php', 'photo_upload');
     $Cbucket->links['manage_favorite_photos'] = array('manage_photos.php?mode=favorite', 'manage_photos.php?mode=favorite');
     $Cbucket->links['manage_orphan_photos'] = array('manage_photos.php?mode=orphan', 'manage_photos.php?mode=orphan');
     $Cbucket->links['user_photos'] = array('user_content.php?object_group=content&object=photos&user='******'user_content.php?object_group=content&object=photos&user='******'user_fav_photos'] = array('user_content.php?object_group=content&object=photos&content_type=favorite&user='******'user_content.php?object_group=content&object=photos&content_type=favorite&user='******'navigation', lang('Photos'), cblink(array("name" => "photos")), "photos", "icon-picture icon-white");
     // Adding photo upload options
     register_upload_option(array('object' => 'photos', 'title' => lang('Upload from computer'), 'description' => lang('Upload photos from your computer. Supported formats are <i>' . implode(', ', $this->exts) . '</i>'), 'function' => 'load_photo_plupload_block'));
     $plupload_js_files = array(MODULES_URL . '/uploader/plupload/plupload.js', MODULES_URL . '/uploader/plupload/plupload.html5.js', MODULES_URL . '/uploader/plupload/plupload.flash.js');
     add_js($plupload_js_files, 'photo_upload');
 }
Example #7
0
/**
 * Add a menu item, without giving tedious/unnecessary detail.
 *
 * @param  SHORT_TEXT	The name of the menu to add the item to.
 * @param  ?mixed			The menu item ID of the parent branch of the menu item (AUTO_LINK) / the URL of something else on the same menu (URLPATH) (NULL: is on root).
 * @param  SHORT_TEXT	The caption.
 * @param  SHORT_TEXT	The URL (in entry point form).
 * @param  BINARY			Whether it is an expanded branch.
 * @param  BINARY			Whether people who may not view the entry point do not see the link.
 * @param  boolean		Whether the caption is a language code.
 * @param  SHORT_TEXT	The tooltip (blank: none).
 * @param  BINARY			Whether the link will open in a new window.
 * @return AUTO_LINK		The ID of the newly added menu item.
 */
function add_menu_item_simple($menu, $parent, $caption, $url = '', $expanded = 0, $check_permissions = 0, $dereference_caption = true, $caption_long = '', $new_window = 0)
{
    global $ADD_MENU_COUNTER;
    $id = $GLOBALS['SITE_DB']->query_value_null_ok('menu_items', 'id', array('i_url' => $url, 'i_menu' => $menu));
    if (!is_null($id)) {
        return $id;
    }
    // Already exists
    if (is_string($parent)) {
        $parent = $GLOBALS['SITE_DB']->query_value_null_ok('menu_items', 'i_parent', array('i_url' => $parent));
    }
    $_caption = strpos($caption, ':') === false ? do_lang($caption, NULL, NULL, NULL, NULL, false) : NULL;
    if (is_null($_caption)) {
        $_caption = $caption;
    }
    $id = add_menu_item($menu, $ADD_MENU_COUNTER, $parent, $dereference_caption ? $_caption : $caption, $url, $check_permissions, '', $expanded, $new_window, $caption_long);
    $ADD_MENU_COUNTER++;
    return $id;
}