Revision: 70
http://svn.sourceforge.net/hw4mdl/?rev=70&view=rev
Author: shazan
Date: 2006-09-29 06:31:54 -0700 (Fri, 29 Sep 2006)
Log Message:
-----------
room id add to the instance on creation
Modified Paths:
--------------
trunk/moodle/mod/liveclassroom/mod.html
Modified: trunk/moodle/mod/liveclassroom/mod.html
===================================================================
--- trunk/moodle/mod/liveclassroom/mod.html 2006-09-26 13:36:58 UTC (rev 69)
+++ trunk/moodle/mod/liveclassroom/mod.html 2006-09-29 13:31:54 UTC (rev 70)
@@ -5,14 +5,27 @@
require_once($CFG->dirroot.'/calendar/lib.php');
include_once($CFG->dirroot.'/mod/liveclassroom/lib.php');
$id = optional_param('id', 0, PARAM_INT);
+
+ require_once("../config.php");
+
+ require_login($course->id);
- if ($id) {
-
- if (! $course = get_record("course", "id", $id)) {
- error("Course is misconfigured");
- }
-
- }
+ if (!isteacher($course->id, $USER->id)) { //to Be sure
+ error("You need to be a teacher in this course to c reate an instance");
+ }
+
+ // Check if the rooms exist on the server
+ if(!(liveclassroom_api_user_exist($course))){
+ // make sure the profiles exist
+ if (!liveclassroom_create_profiles ($course)) {
+ error ("Cannot create liveclassroom profiles");
+ }
+ liveclassroom_create_rooms ($course);
+ }
+ else {
+
+ }
+
/// First we check that form variables have been initialised
if (!isset($form->name)) {
$form->name = '';
@@ -29,6 +42,7 @@
if (!isset($form->section)) {
$form->section = '';
}
+
if (empty($form->timeopen)) {
$form->timeopen = "";
$form->timerestrict = 0;
@@ -77,11 +91,17 @@
<?php
if($course->format == "weeks"){
//Display the lsit of the weeks
- $timenow = time();
- $weekdate = $course->startdate; // this should be 0:00 Monday of that week
+
+ ?>
+ <td align="right"><b><?php print_string('weeksformat', 'liveclassroom')?>:</b></td>
+ <td>
+ <SELECT name="section">
+ <?php
+
+ $weekdate = $course->startdate; // this should be 0:00 Monday of that week
$weekdate += 7200; // Add two hours to avoid possible DST problems
$section = 1;
- $sectionmenu = array();
+ // $sectionmenu = array();
$weekofseconds = 604800;
$course->enddate = $course->startdate + ($weekofseconds * $course->numsections);
$k=0;
@@ -90,34 +110,58 @@
$weekday = userdate($weekdate, '%d %B') ;
$endweekday = userdate($weekdate+518400, '%d %B');
$list_weeks[$k] = $weekday.' - '.$endweekday;
+ ?>
+ <OPTION <?php if($_GET['section']==$k+1) { echo "selected"; }?> VALUE="<?php p($k+1) ?>"><?php p($list_weeks[$k]) ?></OPTION>
+ <?php
$k++;
$section++;
$weekdate = $nextweekdate;
}
-
- ?>
- <td align="right"><b><?php print_string('weeksformat', 'liveclassroom')?>:</b></td>
- <td>
- <SELECT name="section">
- <?php
- for($i=0;$i<sizeof($list_weeks);$i++) {
+
?>
-
- <OPTION <?php if($_GET['section']==$i+1) { echo "selected"; }?> VALUE="<?php p($i+1) ?>"><?php p($list_weeks[$i]) ?></OPTION>
-
- <?php
- }
- ?>
- </SELECT>
+ </SELECT>
</td>
<?php
}
- else if($course->format == "topics"){ ?>
+ else if($course->format == "topics"){
+ // Delete all the < ...>
+ function supprimer_tags($texte, $rempl = "") {
+ $texte = ereg_replace("< [^>]*>", $rempl, $texte);
+ return $texte;
+ }
+
+ function textebrut($texte) {
+ $texte = ereg_replace("[\n\r]+", " ", $texte);
+ $texte = eregi_replace("< (p|br)([[:space:]][^>]*)?".">", "\n\n", $texte);
+ $texte = ereg_replace("^\n+", "", $texte);
+ $texte = ereg_replace("\n+$", "", $texte);
+ $texte = ereg_replace("\n +", "\n", $texte);
+ $texte = supprimer_tags($texte);
+ $texte = ereg_replace("( | )+", " ", $texte);
+ return $texte;
+ }
+
+ function txt($chaine){
+ return str_replace("<br />", "\n" ,$chaine);
+ }
+ ?>
<tr valign="top">
- <td align="right"><b><?php print_string("topicformat") ?>:</b></td>
+ <td align="right"><b><?php print_string('topicformat', 'liveclassroom') ?>:</b></td>
<td>
- <select>
- <option value="">
+ <select name="section">
+ <?php
+ $section = 1;
+ while ($section <= $course->numsections) {
+ if (!$thissection = get_record('course_sections', 'course',$course->id, 'section', $section)) {
+ notify('Error getting course_sections!');
+ }
+
+ ?>
+ <OPTION <?php if($_GET['section']==$section) { echo "selected"; }?> title="<?php p($thissection->summary) ?>" value="<?php p($section) ?>">Topic <?php p($section) ?></OPTION>
+ <?php
+ $section++;
+ }
+ ?>
</select>
</td>
</tr>
@@ -131,20 +175,16 @@
<td>
<?php
include_once($CFG->dirroot.'/mod/liveclassroom/lib.php');
- //Get the list of type of rooms available
- if(!(liveclassroom_api_user_exist($course))){
- $list_type_rooms = liveclassroom_get_list_type_rooms_first_time();
- }
- else {
- $list_type_rooms = liveclassroom_get_list_type_rooms($course);
- }?>
+
+ $list_type_rooms = liveclassroom_get_list_type_rooms($course);
+ ?>
<SELECT name="type">
<?php
for($i=0;$i<sizeof($list_type_rooms);$i++) {
?>
- <OPTION <?php if(liveclassroom_get_room_name_from_id($_GET['roomId'])==$list_type_rooms[$i]){ echo "selected"; } ?> VALUE="<?php p($list_type_rooms[$i]) ?>"><?php p($list_type_rooms[$i]) ?></OPTION>
+ <OPTION <?php if(($_GET['roomId']!=null)&&(liveclassroom_get_room_name_from_id($_GET['roomId']))==$list_type_rooms[$i]){ echo "selected"; } ?> VALUE="<?php p(liveclassroom_get_room_id($course,$list_type_rooms[$i])) ?>"><?php p($list_type_rooms[$i]) ?></OPTION>
<?php
}
@@ -152,6 +192,7 @@
?>
</SELECT>
</td>
+
</tr>
@@ -183,26 +224,8 @@
</td>
</tr>
-
-
-<!--
-
-<table width="100%" border="1" bgcolor="#DDDDDD" cellpadding="0">
-<tr border="1">
- <td>
- <font color="red">*</font><?php print_string('requiredfields', 'liveclassroom')?>
- </td>
- <td align="right">
- <input type="reset" value="<?php print_string("cancel") ?>" />
- <input type="submit" value="<?php print_string("add") ?>" />
- </td>
-
-
</table>
-</tr>
--->
-</table>
<!-- These hidden variables are always the same -->
<input type="hidden" name=course value="<?php p($form->course) ?>" />
<input type="hidden" name="sesskey" value="<?php p($form->sesskey) ?>" />
@@ -214,5 +237,4 @@
<input type="hidden" name=mode value="<?php p($form->mode) ?>" />
</center>
-
</form>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|