Esempio n. 1
0
 /**
  * The index (default) action of the Dashboard.
  * @since 0.0.1-dev
  */
 public function index()
 {
     //load the needed session.
     $this->needSession();
     //get and load the View.
     $view = new View('Dashboard');
     $view->setVar('backend', true);
     $view->load();
 }
Esempio n. 2
0
 public function organizeMember()
 {
     $this->needSession();
     $userRepository = UserRepository::build();
     $users = $userRepository->findAll();
     //get the parameters from the URL.
     $params = func_get_args();
     //initialize a new Team Entity.
     $team = new Team();
     $members = [];
     //check if the ID is available.
     if (isset($params[0]) === true && is_numeric($params[0])) {
         $teams = TeamRepository::build()->findByID($params[0]);
         if (count($teams) === 1) {
             $team = $teams[0];
             $members = $userRepository->findByTeam($team);
         } else {
             $this->redirect(URL . 'team');
             return;
         }
     }
     $users = array_udiff($users, $members, function ($objA, $objB) {
         return $objA->id - $objB->id;
     });
     $view = new View('Team', 'OrganizeMember');
     $view->setVar('backend', true);
     $view->setVar('team', $team);
     $view->setVar('users', $users);
     $view->setVar('members', $members);
     $view->load();
 }
Esempio n. 3
0
 /**
  * The index (default) action of the Login.
  * @since 0.0.1-dev
  */
 public function index()
 {
     $view = new View('Login');
     $view->load();
 }
Esempio n. 4
0
 /**
  * The organize Teams action of the Clan.
  * @param int $id The ID of the Clan which Teams would be organized.
  * @since 0.0.1-dev
  */
 public function teamOrganize($id)
 {
     //get the session.
     $this->needSession();
     //get all Teams from database.
     $teamRepository = TeamRepository::build();
     $teams = $teamRepository->findAll();
     //initialize a new Clan.
     $clan = new Clan();
     $clanTeams = [];
     //check if the ID is available.
     if (is_numeric($id)) {
         $clans = ClanRepository::build()->findByID($id);
         //check if a Clan is available.
         if (count($clans) === 1) {
             $clan = $clans[0];
             $clanTeams = $teamRepository->findByClan($clan);
         } else {
             $this->redirect(URL . 'clan');
             return;
         }
     }
     //get the difference of the Teams.
     $teams = array_udiff($teams, $clanTeams, function ($objA, $objB) {
         return $objA->id - $objB->id;
     });
     //initialize the and load the view.
     $view = new View('Clan', 'OrganizeTeams');
     $view->setVar('backend', true);
     $view->setVar('clan', $clan);
     $view->setVar('teams', $teams);
     $view->setVar('clan_teams', $clanTeams);
     $view->load();
 }
Esempio n. 5
0
 /**
  * Method to add or edit a Account.
  * @param int $user_id The ID of the User of which the Account would be added or edited.
  * @param int $account_id The ID of the Account which will be added (ID = 0) or edited (ID > 0).
  * @return boolean The state whether the Account could be loaded for add or edit.
  * @since 1.0.0
  */
 public function editAccount($user_id = 0, $account_id = 0)
 {
     //this method need a Session.
     $this->needSession();
     //create a new View to create or edit a Account.
     $view = new View('User', 'EditAccount');
     $view->setVar('backend', true);
     //create the UserRepository to load the User from database.
     $userRepository = UserRepository::build();
     $users = $userRepository->findByID($user_id);
     //check whether the User could be loaded from database.
     if (count($users) === 1) {
         $view->setVar('user', $users[0]);
     } else {
         $jsonOutput = [];
         $jsonOutput['state'] = LogLevel::ERROR;
         $jsonOutput['message'] = 'The User could not be found.';
         $jsonOutput['redirect'] = '';
         $jsonOutput['tab_selected'] = '';
         echo json_encode($jsonOutput);
         return false;
     }
     //check whether a Account ID is available.
     if ($account_id > 0) {
         //create the AccountRepository to load the Account from database.
         $accountRepository = AccountRepository::build();
         $accounts = $accountRepository->findByID($account_id);
         //check whether the Account could be loaded from database.
         if (count($accounts) === 1) {
             $view->setVar('account', $accounts[0]);
         } else {
             $jsonOutput = [];
             $jsonOutput['state'] = LogLevel::ERROR;
             $jsonOutput['message'] = 'The Account could not be found.';
             $jsonOutput['redirect'] = '';
             $jsonOutput['tab_selected'] = '';
             echo json_encode($jsonOutput);
             return false;
         }
     }
     //load the View.
     $view->load();
     return true;
 }
Esempio n. 6
0
 /**
  * The index (default) action of the Index.
  * @since 0.0.1-dev
  */
 public function index()
 {
     //get and load the View.
     $view = new View('Index');
     $view->load();
 }