Simple status box for the sidebar.
[elgg_plugins.git] / category / category_manage.php
blob501d4bf007b8d117aa99c4b62be035da72d54ef4
1 <?php
3 /*
5 Elgg weblog categories
6 http://elgg.org/
8 */
10 // Load Elgg framework
11 @require_once("../../includes.php");
13 // Define context
14 define("context","weblog");
16 // Make sure we're logged in; otherwise spew out to front page
17 if (!isloggedin()) {
18 header("Location: " . $CFG->wwwroot);
19 exit;
22 // Load global variables
23 global $CFG, $PAGE, $page_owner, $messages, $profile_id;
25 $page_owner = optional_param("owner",0,PARAM_INT);
26 if (empty($page_owner)) {
27 $page_owner = $_SESSION['userid'];
29 $PAGE->owner = $page_owner;
30 $profile_id = $page_owner;
32 $action = optional_param("action");
33 $cats = trim(optional_param("edit_weblog_categories"));
35 templates_page_setup();
37 if (run("permissions:check","profile")) {
39 // Action handling
40 if (logged_on && run("permissions:check", "profile") && !empty($action) && !empty($cats)) {
42 delete_records('tags','tagtype','weblogcat','ref',$page_owner);
43 insert_tags_from_string ($cats, 'weblogcat', $page_owner, "PUBLIC", $page_owner);
44 $messages[] = __gettext("Your weblog categories were updated.");
45 $_SESSION['messages'] = $messages;
46 header("Location: " . $CFG->wwwroot . "mod/category/category_manage.php?owner=$page_owner");
47 exit;
51 // Some introductory text
53 $body = "<form action=\"\" method=\"post\">";
55 $body .= "<p>" . __gettext("Categories allow you to highlight particular tags that represent important weblog content and display them in your sidebar.") . "</p>";
56 $body .= "<p>" . __gettext("For example, if you wanted to draw attention to all blog posts tagged with 'science', you could add that tag below, and users would know that 'science' represents an important category of content. They could then click on 'science' in your sidebar and see all content relating to science.") . "</p>";
57 $body .= "<p>" . __gettext("To set up categories, type the tags you'd like to highlight separated by commas below:") . "</p>";
59 $body .= templates_draw(array(
60 'context' => 'databoxvertical',
61 'name' => __gettext("Highlighted categories"),
62 'contents' => display_input_field(array("edit_weblog_categories",'',"keywords",'weblogcat',$PAGE->owner,$PAGE->owner))
66 $postButton = __gettext("Save");
68 $body .= <<< END
69 <p>
70 <input type="hidden" name="action" value="weblog:categories:edit" />
71 <input type="submit" value="$postButton" />
72 </p>
74 </form>
75 END;
79 // Output to the screen
80 $title = __gettext("Manage blog categories");
81 $body = templates_draw(array(
82 'context' => 'contentholder',
83 'title' => $title,
84 'body' => $body
88 echo templates_page_draw( array(
89 $title, $body