示例#1
0
 private function changeSubscribe($new_value)
 {
     if (!$this->user->isLoggedIn()) {
         $this->template['response'] = 'false';
         return;
     }
     $game_type_id = $this->getParam("id");
     $user_id = $this->user->user_id;
     Views\Subscription::remove($this->pdo, $user_id, $game_type_id);
     if ($new_value) {
         Views\Subscription::insert($this->pdo, $user_id, $game_type_id);
     }
     $new_sub_count = count(Views\Subscription::fetchUsersByGame($this->pdo, $game_type_id));
     $this->template['response'] = $new_sub_count;
 }