示例#1
0
 /**
  * The Constructor for the User class. Queries the database and assigns values to the approriate variables.
  * @param integer $id
  * @throws DBException
  */
 public function __construct($id)
 {
     global $mysqli;
     $query = $mysqli->query("SELECT * FROM users WHERE id = {$id}");
     if (!$query) {
         throw new DBException('Can\'t get user.', $mysqli->error);
     }
     $result = $query->fetch_array();
     extract($result);
     $this->id = $id;
     $this->username = $username;
     $this->name = $name;
     $this->email = $email;
     $this->merits = $merits;
     $this->rank = new Rank($rank);
     $this->leader = $divleader == 1;
     $this->subleader = $subdivleader == 1;
     $this->division = new Division($division);
     $this->sc = new SecurityClearance($clearance);
     if ($clearance == 7 || $admin != 0) {
         $this->admin = new Admin($id);
     }
     /*if ($nominator == 1)
           $this->nominator = true;
       if ($approver == 1)
           $this->approver = true;*/
     $this->awards = Award::getUserAwards($this);
     /*if ($clearance <= 6) {
           $this->division = new Division($div);
           $this->sc = new SecurityClearance($clearance);
       } else {
           $this->admin = new Admin($clearance, $div);
       }*/
 }
示例#2
0
'})">Edit</a>
                            <?php 
                    }
                    ?>
                    </td>
                </tr>
                <?php 
                }
                ?>
        </table>
        <?php 
            } else {
                if ($do == 'view') {
                    $id = param('id');
                    $user = new User($id);
                    $awards = Award::getUserAwards($user);
                    $count = count($awards);
                    $current = 0;
                    $line = 0;
                    ?>
        <h3><?php 
                    echo $user->getName();
                    ?>
</h3>
        <?php 
                    foreach ($awards as $award) {
                        if ($current == 0) {
                            ?>
                <div class="row">
                <?php 
                        }