Example #1
0
 /**
  * @param User $user
  * @return array
  */
 public static function getRanks(User $user)
 {
     global $mysqli;
     $ranks = array();
     $query = $mysqli->query("SELECT * FROM ranks");
     while ($result = $query->fetch_array()) {
         $rank = new self($result['id']);
         if ($user->getAdmin() || $user->isThrone() || $user->isDivCommand() && ($user->getDivision()->isSame($rank->getDivision()) || $user->getDivision()->isAbove($rank->getDivision()))) {
             $ranks[] = $rank;
         }
     }
     return $ranks;
 }
Example #2
0
 /**
  * Get Documents. Only return documents that the user has access to (i.e. They've either made the document, been assigned to the document, or they're either an Admin or a member of the Throne.)
  * @param User $user
  * @return Document[]
  */
 public static function getDocuments(User $user)
 {
     global $mysqli;
     $docs = array();
     $query = $mysqli->query("SELECT id FROM documents ORDER BY date DESC");
     while ($result = $query->fetch_array()) {
         $doc = new self($result['id']);
         if ($user->getAdmin() || $user->isThrone() || $doc->isCreator($user) || $doc->isAssigned($user)) {
             $docs[] = $doc;
         }
     }
     return $docs;
 }