forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.php
58 lines (39 loc) · 1.55 KB
/
manage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php // $Id$
require_once('../config.php');
require_once('lib.php');
require_once($CFG->dirroot.'/lib/weblib.php');
require_login();
if( empty($CFG->usetags)) {
error(get_string('tagsaredisabled', 'tag'));
}
//managing tags requires moodle/tag:manage capability
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/tag:manage', $systemcontext);
$tagschecked = optional_param('tagschecked', array());
$action = optional_param('action', '', PARAM_ALPHA);
$navlinks = array();
$navlinks[] = array('name' => get_string('tags', 'tag'), 'link' => "{$CFG->wwwroot}/tag/search.php", 'type' => '');
$navlinks[] = array('name' => get_string('managetags', 'tag'), 'link' => '', 'type' => '');
$navigation = build_navigation($navlinks);
print_header_simple(get_string('managetags', 'tag'), '', $navigation);
switch($action) {
case 'delete':
$notice = tag_name_from_string(implode($tagschecked, ', '));
$notice = str_replace(',', ', ', $notice);
$notice .= ' -- ' . get_string('deleted','tag');
notify($notice , 'green');
tag_delete(implode($tagschecked, ','));
break;
case 'reset':
$notice = tag_name_from_string(implode($tagschecked, ', '));
$notice = str_replace(',', ', ', $notice);
$notice .= ' -- ' . get_string('reset','tag');
notify($notice , 'green');
tag_flag_reset(implode($tagschecked, ','));
break;
}
echo '<br/>';
print_tag_management_list();
echo '<br/>';
print_footer();
?>