예제 #1
0
파일: Group.php 프로젝트: ncube/edu
 public function joinAsMember($id)
 {
     if (!self::checkRequest($id)) {
         DB::insert('group_user', array('user_id' => Session::get('user_id'), 'group_id' => $id, 'type' => 'M', 'time' => time()));
         Notif::raiseNotif($id, 'GR');
         return TRUE;
     }
     return FALSE;
 }
예제 #2
0
파일: User.php 프로젝트: ncube/edu
 public function request($post)
 {
     $user_id = User::getPublicUserId($post['username']);
     if ($user_id === Session::get('user_id')) {
         return 'Sorry you cannot Request to your own profile';
     } else {
         $follow_id = DB::fetch(array('request' => 'request_id'), array('user_id' => Session::get('user_id'), 'other_user_id' => $user_id));
         if (empty($follow_id)) {
             DB::insert('request', array('user_id' => Session::get('user_id'), 'other_user_id' => $user_id, 'type' => $post['type'], 'time' => time()));
             Notif::raiseNotif($user_id, 'R' . $post['type']);
             return TRUE;
         } else {
             return 'Request already sent';
         }
     }
 }