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

Source for file online_master.php

Documentation is available at online_master.php

  1. <?php // $Id: online_master.php 13296 2007-09-27 02:19:40Z yannoo $
  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. *    Displays the master's picture and/or the video or audio file
  27. *
  28. *    @author Olivier Brouckaert
  29. *    @package dokeos.online
  30. ==============================================================================
  31. */
  32.  
  33. define('FRAME','master');
  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. $init=intval($_GET['init']);
  42.  
  43.  
  44. $query="SELECT t1.user_id,username,picture_uri,t2.status FROM $tbl_user t1,$tbl_course_user t2 WHERE t1.user_id=t2.user_id AND course_code='$_cid' AND (t1.user_id='".$_user['user_id']."' OR t2.status='1')";
  45. $result=api_sql_query($query,__FILE__,__LINE__);
  46.  
  47. while($row=mysql_fetch_array($result))
  48. {
  49.     if($row['user_id'== $_user['user_id'])
  50.     {
  51.         $pseudoUser=$row['username'];
  52.     }
  53.  
  54.     if($row['status'== 1)
  55.     {
  56.         $picture_uri=$row['picture_uri'];
  57.     }
  58. }
  59.  
  60. $isAllowed=(empty($pseudoUser|| !$_cid)?false:true;
  61. $isMaster=$is_courseAdmin?true:false;
  62.  
  63. if(!$isAllowed)
  64. {
  65.     exit();
  66. }
  67.  
  68. $pictureURL=api_get_path(WEB_CODE_PATH).'upload/users/';
  69. $documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
  70. $onlinePath=$documentPath.'online_files/';
  71.  
  72. if(!is_dir($onlinePath))
  73. {
  74.     if(is_file($onlinePath))
  75.     {
  76.         @unlink($onlinePath);
  77.     }
  78.  
  79.     @mkdir($onlinePath,0777);
  80.     @chmod($onlinePath,0777);
  81. }
  82.  
  83. if($isMaster && $init)
  84. {
  85.     $fp=fopen($onlinePath.'htmlarea.html','w');
  86.  
  87.     fputs($fp,get_lang('TextEditorDefault'));
  88.  
  89.     fclose($fp);
  90.  
  91.     if(!file_exists($onlinePath.'streaming.txt'))
  92.     {
  93.         $fp=fopen($onlinePath.'streaming.txt','w');
  94.  
  95.         fputs($fp,"http://www.dokeos.com/pub/01_discovery_high.mov\nmov");
  96.  
  97.         fclose($fp);
  98.     }
  99. }
  100.  
  101. if(!$isMaster)
  102. {
  103.     if(!list($stream_url,$stream_type)=@file($onlinePath.'streaming.txt'))
  104.     {
  105.         $stream_url='';
  106.         $stream_type='mp3';
  107.     }
  108.     else
  109.     {
  110.         $stream_url=rtrim($stream_url);
  111.         $stream_type=rtrim($stream_type);
  112.     }
  113.  
  114.     $query="SELECT id,name,url FROM $tbl_online_link ORDER BY name";
  115.     $result=api_sql_query($query,__FILE__,__LINE__);
  116.  
  117.     $Links=api_store_result($result);
  118. }
  119.  
  120. include('header_frame.inc.php');
  121. ?>
  122.  
  123. <?php if($isMaster)?>
  124. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  125. <tr>
  126.   <td width="1%" valign="middle"><a href="online_streaming.php"><img src="../img/conf.gif" border="0" alt="" title="<?php echo htmlentities(get_lang('Streaming'),ENT_QUOTES,$charset)?>"></a></td>
  127.   <td width="49%" align="left" nowrap="nowrap">&nbsp;<a href="online_streaming.php"><?php echo get_lang('Streaming')?></a></td>
  128.   <td width="49%" align="right" nowrap="nowrap"><a href="online_htmlarea.php" target="online_working_area"><?php echo get_lang('WhiteBoard')?></a>&nbsp;</td>
  129.   <td width="1%" valign="middle"><a href="online_htmlarea.php" target="online_working_area"><img src="../img/works.gif" border="0" alt="" title="<?php echo htmlentities(get_lang('WhiteBoard'),ENT_QUOTES,$charset)?>"></a></td>
  130. </tr>
  131. </table>
  132.  
  133. <br>
  134. <?php endif?>
  135.  
  136. <table border="0" cellpadding="5" cellspacing="0" width="100%" <?php if(!$isMasterecho 'height="100%"'?> >
  137. <tr>
  138.  
  139. <?php if($isMaster || empty($stream_url))?>
  140.   <td align="center" valign="middle"><img src="<?php if(empty($picture_uri)) echo '../img/unknown.jpg'else echo $pictureURL.$picture_uri?>" border="0" height="120" alt=""></td>
  141. <?php elseif(!empty($stream_url&& $stream_type == 'mp3')?>
  142.   <td width="1%" valign="middle"><img src="<?php if(empty($picture_uri)) echo '../img/unknown.jpg'else echo $pictureURL.$picture_uri?>" border="0" height="120" alt=""></td>
  143.   <td width="99%" valign="middle" align="center">
  144. <?php else?>
  145.   <td align="center">
  146. <?php endif?>
  147.  
  148. <?php
  149. if(!$isMaster && !empty($stream_url))
  150. {
  151.     if($stream_type == 'mp3')
  152.     {
  153. ?>
  154.  
  155.     <embed src="<?php echo $stream_url?>" width="30" height="60" autostart="true" loop="false" controls="PlayOnlyButton,StopButton" type="audio/x-pn-realaudio-plugin" pluginspage="http://www.real.com/player/index.html?src=000629realhome"></embed>
  156.  
  157. <?php
  158.     }
  159.     elseif($stream_type == 'mp4')
  160.     {
  161. ?>
  162.  
  163.     <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="160" height="120" type="application/x-oleobject">
  164.     <param name="src" value="<?php echo $stream_url?>">
  165.     <param name="autoplay" value="true">
  166.     <param name="loop" value="true">
  167.     <param name="cache" value="false">
  168.     <embed src="<?php echo $stream_url?>" width="160" height="120" autoplay="true" loop="true" cache="false" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed>
  169.     </object>
  170.  
  171. <?php
  172.     }
  173.     elseif($stream_type == 'mov')
  174.     {
  175. ?>
  176.  
  177.     <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="160" height="120" type="application/x-oleobject">
  178.     <param name="src" value="<?php echo $stream_url?>">
  179.     <param name="autoplay" value="true">
  180.     <param name="loop" value="true">
  181.     <param name="cache" value="false">
  182.     <embed src="<?php echo $stream_url?>" width="160" height="120" autoplay="true" loop="true" cache="false" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed>
  183.     </object>
  184.  
  185. <?php
  186.     }
  187. }
  188. ?>
  189.  
  190.   </td>
  191. </tr>
  192. </table>
  193.  
  194. <?php if($isMaster)?>
  195. <br>
  196.  
  197. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  198. <tr>
  199.   <td width="1%" valign="middle"><a href="online_links.php"><img src="../img/links.gif" border="0" alt="" title="<?php echo htmlentities(get_lang('Links'),ENT_QUOTES,$charset)?>"></a></td>
  200.   <td width="49%" align="left" nowrap="nowrap">&nbsp;<a href="online_links.php"><?php echo get_lang('Links')?></a></td>
  201.   <td width="49%" align="right" nowrap="nowrap"><a href="online_working_area.php" target="online_working_area"><?php echo get_lang('Home')?></a>&nbsp;</td>
  202.   <td width="1%" valign="middle"><a href="online_working_area.php" target="online_working_area"><img src="../img/home.gif" border="0" alt="" title="<?php echo htmlentities(get_lang('Home'),ENT_QUOTES,$charset)?>"></a></td>
  203. </tr>
  204. </table>
  205. <?php endif?>
  206.  
  207. <?php
  208. include('footer_frame.inc.php');
  209. ?>

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