示例#1
0
 private function _lagCuplisteFraProver($prover, $klubbId)
 {
     $hd = new HundDatabase();
     $pd = new PersonDatabase();
     $cupliste = array();
     //går gjennom prøvene
     foreach ($prover as $prove) {
         $finnes = false;
         //går gjennom lista over hunder som allerede er i cuplista
         foreach ($cupliste as $cup) {
             if ($prove->hundId == $cup->hundId) {
                 $finnes = true;
             }
         }
         //legger til hunden i cuplista hvis den ikke finnes der fra før
         if (!$finnes) {
             $tmp = new AmfCup();
             $tmp->hundId = $prove->hundId;
             $hund = $hd->hentKunHund($prove->hundId, $klubbId);
             $tmp->hundNavn = $hund['navn'];
             $tmp->tittel = $hund['tittel'];
             if ($hund['eierId'] != '') {
                 $pdres = $pd->hentPerson($hund['eierId'], $klubbId);
                 $tmp->eier = $pdres['navn'];
             }
             if ($tmp->hundNavn != '') {
                 $cupliste[] = $tmp;
             }
         }
     }
     return $cupliste;
 }