Exemplo n.º 1
0
 /**
  * Return all notes of a user + max purchased notes + max view notes.
  *
  * @author Kuldeep Dangi <*****@*****.**>
  */
 public function actionGetUserNotes()
 {
     $model = new Extensions();
     $maxPurchaseDocs = $model->getNotesWithMaxPurchase(20);
     $maxViewDocs = $model->getNotesWithMaxViews(20);
     $latestUpdated = $model->getNotesWithLatestUpdated(20);
     if (!empty($_GET['id'])) {
         $userFollower = new UserFollow();
         $usersData = $userFollower->getUserFollowers($_GET['id']);
         $users = array();
         array_map(create_function('$usersData', 'return $usersData["id_user"];'), $users);
         $users[] = $_GET['id'];
         $data = $model->getNotesByUsers($users, 10);
         $this->result['data'] = array_merge($data, $maxPurchaseDocs, $maxViewDocs);
     } else {
         //$this->result['data'] = array_merge($maxPurchaseDocs, $maxViewDocs);
         $this->result['data'] = array_merge($latestUpdated);
     }
     $this->result['success'] = true;
     $this->sendResponse($this->result);
 }