getUsername();
$userId = $user->getId();
$this->links = array();
$this->addLink( "$this->codePath/index.php", "Main Page" );
$this->addLink( "$this->codePath/home.php", "Home" );
$this->addLink( "$this->codePath/changePass.php", "Change password" );
$this->addLink("$this->codePath/addPicture.php", "Add a picture");
//$this->addLink("$this->codePath/addMovie.php", "Add movie (TODO)");
//$this->addLink("$this->codePath/addGame.php", "Add game (TODO)");
//$this->addLink("$this->codePath/addFlash.php", "Add flash movie (TODO)");
// TODO: UPDATE THESE LINKS AS MORE AND MORE FUNCTIONALITY GETS PORTED.
// $this->addLink( "$this->codePath/".$username, "View/Edit Your Page" );
// $this->addLink("$this->codePath/myIcons.php", "Change Profile Picture");
// $friendRequests = simpleQuery("SELECT COUNT(*) FROM friendRequests WHERE friend_id='$userId' AND isResolved='0'");
// $suffix = ($friendRequests==0?"":" ($friendRequests)");
// $this->addLink("$this->codePath/friends.php", "Friends$suffix");
// $numUnread = simpleQuery("SELECT COUNT(*) FROM messages WHERE toUser='$username' AND beenRead='0'");
// $suffix = ($numUnread==0?"":" ($numUnread)");
// $this->addLink("$this->codePath/mailbox.php", "Messages$suffix"); // TODO: Maybe keep the mailbox for private messages, but in general, OffhandWay should use user profile pages with walls for most communication.
$this->addLink("$this->codePath/albumMaker.php", "Upload pictures");
// $this->addLink("$this->codePath/promote.php", "Promote Yourself");
// $this->addLink("$this->codePath/prefs.php", "User preferences");
// $this->addLink("$this->codePath/account.php", "Account Options" );
// TODO: Finish porting the sub-pages.
if($user->isAdmin()){
$this->addLink("$this->codePath/admin/admin_members.php", "Staff Management Page");
$this->addLink("$this->codePath/admin/admin_talbots.php", "Additional Admin Tools");
// TODO: These are mad strict compared to the way things work now (ie: no logos), and being on a separate page, they'll probably never get read. Make sure to put rough guidelines somewhere else and just link to these for more details.
// TODO: Also, have a quick summary version that can be javascript-revelaed with a link to the full version. A very quick bulleted list should make it clear for all except extremely rare edge-cases.
$this->addLink("$this->codePath/guidelines.php", "Guidelines for posting");
$this->addLink("$this->codePath/admin_switchUser.php", "Switch User");
// $this->addLink("$this->codePath/adminTools.php", "Admin Tools"); // TODO: Roll all other admin links into the Admin Tools page.
// $this->addLink("$this->codePath/stats.php", "Stats (WARNING: pwns server)");
}
$binding = '';
$subMenu = UserLinksModule::getSubMenu($_SERVER['PHP_SELF'], $binding);
if(count($subMenu) > 0){
parent::addSubMenu($binding, $subMenu);
}
}
////
// If the current page has a sub-menu, this will return the array of
// sub-pages.
////
function getSubMenu($pageKey, &$binding=''){
// Code-path must be put in the link explicitly to allow for the flexibility of NOT using the codePath if desired.
$subMenus = array(
"$this->codePath/albumMaker.php" => array(
"$this->codePath/albumMaker.php" => "Create Album",
"$this->codePath/albumMaker.php?step=2" => "Add Photos",
"$this->codePath/albumMaker.php?step=3" => "Make Captions",
"$this->codePath/albumViewer.php?".PARAM_USERNAME."=".getUser()->getUsername() => "View Albums"
),
);
$pageKey = str_replace(" ", "%20", $pageKey);
$retVal = getVal($subMenus, $pageKey, array());
// If this isn't the root page, see if it's a subpage.
if(count($retVal) == 0){
foreach($subMenus as $menuKey=>$currMenu){
foreach($currMenu as $subKey=>$subVal){
if($pageKey == $subKey){
$binding = $menuKey; // what the root menu will be
$retVal = $currMenu;
break; // optional, just faster
}
}
}
} else {
$binding = $pageKey;
}
return $retVal;
}
} // end class UserLinksModule
?>