Example #1
0
function file_pagesetup()
{
    // register links --
    global $profile_id;
    global $PAGE;
    global $CFG;
    global $metatags;
    require_once dirname(__FILE__) . "/lib/file_config.php";
    $page_owner = $profile_id;
    if (isloggedin()) {
        if (defined("context") && context == "files" && $page_owner == $_SESSION['userid']) {
            $PAGE->menu[] = array('name' => 'files', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/files/\" class=\"selected\" >" . __gettext("Photos") . '</a></li>');
        } else {
            $PAGE->menu[] = array('name' => 'files', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/files/\" >" . __gettext("Photos") . '</a></li>');
        }
    }
    if (defined("context") && context == "files") {
        $files_username = user_info('username', $page_owner);
        if ($page_owner != -1) {
            if ($page_owner == $_SESSION['userid'] && $page_owner != -1) {
                $PAGE->menu_sub[] = array('name' => 'file:rss', 'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/files/rss/"><img src="' . $CFG->wwwroot . 'mod/template/icons/rss.png" border="0" alt="rss" /></a>');
            }
        }
        if ($page_owner == $_SESSION['userid'] && $page_owner != -1) {
            $PAGE->menu_sub[] = array('name' => 'file:add', 'html' => a_href("{$CFG->wwwroot}{$_SESSION['username']}/files/addphoto", __gettext("Add a Photo")));
        }
        if ($page_owner == $_SESSION['userid'] && $page_owner != -1) {
            $PAGE->menu_sub[] = array('name' => 'file:add', 'html' => a_href("{$CFG->wwwroot}{$_SESSION['username']}/files/addfolder", __gettext("Add a folder")));
        }
    }
    // Adding the file's selector wizard
    $options = array('options' => 'width=600,height=300,left=20,top=20,scrollbars=yes,resizable=yes', 'name' => 'mediapopup', 'url' => $CFG->wwwroot . "mod/file/file_include_wizard.php?owner=" . page_owner());
    add_content_tool_button("mediapopup", __gettext("Add File"), "image.png", "f", $options);
}
Example #2
0
/**
 * contenttoolbar_init
 * 
 * It adds to $CFG the contenttoolbar_icons property 
 * 
 * @uses $CFG 
 * @uses $function
 */
function contenttoolbar_init()
{
    global $CFG, $function;
    $CFG->contenttoolbar_icons = false;
    $CFG->allowobjectembed = true;
    require_once dirname(__FILE__) . "/lib/contenttoolbar_functions.php";
    // Content toolbar
    $function["display:content:toolbar"][] = $CFG->dirroot . "mod/contenttoolbar/lib/contenttoolbar_init.php";
    // Weblog text processing
    $function["video:text:process"][] = $CFG->dirroot . "mod/contenttoolbar/lib/contenttoolbar_text_processing.php";
    if ($CFG->allowobjectembed) {
        adjust_allowed_tags();
        // Adding widgets
        $CFG->widgets->list[] = array('name' => __gettext("Video widget"), 'description' => __gettext("Displays a video of your choice."), 'type' => "contenttoolbar::video");
    }
    // Addding the external video button
    $options = array('options' => 'width=400,height=300,left=20,top=20,scrollbars=yes,resizable=yes', 'name' => 'mediapopup', 'url' => $CFG->wwwroot . "mod/contenttoolbar/contenttoolbar_video_wizard.php");
    add_content_tool_button("mediapopup", __gettext("Add External video"), "image.png", "v", $options);
}