MDL-32064 quiz navigation: JS form submit must fire submit event handlers.
[moodle.git] / tag / coursetags_add.php
blobe5c316a3f8c078cdc55d9df45d4b0c0307e6ac0b
1 <?php
2 /**
3 * coursetags_add.php
4 * @author j.beedell@open.ac.uk June07
5 */
7 require_once('../config.php');
9 require_login();
11 $systemcontext = get_context_instance(CONTEXT_SYSTEM);
12 require_capability('moodle/tag:create', $systemcontext);
14 if (empty($CFG->usetags)) {
15 print_error('tagsaredisabled', 'tag');
18 $returnurl = optional_param('returnurl', null, PARAM_TEXT);
19 $keyword = optional_param('coursetag_new_tag', '', PARAM_TEXT);
20 $courseid = optional_param('entryid', 0, PARAM_INT);
21 $userid = optional_param('userid', 0, PARAM_INT);
23 $keyword = trim(strip_tags($keyword));
24 if ($keyword and confirm_sesskey()) {
26 require_once($CFG->dirroot.'/tag/coursetagslib.php');
28 if ($courseid > 0 and $userid > 0) {
29 $myurl = 'tag/search.php';
30 $keywords = explode(',', $keyword);
31 coursetag_store_keywords($keywords, $courseid, $userid, 'default', $myurl);
35 // send back to originating page, where the new tag will be visible in the block
36 if ($returnurl) {
37 redirect($returnurl);
38 } else {
39 $myurl = $CFG->wwwroot.'/';
42 redirect($myurl);