3 require_once('../config.php');
4 require_once('lib.php');
6 $action = optional_param('action', '', PARAM_ALPHA
);
10 if (empty($CFG->usetags
)) {
11 print_error('tagdisabled');
15 print_error('noguest');
18 if (!confirm_sesskey()) {
19 print_error('sesskey');
22 $usercontext = context_user
::instance($USER->id
);
26 if (!core_tag_tag
::is_enabled('core', 'user')) {
27 print_error('tagdisabled');
29 $tag = required_param('tag', PARAM_TAG
);
30 core_tag_tag
::add_item_tag('core', 'user', $USER->id
, $usercontext, $tag);
31 $tc = core_tag_area
::get_collection('core', 'user');
32 redirect(core_tag_tag
::make_url($tc, $tag));
35 case 'removeinterest':
36 if (!core_tag_tag
::is_enabled('core', 'user')) {
37 print_error('tagdisabled');
39 $tag = required_param('tag', PARAM_TAG
);
40 core_tag_tag
::remove_item_tag('core', 'user', $USER->id
, $tag);
41 $tc = core_tag_area
::get_collection('core', 'user');
42 redirect(core_tag_tag
::make_url($tc, $tag));
45 case 'flaginappropriate':
46 require_capability('moodle/tag:flag', context_system
::instance());
47 $id = required_param('id', PARAM_INT
);
48 $tagobject = core_tag_tag
::get($id, '*', MUST_EXIST
);
50 redirect($tagobject->get_view_url(), get_string('responsiblewillbenotified', 'tag'));
54 print_error('unknowaction');