コード例 #1
0
ファイル: Library.php プロジェクト: nicolasmartin/framework
 public function add()
 {
     if ($this->Request()->post()) {
         $Picture = new Library();
         $Picture->fromArray($this->Request()->post());
         if ($Picture->isValid()) {
             $this->doUpload();
             $Picture->refresh();
             FlashComponent::set('success', "Image créée.");
             $this->redirect(array('action' => 'index'));
         } else {
             $errors = $Picture->getErrorStack();
             FlashComponent::set('error', "Le formulaire contient " . pluralize(count($errors), '{une|{#}} erreur{s}.'));
         }
     } else {
         $Picture = new Library();
     }
     $this->View->set('Picture', $Picture);
 }