Exemple #1
0
 /**
  * @return Poule
  */
 public function getPoule()
 {
     if (!$this->poule) {
         $this->poule = Poule::getByNefubId($this->poule_nefub_id);
     }
     return $this->poule;
 }
 /**
  * 
  * @param int $nefubId
  */
 public function showPoule($nefubId)
 {
     $this->subdirectory = '/poule';
     $this->path = '/' . $nefubId;
     $this->template = '/poule/poule.tpl';
     if ($this->getClearRender()) {
         $oPoule = Poule::getByNefubId($nefubId);
         if ($oPoule) {
             if ($oPoule->getCompetition()->getGenre()->nefub_name == 'jeugd' || $oPoule->getCompetition()->getGenre()->nefub_name == 'beker') {
                 $oPagePoule = Poule::getSingle(array('competition_nefub_id' => $oPoule->getCompetition()->nefub_id), 'nefub_id');
             } else {
                 $oPagePoule = $oPoule;
             }
             $this->assign('oPoule', $oPoule);
             $this->assign('oPagePoule', $oPagePoule);
             $this->assign('hasRanking', $oPoule->hasRanking());
         } else {
             $this->redirect();
         }
     }
     $this->showOutput();
 }
 /**
  * @param stdClass $competition
  * 
  * @return Competition
  */
 protected function convertCompetition(stdClass $competition)
 {
     $oCompetition = Competition::getByNefubId($competition->ID);
     if (!$oCompetition) {
         $oCompetition = new Competition();
         $oCompetition->name = $competition->Name;
         $oCompetition->nefub_id = $competition->ID;
         $oCompetition->season_nefub_id = Season::getInstance()->nefub_id;
         self::put('Competitie ' . $oCompetition->name . ' toegevoegd');
         $this->addedNefubObject($oCompetition);
     }
     if (isset($competition->Poules) && is_array($competition->Poules)) {
         foreach ($competition->Poules as $poule) {
             $oPoule = Poule::getByNefubId($poule->ID);
             if (!$oPoule) {
                 $oPoule = new Poule();
                 $oPoule->nefub_id = $poule->ID;
                 $oPoule->name = $poule->Name;
                 $oPoule->competition_nefub_id = $oCompetition->nefub_id;
                 $oPoule->season_nefub_id = Season::getInstance()->nefub_id;
                 self::put('Poule ' . $oPoule->name . ' toegevoegd');
             }
             $oPoule->sorting = $poule->Order;
             $oPoule->save();
         }
     }
     $oGender = $this->convertGender($competition->Gender);
     $oGenre = $this->convertGenre($competition->Genre);
     $oCompetitionType = $this->convertCompetitionType($competition->Type);
     $oCompetition->gender_id = $oGender->getId();
     $oCompetition->genre_id = $oGenre->getId();
     $oCompetition->competition_type_id = $oCompetitionType->getId();
     $oCompetition->save();
     return $oCompetition;
 }
 protected function showPoules()
 {
     switch ($this->mode) {
         case 'bewerken':
             $oPoule = Poule::getByNefubId($this->editId);
             $this->editObject($oPoule);
             break;
         default:
             $this->assign('aPoules', Poule::getAll(array('season_nefub_id' => Season::getInstance()->nefub_id), 'name'));
             $this->showCompetitionDependentView('/poules.tpl');
     }
 }