Пример #1
0
 function postForm()
 {
     $langtkursus = new VIH_Model_LangtKursus($this->context->name());
     $langtkursus->flushFag();
     $post = $this->body();
     foreach ($this->body('f*g') as $key => $value) {
         $f*g = new VIH_Model_Fag($value);
         if (empty($post['period'][$key])) {
             continue;
         }
         foreach ($post['period'][$key] as $key => $value) {
             $periode = VIH_Model_LangtKursus_Periode::getFromId($this->pdo, $value);
             $fagperiode = new VIH_Model_LangtKursus_FagPeriode($f*g, $periode);
             $langtkursus->addFag($fagperiode);
         }
     }
     return new k_SeeOther($this->url());
 }
Пример #2
0
 public function copy()
 {
     $value = $this->get();
     $value['navn'] = $this->get('navn') . '(kopi)';
     $f*g = array();
     unset($value['id']);
     $new_kursus = new VIH_Model_LangtKursus();
     foreach ($this->getFag() as $f) {
         $f*g[] = $f->get('id');
     }
     $new_id = $new_kursus->save($value);
     $new_kursus->addFag($f*g);
     return $new_id;
 }