public function BuildingPage(User $u) { $this->_user = $u; $this->_queue = ResourceBuilder::GetBuildingListOfColony($u->CurrentColony()); $this->_time = $this->_queue->BuildList()->CommissionedTime(); // Include language files for buildings page, useful to put error messages there. $this->_text =& array_merge($u->Language()->GetFilesByPage("buildings"), $u->Language()->GetFilesByPage("trader"), $u->Language()->GetFilesByPage("research")); }
public function GalaxyView(User $u, Coordinates $c = NULL) { $this->_user = $u; if ($c == NULL) { $this->_coords = $u->CurrentColony()->Coordinates(); } else { $this->_coords = $c; } // Include language files for galaxy page, useful to put error messages there. $this->_text =& $u->Language()->GetFilesByPage("galaxy_view"); }
public static function FromDatabase($row, Colony $c = NULL) { $user = new User(); $user->ID($row['ID']); $user->Username($row['username']); $user->AuthorisationLevel(Database::Instance()->ExecuteQuery("SELECT * FROM authorisation WHERE ID = " . (int) $row['authorisationID'] . ";", "SELECT")); $user->PrimaryEmail($row['primary_email']); $user->SecondaryEmail($row['secondary_email']); $user->RegistrationTime($row['registration_time']); $user->LastOnline($row['last_online']); $user->IsBanned($row['is_banned']); $user->BannedUntil($row['banned_until']); // Load authorisation level name $levelNameRow = Database::Instance()->ExecuteQuery("SELECT name FROM authorisation WHERE level = " . $user->AuthorisationLevel() . ";", "SELECT"); $user->AuthorisationLevelName($levelNameRow['name']); // Load home colony if ($c == NULL) { $colonyDatabaseRow = Database::Instance()->ExecuteQuery("SELECT * FROM colony WHERE userID = " . $user->ID() . " AND is_home_colony = 1", "SELECT"); $user->CurrentColony(Colony::FromDatabase($colonyDatabaseRow, $user)); } else { $user->CurrentColony($c); } // Load user's technologies $technologyDatabaseRow = Database::Instance()->ExecuteQuery("SELECT * FROM user_technology WHERE userID = " . $user->ID(), "SELECT"); $user->Technologies(TechnologyGroup::FromDatabase($technologyDatabaseRow, $user)); // Load user's officers $officerDatabaseRow = Database::Instance()->ExecuteQuery("SELECT * FROM user_officers WHERE userID = " . $user->ID(), "SELECT"); $user->Officers(OfficerGroup::FromDatabase($officerDatabaseRow, $user)); // Return user return $user; }