dokeos-online
[ class tree: dokeos-online ] [ index: dokeos-online ] [ all elements ]

Source for file online_whoisonline.php

Documentation is available at online_whoisonline.php

  1. <?php // $Id: online_whoisonline.php 12269 2007-05-03 14:17:37Z elixir_julian $
  2. /*
  3. ==============================================================================
  4.     Dokeos - elearning and course management software
  5.  
  6.     Copyright (c) 2004 Dokeos S.A.
  7.     Copyright (c) 2003 Ghent University (UGent)
  8.     Copyright (c) 2001 Universite catholique de Louvain (UCL)
  9.     Copyright (c) Olivier Brouckaert
  10.  
  11.     For a full list of contributors, see "credits.txt".
  12.     The full license can be read in "license.txt".
  13.  
  14.     This program is free software; you can redistribute it and/or
  15.     modify it under the terms of the GNU General Public License
  16.     as published by the Free Software Foundation; either version 2
  17.     of the License, or (at your option) any later version.
  18.  
  19.     See the GNU General Public License for more details.
  20.  
  21.     Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  22. ==============================================================================
  23. */
  24. /**
  25. ==============================================================================
  26. *    Shows the list of connected users
  27. *
  28. *    @author Olivier Brouckaert
  29. *    @package dokeos.online
  30. ==============================================================================
  31. */
  32.  
  33. define('FRAME','online');
  34.  
  35. // name of the language file that needs to be included 
  36. $language_file='chat';
  37.  
  38. include('../inc/global.inc.php');
  39. $this_section=SECTION_COURSES;
  40.  
  41. $showPic=intval($_GET['showPic']);
  42.  
  43. $tbl_user                Database::get_main_table(TABLE_MAIN_USER);
  44. $tbl_course_user         Database::get_main_table(TABLE_MAIN_COURSE_USER);
  45. $tbl_online_connected    Database::get_course_table(TABLE_ONLINE_CONNECTED);
  46.  
  47. $query="SELECT username FROM $tbl_user WHERE user_id='".$_user['user_id']."'";
  48. $result=api_sql_query($query,__FILE__,__LINE__);
  49.  
  50. list($pseudoUser)=mysql_fetch_row($result);
  51.  
  52. $isAllowed=(empty($pseudoUser|| !$_cid)?false:true;
  53. $isMaster=$is_courseAdmin?true:false;
  54.  
  55. if(!$isAllowed)
  56. {
  57.     exit();
  58. }
  59.  
  60. $pictureURL=api_get_path(WEB_CODE_PATH).'upload/users/';
  61.  
  62. $query="SELECT t1.user_id,t1.username,t1.firstname,t1.lastname,t1.picture_uri,t3.status FROM $tbl_user t1,$tbl_online_connected t2,$tbl_course_user t3 WHERE t1.user_id=t2.user_id AND t3.user_id=t1.user_id AND t3.course_code = '".$_course[sysCode]."'  AND t2.last_connection>'".date('Y-m-d H:i:s',time()-60*5)."' ORDER BY t1.username";
  63. $result=api_sql_query($query,__FILE__,__LINE__);
  64.  
  65. $Users=api_store_result($result);
  66.  
  67. include('header_frame.inc.php');
  68. ?>
  69.  
  70. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  71.  
  72. <?php
  73. foreach($Users as $enreg)
  74. {
  75. ?>
  76.  
  77. <tr>
  78.   <td width="1%" rowspan="2" valign="middle"><img src="../img/whoisonline.png" border="0" alt="" style="margin-right: 3px;"></td>
  79.   <td width="99%"><a <?php if($enreg['status'== 1echo 'class="master"'?> name="user_<?php echo $enreg['user_id']?>" href="<?php echo api_get_self()?>?showPic=<?php if($showPic == $enreg['user_id']echo '0'else echo $enreg['user_id']?>#user_<?php echo $enreg['user_id']?>"><b><?php echo $enreg['username']?></b></a></td>
  80. </tr>
  81. <tr>
  82.   <td width="99%"><small><?php echo ucfirst($enreg['lastname']).' '.ucfirst($enreg['firstname'])?></small></td>
  83. </tr>
  84.  
  85. <?php if($showPic == $enreg['user_id'])?>
  86. <tr>
  87.   <td colspan="2" align="center"><img src="<?php if(empty($enreg['picture_uri'])) echo '../img/unknown.jpg'else echo $pictureURL.$enreg['picture_uri']?>" border="0" width="100" alt="" style="margin-top: 5px;"></td>
  88. </tr>
  89. <?php endif?>
  90.  
  91. <tr>
  92.   <td height="5"></td>
  93. </tr>
  94.  
  95. <?php
  96. }
  97.  
  98. unset($Users);
  99. ?>
  100.  
  101. </table>
  102.  
  103. <?php
  104. include('footer_frame.inc.php');
  105. ?>

Documentation generated on Thu, 12 Jun 2008 14:08:43 -0500 by phpDocumentor 1.4.1