[ Index ]

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

title

Body

[close]

/message/ -> index.php (source)

   1  <?php /// $Id: index.php,v 1.19.2.1 2008/05/02 05:09:41 jerome Exp $
   2         /// Main interface window for messaging
   3  
   4      require ('../config.php');
   5      require ('lib.php');
   6  
   7      require_login(0, false);
   8  
   9      if (isguest()) {
  10          redirect($CFG->wwwroot);
  11      }
  12  
  13      if (empty($CFG->messaging)) {
  14          error("Messaging is disabled on this site");
  15      }
  16  
  17  /// Optional variables that may be passed in
  18      $tab            = optional_param('tab', 'contacts'); // current tab - default to contacts
  19      $addcontact     = optional_param('addcontact',     0, PARAM_INT); // adding a contact
  20      $removecontact  = optional_param('removecontact',  0, PARAM_INT); // removing a contact
  21      $blockcontact   = optional_param('blockcontact',   0, PARAM_INT); // blocking a contact
  22      $unblockcontact = optional_param('unblockcontact', 0, PARAM_INT); // unblocking a contact
  23      $popup          = optional_param('popup', false, PARAM_ALPHANUM);    // If set then starts a new popup window
  24  
  25  /// Popup a window if required and quit (usually from external links).
  26      if ($popup) {
  27          print_header();
  28          echo '<script type="text/javascript">'."\n//<![CDATA[\n openpopup('/message/index.php', 'message', 'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500', 0);\n//]]>\n</script>";
  29          redirect("$CFG->wwwroot/", '', 0);
  30          exit;
  31      }
  32  
  33  /// Process any contact maintenance requests there may be
  34      if ($addcontact and confirm_sesskey()) {
  35          add_to_log(SITEID, 'message', 'add contact', 'history.php?user1='.$addcontact.'&amp;user2='.$USER->id, $addcontact);
  36          message_add_contact($addcontact);
  37      }
  38      if ($removecontact and confirm_sesskey()) {
  39          add_to_log(SITEID, 'message', 'remove contact', 'history.php?user1='.$removecontact.'&amp;user2='.$USER->id, $removecontact);
  40          message_remove_contact($removecontact);
  41      }
  42      if ($blockcontact and confirm_sesskey()) {
  43          add_to_log(SITEID, 'message', 'block contact', 'history.php?user1='.$blockcontact.'&amp;user2='.$USER->id, $blockcontact);
  44          message_block_contact($blockcontact);
  45      }
  46      if ($unblockcontact and confirm_sesskey()) {
  47          add_to_log(SITEID, 'message', 'unblock contact', 'history.php?user1='.$unblockcontact.'&amp;user2='.$USER->id, $unblockcontact);
  48          message_unblock_contact($unblockcontact);
  49      }
  50  
  51  
  52  /// Header on this page
  53      if ($tab == 'contacts') {
  54          print_header(get_string('messages', 'message').' - '.format_string($SITE->fullname), '', '', '', 
  55                  '<meta http-equiv="refresh" content="'. $CFG->message_contacts_refresh .'; url=index.php" />');
  56      } else {
  57          print_header(get_string('messages', 'message').' - '.format_string($SITE->fullname));
  58      }
  59  
  60      echo '<table cellspacing="2" cellpadding="2" border="0" width="95%" class="boxaligncenter">';  
  61      echo '<tr>';
  62  
  63  /// Print out the tabs
  64      echo '<td>';
  65      $tabrow = array();
  66      $tabrow[] = new tabobject('contacts', $CFG->wwwroot.'/message/index.php?tab=contacts', 
  67                                 get_string('contacts', 'message'));
  68      $tabrow[] = new tabobject('search', $CFG->wwwroot.'/message/index.php?tab=search', 
  69                                 get_string('search', 'message'));
  70      $tabrow[] = new tabobject('settings', $CFG->wwwroot.'/message/index.php?tab=settings', 
  71                                 get_string('settings', 'message'));
  72      $tabrows = array($tabrow);
  73           
  74      print_tabs($tabrows, $tab); 
  75      
  76      echo '</td>';
  77  
  78  
  79      echo '</tr><tr>';
  80  
  81  /// Print out contents of the tab
  82      echo '<td>';
  83  
  84  /// a print function is associated with each tab
  85      $tabprintfunction = 'message_print_'.$tab;
  86      if (function_exists($tabprintfunction)) {
  87          $tabprintfunction();
  88      }
  89  
  90      echo '</td> </tr> </table>';
  91      print_footer('none');
  92  
  93  ?>


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