[ PHPXref.com ] [ Generated: Sun Jul 20 16:25:05 2008 ] [ ACollab 1.2 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> index.php (source)

   1  <?php
   2  /****************************************************************************************/
   3  /* ACollab                                                                              */
   4  /****************************************************************************************/
   5  /* Copyright (c) 2002-2004  Adaptive Technology Resource Centre / University of Toronto */
   6  /*                                                                                      */
   7  /* http://atutor.ca/acollab                                                             */
   8  /*                                                                                      */
   9  /* This program is free software. You may redistribute it and/or                        */
  10  /* modify it under the terms of the GNU General Public License                          */
  11  /* as published by the Free Software Foundation; either version 2 of the License,       */
  12  /* or (at your option) any later version.                                               */
  13  /*                                                                                      */
  14  /* This program is distributed in the hope that it will be useful, but                  */
  15  /* WITHOUT ANY WARRANTY; without even the implied warranty of                           */
  16  /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                                 */
  17  /* See the GNU General Public License for more details.                                 */
  18  /*                                                                                      */
  19  /* You may access the GNU General Public License at:                                    */
  20  /* http://www.opensource.org/licenses/gpl-license.php                                   */
  21  /*                                                                                      */
  22  /* You may contact the Adaptive Technology Resource Centre at                           */
  23  /* Robarts Library, University of Toronto                                               */
  24  /* 130 St. George Street, Toronto, Ontario, Canada M5S 1A5                              */
  25  /* Further contact information is available at http://www.utoronto.ca/atrc/             */
  26  /****************************************************************************************/
  27  /* Programmer:                                                                          */
  28  /* Joel Kronenberg - ATRC                                                               */
  29  /* Heidi Hazelton  - ATRC                                                               */
  30  /****************************************************************************************/
  31  // $Id: index.php 484 2005-04-01 14:59:55Z shozubq $
  32  
  33  define('AC_INCLUDE_PATH', 'include/');
  34  
  35  require(AC_INCLUDE_PATH.'vitals.inc.php');
  36  /*echo '<pre>';
  37  print_r($_SESSION);*/
  38  authenticate(USER_CLIENT, USER_GROUP_ADMIN);
  39  
  40  if (isset($_GET['id'])) {
  41      $id = intval($_GET['id']);
  42  
  43      if (authenticate(USER_ADMIN, USER_RETURN_CHECK)) {
  44          $_SESSION['group_id'] = $id;
  45          $_SESSION['course_id'] = intval($_GET['cid']);
  46          //update online users list
  47          addd_user_online();
  48  
  49          if (isset($_GET['p'])) {
  50              header('Location: '.urldecode($_GET['p']));
  51          } else {
  52              header('Location: home.php');
  53          }
  54          exit;
  55  
  56      } else {
  57          $sql    = "SELECT M.privileges FROM ".TABLE_PREFIX."groups_members M WHERE M.member_id=$_SESSION[member_id] AND M.group_id=$id";
  58          $result    = mysql_query($sql, $db);
  59          if ($row = mysql_fetch_assoc($result)) {
  60              $_SESSION['group_id'] = $id;
  61              //update online users list
  62              addd_user_online();
  63              
  64              if ($row['privileges'] > 0) {
  65                  $_SESSION['status']   = $row['privileges'];
  66              } else {
  67                  $_SESSION['status'] = USER_CLIENT;
  68              }
  69              
  70              header('Location: home.php');
  71              exit;
  72          } else if (($_SESSION['courtyard_priv'] == COURTYARD_PRIV_GROUP_ACCESS) 
  73              || ($_SESSION['courtyard_priv'] == COURTYARD_PRIV_ADMIN) 
  74              || ($_SESSION['courtyard_priv'] == COURTYARD_PRIV_GROUP_ACCESS_CREATE) ) {
  75  
  76              $_SESSION['group_id'] = $id;
  77              $_SESSION['status'] = USER_GROUP_ADMIN;
  78  
  79              header('Location: home.php');
  80              exit;
  81          }
  82      }
  83  }
  84  
  85  $_SESSION['status'] = USER_CLIENT;
  86  
  87  $_SECTION[0][0] = _AC('groups');
  88  $_SECTION[0][1] = 'index.php';
  89  
  90  require(AC_INCLUDE_PATH.'pub/header.inc.php');
  91  
  92  ?>
  93  <br /><br /><br />
  94  <?php
  95  if (isset($_GET['f'])) {
  96      print_feedback($_GET['f']);
  97  }
  98  
  99  if (!$_SESSION['course_id']) {
 100  ?>
 101  
 102  <table border="0" cellspacing="0" cellpadding="0" align="center" width="70%">
 103      <tr><td>
 104          <a href="sign_out.php" onfocus="this.className='highlight'" onblur="this.className=''"><?php echo _AC('sign_out'); ?></a>
 105      </td></tr>
 106  </table>
 107  <?php
 108  } //end if
 109  ?>
 110  
 111  <table border="0" cellspacing="0" cellpadding="0" align="center" class="box" width="70%">
 112  
 113      <tr>
 114          <th colspan="4" class="box"><h3>
 115          <?php 
 116              if (defined('AT_PATH') && AT_PATH) {
 117                  $sql = 'SELECT title FROM '.AT_TABLE_PREFIX.'courses WHERE course_id='.$_SESSION['course_id'];
 118                  $result    = mysql_query($sql, $db);
 119                  if ($row = mysql_fetch_assoc($result)) {
 120                      echo $row['title'].' ';
 121                  }
 122              }
 123  
 124              echo _AC('groups'); 
 125          ?></h3></th>
 126      </tr>
 127  <?php 
 128  if ($_SESSION['course_id']) {
 129      require ('atutor/include/user_bar.inc.php'); 
 130  }    
 131  ?>
 132      <tr>
 133          <td><table border="0" cellspacing="0" cellpadding="4" class="border" width="100%"><?php
 134  
 135              if ($_SESSION['courtyard_priv'] == COURTYARD_PRIV_ADMIN) {
 136                  $order  = 'title';
 137                  $sql    = "SELECT *, 2 AS `privileges`, $_SESSION[member_id] AS member_id FROM ".TABLE_PREFIX."groups WHERE course_id=$_SESSION[course_id] ORDER BY $order";
 138                  //debug('is admin');
 139              } else if ($_SESSION['courtyard_priv'] == COURTYARD_PRIV_GROUP_CREATE) {
 140                  $order  = 'title';
 141                  $sql    = "SELECT H.*, M.privileges FROM ".TABLE_PREFIX."groups_members M, ".TABLE_PREFIX."groups H WHERE M.member_id=$_SESSION[member_id] AND M.group_id=H.group_id AND H.course_id=$_SESSION[course_id] ORDER BY $order";
 142                  //debug('is create');
 143              } else if (($_SESSION['courtyard_priv'] == COURTYARD_PRIV_GROUP_ACCESS) || ($_SESSION['courtyard_priv'] == COURTYARD_PRIV_GROUP_ACCESS_CREATE)) {
 144                  $order  = 'title';
 145                  $sql    = "SELECT * FROM ".TABLE_PREFIX."groups WHERE course_id=$_SESSION[course_id] ORDER BY $order";
 146  
 147                  $sql    = "SELECT H.group_id, H.title, H.image_name, M.member_id, M.privileges FROM ".TABLE_PREFIX."groups H LEFT JOIN ".TABLE_PREFIX."groups_members M ON H.group_id=M.group_id WHERE H.course_id=$_SESSION[course_id] ORDER BY $order";
 148  
 149                  //debug('is access');
 150              } else {
 151                  $order  = 'title';
 152                  $sql    = "SELECT H.*, M.member_id, M.privileges FROM ".TABLE_PREFIX."groups_members M, ".TABLE_PREFIX."groups H WHERE M.member_id=$_SESSION[member_id] AND M.group_id=H.group_id AND H.course_id=$_SESSION[course_id] ORDER BY $order";
 153                  //debug('is client');
 154              }
 155  
 156              $result    = mysql_query($sql, $db);
 157  
 158              while ($row = mysql_fetch_assoc($result)) {
 159                  if (isset($groups[$row['group_id']]) && ($row['member_id'] == $_SESSION['member_id'])) {
 160                      $groups[$row['group_id']] = $row;
 161                  } else if (!isset($groups[$row['group_id']]) && ($row['member_id'] == $_SESSION['member_id'])) {
 162                      $groups[$row['group_id']] = $row;
 163                  } else if (!isset($groups[$row['group_id']])) {
 164                      $row['privileges'] = 0;
 165                      $groups[$row['group_id']] = $row;
 166  
 167                  }
 168              }
 169  
 170              if (isset($groups)) {
 171                  $count=1;
 172                  foreach ($groups as $row) {
 173                      if ($count % 2) {
 174                          if ($count > 1) {
 175                              echo '</tr>';
 176                          }
 177                          echo '<tr>';
 178                      }
 179                      echo '<td align="center" valign="top" width="50%">';
 180                      echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$row['group_id'].'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'"><img src="images/group_icons/'.$row['image_name'].'" height="79" width="79" alt="" border="0" class="img3"/><br /><strong>';
 181                      echo $row['title'];
 182                      echo '</strong></a><br />';
 183                      if (query_bit( $row['privileges'], USER_GROUP_ADMIN) && !$_SESSION['course_id']) {
 184                          echo '<small><strong>('._AC('group_admin').')</strong></small>';
 185                      } else {
 186                          echo '<br />';
 187                      }
 188                      echo '</td>';
 189  
 190                      $count++;
 191  
 192                  }
 193              } else {
 194                  echo '<tr>';
 195                  echo '<td>';
 196                  echo _AC('not_in_groups');
 197                  echo '</td>';
 198                  echo '</tr>';
 199              }
 200          
 201          if ($count % 2) {
 202              if ($count > 1) {
 203                  echo '</tr>';
 204              }
 205              echo '<tr>';
 206          }
 207  
 208          if (!$_SESSION['course_id']) {
 209              echo '<td align="center" width="50%" valign="top"><a href="prefs/" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'"><img src="images/options.gif" border="0" height="80" width="80" alt="" class="img3" /><br /><b>'._AC('options').'</b></a></td>';
 210      
 211              $count++;
 212  
 213              if (authenticate(USER_ADMIN, USER_RETURN_CHECK)) {
 214                  if ($count % 2) {
 215                      if ($count > 1) {
 216                          echo '</tr>';
 217                      }
 218                      echo '<tr>';
 219                  }
 220                  echo '<td align="center" width="50%" valign="top"><a href="admin/index.php" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'"><img src="images/super.gif" border="0" height="80" width="80" alt="" class="img3" /><br /><b>'._AC('system_settings').'</b></a>';
 221                  echo '<br /><small><b>('._AC('admin').')</b></small>';
 222                  echo '</td>';
 223              }
 224          } else {
 225              if (($_SESSION['courtyard_priv'] == COURTYARD_PRIV_GROUP_CREATE) 
 226                      || ($_SESSION['courtyard_priv'] == COURTYARD_PRIV_ADMIN) 
 227                      || ($_SESSION['courtyard_priv'] == COURTYARD_PRIV_GROUP_ACCESS_CREATE) ) {
 228                  echo '<td align="center" width="50%" valign="top"><a href="admin/groups_create.php" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'"><img src="images/super.gif" border="0" height="80" width="80" alt="" class="img3" /><br /><strong>'._AC('create_group').'</strong></a>';
 229                  echo '</td>';
 230              } 
 231          }
 232          if ($count % 2) {
 233              echo '<td>&nbsp;</td>';
 234          }
 235          echo '</tr>';
 236          echo '</table>';
 237  
 238      require (AC_INCLUDE_PATH.'footer.inc.php');
 239  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]