Exemplo n.º 1
0
 public static function user($request, $context)
 {
     //print_r($request);
     if (!empty($request['id'])) {
         $user = utilisateurTable::getUserById($request['id']);
         if (empty($user)) {
             return context::ERROR;
         }
         $tweet = tweetTable::getTweetsPostedBy($request['id']);
         $data['user'] = $user[0];
         $data['tweet'] = $tweet;
         $context->data = $data;
         if ($context->getSessionAttribute('is_logged') == 1 && $request['id'] == $context->getSessionAttribute('id')) {
             return context::SUCCESS;
         } else {
             return context::ACCESS;
         }
     } else {
         if ($context->getSessionAttribute('is_logged') == 1) {
             $user = utilisateurTable::getUserById($context->getSessionAttribute('id'));
             $tweet = tweetTable::getTweetsPostedBy($context->getSessionAttribute('id'));
             $data['user'] = $user[0];
             $data['tweet'] = $tweet;
             $context->data = $data;
             return context::SUCCESS;
         }
     }
     return context::ERROR;
 }
Exemplo n.º 2
0
 public static function testTweetGetUtilisateursVotes($request, $context)
 {
     $tweet = tweetTable::getTweetById($request["tweet"]);
     if (!is_null($tweet)) {
         return $tweet->getUsersWhoLikeMe();
     } else {
         return null;
     }
 }