[ Index ]

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

title

Body

[close]

/mod/forum/ -> unsubscribeall.php (source)

   1  <?php  //$Id: unsubscribeall.php,v 1.1.2.2 2008/07/07 21:51:40 skodak Exp $
   2  
   3  require_once("../../config.php");
   4  require_once ("lib.php");
   5  
   6  $confirm = optional_param('confirm', false, PARAM_BOOL);
   7  
   8  require_login();
   9  
  10  $return = $CFG->wwwroot.'/';
  11  
  12  if (isguestuser()) {
  13      redirect($return);
  14  }
  15  
  16  $strunsubscribeall = get_string('unsubscribeall', 'forum');
  17  $navlinks = array(array('name' => get_string('modulename', 'forum'), 'link' => null, 'type' => 'misc'),
  18                    array('name' => $strunsubscribeall, 'link' => null, 'type' => 'misc'));
  19  $navigation = build_navigation($navlinks);
  20  
  21  print_header($strunsubscribeall, format_string($COURSE->fullname), $navigation);
  22  print_heading($strunsubscribeall);
  23  
  24  if (data_submitted() and $confirm and confirm_sesskey()) {
  25      delete_records('forum_subscriptions', 'userid', $USER->id);
  26      set_field('user', 'autosubscribe', 0, 'id', $USER->id);
  27      print_box(get_string('unsubscribealldone', 'forum'));
  28      print_continue($return);
  29      print_footer();
  30      die;
  31      
  32  } else {
  33      $a = count_records('forum_subscriptions', 'userid', $USER->id);
  34  
  35      if ($a) {
  36          $msg = get_string('unsubscribeallconfirm', 'forum', $a);
  37          notice_yesno($msg, 'unsubscribeall.php', $return, array('confirm'=>1, 'sesskey'=>sesskey()), NULL, 'post', 'get');
  38          print_footer();
  39          die;
  40  
  41      } else {
  42          print_box(get_string('unsubscribeallempty', 'forum'));
  43          print_continue($return);
  44          print_footer();
  45          die;
  46      }
  47  }


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