diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-29 00:56:55 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-29 00:56:55 +0000 |
commit | 855b008013aad0426ab0332b040bddb033bb6af9 (patch) | |
tree | 70c137e5c9a9c916bb9f8172daf3bd0483895bf6 /mod/reportedcontent/start.php | |
parent | 71dc8cbf9eecb4de149bc96bb5758b866116b1c8 (diff) | |
download | elgg-855b008013aad0426ab0332b040bddb033bb6af9.tar.gz elgg-855b008013aad0426ab0332b040bddb033bb6af9.tar.bz2 |
cleaned up the reported content plugin
git-svn-id: http://code.elgg.org/elgg/trunk@7466 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/reportedcontent/start.php')
-rw-r--r-- | mod/reportedcontent/start.php | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php index 09ab71406..815c35fe5 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -5,15 +5,20 @@ * @package ElggReportedContent */ +elgg_register_event_handler('init','system','reportedcontent_init'); + /** - * Initialise the Reported content and set up the menus. - * + * Initialize the plugin */ function reportedcontent_init() { global $CONFIG; + // Register a page handler, so we can have nice URLs + register_page_handler('reportedcontent', 'reportedcontent_page_handler'); + // Extend CSS - elgg_extend_view('css', 'reportedcontent/css'); + elgg_extend_view('css/elgg', 'reportedcontent/css'); + elgg_extend_view('css/admin', 'reportedcontent/admin_css'); // Extend context menu and footer with report content link if (isloggedin()) { @@ -21,13 +26,36 @@ function reportedcontent_init() { elgg_extend_view('footer/links', 'reportedcontent/footer_link'); } + // Add admin menu item elgg_add_admin_submenu_item('reportedcontent', elgg_echo('reportedcontent'), 'overview'); - //register action - elgg_register_action('reportedcontent/add', "{$CONFIG->pluginspath}reportedcontent/actions/add.php"); - elgg_register_action('reportedcontent/delete', "{$CONFIG->pluginspath}reportedcontent/actions/delete.php", 'admin'); - elgg_register_action('reportedcontent/archive', "{$CONFIG->pluginspath}reportedcontent/actions/archive.php", 'admin'); + // Register actions + $action_path = "{$CONFIG->pluginspath}reportedcontent/actions"; + elgg_register_action('reportedcontent/add', "$action_path/add.php"); + elgg_register_action('reportedcontent/delete', "$action_path/delete.php", 'admin'); + elgg_register_action('reportedcontent/archive', "$action_path/archive.php", 'admin'); } -// Initialise Reported Content -elgg_register_event_handler('init','system','reportedcontent_init'); +/** + * Reported content page handler + * + * Serves the add report page + * + * @param array $page Array of page routing elements + */ +function reportedcontent_page_handler($page) { + // only logged in users can report things + gatekeeper(); + + $content .= elgg_view_title(elgg_echo('reportedcontent:this')); + $content .= elgg_view('reportedcontent/form'); + $sidebar .= elgg_echo('reportedcontent:instructions'); + + $params = array( + 'content' => $content, + 'sidebar' => $sidebar + ); + $body = elgg_view_layout('one_column_with_sidebar', $params); + + echo elgg_view_page(elgg_echo('reportedcontent:this'), $body); +} |