public function executeExternalTvStatsTeams(sfWebRequest $request) { $this->setLayout("layout_external"); $this->forward404Unless($request->getParameter("ids")); $this->forward404Unless($request->getParameter("team1")); $this->forward404Unless($request->getParameter("team2")); $this->matchs = MatchsTable::getInstance()->createQuery()->where("id IN ?", array(explode(",", $request->getParameter("ids"))))->execute(); $this->team1 = TeamsTable::getInstance()->find($request->getParameter("team1")); $this->team2 = TeamsTable::getInstance()->find($request->getParameter("team2")); }
public function executeTeamsInSeasons(sfWebRequest $request) { if ($request->getMethod() == sfWebRequest::POST) { if ($request->getPostParameter("season_id")) { $season_id = $request->getPostParameter("season_id"); $getTeams = TeamsInSeasonsTable::getInstance()->createQuery('s')->select('s.team_id')->where('s.season_id = ?', $season_id)->fetchArray(); $teams = array(); for ($i = 0; $i < count($getTeams); $i++) { $teams['id'][] = $getTeams[$i]['team_id']; $name = TeamsTable::getInstance()->createQuery('t')->select('t.name, t.flag')->where('t.id = ?', $getTeams[$i]['team_id'])->fetchArray(); $teams['name'][] = $name[0]['name']; $teams['flag'][] = $name[0]['flag']; } echo json_encode($teams); } } return sfView::NONE; }