Пример #1
0
 protected function Create()
 {
     //Check user is logged in
     if (!CHelper::IsLoggedIn()) {
         $this->Redirect('account', 'login', 'createevent');
     }
     //Check if is post
     if (CHelper::IsPost()) {
         //POST
         $model = new EventModel("Create", true);
         //Error checking
         if ($model->hasError()) {
             $model->setPageTitle('Create Event');
             $this->ReturnViewByName("create", $model->view, "layout");
             exit;
         }
         $this->Redirect('event', 'detail', $model->view->post['id']);
     } else {
         //GET
         $model = new EventModel("Create");
         $model->setPageTitle('New Event');
         $this->ReturnView($model->view);
     }
 }