/** * (non-PHPdoc) * @see IModel::getTemplateParameters() */ public function getTemplateParameters() { $matchId = (int) $this->_websoccer->getRequestParameter('id'); if ($matchId < 1) { throw new Exception($this->_i18n->getMessage(MSG_KEY_ERROR_PAGENOTFOUND)); } $match = MatchesDataService::getMatchById($this->_websoccer, $this->_db, $matchId); if (!isset($match['match_id'])) { throw new Exception($this->_i18n->getMessage(MSG_KEY_ERROR_PAGENOTFOUND)); } $allowTacticChanges = FALSE; $reportmessages = array(); if ($match['match_minutes'] > 0) { $reportmessages = MatchesDataService::getMatchReportMessages($this->_websoccer, $this->_db, $this->_i18n, $matchId); $userTeamId = $this->_websoccer->getUser()->getClubId($this->_websoccer, $this->_db); $userNationalTeamId = NationalteamsDataService::getNationalTeamManagedByCurrentUser($this->_websoccer, $this->_db); if (!$match['match_simulated'] && $this->_websoccer->getConfig('sim_allow_livechanges') && ($match['match_home_id'] == $userTeamId || $match['match_guest_id'] == $userTeamId || $match['match_home_id'] == $userNationalTeamId || $match['match_guest_id'] == $userNationalTeamId)) { $allowTacticChanges = TRUE; } } // collect strikers $homeStrikerMessages = array(); $guestStrikerMessages = array(); foreach ($reportmessages as $reportMessage) { $type = $reportMessage['type']; if ($type == 'Tor' || $type == 'Tor_mit_vorlage' || $type == 'Elfmeter_erfolg' || $type == 'Freistoss_treffer') { if ($reportMessage['active_home']) { array_unshift($homeStrikerMessages, $reportMessage); } else { array_unshift($guestStrikerMessages, $reportMessage); } } } return array('match' => $match, 'reportmessages' => $reportmessages, 'allowTacticChanges' => $allowTacticChanges, 'homeStrikerMessages' => $homeStrikerMessages, 'guestStrikerMessages' => $guestStrikerMessages); }
echo "<select name=\"team_id\" id=\"team_id\">"; echo "<option value=\"" . $match["match_home_id"] . "\">" . escapeOutput($match["match_home_name"]) . "</option>"; echo "<option value=\"" . $match["match_guest_id"] . "\">" . escapeOutput($match["match_guest_name"]) . "</option>"; echo "</select>"; echo "</div>"; echo "</div>"; echo FormBuilder::createFormGroup($i18n, "message_id", array("type" => "foreign_key", "jointable" => "spiel_text", "entity" => "matchtext", "labelcolumns" => "aktion,nachricht"), "", "match_manage_reportmsg_"); echo FormBuilder::createFormGroup($i18n, "playernames", array("type" => "text"), "", "match_manage_reportmsg_"); echo FormBuilder::createFormGroup($i18n, "minute", array("type" => "number"), "", "match_manage_reportmsg_"); echo FormBuilder::createFormGroup($i18n, "intermediateresult", array("type" => "text"), "", "match_manage_reportmsg_"); echo "</fieldset>"; echo "<div class=\"form-actions\">"; echo "<button type=\"submit\" class=\"btn btn-primary\">" . $i18n->getMessage("button_save") . "</button>"; echo "</div></form>"; // ******** list items $reportItems = MatchesDataService::getMatchReportMessages($website, $db, $i18n, $matchId); // no items if (!count($reportItems)) { echo createInfoMessage("", $i18n->getMessage("match_manage_reportitems_noitems")); // list items } else { echo "<table class=\"table table-bordered table-striped table-hover\">"; echo "<thead>"; echo "<tr>"; echo "<th>" . $i18n->getMessage("match_manage_reportmsg_minute") . "</th>"; echo "<th>" . $i18n->getMessage("entity_matchtext_aktion") . "</th>"; echo "<th>" . $i18n->getMessage("entity_matchtext_nachricht") . "</th>"; echo "<th>" . $i18n->getMessage("match_manage_reportmsg_playernames") . "</th>"; echo "<th>" . $i18n->getMessage("match_manage_reportmsg_intermediateresult") . "</th>"; echo "</tr>"; echo "</thead>";