|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00007 require_once('../config.php'); 00008 00009 require_login(); 00010 00011 $systemcontext = get_context_instance(CONTEXT_SYSTEM); 00012 require_capability('moodle/tag:create', $systemcontext); 00013 00014 if (empty($CFG->usetags)) { 00015 print_error('tagsaredisabled', 'tag'); 00016 } 00017 00018 $returnurl = optional_param('returnurl', null, PARAM_TEXT); 00019 $keyword = optional_param('coursetag_new_tag', '', PARAM_TEXT); 00020 $courseid = optional_param('entryid', 0, PARAM_INT); 00021 $userid = optional_param('userid', 0, PARAM_INT); 00022 00023 $keyword = trim(strip_tags($keyword)); 00024 if ($keyword and confirm_sesskey()) { 00025 00026 require_once($CFG->dirroot.'/tag/coursetagslib.php'); 00027 00028 if ($courseid > 0 and $userid > 0) { 00029 $myurl = 'tag/search.php'; 00030 $keywords = explode(',', $keyword); 00031 coursetag_store_keywords($keywords, $courseid, $userid, 'default', $myurl); 00032 } 00033 } 00034 00035 // send back to originating page, where the new tag will be visible in the block 00036 if ($returnurl) { 00037 redirect($returnurl); 00038 } else { 00039 $myurl = $CFG->wwwroot.'/'; 00040 } 00041 00042 redirect($myurl);