Example #1
0
 public function getFinishedGames()
 {
     $aGames = array();
     $aTeamPersons = $this->getTeamPersons(false);
     foreach ($aTeamPersons as $oTeamPerson) {
         $aTeamGames = $oTeamPerson->getTeam()->getFinishedGames();
         foreach ($aTeamGames as $oGame) {
             if (!isset($aGames[$oGame->date])) {
                 $aGames[$oGame->date] = array();
             }
             $aGames[$oGame->date][$oGame->nefub_id] = array('teamperson' => $oTeamPerson, 'game' => $oGame);
             krsort($aGames[$oGame->date]);
         }
     }
     // From old teams: only the ones the person played in
     $aTeamPersons = $this->getTeamPersons(true, false);
     foreach ($aTeamPersons as $oTeamPerson) {
         $oTeam = $oTeamPerson->getTeam();
         $aGamePersons = GamePerson::getAll(array('person_nefub_id' => $oTeamPerson->person_nefub_id, 'team_nefub_id' => $oTeamPerson->team_nefub_id));
         foreach ($aGamePersons as $oGamePerson) {
             $oGame = $oGamePerson->getGame();
             if (!isset($aGames[$oGame->date])) {
                 $aGames[$oGame->date] = array();
             }
             $aGames[$oGame->date][$oGame->nefub_id] = array('teamperson' => $oTeamPerson, 'game' => $oGame);
             krsort($aGames[$oGame->date]);
         }
     }
     krsort($aGames);
     /*
     		$query = 'SELECT * from 
     			Game
     			WHERE 
     			team_nefub_id 
     WHERE'
     */
     return $aGames;
 }
 /**
  * 
  * @param stdClass $gamePerson
  * @param int $teamNefubId
  * @param Game $oGame
  * @return GamePerson
  */
 protected function convertGamePerson(stdClass $gamePerson, $teamNefubId, Game $oGame)
 {
     if (!($oGamePerson = GamePerson::getByNefubId($gamePerson->Person->ID, $oGame->nefub_id))) {
         $oGamePerson = new GamePerson();
         $this->addedNefubObject($oGamePerson);
     }
     $oGamePerson->game_nefub_id = $oGame->nefub_id;
     $oGamePerson->team_nefub_id = $teamNefubId;
     $oGamePerson->person_nefub_id = $gamePerson->Person->ID;
     $oGamePerson->shirt_number = $gamePerson->Number;
     if ($gamePerson->Type) {
         $oType = NefubTypeMapper::mapTypeFromAPI($gamePerson->Type, 'GamePersonSpecialType');
         $oGamePerson->game_person_special_type_id = $oType->getId();
     }
     $oGamePerson->save();
     return $oGamePerson;
 }
Example #3
0
 protected function showGamePersons()
 {
     switch ($this->mode) {
         case 'bewerken':
             $oGamePerson = new GamePerson($this->editId);
             $this->editObject($oGamePerson);
             break;
         default:
             $aGamePersons = GamePerson::getAll(array(), 'id', 'asc');
             $this->assign('aGamePersons', $aGamePersons);
             $this->template = '/personen.tpl';
             $this->showOutput();
     }
 }
Example #4
0
 public function getTeam2Persons()
 {
     return GamePerson::getAll(array('team_nefub_id' => $this->team2_nefub_id, 'game_nefub_id' => $this->nefub_id), 'shirt_number');
 }