Beispiel #1
0
 public function generateTables()
 {
     $this->removeTables();
     Doctrine_Core::createTablesFromModels(MODELS);
     FlashComponent::set('info', 'Generate Table terminé.');
     $this->redirect(array('action' => 'index'));
 }
Beispiel #2
0
 public function preExecute()
 {
     if ($this->options['basic']['username'] && $this->options['basic']['password']) {
         if (!$this->basic($this->options['basic']['username'], $this->options['basic']['password'])) {
             die('Cette partie est privée, vous devez vous identifier.');
         }
     } else {
         session_start();
         $User = isset($_SESSION['_protection']) ? $_SESSION['_protection'] : null;
         session_write_close();
         if (!isset($User) && !in_array($this->Controller->action, $this->options['authorize'])) {
             FlashComponent::set('info', "Cette partie est privée, vous devez vous identifier.");
             $this->Controller->redirect($this->options['login'], 403);
         } else {
             $this->setUser($User);
             $this->Controller->View->set('ProtectionComponent', $User);
         }
     }
 }
Beispiel #3
0
 public function batch()
 {
     $id = $this->Request()->post('id');
     $action = $this->Request()->post('action');
     if (!$action) {
         FlashComponent::set('error', "Une action doit être choisie.");
         $this->redirect(array('action' => 'index'));
     }
     if (!count($id)) {
         FlashComponent::set('error', "Un ou plusieurs Images doivent être cochées.");
         $this->redirect(array('action' => 'index'));
     }
     switch ($action) {
         case "delete":
             $Items = Doctrine::getTable('Library')->createQuery()->whereIn('id', $id)->execute();
             foreach ($Items as $Item) {
                 $Item->delete();
             }
             FlashComponent::set('success', pluralize(count($id), "{Image|Images} effacée{s}"));
             break;
     }
     $this->redirect(array('action' => 'index'));
 }