function getFeedFromFollowers($uid, $page = 1, $limit = 10) { global $db, $session; // Get activities published by user $ats = getActivitiesFromUser($uid); // Get the users the uid is following $following = getFollowing($uid); // Flatten the uid list $fgraph = array(); foreach ($following as $f) { if (!in_array($fgraph, $f['user_id'])) { $fgraph[] = $f['user_id']; } } // Pull out their experiment ids $responses = array(); for ($i = 0; $i < count($ats) - 1; $i++) { $aid = $ats[$i]['experiment_id']; $v = getResponsesForActivity($aid); if (count($v) > 0) { for ($j = 0; $j < count($v); $j++) { array_push($responses, $v[$j]); } } } return $responses; }
$ownerid = $meta['owner_id']; $meta['create_diff'] = dateDifference(time(), strtotime($meta['timecreated'])); $meta['mod_diff'] = dateDifference(time(), strtotime($meta['timemodified'])); // Make calls to pull data from db $fields = array(); $vises = array(); $tags = array(); $videos = array(); $images = array(); $sessions = array(); $collabs = array(); if ($is_activity) { $fields = getFields($meta['activity_for']); $tags = getTagsForExperiment($meta['activity_for']); $sessions = getSessionsForExperiment($id); $vises = getResponsesForActivity($id); } else { $fields = getFields($id); $vises = getVisByExperiment($id); $tags = getTagsForExperiment($id); $videos = getVideosForExperiment($id); $images = getImagesForExperiment($id); $collabs = getExperimentCollaborators($ownerid, $id); $sessions = getSessionsForExperiment($id); } // Process the images for display $image_urls = array(); if ($images) { foreach ($images as $img) { array_push($image_urls, array('source' => $img['provider_url'], 'set_url' => $img['provider_url'])); }