/** * * @param stdClass $gameAction * @param Team $oTeam * @param Game $oGame */ private function convertGameAction(stdClass $gameAction, Game $oGame, $team1_score, $team2_score) { $oGameAction = new GameAction(); $oGameAction->period = $gameAction->Period; $oGameAction->time = '00:' . str_pad(str_replace('.', ':', $gameAction->Time), 5, '0', STR_PAD_LEFT); $oGameAction->game_nefub_id = $oGame->nefub_id; $oGameAction->team_nefub_id = $gameAction->Team->ID; $oGameAction->person_nefub_id = $gameAction->Person->ID; if ($gameAction->Assist) { $oGameAction->assist_person_nefub_id = $gameAction->Assist->ID; } // add new unkown type $oType = GameActionType::getByNefubName($gameAction->Type); if (!$oType) { self::put('Wedstrijdactietype ' . $gameAction->Type . ' toegevoegd'); $oType = new GameActionType(); $oType->name = $gameAction->Type; $oType->nefub_name = $gameAction->Type; $oType->use = true; $oType->save(); $this->addedNefubObject($oType); } $oGameAction->game_action_type_id = $oType->getId(); if ($gameAction->Code) { $oGameAction->code = $gameAction->Code; $oGameAction->description = $gameAction->Description; } // add a point to the assigned team is needed if ($oType->is_goal) { if ($oGameAction->team_nefub_id == $oGame->team1_nefub_id) { $team1_score++; } else { $team2_score++; } } $oGameAction->team1_score = $team1_score; $oGameAction->team2_score = $team2_score; $oGameAction->save(); $this->addedNefubObject($oGameAction); return $oGameAction; }
protected function showGameActionTypes() { $this->assign('title', 'Wedstrijdactietypes'); switch ($this->mode) { case 'bewerken': $oType = new GameActionType($this->editId); $this->editObject($oType); break; default: $aGamePersons = GameActionType::getAll(array(), 'name', 'asc'); $this->assign('aTypes', $aGamePersons); $this->template = '/types.tpl'; $this->showOutput(); } }