moodle/user/tag.php
moodler c933a06065 First checkin of tag system from GSOC student Luiz Cruz
It's a very simple first version.

TODO for 1.9:

   - Store rawname of each tag as well as normalised version and treat accordingly
   - Add blocks to the tag interest pages
2007-07-31 07:51:32 +00:00

42 lines
942 B
PHP

<?php // $Id$
require_once('../config.php');
require_once('../tag/lib.php');
$action = optional_param('action', '', PARAM_ALPHA);
require_login();
if (empty($CFG->usetags)) {
error('Tags are disabled!');
}
switch ($action) {
case 'addinterest':
$id = optional_param('id', 0, PARAM_INT);
$name = optional_param('name', '', PARAM_TEXT);
if (empty($name) && $id) {
$name = tag_name($id);
}
tag_an_item('user',$USER->id, $name);
if (!empty($name) && !$id) {
$id = tag_id($name);
}
redirect($CFG->wwwroot.'/tag/index.php?id='.$id);
break;
case 'flaginappropriate':
$id = required_param('id', PARAM_INT);
tag_flag_inappropriate($id);
redirect($CFG->wwwroot.'/tag/index.php?id='.$id, get_string('responsiblewillbenotified','tag'));
break;
}
?>