/** * Dispatches shoutout pages. * URLs take the form of * All shoutouts: shoutout/all * View shoutout: shoutout/view/<guid> * Edit shoutout: shoutout/edit/<guid> * Comment shoutout: shoutout/comment/<guid> * Show thumb: shoutout/temporary_thumb/<guid>/<file_name> * @param array $page * @return bool */ function shoutout_page_handler($page) { elgg_load_library('elgg:shoutout'); $page_type = $page[0]; switch ($page_type) { case 'all': //echo shoutout_get_all_page(); echo shoutout_get_activity_page(); break; case 'activity': echo shoutout_get_activity_page(); break; case 'shout_entity': // allows attaching entities to shoutouts, eg. polls echo shoutout_get_activity_page($page[1]); break; case 'owner': set_input('page_type', 'mine'); echo shoutout_get_activity_page(); break; case 'friends': set_input('page_type', 'friends'); echo shoutout_get_activity_page(); break; case 'wall': set_input('page_type', 'wall'); set_input('origin', 'shoutout/wall'); echo shoutout_get_activity_page(); break; case 'activity_river_view': $activity = shoutout_get_activity(); echo $activity['content']; break; case 'view': echo shoutout_get_view_page($page[1]); break; case 'edit': if (isset($page[2]) && $page[2] == 'wall') { set_input('origin', 'shoutout/wall'); } else { set_input('origin', 'shoutout/all'); } echo shoutout_get_edit_page($page[1]); break; case 'comment': echo shoutout_get_comment_page($page[1]); break; case 'temporary_thumb': echo shoutout_show_temporary_attachment($page[1], $page[2], urldecode($page[3])); break; case 'show_attachment_image': shoutout_show_attachment_image($page[1]); break; case 'download_attachment': shoutout_download_attachment($page[1]); break; case 'get_file_uploader_bit': echo shoutout_get_file_uploader_bit($page[1]); break; case 'watch': echo elgg_view('shoutout/video_watch', array('guid' => $page[1])); break; default: echo shoutout_get_activity_page(); break; } return true; }
function shoutout_get_activity_page($attached_guid = 0) { /** * Main activity stream list page */ elgg_load_js('lightbox'); elgg_load_css('lightbox'); if ($owner_guid) { $owner = get_entity($owner_guid); if (elgg_instanceof($owner, 'user')) { elgg_set_page_owner_guid($owner_guid); } } elgg_load_library('elgg:shoutout:uploads'); elgg_load_js('elgg.shoutout'); elgg_load_js('qq.fileuploader'); $activity = shoutout_get_activity(); $activity_bit = '<div id="shoutout-content-area">' . $activity['content'] . '</div>'; $page_type = get_input('page_type'); if (elgg_is_logged_in()) { $form_vars = array('id' => 'shoutout-form'); $body_vars = array('attached_guid' => $attached_guid); $content .= elgg_view_form('shoutout/edit', $form_vars, $body_vars); } else { $content .= '<p>' . elgg_echo('shoutout:login') . '</p>'; } $sidebar = elgg_view('core/river/sidebar'); if ($page_type != 'wall') { $filter_tabs = elgg_view('page/layouts/content/filter', array('filter_context' => $activity['page_filter'])); } else { $filter_tabs = ''; } $filter_dropdown = $filter = elgg_view('core/river/filter', array('selector' => $activity['selector'])); $params = array('content' => $content . $filter_dropdown . $filter_tabs . $activity_bit, 'title' => $activity['title'], 'sidebar' => $sidebar, 'filter' => '', 'class' => 'elgg-river-layout'); $body = elgg_view_layout('content', $params); return elgg_view_page($title, $body); }