コード例 #1
0
 /**
  * (non-PHPdoc)
  * @see IModel::renderView()
  */
 public function renderView()
 {
     if (!$this->_websoccer->getConfig('nationalteams_enabled')) {
         return FALSE;
     }
     // get team info
     $this->_teamId = NationalteamsDataService::getNationalTeamManagedByCurrentUser($this->_websoccer, $this->_db);
     if (!$this->_teamId) {
         return FALSE;
     }
     $matchesCount = NationalteamsDataService::countNextMatches($this->_websoccer, $this->_db, $this->_teamId);
     if (!$matchesCount) {
         return FALSE;
     }
     return TRUE;
 }
コード例 #2
0
 /**
  * (non-PHPdoc)
  * @see IModel::getTemplateParameters()
  */
 public function getTemplateParameters()
 {
     // get team info
     $teamId = NationalteamsDataService::getNationalTeamManagedByCurrentUser($this->_websoccer, $this->_db);
     if (!$teamId) {
         throw new Exception($this->_i18n->getMessage("nationalteams_user_requires_team"));
     }
     $matchesCount = NationalteamsDataService::countNextMatches($this->_websoccer, $this->_db, $teamId);
     // setup paginator
     $eps = 5;
     $paginator = new Paginator($matchesCount, $eps, $this->_websoccer);
     $paginator->addParameter("block", "national-next-matches");
     $matches = array();
     if ($matchesCount) {
         $matches = NationalteamsDataService::getNextMatches($this->_websoccer, $this->_db, $teamId, $paginator->getFirstIndex(), $eps);
     }
     return array("paginator" => $paginator, "matches" => $matches);
 }