public function store()
 {
     $fee = Input::get('fee');
     $fee = str_replace(",", ".", $fee);
     $fee = str_replace(".", "", $fee);
     $fee = substr($fee, 0, -2);
     $participation = new Participation();
     $participation->activity_id = Input::get('activity');
     $participation->issue_id = Input::get('issue_id');
     $participation->employee_id = Auth::user()->employee_id;
     $participation->registration_fee = $fee;
     $participation->save();
     Session::flash('message', 'Sukses Menambahkan Peserta Baru!');
 }
예제 #2
0
 function updateUnites($participantes)
 {
     $tu = new Unites();
     $annee = $this->getAnnee();
     // d'abord nettoyer l'ancien.
     foreach ($this->findParticipations() as $p) {
         $p->delete();
     }
     // Reconstruire la liste des participants
     foreach ($participantes as $parente) {
         $p = new Participation();
         $p->activite = $this->id;
         $p->unite = $parente->id;
         try {
             $p->save();
         } catch (Zend_Db_Statement_Exception $e) {
             if (strpos($e->getMessage(), 'UNIQUE') === false) {
                 throw $e;
             }
             /* L'unité a déjà été ajoutée. Peut-être une sous unité cliqué
              * explicitement dans les participantes. */
         }
         foreach ($parente->findSousUnites($annee, true) as $unite) {
             $p = new Participation();
             $p->activite = $this->id;
             $p->unite = $unite->id;
             $p->save();
         }
     }
 }