Exemple #1
0
 public function createAction()
 {
     if ($this->user) {
         $date = $this->request->getPost('date');
         $content = $this->request->getPost('content');
         if ($date && $content) {
             $time = strtotime($date);
             $new = new Timetable();
             $new->user = $this->user;
             $new->content = $content;
             $new->created = $time;
             $new->text_time = $date;
             if ($new->create()) {
                 $now = time();
                 if ($time == $now) {
                     $new->status = 'in comming';
                 } elseif ($time > $now) {
                     $new->status = 'on going';
                 } else {
                     $new->status = 'passed';
                 }
                 echo json_encode($new);
             }
         }
     }
 }