public function getUserdata($keyword, $user_id = null) { return json_encode(['data' => Watchdog::queryUserInfo($keyword, $user_id)]); }
/** * @author Aunne * @param $facebook_id * @param int $limit * @return JSON containing the industries view/searched by user */ public function getUserIndustryInfo($facebook_id, $limit = 10) { try { $user_id = User::getUserIdByFbId($facebook_id); } catch (Exception $e) { $user_id = null; } if ($user_id) { $industry_data = Watchdog::queryUserInfo('industry', $user_id); unset($industry_data['Industry']); //remove industry index since this is useless data caused by searching without industry parameter arsort($industry_data); $industry_data = array_slice($industry_data, 0, $limit); return json_encode(['industries' => $industry_data]); } else { return json_encode(['error' => 'You are not registered to FeatherQ.']); } }