/** * Generate the fql query to get the details of user events * * @param array $users * * @param int $timestamp * * @return array an array of fql queries. */ private function generate_fql_multiquery_to_get_events_details(array $users, $timestamp) { $fql = array(); // When we make a query we must convert $time = Ai1ec_Facebook_Event::get_facebook_actual_time_for_events($timestamp); foreach ($users as $id) { $fql[$id] = "SELECT\n\t\t\t\t\teid,\n\t\t\t\t\tname,\n\t\t\t\t\tdescription,\n\t\t\t\t\tstart_time,\n\t\t\t\t\tend_time,\n\t\t\t\t\tvenue,\n\t\t\t\t\tlocation,\n\t\t\t\t\tupdate_time,\n\t\t\t\t\ttimezone,\n\t\t\t\t\thas_profile_pic,\n\t\t\t\t\tpic_big\n\t\t\t\tFROM\n\t\t\t\t\tevent\n\t\t\t\tWHERE\n\t\t\t\t\teid IN (SELECT eid FROM event_member WHERE uid = {$id}) AND start_time > {$time}"; } return $fql; }
/** * Creates a multy-query to get events for groups * * @param array $grouped_eids an array where the keys are the id of the groups and the values are an array of events id * * @param int $timestamp the timestamp that needs to be passed for checking only events that start after it * * @return array the FQL mutly-query array. */ private function generate_multi_query_for_event_details(array $grouped_eids, $timestamp) { $fql = array(); foreach ($grouped_eids as $id => $eids) { $imploded_eids = implode(',', $eids); $time = Ai1ec_Facebook_Event::get_facebook_actual_time_for_events($timestamp); $fql[$id] = "SELECT\n\t\t\t\t\teid,\n\t\t\t\t\tname,\n\t\t\t\t\tdescription,\n\t\t\t\t\tstart_time,\n\t\t\t\t\tend_time,\n\t\t\t\t\tvenue,\n\t\t\t\t\tlocation,\n\t\t\t\t\tupdate_time,\n\t\t\t\t\thas_profile_pic,\n\t\t\t\t\tpic_big\n\t\t\t\tFROM\n\t\t\t\t\tevent\n\t\t\t\tWHERE\n\t\t\t\t\teid IN ({$imploded_eids}) AND start_time > {$time}"; } return $fql; }