Example #1
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();
         }
     }
 }
Example #2
0
 public function testSettingTemplateFromViewProperty()
 {
     $kernelMock = $this->getKernelMock();
     $widget = new Participation($kernelMock, array('config' => array('view' => 'my-test-view')));
     $this->assertEquals(__DIR__ . '/Participation/views/my-test-view.html', $widget->getViewFile(), "view file should be using `config.view` for the view name `my-test-view`");
 }
 public function destroy($id)
 {
     Participation::destroy($id);
     Session::flash('message', 'Sukses Membatalkan Keikutsertaan!');
 }