コード例 #1
0
 public function proccess()
 {
     Phalanx::loadClasses('Favorites', 'Notification');
     switch ($this->post->action) {
         case 'favorite':
             $n = new Notification(Notification::FAVORITED_A_POST, $this->session->user->id, $this->post->post_id);
             $status = Favorites::add($this->session->user->id, $this->post->post_id);
             break;
         case 'unfavorite':
             $status = Favorites::remove($this->session->user->id, $this->post->post_id);
             break;
     }
     header("Content-type: text/html; charset=utf-8");
     $o = new stdClass();
     $o->status = $status;
     die(json_encode($o));
 }