} if (!isset($relationship['last_update'])) { $relationship['last_update'] = array(); } $relationship['last_update']['timestamp'] = $new_timestamp; if ($rel_id != "") { $relationship["_id"] = $rel_id; } $upd_criteria = array("subject" => $uuid, "predicate" => $pred); $rel_collection->update($upd_criteria, $relationship, array("upsert" => true)); } continue; } if (in_array($comp_name, $supported_components)) { $collection = $mongodb->{$comp_name}; $existing_component = getComponentMongoDB($mongodb, $comp_name, $uuid, true); if ($existing_component != NULL) { $update_timestamp = 0; $curr_timestamp = 0; if (isset($comp_data['last_update'])) { $last_update = $comp_data['last_update']; if (isset($last_update['timestamp'])) { $update_timestamp = intval($last_update['timestamp']); } } if (isset($existing_component['last_update'])) { if (isset($existing_component['last_update']['timestamp'])) { $curr_timestamp = $existing_component['last_update']['timestamp']; } } if ($curr_timestamp != $update_timestamp) {
$end_limit = array($end_time['year'], $end_time['month'], $end_time['day'], $end_time['hour'], $end_time['minute'], $end_time['second']); $result = find_open_time($schedule, $common_params['min_minutes'] * 60, $start_event, $end_limit, $res_begintime, $res_endtime); //Filter POIs from $json_struct that do not fulfill the time constraints... if ($result == False) { unset($json_struct["pois"][$uuid]); } } } foreach ($common_params['components'] as $component) { //skip fw_core, as it hase been already handled... if ($component == "fw_core") { continue; } foreach (array_keys($json_struct["pois"]) as $uuid) { // print $uuid; $comp_data = getComponentMongoDB($mongodb, $component, $uuid, false); if ($comp_data != NULL) { $json_struct["pois"][$uuid][$component] = $comp_data; } } } } else { // no view permission, show empty list $json_struct['pois'] = array(); } $json_struct['service_info'] = get_service_info(SERVICE_NAME); //Language filtering $accept_lang = $_SERVER['HTTP_ACCEPT_LANGUAGE']; $langs = parse_accept_language($accept_lang); filter_poi_intl_properties($json_struct, array_keys($langs)); $return_val = json_encode($json_struct);
foreach ($core_pois as $core_poi_uuid => $fw_core_content) { $poi_data = get_fw_core_intl_properties_for_poi($pgcon, $fw_core_intl_tbl, $core_poi_uuid, $fw_core_content); $data[$core_poi_uuid] = $poi_data; } } //Handle other components from MongoDB... $mongodb = connectMongoDB($db_opts['mongo_db_name']); foreach ($components as $component) { //skip fw_core, as it hase been already handled... if ($component == "fw_core") { continue; } foreach (array_keys($data) as $uuid) { // print $uuid; try { $comp_data = getComponentMongoDB($mongodb, $component, $uuid, $fetch_for_update); } catch (Exception $e) { echo "*ERROR: Exception when getting " . $uuid . "." . $comp_name . "\n"; echo " message: " . $e->getMessage() . "\n"; echo " code: " . $e->getCode() . "\n"; } if ($comp_data != NULL) { $data[$uuid][$component] = $comp_data; } } } /* Include dynamic data */ $new_timestamp = time(); $supported_components = get_supported_components(); foreach (array_keys($data) as $uuid) { $comps_to_update = array();