calendar/lib: calendar_set_filters() use pre-fetched context and course recs
[moodle-pu.git] / user / tag.php
blob6042908deca13f47119e91e4e31a19fb5b3a9268
1 <?php // $Id$
3 require_once('../config.php');
4 require_once('../tag/lib.php');
6 $action = optional_param('action', '', PARAM_ALPHA);
8 require_login();
10 if (empty($CFG->usetags)) {
11 error('Tags are disabled!');
14 if (isguestuser()) {
15 print_error('noguest');
18 if (!confirm_sesskey()) {
19 print_error('sesskey');
23 switch ($action) {
24 case 'addinterest':
25 $id = optional_param('id', 0, PARAM_INT);
26 $name = optional_param('name', '', PARAM_TEXT);
28 if (empty($name) && $id) {
29 $name = tag_name($id);
32 tag_an_item('user',$USER->id, $name);
34 if (!empty($name) && !$id) {
35 $id = tag_id(tag_normalize($name));
38 redirect($CFG->wwwroot.'/tag/index.php?id='.$id);
39 break;
41 case 'flaginappropriate':
43 $id = required_param('id', PARAM_INT);
45 tag_flag_inappropriate($id);
47 redirect($CFG->wwwroot.'/tag/index.php?id='.$id, get_string('responsiblewillbenotified','tag'));
48 break;