Code Search for Developers
 
 
  

online_master.php from pointcarre at Krugle


Show online_master.php syntax highlighted

<?php // $Id: online_master.php 2 2005-07-15 13:01:38Z roane $
/*
==============================================================================
	Dokeos - elearning and course management software

	Copyright (c) 2004 Dokeos S.A.
	Copyright (c) 2003 Ghent University (UGent)
	Copyright (c) 2001 Universite catholique de Louvain (UCL)
	Copyright (c) Olivier Brouckaert

	For a full list of contributors, see "credits.txt".
	The full license can be read in "license.txt".

	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.

	See the GNU General Public License for more details.

	Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/**
==============================================================================
*	Displays the master's picture and/or the video or audio file
*
*	@author Olivier Brouckaert
*	@package dokeos.online
==============================================================================
*/

define('FRAME','master');

$langFile='chat';

include('../inc/claro_init_global.inc.php');


$init=intval($_GET['init']);

$tbl_user=$mainDbName."`.`user";
//$tbl_cours_user=$mainDbName."`.`cours_user";
//updated for 1.6 - YW
$tbl_course_user = Database::get_main_table(MAIN_COURSE_USER_TABLE);
$tbl_online_link=$_course['dbNameGlu'].'online_link';

$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 (t1.user_id='$_uid' OR t2.status='1')";
$result=api_sql_query($query,__FILE__,__LINE__);

while($row=mysql_fetch_array($result))
{
	if($row['user_id'] == $_uid)
	{
		$pseudoUser=$row['username'];
	}

	if($row['status'] == 1)
	{
		$picture_uri=$row['picture_uri'];
	}
}

$isAllowed=(empty($pseudoUser) || !$_cid)?false:true;
$isMaster=$is_courseAdmin?true:false;

if(!$isAllowed)
{
	exit();
}

$pictureURL=api_get_path(WEB_CODE_PATH).'upload/users/';
$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
$onlinePath=$documentPath.'online_files/';

if(!is_dir($onlinePath))
{
	if(is_file($onlinePath))
	{
		@unlink($onlinePath);
	}

	@mkdir($onlinePath,0777);
	@chmod($onlinePath,0777);
}

if($isMaster && $init)
{
	$fp=fopen($onlinePath.'htmlarea.html','w');

	fputs($fp,get_lang('TextEditorDefault'));

	fclose($fp);

	if(!file_exists($onlinePath.'streaming.txt'))
	{
		$fp=fopen($onlinePath.'streaming.txt','w');

		fputs($fp,"http://www.dokeos.com/pub/01_discovery_high.mov\nmov");

		fclose($fp);
	}
}

if(!$isMaster)
{
	if(!list($stream_url,$stream_type)=@file($onlinePath.'streaming.txt'))
	{
		$stream_url='';
		$stream_type='mp3';
	}
	else
	{
		$stream_url=rtrim($stream_url);
		$stream_type=rtrim($stream_type);
	}

	$query="SELECT id,name,url FROM `$tbl_online_link` ORDER BY name";
	$result=api_sql_query($query,__FILE__,__LINE__);

	$Links=api_store_result($result);
}

include('header_frame.inc.php');
?>

<?php if($isMaster): ?>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
  <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')); ?>"></a></td>
  <td width="49%" align="left" nowrap="nowrap">&nbsp;<a href="online_streaming.php"><?php echo get_lang('Streaming'); ?></a></td>
  <td width="49%" align="right" nowrap="nowrap"><a href="online_htmlarea.php" target="online_working_area"><?php echo get_lang('WhiteBoard'); ?></a>&nbsp;</td>
  <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')); ?>"></a></td>
</tr>
</table>

<br>
<?php endif; ?>

<table border="0" cellpadding="5" cellspacing="0" width="100%" <?php if(!$isMaster) echo 'height="100%"'; ?> >
<tr>

<?php if($isMaster || empty($stream_url)): ?>
  <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>
<?php elseif(!empty($stream_url) && $stream_type == 'mp3'): ?>
  <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>
  <td width="99%" valign="middle" align="center">
<?php else: ?>
  <td align="center">
<?php endif; ?>

<?php
if(!$isMaster && !empty($stream_url))
{
	if($stream_type == 'mp3')
	{
?>

	<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>

<?php
	}
	elseif($stream_type == 'mp4')
	{
?>

	<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="160" height="120" type="application/x-oleobject">
	<param name="src" value="<?php echo $stream_url; ?>">
	<param name="autoplay" value="true">
	<param name="loop" value="true">
	<param name="cache" value="false">
	<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>
	</object>

<?php
	}
	elseif($stream_type == 'mov')
	{
?>

	<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="160" height="120" type="application/x-oleobject">
	<param name="src" value="<?php echo $stream_url; ?>">
	<param name="autoplay" value="true">
	<param name="loop" value="true">
	<param name="cache" value="false">
	<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>
	</object>

<?php
	}
}
?>

  </td>
</tr>
</table>

<?php if($isMaster): ?>
<br>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
  <td width="1%" valign="middle"><a href="online_links.php"><img src="../img/liens.gif" border="0" alt="" title="<?php echo htmlentities(get_lang('Links')); ?>"></a></td>
  <td width="49%" align="left" nowrap="nowrap">&nbsp;<a href="online_links.php"><?php echo get_lang('Links'); ?></a></td>
  <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>
  <td width="1%" valign="middle"><a href="online_working_area.php" target="online_working_area"><img src="../img/home.png" border="0" alt="" title="<?php echo htmlentities(get_lang('Home')); ?>"></a></td>
</tr>
</table>
<?php endif; ?>

<?php
include('footer_frame.inc.php');
?>




See more files for this project here

pointcarre

Pointcarre - a learning management system based on the Dokeos community releases. No fork, but containing locally developed extensions, features not (yet) in the standard release, integrated plugins...

Project homepage: http://sourceforge.net/projects/pointcarre
Programming language(s): PHP
License: other

  footer_frame.inc.php
  header_frame.inc.php
  index.html
  online.php
  online_banner.php
  online_chat.php
  online_goto.php
  online_hidden1.php
  online_hidden2.php
  online_htmlarea.php
  online_links.php
  online_master.php
  online_message.php
  online_streaming.php
  online_whoisonline.php
  online_working_area.php