Exemplo n.º 1
0
function profile_pagesetup()
{
    // register links --
    global $profile_id;
    global $PAGE;
    global $CFG;
    // don't clobber $page_owner, use a
    // local $pgowner instead for clarity
    $pgowner = $profile_id;
    if (isloggedin()) {
        if (defined("context") && context == "profile" && $pgowner == $_SESSION['userid']) {
            $PAGE->menu[] = array('name' => 'profile', 'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/profile/" class="selected">' . __gettext("Profile") . '</a></li>');
        } else {
            $PAGE->menu[] = array('name' => 'profile', 'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/profile/">' . __gettext("Profile") . '</a></li>');
        }
        if (profile_permissions_check("profile") && defined("context") && context == "profile") {
            if (user_type($pgowner) == "person") {
                $PAGE->menu_sub[] = array('name' => 'profile:edit', 'html' => '<a href="' . $CFG->wwwroot . 'profile/edit.php?profile_id=' . $pgowner . '">' . __gettext("Edit this profile") . '</a>');
                $PAGE->menu_sub[] = array('name' => 'profile:picedit', 'html' => '<a href="' . $CFG->wwwroot . '_icons/?context=profile&amp;profile_id=' . $pgowner . '">' . __gettext("Change site picture") . '</a>');
                if (!empty($CFG->uses_YUI)) {
                    $PAGE->menu_sub[] = array('name' => 'profile:widget:manage', 'html' => '<a href="' . $CFG->wwwroot . 'mod/widget/manage_widgets.php">' . __gettext("Manage widgets") . '</a>');
                }
                /*else {
                			$PAGE->menu_sub[] = array (
                				'name' => 'profile:widget:add',
                				'html' => '<a href="' . $CFG->wwwroot . 'mod/profile/add.php?owner=' . $pgowner . '">' . __gettext("Add widget") . '</a>');
                		}*/
            }
        }
    }
    $PAGE->search_menu[] = array('name' => __gettext("People"), 'user_type' => 'person');
}
Exemplo n.º 2
0
function messages_pagesetup()
{
    // register links --
    global $profile_id, $PAGE, $CFG, $metatags, $function, $USER;
    $pgowner = $profile_id;
    require_once $CFG->dirroot . "mod/messages/lib/messages_config.php";
    require_once $CFG->dirroot . "mod/messages/default_template.php";
    if (isloggedin() && user_info("user_type", $_SESSION['userid']) != "external") {
        // Add the JavaScript functions
        // Lose the trailing slash
        $url = substr($CFG->wwwroot, 0, -1);
        $metatags .= "<script language=\"javascript\" type=\"text/javascript\" src=\"{$url}/mod/messages/messages.js\"></script>";
        $metatags .= "<link rel=\"stylesheet\" href=\"" . $CFG->wwwroot . "mod/messages/css.css\" type=\"text/css\" media=\"screen\" />";
        $messages = count_records_select('messages', 'to_id=' . $USER->ident . " AND status='unread'");
        if (defined("context") && context == "messages" && $pgowner == $_SESSION['userid']) {
            $PAGE->menu[] = array('name' => 'messages', 'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/" class="selected">' . __gettext("Messages") . " ({$messages})" . '</a></li>');
        } else {
            $PAGE->menu[] = array('name' => 'messages', 'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/">' . __gettext("Messages") . " ({$messages})" . '</a></li>');
        }
        if (profile_permissions_check("profile") && defined("context") && context == "messages") {
            if (user_type($pgowner) == "person") {
                $PAGE->menu_sub[] = array('name' => 'messages:list', 'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/">' . __gettext("View Messages") . '</a>');
                $PAGE->menu_sub[] = array('name' => 'messages:compose', 'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/compose">' . __gettext("Compose") . '</a>');
                $PAGE->menu_sub[] = array('name' => 'messages:sent', 'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/sent">' . __gettext("Sent Messages") . '</a>');
            }
        }
    }
}
Exemplo n.º 3
0
function profile_pagesetup()
{
    // register links --
    global $profile_id;
    global $PAGE;
    global $CFG;
    // don't clobber $page_owner, use a
    // local $pgowner instead for clarity
    $pgowner = $profile_id;
    if (isloggedin()) {
        if (defined("context") && context == "profile" && $pgowner == $_SESSION['userid']) {
            $PAGE->menu[] = array('name' => 'profile:me', 'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '" class="selected">' . gettext("Your Profile") . '</a></li>');
        } else {
            $PAGE->menu[] = array('name' => 'profile:me', 'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '">' . gettext("Your Profile") . '</a></li>');
        }
        if (profile_permissions_check("profile") && defined("context") && context == "profile") {
            if (run("users:type:get", $pgowner) == "person") {
                $PAGE->menu_sub[] = array('name' => 'profile:edit', 'html' => '<a href="' . $CFG->wwwroot . 'profile/edit.php?profile_id=' . $pgowner . '">' . gettext("Edit this profile") . '</a>');
                $PAGE->menu_sub[] = array('name' => 'profile:picedit', 'html' => '<a href="' . $CFG->wwwroot . '_icons/?context=profile&amp;profile_id=' . $pgowner . '">' . gettext("Change site picture") . '</a>');
            }
            $PAGE->menu_sub[] = array('name' => 'profile:help', 'html' => '<a href="' . $CFG->wwwroot . 'help/profile_help.php">' . gettext("Page help") . '</a>');
        }
    }
}