コード例 #1
0
 public function createAction()
 {
     $theme = new ThemeLayout();
     $theme->name = $this->request->getPost("name");
     $theme->width = $this->request->getPost("width");
     if (!ThemeLayout::findFirstByName($theme->name)) {
         if (!$theme->save()) {
             foreach ($theme->getMessages() as $message) {
                 $this->flash->error($message);
             }
             $this->dispatcher->forward(array("controller" => "theme_creator", "action" => "index"));
         }
         $this->flash->success("theme was created successfully");
         $this->dispatcher->forward(array("controller" => "theme_creator", "action" => "index", "params" => array($theme->id)));
     } else {
         $this->flash->error("Theme with the same name already exist");
         $this->dispatcher->forward(array("controller" => "theme_creator", "action" => "index"));
     }
 }