public function getTemplateParameters()
 {
     $teamId = $this->_websoccer->getUser()->getClubId($this->_websoccer, $this->_db);
     $players = array();
     if ($teamId > 0) {
         $players = YouthPlayersDataService::getYouthPlayersOfTeam($this->_websoccer, $this->_db, $teamId);
         $noOfPlayers = count($players);
         for ($playerIndex = 0; $playerIndex < $noOfPlayers; $playerIndex++) {
             $players[$playerIndex]["nation_flagfile"] = PlayersDataService::getFlagFilename($players[$playerIndex]["nation"]);
         }
     }
     return array("players" => $players);
 }
 /**
  * Provides players of specified national team, grouped by position.
  * 
  * @param WebSoccer $websoccer Application context.
  * @param DbConnection $db DB connection.
  * @param int $clubId ID of team.
  * @param string $positionSort ASC|DESC
  * @return array two dim array. first dim: Position name, second dim: List of players of this position.
  */
 public static function getNationalPlayersOfTeamByPosition(WebSoccer $websoccer, DbConnection $db, $clubId, $positionSort = "ASC")
 {
     $columns = array("P.id" => "id", "vorname" => "firstname", "nachname" => "lastname", "kunstname" => "pseudonym", "verletzt" => "matches_injured", "gesperrt_nationalteam" => "matches_blocked", "position" => "position", "position_main" => "position_main", "position_second" => "position_second", "w_staerke" => "strength", "w_technik" => "strength_technique", "w_kondition" => "strength_stamina", "w_frische" => "strength_freshness", "w_zufriedenheit" => "strength_satisfaction", "transfermarkt" => "transfermarket", "nation" => "player_nationality", "picture" => "picture", "P.sa_tore" => "st_goals", "P.sa_spiele" => "st_matches", "P.sa_karten_gelb" => "st_cards_yellow", "P.sa_karten_gelb_rot" => "st_cards_yellow_red", "P.sa_karten_rot" => "st_cards_red", "marktwert" => "marketvalue", "verein_id" => "team_id", "C.name" => "team_name");
     if ($websoccer->getConfig('players_aging') == 'birthday') {
         $ageColumn = 'TIMESTAMPDIFF(YEAR,geburtstag,CURDATE())';
     } else {
         $ageColumn = 'age';
     }
     $columns[$ageColumn] = 'age';
     $fromTable = $websoccer->getConfig("db_prefix") . "_spieler AS P";
     $fromTable .= " INNER JOIN " . $websoccer->getConfig("db_prefix") . "_nationalplayer AS NP ON NP.player_id = P.id";
     $fromTable .= " LEFT JOIN " . $websoccer->getConfig("db_prefix") . "_verein AS C ON C.id = P.verein_id";
     $whereCondition = "P.status = 1 AND NP.team_id = %d ORDER BY position " . $positionSort . ", position_main ASC, nachname ASC, vorname ASC";
     $result = $db->querySelect($columns, $fromTable, $whereCondition, $clubId, 50);
     $players = array();
     while ($player = $result->fetch_array()) {
         $player["position"] = PlayersDataService::_convertPosition($player["position"]);
         $player["player_nationality_filename"] = PlayersDataService::getFlagFilename($player["player_nationality"]);
         $player["marketvalue"] = PlayersDataService::getMarketValue($websoccer, $player, "");
         $players[$player["position"]][] = $player;
     }
     $result->free();
     return $players;
 }
 /**
  * Provides youth players who are transferable.
  * 
  * @param WebSoccer $websoccer Application context.
  * @param DbConnection $db DB connection.
  * @param string|NULL $positionFilter DB value of position to filter for.
  * @param int $startIndex fetch start index.
  * @param int $entries_per_page Number of items to fetch.
  * @return array Array of players or empty array if no youth players found.
  */
 public static function getTransferableYouthPlayers(WebSoccer $websoccer, DbConnection $db, $positionFilter = NULL, $startIndex, $entries_per_page)
 {
     $columns = array("P.id" => "player_id", "P.firstname" => "firstname", "P.lastname" => "lastname", "P.position" => "position", "P.nation" => "nation", "P.transfer_fee" => "transfer_fee", "P.age" => "age", "P.strength" => "strength", "P.st_matches" => "st_matches", "P.st_goals" => "st_goals", "P.st_assists" => "st_assists", "P.st_cards_yellow" => "st_cards_yellow", "P.st_cards_yellow_red" => "st_cards_yellow_red", "P.st_cards_red" => "st_cards_red", "P.team_id" => "team_id", "C.name" => "team_name", "C.bild" => "team_picture", "C.user_id" => "user_id", "U.nick" => "user_nick", "U.email" => "user_email", "U.picture" => "user_picture");
     $fromTable = $websoccer->getConfig("db_prefix") . "_youthplayer AS P";
     $fromTable .= " INNER JOIN " . $websoccer->getConfig("db_prefix") . "_verein AS C ON C.id = P.team_id";
     $fromTable .= " LEFT JOIN " . $websoccer->getConfig("db_prefix") . "_user AS U ON U.id = C.user_id";
     $parameters = "";
     $whereCondition = "P.transfer_fee > 0";
     if ($positionFilter != NULL) {
         $whereCondition .= " AND P.position = '%s'";
         $parameters = $positionFilter;
     }
     $whereCondition .= " ORDER BY P.strength DESC";
     $players = array();
     $limit = $startIndex . "," . $entries_per_page;
     $result = $db->querySelect($columns, $fromTable, $whereCondition, $parameters, $limit);
     while ($player = $result->fetch_array()) {
         $player["user_picture"] = UsersDataService::getUserProfilePicture($websoccer, $player["user_picture"], $player["user_email"], 20);
         $player["nation_flagfile"] = PlayersDataService::getFlagFilename($player["nation"]);
         $players[] = $player;
     }
     $result->free();
     return $players;
 }