Simple status box for the sidebar.
[elgg_plugins.git] / category / lib.php
blob2a3455daee1b41973ab7aae6578e8ad1dc6c3df4
1 <?php
3 /*
4 Elgg blog categories plugin
6 Ben Werdmuller, October 2006
7 ben@curverider.co.uk
9 Released under the GPL v2
12 // Before using, add this .htaccess rule:
13 // RewriteRule ^([A-Za-z0-9]+)\/weblog\/category\/(.+)\/?$ mod/category/category_view.php?weblog_name=$1&category=$2
15 function category_pagesetup() {
17 global $CFG, $PAGE, $function, $page_owner;
19 // Add category management to the account settings
20 if (defined("context") && context == "weblog" && run("permissions:check","profile")) {
21 $PAGE->menu_sub[] = array('name' => 'blog:category',
22 'html' => a_href("{$CFG->wwwroot}mod/category/category_manage.php?owner=$page_owner",
23 __gettext("Manage blog categories")));
28 function category_init() {
29 global $function, $CFG, $page_owner, $PAGE;
31 // Add weblog categories to the sidebar
32 // TODO fix display order, categories should probably be somewhere near archive
33 //if (context == 'weblog') {
35 $inserted = 0;
37 foreach($function['display:sidebar'] as $key => $sidebar) {
38 if ($sidebar == $CFG->dirroot . "units/weblogs/weblogs_user_info_menu.php") {
39 $inserted++;
40 $array1 = array_slice($function['display:sidebar'], 0, $key+ 1);
41 $array2 = array_slice($function['display:sidebar'], $key + 1, sizeof($function['display:sidebar']) - $key);
42 $array1[] = $CFG->dirroot . 'mod/category/category_sidebar.php';
43 $function['display:sidebar'] = array_merge($array1, $array2);
46 if (!$inserted) {
47 $function['display:sidebar'][] = $CFG->dirroot . 'mod/category/category_sidebar.php';