[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/tag/ -> user.php (source)

   1  <?php  // $Id: user.php,v 1.1.2.2 2008/03/18 08:29:20 scyrma Exp $
   2  
   3  require_once ('../config.php');
   4  require_once ('lib.php');
   5  
   6  $action = optional_param('action', '', PARAM_ALPHA);
   7  $id = optional_param('id', 0, PARAM_INT);
   8  $tag = optional_param('tag', '', PARAM_TAG);
   9          
  10  require_login();
  11  
  12  if (empty($CFG->usetags)) {
  13      error('Tags are disabled!');
  14  }
  15  
  16  if (isguestuser()) {
  17      print_error('noguest');
  18  }
  19  
  20  if (!confirm_sesskey()) {
  21      print_error('sesskey');
  22  }
  23  
  24  
  25  switch ($action) {
  26      case 'addinterest':
  27          if (empty($tag) && $id) { // for backward-compatibility (people saving bookmarks, mostly..)
  28              $tag = tag_get_name($id);
  29          } 
  30          
  31          tag_set_add('user', $USER->id, $tag);
  32  
  33          redirect($CFG->wwwroot.'/tag/index.php?tag='. rawurlencode($tag));
  34          break;
  35  
  36      case 'removeinterest':
  37          if (empty($tag) && $id) { // for backward-compatibility (people saving bookmarks, mostly..)
  38              $tag = tag_get_name($id);
  39          } 
  40  
  41          tag_set_delete('user', $USER->id, $tag);
  42  
  43          redirect($CFG->wwwroot.'/tag/index.php?tag='. rawurlencode($tag));
  44          break;
  45  
  46      case 'flaginappropriate':
  47          
  48          tag_set_flag(tag_get_id($tag));
  49          
  50          redirect($CFG->wwwroot.'/tag/index.php?tag='. rawurlencode($tag), get_string('responsiblewillbenotified', 'tag'));
  51          break;
  52  
  53      default:
  54          error('No action was specified');
  55          break;
  56  }
  57  
  58  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7