Beispiel #1
0
 private function getNavigationHTML()
 {
     $login = $this->getLoginInfo();
     $text = "<div class=\"logininfo\">{$login}</div>";
     if ($this->modal) {
         return $text;
     }
     $level = Session::defaultPosition();
     global $GLOBAL_NAVIGATION;
     $name = Server::currentPageName();
     foreach ($GLOBAL_NAVIGATION as $link => $array) {
         $disp = $array[0];
         $imageFile = "images/nav/" . substr($link, 0, -4) . ".png";
         if (file_exists(realpath($imageFile))) {
             $imageHtml = "<img class=\"largeicon\" src=\"{$imageFile}\" />&nbsp;";
         } else {
             $imageHtml = '';
         }
         if ($level >= $array[1]) {
             if ($link == $name) {
                 $text .= "<a class=navsel href=\"{$link}\">";
             } else {
                 $text .= "<a class=nav href=\"{$link}\">";
             }
             $text .= $imageHtml . $disp . "</a>";
         }
     }
     return $text;
 }
Beispiel #2
0
 public static function initialize()
 {
     session_start();
     self::$sunetid = self::getWebAuthUserID();
     self::$defaultPosition = POSITION_NONE;
     if (self::$sunetid) {
         self::$person = Person::getPersonBySUNetID(self::$sunetid);
         if (self::$person) {
             self::$defaultPosition = POSITION_ACCOUNT;
             self::$team = self::$person->getTeam();
             if (self::$team) {
                 self::$defaultPosition = POSITION_PLAYER;
             }
             if (self::$person->isAdmin()) {
                 self::$defaultPosition = POSITION_ADMIN;
             }
         }
     }
 }
Beispiel #3
0
<?php

/**
 * @author Matt Bush
 * (c) 2011 Stanford CS198 program. All rights reserved.
 */
ini_set('include_path', ini_get('include_path') . ':./php/data:./php/ui:./php/misc');
require_once 'Session.php';
require_once 'Person.php';
require_once 'ChallengeWinner.php';
require_once 'Challenge.php';
require_once 'UIPage.php';
require_once 'UIForm.php';
// SETUP/CONTEXT
$action = null;
$position = Session::defaultPosition();
if (key_exists('new', $_POST) && $position >= POSITION_ADMIN) {
    $challenge_name = $_POST['name'];
    $challenge_points = $_POST['points'];
    $challenge_code = $_POST['code'] ? $_POST['code'] : null;
    $action = 'new';
} else {
    if (key_exists('delete', $_POST) && $position >= POSITION_ADMIN) {
        $challenge_id = $_POST['challenge_id'];
        $action = 'delete';
    } else {
        if (key_exists('add', $_POST) && $position >= POSITION_ADMIN) {
            $team_id = $_POST['team_id'];
            $challenge_id = $_POST['challenge_id'];
            $action = 'add';
        } else {
Beispiel #4
0
 public function canRemove()
 {
     return !$this->inUse() && Session::defaultPosition() >= POSITION_ADMIN;
 }