skala
iflores 16 years ago
commit 0e0b9b5b4a
  1. 1
      documentation/changelog.html
  2. 2
      documentation/installation_guide.html
  3. 2
      documentation/installation_guide_es_ES.html
  4. 65
      main/admin/session_export.php
  5. 288
      main/admin/session_import.php
  6. 4
      main/admin/user_import.php
  7. 25
      main/auth/my_progress.php
  8. 49
      main/chat/chat_banner.php
  9. 20
      main/chat/chat_whoisonline.php
  10. 11
      main/group/group_category.php
  11. 7
      main/group/group_edit.php
  12. 15
      main/group/group_space.php
  13. 4
      main/inc/lib/add_course.lib.inc.php
  14. 12
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_details_listing.php
  15. 13
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajaxfilemanager.php
  16. 2
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/config.base.php
  17. 4
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/jscripts/ajaxfilemanager_c.js
  18. 5
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/theme/default/css/fckeditor.css
  19. 17
      main/inc/lib/groupmanager.lib.php
  20. 2
      main/install/migrate-db-1.8.6.1-1.8.6.2-pre.sql
  21. 30
      main/mySpace/myStudents.php

@ -30,6 +30,7 @@
<li>Added sessions history (optional access to previous sessions in read-only for students)</li> <li>Added sessions history (optional access to previous sessions in read-only for students)</li>
<li>Added advanced search in sessions: you can also search by session name, session category, tutor and visibility. (DT#5541)</li> <li>Added advanced search in sessions: you can also search by session name, session category, tutor and visibility. (DT#5541)</li>
<li>Added an option to configure courses as "auto-registered" (every user has it in his courses list and is automatically subscribed)</li> <li>Added an option to configure courses as "auto-registered" (every user has it in his courses list and is automatically subscribed)</li>
<li>Added chat tool to the groups(DT#3318)</li>
<li>Allowed password to be recovered using username *or* e-mail</li> <li>Allowed password to be recovered using username *or* e-mail</li>
<li>Added editable section to the registration form</li> <li>Added editable section to the registration form</li>
<li>Reporting: notification of user who have never been active yet</li> <li>Reporting: notification of user who have never been active yet</li>

@ -72,7 +72,7 @@ optimal flexibility, remote control and scalability. <br />
<br /> <br />
Dokeos is mainly a LMS running <span style="font-weight: bold;">Apache</span>, <span style="font-weight: bold;">MySQL</span> and <span style="font-weight: bold;">PHP5</span> (the so called <span style="font-weight: bold;">AMP</span> trilogy). <br /> Dokeos is mainly a LMS running <span style="font-weight: bold;">Apache 1.3, 2.0</span>, <span style="font-weight: bold;">MySQL 5.1</span> and <span style="font-weight: bold;">PHP 5.1</span> (the so called <span style="font-weight: bold;">AMP</span> trilogy). <br />
<br /> <br />

@ -83,7 +83,7 @@ control remoto y escalabilidad. <br />
<br /> <br />
Dokeos es principalmente un LMS que se ejecuta con <span style="font-weight: bold;">Apache</span>, <span style="font-weight: bold;">MySQL</span> y <span style="font-weight: bold;">PHP5</span> (tambien llamada la trilogía <span style="font-weight: bold;">AMP</span>). <br /> Dokeos es principalmente un LMS que se ejecuta con <span style="font-weight: bold;">Apache 1.3, 2.0</span>, <span style="font-weight: bold;">MySQL 5.1</span> y <span style="font-weight: bold;">PHP 5.1</span> (tambien llamada la trilogía <span style="font-weight: bold;">AMP</span>). <br />
<br /> <br />

@ -69,7 +69,7 @@ if($_POST['formSent'] )
$session_id=$_POST['session_id']; $session_id=$_POST['session_id'];
if(empty($session_id)) if(empty($session_id))
{ {
$sql = "SELECT id,name,id_coach,username,date_start,date_end FROM $tbl_session INNER JOIN $tbl_user $sql = "SELECT id,name,id_coach,username,date_start,date_end,visibility,session_category_id FROM $tbl_session INNER JOIN $tbl_user
ON $tbl_user.user_id = $tbl_session.id_coach ORDER BY id"; ON $tbl_user.user_id = $tbl_session.id_coach ORDER BY id";
global $_configuration; global $_configuration;
@ -77,7 +77,7 @@ if($_POST['formSent'] )
$tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1){ if ($access_url_id != -1){
$sql = "SELECT id, name,id_coach,username,date_start,date_end FROM $tbl_session s INNER JOIN $tbl_session_rel_access_url as session_rel_url $sql = "SELECT id, name,id_coach,username,date_start,date_end,visibility,session_category_id FROM $tbl_session s INNER JOIN $tbl_session_rel_access_url as session_rel_url
ON (s.id= session_rel_url.session_id) INNER JOIN $tbl_user u ON (u.user_id = s.id_coach) ON (s.id= session_rel_url.session_id) INNER JOIN $tbl_user u ON (u.user_id = s.id_coach)
WHERE access_url_id = $access_url_id WHERE access_url_id = $access_url_id
ORDER BY id"; ORDER BY id";
@ -88,7 +88,7 @@ if($_POST['formSent'] )
} }
else else
{ {
$sql = "SELECT id,name,username,date_start,date_end $sql = "SELECT id,name,username,date_start,date_end,visibility,session_category_id
FROM $tbl_session FROM $tbl_session
INNER JOIN $tbl_user INNER JOIN $tbl_user
ON $tbl_user.user_id = $tbl_session.id_coach ON $tbl_user.user_id = $tbl_session.id_coach
@ -125,7 +125,7 @@ if($_POST['formSent'] )
if($file_type == 'csv') if($file_type == 'csv')
{ {
$cvs = true; $cvs = true;
fputs($fp,"SessionName;Coach;DateStart;DateEnd;Users;Courses;\n"); fputs($fp,"SessionName;Coach;DateStart;DateEnd;Visibility;SessionCategory;Users;Courses;\n");
} }
else else
{ {
@ -140,15 +140,19 @@ if($_POST['formSent'] )
$row['username'] = str_replace(';',',',$row['username']); $row['username'] = str_replace(';',',',$row['username']);
$row['date_start'] = str_replace(';',',',$row['date_start']); $row['date_start'] = str_replace(';',',',$row['date_start']);
$row['date_end'] = str_replace(';',',',$row['date_end']); $row['date_end'] = str_replace(';',',',$row['date_end']);
$row['visibility'] = str_replace(';',',',$row['visibility']);
$row['session_category'] = str_replace(';',',',$row['session_category_id']);
if($cvs){ if($cvs){
$add.= $row['name'].';'.$row['username'].';'.$row['date_start'].';'.$row['date_end'].';'; $add.= $row['name'].';'.$row['username'].';'.$row['date_start'].';'.$row['date_end'].';'.$row['visibility'].';'.$row['session_category'].';';
} }
else { else {
$add = "\t<Session>\n" $add = "\t<Session>\n"
."\t\t<SessionName>$row[name]</SessionName>\n" ."\t\t<SessionName>$row[name]</SessionName>\n"
."\t\t<Coach>$row[username]</Coach>\n" ."\t\t<Coach>$row[username]</Coach>\n"
."\t\t<DateStart>$row[date_start]</DateStart>\n" ."\t\t<DateStart>$row[date_start]</DateStart>\n"
."\t\t<DateEnd>$row[date_end]</DateEnd>\n"; ."\t\t<DateEnd>$row[date_end]</DateEnd>\n"
."\t\t<Visibility>$row[visibility]</Visibility>\n"
."\t\t<SessionCategory>$row[session_category]</SessionCategory>\n";
} }
//users //users
@ -176,37 +180,55 @@ if($_POST['formSent'] )
$add .= $users; $add .= $users;
//courses //courses
$sql = "SELECT DISTINCT $tbl_course.code, $tbl_user.username FROM $tbl_course $sql = "SELECT DISTINCT $tbl_course.code
INNER JOIN $tbl_session_course FROM $tbl_course
ON $tbl_course.code = $tbl_session_course.course_code INNER JOIN $tbl_session_course_user
AND $tbl_session_course.id_session = '".$row['id']."' ON $tbl_course.code = $tbl_session_course_user.course_code
LEFT JOIN $tbl_user AND $tbl_session_course_user.id_session = '".$row['id']."'";
ON $tbl_user.user_id = $tbl_session_course.id_coach";
$rsCourses = Database::query($sql,__FILE__,__LINE__); $rsCourses = Database::query($sql,__FILE__,__LINE__);
$courses = ''; $courses = '';
while($rowCourses = Database::fetch_array($rsCourses)){ while($rowCourses = Database::fetch_array($rsCourses)){
// get coachs from a course
$sql = "SELECT u.username
FROM $tbl_session_course_user scu
INNER JOIN $tbl_user u ON u.user_id = scu.id_user
WHERE scu.course_code = '{$rowCourses['code']}'
AND scu.id_session = '".$row['id']."' AND scu.status = 2 ";
$rs_coachs = Database::query($sql,__FILE__,__LINE__);
$coachs = array();
while ($row_coachs = Database::fetch_array($rs_coachs)) {
$coachs[] = $row_coachs['username'];
}
$coachs = implode(",",$coachs);
if($cvs){ if($cvs){
$courses .= str_replace(';',',',$rowCourses['code']); $courses .= str_replace(';',',',$rowCourses['code']);
$courses .= '['.str_replace(';',',',$rowCourses['username']).']['; $courses .= '['.str_replace(';',',',$coachs).'][';
} }
else { else {
$courses .= "\t\t<Course>\n"; $courses .= "\t\t<Course>\n";
$courses .= "\t\t\t<CourseCode>$rowCourses[code]</CourseCode>\n"; $courses .= "\t\t\t<CourseCode>$rowCourses[code]</CourseCode>\n";
$courses .= "\t\t\t<Coach>$rowCourses[username]</Coach>\n"; $courses .= "\t\t\t<Coach>$coachs</Coach>\n";
} }
// rel user courses // rel user courses
$sql = "SELECT DISTINCT username $sql = "SELECT DISTINCT u.username
FROM $tbl_user FROM $tbl_session_course_user scu
INNER JOIN $tbl_session_course_user INNER JOIN $tbl_session_user su ON scu.id_user = su.id_user AND scu.id_session = su.id_session
ON $tbl_session_course_user.id_user = $tbl_user.user_id INNER JOIN $tbl_user u
AND $tbl_session_course_user.course_code='".$rowCourses['code']."' ON scu.id_user = u.user_id
AND id_session='".$row['id']."'"; AND scu.course_code='".$rowCourses['code']."'
AND scu.id_session='".$row['id']."'";
$rsUsersCourse = Database::query($sql,__FILE__,__LINE__); $rsUsersCourse = Database::query($sql,__FILE__,__LINE__);
$userscourse = '';
while($rowUsersCourse = Database::fetch_array($rsUsersCourse)){ while($rowUsersCourse = Database::fetch_array($rsUsersCourse)){
if($cvs){ if($cvs){
$userscourse .= str_replace(';',',',$rowUsersCourse['username']).','; $userscourse .= str_replace(';',',',$rowUsersCourse['username']).',';
} }
@ -224,12 +246,11 @@ if($_POST['formSent'] )
$courses .= "\t\t</Course>\n"; $courses .= "\t\t</Course>\n";
} }
} }
if(!empty($courses) && $cvs) if(!empty($courses) && $cvs)
$courses = api_substr($courses , 0, api_strlen($courses)-1); $courses = api_substr($courses , 0, api_strlen($courses)-1);
$add .= $courses; $add .= $courses;
if($cvs) { if($cvs) {
$breakline = api_is_windows_os()?"\r\n":"\n"; $breakline = api_is_windows_os()?"\r\n":"\n";
$add .= ";$breakline"; $add .= ";$breakline";

@ -69,6 +69,7 @@ if ($_POST['formSent']) {
// $root = @simplexml_load_string(api_utf8_encode_xml(file_get_contents($_FILES['import_file']['tmp_name']))); // $root = @simplexml_load_string(api_utf8_encode_xml(file_get_contents($_FILES['import_file']['tmp_name'])));
// To ease debugging let us use: // To ease debugging let us use:
$content = file_get_contents($_FILES['import_file']['tmp_name']); $content = file_get_contents($_FILES['import_file']['tmp_name']);
$content = api_utf8_encode_xml($content); $content = api_utf8_encode_xml($content);
$root = @simplexml_load_string($content); $root = @simplexml_load_string($content);
unset($content); unset($content);
@ -241,6 +242,7 @@ if ($_POST['formSent']) {
// Creating sessions from <Sessions> base node. // Creating sessions from <Sessions> base node.
if (count($root->Session) > 0) { if (count($root->Session) > 0) {
foreach ($root->Session as $node_session) { foreach ($root->Session as $node_session) {
$course_counter = 0; $course_counter = 0;
@ -287,6 +289,9 @@ if ($_POST['formSent']) {
} }
} }
$visibility = trim(api_utf8_decode($node_session->Visibility));
$session_category_id = trim(api_utf8_decode($node_session->SessionCategory));
if (!$updatesession) { if (!$updatesession) {
// Always create a session. // Always create a session.
$unique_name = false; // This MUST be initializead. $unique_name = false; // This MUST be initializead.
@ -311,6 +316,8 @@ if ($_POST['formSent']) {
id_coach = '$coach_id', id_coach = '$coach_id',
date_start = '$date_start', date_start = '$date_start',
date_end = '$date_end', date_end = '$date_end',
visibility = '$visibility',
session_category_id = '$session_category_id',
session_admin_id=".intval($_user['user_id']); session_admin_id=".intval($_user['user_id']);
$rs_session = Database::query($sql_session, __FILE__, __LINE__); $rs_session = Database::query($sql_session, __FILE__, __LINE__);
$session_id = Database::insert_id(); $session_id = Database::insert_id();
@ -326,6 +333,8 @@ if ($_POST['formSent']) {
id_coach = '$coach_id', id_coach = '$coach_id',
date_start = '$date_start', date_start = '$date_start',
date_end = '$date_end', date_end = '$date_end',
visibility = '$visibility',
session_category_id = '$session_category_id',
session_admin_id=".intval($_user['user_id']); session_admin_id=".intval($_user['user_id']);
$rs_session = Database::query($sql_session, __FILE__, __LINE__); $rs_session = Database::query($sql_session, __FILE__, __LINE__);
$session_id = Database::insert_id(); $session_id = Database::insert_id();
@ -335,7 +344,9 @@ if ($_POST['formSent']) {
$sql_session = "UPDATE $tbl_session SET $sql_session = "UPDATE $tbl_session SET
id_coach = '$coach_id', id_coach = '$coach_id',
date_start = '$date_start', date_start = '$date_start',
date_end = '$date_end' date_end = '$date_end',
visibility = '$visibility',
session_category_id = '$session_category_id'
WHERE name = '$session_name'"; WHERE name = '$session_name'";
$rs_session = Database::query($sql_session, __FILE__, __LINE__); $rs_session = Database::query($sql_session, __FILE__, __LINE__);
$session_id = Database::query("SELECT id FROM $tbl_session WHERE name='$session_name'", __FILE__, __LINE__); $session_id = Database::query("SELECT id FROM $tbl_session WHERE name='$session_name'", __FILE__, __LINE__);
@ -358,6 +369,7 @@ if ($_POST['formSent']) {
UrlManager::add_session_to_url($session_id, 1); UrlManager::add_session_to_url($session_id, 1);
} }
// Adding users to the new session. // Adding users to the new session.
foreach ($node_session->User as $node_user) { foreach ($node_session->User as $node_user) {
$username = UserManager::purify_username(api_utf8_decode($node_user), $purification_option_for_usernames); $username = UserManager::purify_username(api_utf8_decode($node_user), $purification_option_for_usernames);
@ -371,24 +383,18 @@ if ($_POST['formSent']) {
} }
} }
// Adding courses to a session. // Adding courses to a session.
foreach ($node_session->Course as $node_course) { foreach ($node_session->Course as $node_course) {
$course_code = Database::escape_string(trim(api_utf8_decode($node_course->CourseCode))); $course_code = Database::escape_string(trim(api_utf8_decode($node_course->CourseCode)));
// Verify that the course pointed by the course code node exists. // Verify that the course pointed by the course code node exists.
if (CourseManager::course_exists($course_code)) { if (CourseManager::course_exists($course_code)) {
// If the course exists we continue. // If the course exists we continue.
$course_info = CourseManager::get_course_information($course_code); $course_info = CourseManager::get_course_information($course_code);
// Searching the coach.
$coach = UserManager::purify_username(api_utf8_decode($node_course->Coach), $purification_option_for_usernames);
if (!empty($coach)) {
$coach_id = UserManager::get_user_id_from_username($coach);
if ($coach_id === false) {
$error_message .= get_lang('UserDoesNotExist').' : '.$coach.'<br />';
$coach_id = '';
}
} else {
$coach_id = '';
}
$session_course_relation = SessionManager::relation_session_course_exist($session_id, $course_code); $session_course_relation = SessionManager::relation_session_course_exist($session_id, $course_code);
if (!$session_course_relation) { if (!$session_course_relation) {
$sql_course = "INSERT INTO $tbl_session_course SET $sql_course = "INSERT INTO $tbl_session_course SET
@ -396,34 +402,53 @@ if ($_POST['formSent']) {
id_session='$session_id'"; id_session='$session_id'";
$rs_course = Database::query($sql_course, __FILE__, __LINE__); $rs_course = Database::query($sql_course, __FILE__, __LINE__);
} }
if (Database::affected_rows()) {
$course_counter++; $course_coachs = explode(",",$node_course->Coach);
$users_in_course_counter = 0;
foreach ($node_course->User as $node_user) { // adding coachs to session course user
$username = UserManager::purify_username(api_utf8_decode($node_user), $purification_option_for_usernames); foreach ($course_coachs as $course_coach) {
$user_id = UserManager::get_user_id_from_username($username); $coach_id = UserManager::purify_username(api_utf8_decode($course_coach), $purification_option_for_usernames);
if ($user_id !== false) { $coach_id = UserManager::get_user_id_from_username($course_coach);
// Adding to session_rel_user table. if ($coach_id !== false) {
$sql = "INSERT IGNORE INTO $tbl_session_user SET $sql = "INSERT IGNORE INTO $tbl_session_course_user SET
id_user='$user_id', id_user='$coach_id',
id_session = '$session_id'"; course_code='$course_code',
$rs_user = Database::query($sql, __FILE__, __LINE__); id_session = '$session_id',
$user_counter++; status = 2 ";
// Adding to session_rel_user_rel_course table. $rs_coachs = Database::query($sql, __FILE__, __LINE__);
$sql = "INSERT IGNORE INTO $tbl_session_course_user SET } else {
id_user='$user_id', $error_message .= get_lang('UserDoesNotExist').' : '.$user.'<br />';
course_code='$course_code', }
id_session = '$session_id'"; }
$rs_users = Database::query($sql, __FILE__, __LINE__);
$users_in_course_counter++; // adding users
} else { $course_counter++;
$error_message .= get_lang('UserDoesNotExist').' : '.$username.'<br />'; $users_in_course_counter = 0;
} foreach ($node_course->User as $node_user) {
$username = UserManager::purify_username(api_utf8_decode($node_user), $purification_option_for_usernames);
$user_id = UserManager::get_user_id_from_username($username);
if ($user_id !== false) {
// Adding to session_rel_user table.
$sql = "INSERT IGNORE INTO $tbl_session_user SET
id_user='$user_id',
id_session = '$session_id'";
$rs_user = Database::query($sql, __FILE__, __LINE__);
$user_counter++;
// Adding to session_rel_user_rel_course table.
$sql = "INSERT IGNORE INTO $tbl_session_course_user SET
id_user='$user_id',
course_code='$course_code',
id_session = '$session_id'";
$rs_users = Database::query($sql, __FILE__, __LINE__);
$users_in_course_counter++;
} else {
$error_message .= get_lang('UserDoesNotExist').' : '.$username.'<br />';
} }
$update_session_course = "UPDATE $tbl_session_course SET nbr_users='$users_in_course_counter' WHERE course_code='$course_code'";
Database::query($update_session_course, __FILE__, __LINE__);
$inserted_in_course[$course_code] = $course_info['title'];
} }
$update_session_course = "UPDATE $tbl_session_course SET nbr_users='$users_in_course_counter' WHERE course_code='$course_code'";
Database::query($update_session_course, __FILE__, __LINE__);
$inserted_in_course[$course_code] = $course_info['title'];
} }
if (CourseManager::course_exists($course_code, true)) { if (CourseManager::course_exists($course_code, true)) {
@ -434,52 +459,62 @@ if ($_POST['formSent']) {
if ($vcourse['code'] == $course_code) { if ($vcourse['code'] == $course_code) {
// Ignore, this has already been inserted. // Ignore, this has already been inserted.
} else { } else {
$coach = UserManager::purify_username(api_utf8_decode($node_course->Coach), $purification_option_for_usernames);
if (!empty($coach)) {
$coach_id = UserManager::get_user_id_from_username($coach);
if ($user_id === false) {
$error_message .= get_lang('UserDoesNotExist').' : '.$coach.'<br />';
$coach_id = '';
}
} else {
$coach_id = '';
}
$sql_course = "INSERT INTO $tbl_session_course SET $sql_course = "INSERT INTO $tbl_session_course SET
course_code = '".$vcourse['code']."', course_code = '".$vcourse['code']."',
id_session='$session_id'"; id_session='$session_id'";
$rs_course = Database::query($sql_course, __FILE__, __LINE__); $rs_course = Database::query($sql_course, __FILE__, __LINE__);
if (Database::affected_rows()) {
$course_counter++; $course_coachs = explode(",",$node_course->Coach);
$users_in_course_counter = 0;
foreach ($node_course->User as $node_user) { // adding coachs to session course user
$username = UserManager::purify_username(api_utf8_decode($node_user), $purification_option_for_usernames); foreach ($course_coachs as $course_coach) {
$user_id = UserManager::get_user_id_from_username($username); $coach_id = UserManager::purify_username(api_utf8_decode($course_coach), $purification_option_for_usernames);
if ($user_id !== false) { $coach_id = UserManager::get_user_id_from_username($course_coach);
$sql = "INSERT IGNORE INTO $tbl_session_user SET if ($coach_id !== false) {
id_user='$user_id', $sql = "INSERT IGNORE INTO $tbl_session_course_user SET
id_session = '$session_id'"; id_user='$coach_id',
$rs_user = Database::query($sql, __FILE__, __LINE__); course_code='{$vcourse['code']}',
if (Database::affected_rows()) { id_session = '$session_id',
$user_counter++; status = 2 ";
} $rs_coachs = Database::query($sql, __FILE__, __LINE__);
$sql = "INSERT IGNORE INTO $tbl_session_course_user SET } else {
id_user='$user_id', $error_message .= get_lang('UserDoesNotExist').' : '.$user.'<br />';
course_code='".$vcourse['code']."', }
id_session = '$session_id'"; }
$rs_users = Database::query($sql, __FILE__, __LINE__);
if (Database::affected_rows()) { // adding users
$users_in_course_counter++; $course_counter++;
} $users_in_course_counter = 0;
} else { foreach ($node_course->User as $node_user) {
$error_message .= get_lang('UserDoesNotExist').' : '.$username.'<br />'; $username = UserManager::purify_username(api_utf8_decode($node_user), $purification_option_for_usernames);
} $user_id = UserManager::get_user_id_from_username($username);
if ($user_id !== false) {
// Adding to session_rel_user table.
$sql = "INSERT IGNORE INTO $tbl_session_user SET
id_user='$user_id',
id_session = '$session_id'";
$rs_user = Database::query($sql, __FILE__, __LINE__);
$user_counter++;
// Adding to session_rel_user_rel_course table.
$sql = "INSERT IGNORE INTO $tbl_session_course_user SET
id_user='$user_id',
course_code='{$vcourse['code']}',
id_session = '$session_id'";
$rs_users = Database::query($sql, __FILE__, __LINE__);
$users_in_course_counter++;
} else {
$error_message .= get_lang('UserDoesNotExist').' : '.$username.'<br />';
} }
Database::query("UPDATE $tbl_session_course SET nbr_users='$users_in_course_counter' WHERE course_code='$course_code'",__FILE__,__LINE__);
} }
$update_session_course = "UPDATE $tbl_session_course SET nbr_users='$users_in_course_counter' WHERE course_code='$course_code'";
Database::query($update_session_course, __FILE__, __LINE__);
$inserted_in_course[$course_code] = $course_info['title'];
} }
$inserted_in_course[$vcourse['code']] = $vcourse['title']; $inserted_in_course[$vcourse['code']] = $vcourse['title'];
} }
} else { } else {
// Tthe course does not exist. // Tthe course does not exist.
$error_message .= get_lang('CourseDoesNotExist').' : '.$course_code.'<br />'; $error_message .= get_lang('CourseDoesNotExist').' : '.$course_code.'<br />';
@ -502,6 +537,7 @@ if ($_POST['formSent']) {
/////////////////// ///////////////////
$content = file($_FILES['import_file']['tmp_name']); $content = file($_FILES['import_file']['tmp_name']);
if (!api_strstr($content[0], ';')) { if (!api_strstr($content[0], ';')) {
$error_message = get_lang('NotCSV'); $error_message = get_lang('NotCSV');
} else { } else {
@ -523,6 +559,7 @@ if ($_POST['formSent']) {
} }
} }
} }
// looping the sessions // looping the sessions
foreach ($sessions as $enreg) { foreach ($sessions as $enreg) {
$user_counter = 0; $user_counter = 0;
@ -531,6 +568,8 @@ if ($_POST['formSent']) {
$session_name = $enreg['SessionName']; $session_name = $enreg['SessionName'];
$date_start = $enreg['DateStart']; $date_start = $enreg['DateStart'];
$date_end = $enreg['DateEnd']; $date_end = $enreg['DateEnd'];
$visibility = $enreg['Visibility'];
$session_category_id = $enreg['SessionCategory'];
// searching a coach // searching a coach
if (!empty($enreg['Coach'])) { if (!empty($enreg['Coach'])) {
@ -569,6 +608,8 @@ if ($_POST['formSent']) {
id_coach = '$coach_id', id_coach = '$coach_id',
date_start = '$date_start', date_start = '$date_start',
date_end = '$date_end', date_end = '$date_end',
visibility = '$visibility',
session_category_id = '$session_category_id',
session_admin_id=".intval($_user['user_id']); session_admin_id=".intval($_user['user_id']);
$rs_session = Database::query($sql_session, __FILE__, __LINE__); $rs_session = Database::query($sql_session, __FILE__, __LINE__);
$session_id = Database::insert_id(); $session_id = Database::insert_id();
@ -582,7 +623,10 @@ if ($_POST['formSent']) {
name = '$session_name', name = '$session_name',
id_coach = '$coach_id', id_coach = '$coach_id',
date_start = '$date_start', date_start = '$date_start',
date_end = '$date_end'"; date_end = '$date_end',
visibility = '$visibility',
session_category_id = '$session_category_id'";
$rs_session = Database::query($sql_session, __FILE__, __LINE__); $rs_session = Database::query($sql_session, __FILE__, __LINE__);
// We get the last insert id. // We get the last insert id.
$my_session_result = SessionManager::get_session_by_name($session_name); $my_session_result = SessionManager::get_session_by_name($session_name);
@ -593,7 +637,9 @@ if ($_POST['formSent']) {
$sql_session = "UPDATE $tbl_session SET $sql_session = "UPDATE $tbl_session SET
id_coach = '$coach_id', id_coach = '$coach_id',
date_start = '$date_start', date_start = '$date_start',
date_end = '$date_end' date_end = '$date_end',
visibility = '$visibility',
session_category_id = '$session_category_id'
WHERE name = '$session_name'"; WHERE name = '$session_name'";
$rs_session = Database::query($sql_session, __FILE__, __LINE__); $rs_session = Database::query($sql_session, __FILE__, __LINE__);
$session_id = Database::query("SELECT id FROM $tbl_session WHERE name='$session_name'", __FILE__, __LINE__); $session_id = Database::query("SELECT id FROM $tbl_session WHERE name='$session_name'", __FILE__, __LINE__);
@ -626,6 +672,7 @@ if ($_POST['formSent']) {
foreach ($courses as $course) { foreach ($courses as $course) {
$course_code = api_strtoupper(api_substr($course, 0, api_strpos($course, '['))); $course_code = api_strtoupper(api_substr($course, 0, api_strpos($course, '[')));
if (CourseManager::course_exists($course_code)) { if (CourseManager::course_exists($course_code)) {
// If the course exists we continue // If the course exists we continue
@ -649,12 +696,34 @@ if ($_POST['formSent']) {
$rs_course = Database::query($sql_course, __FILE__, __LINE__); $rs_course = Database::query($sql_course, __FILE__, __LINE__);
$course_counter++; $course_counter++;
$users = api_substr($course, api_strpos($course, '[', 1) + 1 , api_strpos($course, ']', 1)); $course_split = array();
$users = explode('|', $enreg['Users']); $tok = strtok($course, "[]");
$users_in_course_counter = 0; while ($tok !== false) {
$course_split[] = $tok;
$tok = strtok("[]");
}
$course_coachs = explode(",",$course_split[1]);
$course_users = explode(",",$course_split[2]);
// adding coachs to session course user
foreach ($course_coachs as $course_coach) {
$coach_id = UserManager::get_user_id_from_username($course_coach);
if ($coach_id !== false) {
$sql = "INSERT IGNORE INTO $tbl_session_course_user SET
id_user='$coach_id',
course_code='$course_code',
id_session = '$session_id',
status = 2 ";
$rs_coachs = Database::query($sql, __FILE__, __LINE__);
} else {
$error_message .= get_lang('UserDoesNotExist').' : '.$user.'<br />';
}
}
$users_in_course_counter = 0;
// Adding the relationship "Session - Course - User". // Adding the relationship "Session - Course - User".
foreach ($users as $user) { foreach ($course_users as $user) {
$user_id = UserManager::get_user_id_from_username($user); $user_id = UserManager::get_user_id_from_username($user);
if ($user_id !== false) { if ($user_id !== false) {
$sql = "INSERT IGNORE INTO $tbl_session_course_user SET $sql = "INSERT IGNORE INTO $tbl_session_course_user SET
@ -667,7 +736,8 @@ if ($_POST['formSent']) {
$error_message .= get_lang('UserDoesNotExist').' : '.$user.'<br />'; $error_message .= get_lang('UserDoesNotExist').' : '.$user.'<br />';
} }
} }
Database::query("UPDATE $tbl_session_course SET nbr_users='$users_in_course_counter' WHERE course_code='$course_code'", __FILE__, __LINE__); $sql = "UPDATE $tbl_session_course SET nbr_users='$users_in_course_counter' WHERE course_code='$course_code'";
Database::query($sql,__FILE__,__LINE__);
$course_info = CourseManager::get_course_information($course_code); $course_info = CourseManager::get_course_information($course_code);
$inserted_in_course[$course_code] = $course_info['title']; $inserted_in_course[$course_code] = $course_info['title'];
@ -676,47 +746,55 @@ if ($_POST['formSent']) {
} }
if (CourseManager::course_exists($course_code, true)) { if (CourseManager::course_exists($course_code, true)) {
$list = CourseManager :: get_courses_info_from_visual_code($course_code); $list = CourseManager :: get_courses_info_from_visual_code($course_code);
foreach ($list as $vcourse) { foreach ($list as $vcourse) {
if ($vcourse['code'] == $course_code) { if ($vcourse['code'] == $course_code) {
// Ignore, this has already been inserted. // Ignore, this has already been inserted.
} else { } else {
$coach = api_strstr($course, '['); $coach = api_strstr($course, '[');
$coach = api_substr($coach, 1, api_strpos($coach,']') - 1); $coach = api_substr($coach, 1, api_strpos($coach,']') - 1);
if (!empty($coach)) {
$sql_coach = "SELECT user_id FROM $tbl_user WHERE username='$coach'";
$rs_coach = Database::query($sql_coach,__FILE__,__LINE__);
list($coach) = (Database::fetch_array($rs_coach));
} else {
$coach = '';
}
// Adding the relationship "Session - Course". // Adding the relationship "Session - Course".
$sql_course = "INSERT IGNORE INTO $tbl_session_course SET $sql_course = "INSERT IGNORE INTO $tbl_session_course SET
course_code = '".$vcourse['code']."', course_code = '".$vcourse['code']."',
id_session='$session_id'"; id_session='$session_id'";
$rs_course = Database::query($sql_course, __FILE__, __LINE__); $rs_course = Database::query($sql_course, __FILE__, __LINE__);
if (Database::affected_rows()) {
$course_counter++; // adding coachs to session course user
$users = api_substr($course , api_strpos($course,'[', 1) + 1, api_strpos($course,']', 1)); foreach ($course_coachs as $course_coach) {
$users = explode('|', $enreg['Users']); $coach_id = UserManager::get_user_id_from_username($course_coach);
$users_in_course_counter = 0; if ($coach_id !== false) {
foreach ($users as $user) { $sql = "INSERT IGNORE INTO $tbl_session_course_user SET
$sqlUser = "SELECT user_id FROM $tbl_user WHERE username='".$user."'"; id_user='$coach_id',
$rs_user = Database::query($sqlUser); course_code='{$vcourse['code']}',
list($user_id) = (Database::fetch_array($rs_user)); id_session = '$session_id',
$sql = "INSERT INTO $tbl_session_course_user SET status = 2 ";
$rs_coachs = Database::query($sql, __FILE__, __LINE__);
} else {
$error_message .= get_lang('UserDoesNotExist').' : '.$user.'<br />';
}
}
$users_in_course_counter = 0;
// Adding the relationship "Session - Course - User".
foreach ($course_users as $user) {
$user_id = UserManager::get_user_id_from_username($user);
if ($user_id !== false) {
$sql = "INSERT IGNORE INTO $tbl_session_course_user SET
id_user='$user_id', id_user='$user_id',
course_code='".$vcourse['code']."', course_code='{$vcourse['code']}',
id_session = '$session_id'"; id_session = '$session_id'";
$rs_users = Database::query($sql, __FILE__, __LINE__); $rs_users = Database::query($sql, __FILE__, __LINE__);
if (Database::affected_rows()) { $users_in_course_counter++;
$users_in_course_counter++; } else {
} $error_message .= get_lang('UserDoesNotExist').' : '.$user.'<br />';
} }
Database::query("UPDATE $tbl_session_course SET nbr_users='$users_in_course_counter' WHERE course_code='".$vcourse['code']."'", __FILE__, __LINE__);
} }
Database::query("UPDATE $tbl_session_course SET nbr_users='$users_in_course_counter' WHERE course_code='".$vcourse['code']."'", __FILE__, __LINE__);
} }
} }
$inserted_in_course[$vcourse['code']] = $vcourse['title']; $inserted_in_course[$vcourse['code']] = $vcourse['title'];

@ -360,8 +360,8 @@ if ($_POST['formSent'] AND $_FILES['import_file']['size'] !== 0) {
$_SESSION['session_message_import_users'] = $error_message; $_SESSION['session_message_import_users'] = $error_message;
$error_message = 'session_message'; $error_message = 'session_message';
} }
header('Location: user_list.php?action=show_message&message='.urlencode($see_message_import).'&warn='.urlencode($error_message).'&sec_token='.$tok); header('Location: '.api_get_path(WEB_CODE_PATH).'admin/user_list.php?action=show_message&message='.urlencode($see_message_import).'&warn='.urlencode($error_message).'&sec_token='.$tok);
exit (); exit;
} }
Display :: display_header($tool_name); Display :: display_header($tool_name);

@ -156,18 +156,23 @@ foreach ($courses as $enreg) {
$session_name = Database::result($rs, 0, 'name'); $session_name = Database::result($rs, 0, 'name');
$session_coach_id = intval(Database::result($rs, 0, 'id_coach')); $session_coach_id = intval(Database::result($rs, 0, 'id_coach'));
// get coach of the course in the session $sql = 'SELECT id_user FROM ' . $tbl_session_course_user . '
$sql = 'SELECT id_coach FROM '.$tbl_session_course.' WHERE id_session=' . $session_id . '
WHERE id_session='.$session_id.' AND course_code = "' . Database :: escape_string($course) . '" AND status=2';
AND course_code = "'.Database::escape_string($_GET['course']).'"';
$rs = Database::query($sql, __FILE__, __LINE__); $rs = Database::query($sql, __FILE__, __LINE__);
$session_course_coach_id = intval(Database::result($rs, 0, 0)); $course_coachs = array();
while ($row_coachs = Database::fetch_array($rs)) {
if ($session_course_coach_id != 0) { $course_coachs[] = $row_coachs['id_user'];
$coach_info = UserManager :: get_user_info_by_id($session_course_coach_id);
$course_info['tutor_name'] = api_get_person_name($coach_info['firstname'], $coach_info['lastname']);
} }
else if($session_coach_id != 0) {
if (!empty($course_coachs)) {
$info_tutor_name = array();
foreach ($course_coachs as $course_coach) {
$coach_infos = UserManager :: get_user_info_by_id($course_coach);
$info_tutor_name[] = api_get_person_name($coach_infos['firstname'], $coach_infos['lastname']);
}
$course_info['tutor_name'] = implode(",",$info_tutor_name);
} else if($session_coach_id != 0) {
$coach_info = UserManager :: get_user_info_by_id($session_coach_id); $coach_info = UserManager :: get_user_info_by_id($session_coach_id);
$course_info['tutor_name'] = api_get_person_name($coach_info['firstname'], $coach_info['lastname']); $course_info['tutor_name'] = api_get_person_name($coach_info['firstname'], $coach_info['lastname']);
} }

@ -31,15 +31,54 @@
*/ */
$language_file = array ('chat'); $language_file = array ('chat');
include('../inc/global.inc.php'); include('../inc/global.inc.php');
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
//$interbreadcrumb[] = array ("url" => "chat.php", "name" => get_lang("Chat"));
//$noPHP_SELF=true;
//$shortBanner=false;
//Display::display_header(null,"Chat");
$tool_name = get_lang('Chat');
// If it is a group chat then the breadcrumbs.
if ($_SESSION['_gid'] OR $_GET['group_id']) {
if (isset($_SESSION['_gid'])) {
$_clean['group_id']=(int)$_SESSION['_gid'];
}
if (isset($_GET['group_id'])) {
$_clean['group_id']=(int)Database::escape_string($_GET['group_id']);
}
$group_properties = GroupManager :: get_group_properties($_clean['group_id']);
$interbreadcrumb[] = array ("url" => "../group/group.php", "name" => get_lang('Groups'));
$interbreadcrumb[] = array ("url"=>"../group/group_space.php?gidReq=".$_SESSION['_gid'], "name"=> get_lang('GroupSpace').' ('.$group_properties['name'].')');
$noPHP_SELF=true;
$shortBanner=false;
$add_group_to_title = ' ('.$group_properties['name'].')';
$groupfilter='group_id="'.$_clean['group_id'].'"';
$interbreadcrumb[] = array ("url" => "chat.php", "name" => get_lang("Chat")); //ensure this tool in groups whe it's private or deactivated
$noPHP_SELF=true; /*if ($group_properties['chat_state']==0)
$shortBanner=false; {
echo api_not_allowed();
}
elseif ($group_properties['chat_state']==2)
{
if (!api_is_allowed_to_edit(false,true) and !GroupManager :: is_user_in_group($_user['user_id'], $_SESSION['_gid']))
{
echo api_not_allowed();
}
}*/
Display::display_header(null,"Chat"); }
else
{
$groupfilter='group_id=0';
}
Display::display_header($tool_name, 'Chat');
//$is_allowed_to_edit = api_is_allowed_to_edit(false,true);
?> ?>
</body> </body>

@ -83,14 +83,25 @@ if (!empty($course))
$Users[$coach['user_id']] = $coach; $Users[$coach['user_id']] = $coach;
// select session course coach // select session course coach
$query="SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri FROM $tbl_user t1,$tbl_chat_connected t2,$tbl_session_course t3 WHERE t1.user_id=t2.user_id AND t3.id_coach=t2.user_id AND t3.id_session = '".$_SESSION['id_session']."' AND t3.course_code = '".$_course['sysCode']."' AND t2.last_connection>'".$date_inter."' ORDER BY username"; $query="SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri
FROM $tbl_user t1,$tbl_chat_connected t2,$tbl_session_course_user t3
WHERE t1.user_id=t2.user_id
AND t3.id_user=t2.user_id AND t3.status=2
AND t3.id_session = '".$_SESSION['id_session']."'
AND t3.course_code = '".$_course['sysCode']."'
AND t2.last_connection>'".$date_inter."' ORDER BY username";
$result=Database::query($query,__FILE__,__LINE__); $result=Database::query($query,__FILE__,__LINE__);
if($coach = Database::fetch_array($result)) $course_coachs = array();
$Users[$coach['user_id']] = $coach; while ($coachs = Database::fetch_array($result)) {
//$course_coachs[] = $coachs['user_id'];
$Users[$coachs['user_id']] = $coachs;
}
//if($coach = Database::fetch_array($result))
//$Users[$coach['user_id']] = $coach;
} }
$user_id=$enreg['user_id']; $user_id=$enreg['user_id'];
include('header_frame.inc.php'); include('header_frame.inc.php');
?> ?>
@ -99,6 +110,7 @@ if (!empty($course))
<?php <?php
foreach($Users as $enreg) foreach($Users as $enreg)
{ {
if(!isset($_SESSION['id_session'])) if(!isset($_SESSION['id_session']))
{ {
$status=$enreg['status']; $status=$enreg['status'];

@ -81,7 +81,7 @@ if (api_get_setting('allow_group_categories') == 'true')
{ {
$nameTools = get_lang('AddCategory'); $nameTools = get_lang('AddCategory');
// default values for new category // default values for new category
$category = array ('groups_per_user' => 1, 'doc_state' => TOOL_PRIVATE, 'work_state' => TOOL_PRIVATE, 'wiki_state' => TOOL_PRIVATE, 'calendar_state' => TOOL_PRIVATE, 'announcements_state'=> TOOL_PRIVATE, 'forum_state' => TOOL_PRIVATE, 'max_student' => 0); $category = array ('groups_per_user' => 1, 'doc_state' => TOOL_PRIVATE, 'work_state' => TOOL_PRIVATE, 'wiki_state' => TOOL_PRIVATE , 'chat_state' => TOOL_PRIVATE, 'calendar_state' => TOOL_PRIVATE, 'announcements_state'=> TOOL_PRIVATE, 'forum_state' => TOOL_PRIVATE, 'max_student' => 0);
} }
} }
else else
@ -189,6 +189,11 @@ $form->addElement('radio', 'wiki_state', get_lang('GroupWiki'), get_lang('NotAva
$form->addElement('radio', 'wiki_state', null, get_lang('Public'), TOOL_PUBLIC); $form->addElement('radio', 'wiki_state', null, get_lang('Public'), TOOL_PUBLIC);
$form->addElement('radio', 'wiki_state', null, get_lang('Private'), TOOL_PRIVATE); $form->addElement('radio', 'wiki_state', null, get_lang('Private'), TOOL_PRIVATE);
// Chat Settings
$form->addElement('radio', 'chat_state', get_lang('Chat'), get_lang('NotAvailable'), TOOL_NOT_AVAILABLE);
$form->addElement('radio', 'chat_state', null, get_lang('Public'), TOOL_PUBLIC);
$form->addElement('radio', 'chat_state', null, get_lang('Private'), TOOL_PRIVATE);
// Submit // Submit
$form->addElement('style_submit_button', 'submit', get_lang('PropModify'), 'class="save"'); $form->addElement('style_submit_button', 'submit', get_lang('PropModify'), 'class="save"');
// If form validates -> save data // If form validates -> save data
@ -208,12 +213,12 @@ if ($form->validate())
switch ($values['action']) switch ($values['action'])
{ {
case 'update_settings' : case 'update_settings' :
GroupManager :: update_category($values['id'], $values['title'], $values['description'], $values['doc_state'], $values['work_state'], $values['calendar_state'], $values['announcements_state'], $values['forum_state'], $values['wiki_state'], $self_reg_allowed, $self_unreg_allowed, $max_member, $values['groups_per_user']); GroupManager :: update_category($values['id'], $values['title'], $values['description'], $values['doc_state'], $values['work_state'], $values['calendar_state'], $values['announcements_state'], $values['forum_state'], $values['wiki_state'], $values['chat_state'], $self_reg_allowed, $self_unreg_allowed, $max_member, $values['groups_per_user']);
$msg = urlencode(get_lang("GroupPropertiesModified")); $msg = urlencode(get_lang("GroupPropertiesModified"));
header('Location: group.php?action=show_msg&msg='.$msg.'&category='.$values['id']); header('Location: group.php?action=show_msg&msg='.$msg.'&category='.$values['id']);
break; break;
case 'add_category' : case 'add_category' :
GroupManager :: create_category($values['title'], $values['description'], $values['doc_state'], $values['work_state'], $values['calendar_state'], $values['announcements_state'], $values['forum_state'], $values['wiki_state'], $self_reg_allowed, $self_unreg_allowed, $max_member, $values['groups_per_user']); GroupManager :: create_category($values['title'], $values['description'], $values['doc_state'], $values['work_state'], $values['calendar_state'], $values['announcements_state'], $values['forum_state'], $values['wiki_state'], $values['chat_state'], $self_reg_allowed, $self_unreg_allowed, $max_member, $values['groups_per_user']);
$msg = urlencode(get_lang("CategoryCreated")); $msg = urlencode(get_lang("CategoryCreated"));
header('Location: group.php?action=show_msg&msg='.$msg); header('Location: group.php?action=show_msg&msg='.$msg);
break; break;

@ -201,6 +201,11 @@ $form->addElement('radio', 'wiki_state', get_lang('GroupWiki'), get_lang('NotAva
$form->addElement('radio', 'wiki_state', null, get_lang('Public'), TOOL_PUBLIC); $form->addElement('radio', 'wiki_state', null, get_lang('Public'), TOOL_PUBLIC);
$form->addElement('radio', 'wiki_state', null, get_lang('Private'), TOOL_PRIVATE); $form->addElement('radio', 'wiki_state', null, get_lang('Private'), TOOL_PRIVATE);
// Chat settings
$form->addElement('radio', 'chat_state', get_lang('Chat'), get_lang('NotAvailable'), TOOL_NOT_AVAILABLE);
$form->addElement('radio', 'chat_state', null, get_lang('Public'), TOOL_PUBLIC);
$form->addElement('radio', 'chat_state', null, get_lang('Private'), TOOL_PRIVATE);
// getting all the users // getting all the users
if (isset($_SESSION['id_session'])) { if (isset($_SESSION['id_session'])) {
$complete_user_list = CourseManager :: get_user_list_from_course_code($_course['id'],true,$_SESSION['id_session']); $complete_user_list = CourseManager :: get_user_list_from_course_code($_course['id'],true,$_SESSION['id_session']);
@ -283,7 +288,7 @@ if ($form->validate()) {
} }
$self_registration_allowed = isset ($values['self_registration_allowed']) ? 1 : 0; $self_registration_allowed = isset ($values['self_registration_allowed']) ? 1 : 0;
$self_unregistration_allowed = isset ($values['self_unregistration_allowed']) ? 1 : 0; $self_unregistration_allowed = isset ($values['self_unregistration_allowed']) ? 1 : 0;
GroupManager :: set_group_properties($current_group['id'], strip_tags($values['name']), strip_tags($values['description']), $max_member, $values['doc_state'], $values['work_state'], $values['calendar_state'], $values['announcements_state'], $values['forum_state'],$values['wiki_state'], $self_registration_allowed, $self_unregistration_allowed); GroupManager :: set_group_properties($current_group['id'], strip_tags($values['name']), strip_tags($values['description']), $max_member, $values['doc_state'], $values['work_state'], $values['calendar_state'], $values['announcements_state'], $values['forum_state'],$values['wiki_state'], $values['chat_state'], $self_registration_allowed, $self_unregistration_allowed);
// storing the tutors (we first remove all the tutors and then add only those who were selected) // storing the tutors (we first remove all the tutors and then add only those who were selected)
GroupManager :: unsubscribe_all_tutors($current_group['id']); GroupManager :: unsubscribe_all_tutors($current_group['id']);

@ -79,7 +79,7 @@ if (is_array($forums_of_groups)) {
} }
} }
if ($current_group['doc_state']!=1 and $current_group['calendar_state']!=1 and $current_group['work_state']!=1 and $current_group['announcements_state']!=1 and $current_group['wiki_state']!=1 and $forum_state_public!=1) { if ($current_group['doc_state']!=1 and $current_group['calendar_state']!=1 and $current_group['work_state']!=1 and $current_group['announcements_state']!=1 and $current_group['wiki_state']!=1 and $current_group['chat_state']!=1 and $forum_state_public!=1) {
if (!api_is_allowed_to_edit(null,true) and !GroupManager :: is_user_in_group($_user['user_id'], $current_group['id'])) { if (!api_is_allowed_to_edit(null,true) and !GroupManager :: is_user_in_group($_user['user_id'], $current_group['id'])) {
echo api_not_allowed($print_headers); echo api_not_allowed($print_headers);
} }
@ -214,6 +214,13 @@ if (api_is_allowed_to_edit(false,true) OR GroupManager :: is_user_in_group($_SES
//link to the wiki area of this group //link to the wiki area of this group
$tools .= "<div style='margin-bottom: 5px;'><a href=\"../wiki/index.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."\">".Display::return_icon('wiki.gif', get_lang("GroupWiki"))."&nbsp;".get_lang("GroupWiki")."</a></div>"; $tools .= "<div style='margin-bottom: 5px;'><a href=\"../wiki/index.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."\">".Display::return_icon('wiki.gif', get_lang("GroupWiki"))."&nbsp;".get_lang("GroupWiki")."</a></div>";
} }
if ( $current_group['chat_state'] != TOOL_NOT_AVAILABLE)
{
//link to the chat area of this group
$tools .= "<div style='margin-bottom: 5px;'><a href=\"../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."\">".Display::return_icon('chat.gif', get_lang("Chat"))."&nbsp;".get_lang("Chat")."</a></div>";
}
echo '<div class="actions-message" style="margin-bottom:4px;"><b>'.get_lang("Tools").':</b></div>'; echo '<div class="actions-message" style="margin-bottom:4px;"><b>'.get_lang("Tools").':</b></div>';
if (!empty($tools)) if (!empty($tools))
{ {
@ -263,6 +270,12 @@ if (api_is_allowed_to_edit(false,true) OR GroupManager :: is_user_in_group($_SES
$tools .= "<a href=\"../wiki/index.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."\">".Display::return_icon('wiki.gif', get_lang('GroupWiki'))."&nbsp;".get_lang('GroupWiki')."</a><br/>"; $tools .= "<a href=\"../wiki/index.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."\">".Display::return_icon('wiki.gif', get_lang('GroupWiki'))."&nbsp;".get_lang('GroupWiki')."</a><br/>";
} }
if ( $current_group['chat_state'] == TOOL_PUBLIC )
{
//link to the chat area of this group
$tools .= "<a href=\"../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."\">".Display::return_icon('chat.gif', get_lang('Chat'))."&nbsp;".get_lang('Chat')."</a><br/>";
}
echo '<br/>'; echo '<br/>';
echo '<div class="actions-message" style="margin-bottom:4px;"><b>'.get_lang("Tools").':</b></div>'; echo '<div class="actions-message" style="margin-bottom:4px;"><b>'.get_lang("Tools").':</b></div>';

@ -628,7 +628,7 @@ function update_Db_course($courseDbName)
start_time datetime NOT NULL default '0000-00-00 00:00:00', start_time datetime NOT NULL default '0000-00-00 00:00:00',
end_time datetime NOT NULL default '0000-00-00 00:00:00', end_time datetime NOT NULL default '0000-00-00 00:00:00',
feedback_type int NOT NULL default 0, feedback_type int NOT NULL default 0,
expired_time int NOT NULL default '0', expired_time int NOT NULL default '0',
session_id smallint default 0, session_id smallint default 0,
PRIMARY KEY (id) PRIMARY KEY (id)
)"; )";
@ -1001,6 +1001,7 @@ function update_Db_course($courseDbName)
announcements_state tinyint unsigned NOT NULL default 0, announcements_state tinyint unsigned NOT NULL default 0,
forum_state tinyint unsigned NOT NULL default 0, forum_state tinyint unsigned NOT NULL default 0,
wiki_state tinyint unsigned NOT NULL default 1, wiki_state tinyint unsigned NOT NULL default 1,
chat_state tinyint unsigned NOT NULL default 1,
secret_directory varchar(255) default NULL, secret_directory varchar(255) default NULL,
self_registration_allowed tinyint unsigned NOT NULL default '0', self_registration_allowed tinyint unsigned NOT NULL default '0',
self_unregistration_allowed tinyint unsigned NOT NULL default '0', self_unregistration_allowed tinyint unsigned NOT NULL default '0',
@ -1019,6 +1020,7 @@ function update_Db_course($courseDbName)
announcements_state tinyint unsigned NOT NULL default 1, announcements_state tinyint unsigned NOT NULL default 1,
forum_state tinyint unsigned NOT NULL default 1, forum_state tinyint unsigned NOT NULL default 1,
wiki_state tinyint unsigned NOT NULL default 1, wiki_state tinyint unsigned NOT NULL default 1,
chat_state tinyint unsigned NOT NULL default 1,
max_student smallint unsigned NOT NULL default 8, max_student smallint unsigned NOT NULL default 8,
self_reg_allowed tinyint unsigned NOT NULL default 0, self_reg_allowed tinyint unsigned NOT NULL default 0,
self_unreg_allowed tinyint unsigned NOT NULL default 0, self_unreg_allowed tinyint unsigned NOT NULL default 0,

@ -7,7 +7,7 @@
<th width="10" class="fileColumns">&nbsp;</th> <th width="10" class="fileColumns">&nbsp;</th>
<th class="docName"><?php echo LBL_NAME; ?></th> <th class="docName"><?php echo LBL_NAME; ?></th>
<th width="70" class="fileColumns"><?php echo LBL_SIZE; ?></th> <th width="70" class="fileColumns"><?php echo LBL_SIZE; ?></th>
<!-- hidde by now while implementing this dokeos --> <!-- hide while implementing this Dokeos -->
<!--<th class="fileColumns"><?php // echo LBL_MODIFIED; ?></th> --> <!--<th class="fileColumns"><?php // echo LBL_MODIFIED; ?></th> -->
</tr> </tr>
</thead> </thead>
@ -25,7 +25,7 @@
$strClass = ($file['is_writable']?"left":" leftDisabled"); $strClass = ($file['is_writable']?"left":" leftDisabled");
///First step for hidden some type of Dokeos files and folders ///First step for hidden some type of Dokeos files and folders
//Juan Carlos Ra<EFBFBD>a //Juan Carlos Raña
//hidden files and folders deleted by Dokeos. Hidde folders css, hotpotatoes, chat_files //hidden files and folders deleted by Dokeos. Hidde folders css, hotpotatoes, chat_files
$deleted_by_dokeos_file=' DELETED '; // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php $deleted_by_dokeos_file=' DELETED '; // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php
@ -52,7 +52,7 @@
$shared_folder='shared folder'; //'shared folder' not 'shared_folder' because in $file['name'] _ is replaced with blank see class.manager.php $shared_folder='shared folder'; //'shared folder' not 'shared_folder' because in $file['name'] _ is replaced with blank see class.manager.php
///Second step: hiding as the case ///Second step: hiding as the case
//Juan Carlos Ra<EFBFBD>a //Juan Carlos Raña
if((!ereg($deleted_by_dokeos_file, $file['name']) || !ereg($deleted_by_dokeos_folder, $file['path'])) && !ereg($css_folder_dokeos, $file['path']) && !ereg($hotpotatoes_folder_dokeos, $file['path']) && !ereg($chat_files_dokeos, $file['path']) && $show_doc_group==true && $file['name'][0]!='.') if((!ereg($deleted_by_dokeos_file, $file['name']) || !ereg($deleted_by_dokeos_folder, $file['path'])) && !ereg($css_folder_dokeos, $file['path']) && !ereg($hotpotatoes_folder_dokeos, $file['path']) && !ereg($chat_files_dokeos, $file['path']) && $show_doc_group==true && $file['name'][0]!='.')
{ {
@ -62,11 +62,11 @@
?> ?>
<tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>" > <tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>" >
<td align="center" id="tdz<?php echo $count; ?>"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>">&nbsp;</span><input type="checkbox" name="check[]" id="cb<?php echo $count; ?>" value="<?php echo $file['path']; ?>" <?php echo $strDisabled; ?> /></td> <td align="center" id="tdz<?php echo $count; ?>"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>">&nbsp;</span><input type="checkbox" name="check[]" id="cb<?php echo $count; ?>" value="<?php echo $file['path']; ?>" <?php echo $strDisabled; ?> /></td>
<td align="center" class="fileColumns" id="tdst<?php echo $count; ?>">&nbsp;<a id="a<?php echo $count; ?>" href="<?php echo "../".$file['path']; ?>" target="_blank"><span class="<?php echo $file['cssClass']; ?>">&nbsp;</span></a></td><!-- Juan Carlos Ra<EFBFBD>a Fix for Dokeos: On the path I put a directory up echo "../".$ file [ 'path'], what makes good show when pressed next on window preview, don't only one image --> <td align="center" class="fileColumns" id="tdst<?php echo $count; ?>">&nbsp;<a id="a<?php echo $count; ?>" href="<?php echo "../".$file['path']; ?>" target="_blank"><span class="<?php echo $file['cssClass']; ?>">&nbsp;</span></a></td><!-- Juan Carlos Raña Fix for Dokeos: On the path I put a directory up echo "../".$ file [ 'path'], what makes good show when pressed next on window preview, don't only one image -->
<td class="<?php echo $strClass; ?> docName" id="tdnd<?php echo $count; ?>"><a id="aa<?php echo $count; ?>" href="<?php echo "../".$file['path']; ?>" target="_blank"><?php echo $file['name']; ?></a></td> <td class="<?php echo $strClass; ?> docName" id="tdnd<?php echo $count; ?>"><a id="aa<?php echo $count; ?>" href="<?php echo "../".$file['path']; ?>" target="_blank"><?php echo $file['name']; ?></a></td>
<td class="docInfo" id="tdrd<?php echo $count; ?>"><?php echo transformFileSize($file['size']); ?></td> <td class="docInfo" id="tdrd<?php echo $count; ?>"><?php echo transformFileSize($file['size']); ?></td>
<!-- hidde by now while implementing this dokeos --> <!-- hide while implementing this Dokeos -->
<!--<td class="docInfo" id="tdth<?php //echo $count; ?>"><?php //echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td> --> <!--<td class="docInfo" id="tdth<?php //echo $count; ?>"><?php //echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td> -->
</tr> </tr>
<?php <?php
@ -98,7 +98,7 @@
<td class="<?php echo $strClass; ?> docName" id="tdnd<?php echo $count; ?>"><a id="aa<?php echo $count; ?>" href="<?php echo "../".$file['path']; ?>" target="_blank"><?php echo $file['name']; ?></a></td> <td class="<?php echo $strClass; ?> docName" id="tdnd<?php echo $count; ?>"><a id="aa<?php echo $count; ?>" href="<?php echo "../".$file['path']; ?>" target="_blank"><?php echo $file['name']; ?></a></td>
<td class="docInfo" id="tdrd<?php echo $count; ?>">&nbsp;</td> <td class="docInfo" id="tdrd<?php echo $count; ?>">&nbsp;</td>
<!-- hidde by now while implementing this dokeos --> <!-- hide while implementing this Dokeos -->
<!--<td class="docInfo" id="tdth<?php// echo $count; ?>"><?php //echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td> --> <!--<td class="docInfo" id="tdth<?php// echo $count; ?>"><?php //echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td> -->
</tr> </tr>
<?php <?php

@ -214,7 +214,7 @@ $(document).ready(
<div id="header"> <div id="header">
<dl id="currentFolderInfo"> <dl id="currentFolderInfo">
<dt><?php echo LBL_CURRENT_FOLDER_PATH; ?></dt> <dt><?php echo LBL_CURRENT_FOLDER_PATH; ?></dt>
<dd id="currentFolderPath"><?php echo $folderInfo['path']; ?></dd> <dt id="currentFolderPath"><?php echo $folderInfo['path']; ?></dt><!-- hack for breadcrumb for Dokeos change <dd> by <dt> -->
</dl> </dl>
<div id="viewList"> <div id="viewList">
@ -466,7 +466,7 @@ $(document).ready(
foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v) foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
{ {
if(hideFolderName($k)) if(hideFolderName($k))
{ {
//shows only those permitted by Dokeos //shows only those permitted by Dokeos
?> ?>
@ -477,7 +477,8 @@ $(document).ready(
} }
?> ?>
</select> </select>
<?php <?php
} }
?></span> ?></span>
@ -502,10 +503,8 @@ $(document).ready(
</td><td><!--add a col while integratins --> </td><td><!--add a col while integratins -->
<b><?php // echo LBL_SEARCH_RECURSIVELY; ?></b>&nbsp;&nbsp; <b><?php // echo LBL_SEARCH_RECURSIVELY; ?></b>&nbsp;&nbsp;
<!--change for Dokeos recursively by default --> <!--change for Dokeos recursively by default -->
<input type="radio" name="search_recursively" value="1" id="search_recursively_1" class="radio" <?php echo (empty($_GET['search_recursively'])?'checked="checked"':''); ?> /> <?php //echo LBL_RECURSIVELY_YES; ?> <!-- <input type="radio" name="search_recursively" value="1" id="search_recursively_1" class="radio" <?php //echo (empty($_GET['search_recursively'])?'checked="checked"':''); ?> /> <?php //echo LBL_RECURSIVELY_YES; ?> -->
<!-- <input type="radio" name="search_recursively" value="0" id="search_recursively_0" class="radio" <?php //echo (!empty($_GET['search_recursively'])?'checked="checked"':''); ?> /> <?php //echo LBL_RECURSIVELY_NO; ?> --> <!-- <input type="radio" name="search_recursively" value="0" id="search_recursively_0" class="radio" <?php //echo (!empty($_GET['search_recursively'])?'checked="checked"':''); ?> /> <?php //echo LBL_RECURSIVELY_NO; ?> -->
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -514,7 +513,7 @@ $(document).ready(
<p class="searchButtons"> <p class="searchButtons">
<span class="left" id="linkClose" style="display:none"> <span class="left" id="linkClose" style="display:none">
<!-- comment these lines while integrating into dokeos --> <!-- comment these lines while integrating into Dokeos -->
<!--<input type="button" value="<?php // echo LBL_ACTION_CLOSE; ?>" onclick="return cancelSelectFile();" class="button"> --> <!--<input type="button" value="<?php // echo LBL_ACTION_CLOSE; ?>" onclick="return cancelSelectFile();" class="button"> -->
</span> </span>
<span class="right" id="linkSearch"> <span class="right" id="linkSearch">

@ -195,7 +195,7 @@
define('CONFIG_EDITOR_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['editor'])?secureFileName($_GET['editor']):'fckeditor')); // run mode fckeditor (Dokeos editor) define('CONFIG_EDITOR_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['editor'])?secureFileName($_GET['editor']):'fckeditor')); // run mode fckeditor (Dokeos editor)
define('CONFIG_THEME_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['theme'])?secureFileName($_GET['theme']):'default')); //change the theme to your custom theme rather than default define('CONFIG_THEME_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['theme'])?secureFileName($_GET['theme']):'default')); //change the theme to your custom theme rather than default
define('CONFIG_DEFAULT_VIEW', (CONFIG_SYS_THUMBNAIL_VIEW_ENABLE?'thumbnail':'detail')); //thumbnail or detail define('CONFIG_DEFAULT_VIEW', (CONFIG_SYS_THUMBNAIL_VIEW_ENABLE?'thumbnail':'detail')); //thumbnail or detail
define('CONFIG_DEFAULT_PAGINATION_LIMIT', 10); define('CONFIG_DEFAULT_PAGINATION_LIMIT', 10000); //change 10 by 10000 while pagination is deactivated on Dokeos
define('CONFIG_LOAD_DOC_LATTER', false); //all documents will be loaded up after the template has been loaded to the client define('CONFIG_LOAD_DOC_LATTER', false); //all documents will be loaded up after the template has been loaded to the client

@ -140,8 +140,8 @@ return false;}; function getUrl(index,limitNeeded , viewNeeded, searchNeeded)
} }
if(typeof(viewNeeded) == 'boolean' && viewNeeded) if(typeof(viewNeeded) == 'boolean' && viewNeeded)
{ queryStr += (queryStr == ''?'':'&') + 'view=' + getView(); excluded[excluded.length] = 'view';} { queryStr += (queryStr == ''?'':'&') + 'view=' + getView(); excluded[excluded.length] = 'view';}
if(typeof(searchNeeded) == 'boolean' && searchNeeded && searchRequired) if(typeof(searchNeeded) == 'boolean' && searchNeeded && searchRequired) // Below a temporal hack for Dokeos, change var search_recursively from = 0 to = 1 while radio button is deactivated into ajaxfilemanager.php Now alltime is recursively
{ var search_recursively = 0; $('input[@name=search_recursively][@checked]').each( function() { var search_recursively = 1; $('input[@name=search_recursively][@checked]').each( function()
{ search_recursively = this.value;} ); var searchFolder = document.getElementById('search_folder'); queryStr += (queryStr == ''?'':'&') + 'search=1&search_name=' + $('#search_name').val() + '&search_recursively=' + search_recursively + '&search_mtime_from=' + $('#search_mtime_from').val() + '&search_mtime_to=' + $('#search_mtime_to').val() + '&search_folder=' + searchFolder.options[searchFolder.selectedIndex].value; excluded[excluded.length] = 'search'; excluded[excluded.length] = 'search_recursively'; excluded[excluded.length] = 'search_mtime_from'; excluded[excluded.length] = 'search_mtime_to'; excluded[excluded.length] = 'search_folder'; excluded[excluded.length] = 'search_name'; excluded[excluded.length] = 'search';} { search_recursively = this.value;} ); var searchFolder = document.getElementById('search_folder'); queryStr += (queryStr == ''?'':'&') + 'search=1&search_name=' + $('#search_name').val() + '&search_recursively=' + search_recursively + '&search_mtime_from=' + $('#search_mtime_from').val() + '&search_mtime_to=' + $('#search_mtime_to').val() + '&search_folder=' + searchFolder.options[searchFolder.selectedIndex].value; excluded[excluded.length] = 'search'; excluded[excluded.length] = 'search_recursively'; excluded[excluded.length] = 'search_mtime_from'; excluded[excluded.length] = 'search_mtime_to'; excluded[excluded.length] = 'search_folder'; excluded[excluded.length] = 'search_name'; excluded[excluded.length] = 'search';}
return appendQueryString(appendQueryString(urls[index], queryString), queryStr, excluded);}; function changeView() return appendQueryString(appendQueryString(urls[index], queryString), queryStr, excluded);}; function changeView()
{ var url = getUrl('view', true, true); $('#rightCol').empty(); ajaxStart('#rightCol'); $('#rightCol').load(url, {}, function(){ ajaxStop('#rightCol img.ajaxLoadingImg'); urls.present = getUrl('home', true, true); initAfterListingLoaded();});}; function goParentFolder() { var url = getUrl('view', true, true); $('#rightCol').empty(); ajaxStart('#rightCol'); $('#rightCol').load(url, {}, function(){ ajaxStop('#rightCol img.ajaxLoadingImg'); urls.present = getUrl('home', true, true); initAfterListingLoaded();});}; function goParentFolder()

@ -48,6 +48,7 @@ input{ padding: 0; background-color: transparent;}
#wrapper #wrapper
{ {
margin: 0px 0px; margin: 0px 0px;
margin-top:15px;
min-width:760px; min-width:760px;
width:100%; width:100%;
padding:0px; padding:0px;
@ -58,6 +59,7 @@ position:absolute;
top:60px; top:60px;
width:100%; width:100%;
border-color:#0000CC; border-color:#0000CC;
margin-top:15px;
} }
#leftCol{ #leftCol{
background:#e8e8e8; background:#e8e8e8;
@ -79,7 +81,7 @@ margin-left: 50%;
margin-top:100px; margin-top:100px;
} }
#content{ #content{
margin-left: 200px; margin-left: 200px;
overflow: auto; overflow: auto;
overflow-x: hidden; overflow-x: hidden;
max-height:380px; max-height:380px;
@ -183,7 +185,6 @@ float:left;
font-size: 14px; font-size: 14px;
font-weight: bold; font-weight: bold;
color: #666666; color: #666666;
} }
#currentFolderInfo dt{ #currentFolderInfo dt{
font-size:12px; font-size:12px;

@ -68,6 +68,7 @@ define("GROUP_TOOL_CALENDAR","2");
define("GROUP_TOOL_ANNOUNCEMENT","3"); define("GROUP_TOOL_ANNOUNCEMENT","3");
define("GROUP_TOOL_WORK","4"); define("GROUP_TOOL_WORK","4");
define("GROUP_TOOL_WIKI", "5"); define("GROUP_TOOL_WIKI", "5");
define("GROUP_TOOL_CHAT", "6");
/** /**
* Fixed id's for group categories * Fixed id's for group categories
@ -226,7 +227,7 @@ class GroupManager {
} }
$sql = "INSERT INTO ".$table_group." SET $sql = "INSERT INTO ".$table_group." SET
category_id='".Database::escape_string($category_id)."', max_student = '".$places."', doc_state = '".$category['doc_state']."', category_id='".Database::escape_string($category_id)."', max_student = '".$places."', doc_state = '".$category['doc_state']."',
calendar_state = '".$category['calendar_state']."', work_state = '".$category['work_state']."', announcements_state = '".$category['announcements_state']."', forum_state = '".$category['forum_state']."', wiki_state = '".$category['wiki_state']."', self_registration_allowed = '".$category['self_reg_allowed']."', self_unregistration_allowed = '".$category['self_unreg_allowed']."', session_id='".Database::escape_string($my_id_session)."'"; calendar_state = '".$category['calendar_state']."', work_state = '".$category['work_state']."', announcements_state = '".$category['announcements_state']."', forum_state = '".$category['forum_state']."', wiki_state = '".$category['wiki_state']."', chat_state = '".$category['chat_state']."', self_registration_allowed = '".$category['self_reg_allowed']."', self_unregistration_allowed = '".$category['self_unreg_allowed']."', session_id='".Database::escape_string($my_id_session)."'";
Database::query($sql,__FILE__,__LINE__); Database::query($sql,__FILE__,__LINE__);
$lastId = Database::insert_id(); $lastId = Database::insert_id();
/*$secret_directory = uniqid("")."_team_".$lastId; /*$secret_directory = uniqid("")."_team_".$lastId;
@ -470,6 +471,7 @@ class GroupManager {
$result['announcements_state'] = $db_object->announcements_state; $result['announcements_state'] = $db_object->announcements_state;
$result['forum_state'] = $db_object->forum_state; $result['forum_state'] = $db_object->forum_state;
$result['wiki_state'] = $db_object->wiki_state; $result['wiki_state'] = $db_object->wiki_state;
$result['chat_state'] = $db_object->chat_state;
$result['directory'] = $db_object->secret_directory; $result['directory'] = $db_object->secret_directory;
$result['self_registration_allowed'] = $db_object->self_registration_allowed; $result['self_registration_allowed'] = $db_object->self_registration_allowed;
$result['self_unregistration_allowed'] = $db_object->self_unregistration_allowed; $result['self_unregistration_allowed'] = $db_object->self_unregistration_allowed;
@ -489,11 +491,12 @@ class GroupManager {
* @param int Announcement tool's visibility (0=none,1=private,2=public) * @param int Announcement tool's visibility (0=none,1=private,2=public)
* @param int Forum tool's visibility (0=none,1=private,2=public) * @param int Forum tool's visibility (0=none,1=private,2=public)
* @param int Wiki tool's visibility (0=none,1=private,2=public) * @param int Wiki tool's visibility (0=none,1=private,2=public)
* @param int Chat tool's visibility (0=none,1=private,2=public)
* @param bool Whether self registration is allowed or not * @param bool Whether self registration is allowed or not
* @param bool Whether self unregistration is allowed or not * @param bool Whether self unregistration is allowed or not
* @return bool TRUE if properties are successfully changed, false otherwise * @return bool TRUE if properties are successfully changed, false otherwise
*/ */
public static function set_group_properties ($group_id, $name, $description, $maximum_number_of_students, $doc_state, $work_state, $calendar_state, $announcements_state, $forum_state,$wiki_state, $self_registration_allowed, $self_unregistration_allowed) { public static function set_group_properties ($group_id, $name, $description, $maximum_number_of_students, $doc_state, $work_state, $calendar_state, $announcements_state, $forum_state, $wiki_state, $chat_state, $self_registration_allowed, $self_unregistration_allowed) {
$table_group = Database :: get_course_table(TABLE_GROUP); $table_group = Database :: get_course_table(TABLE_GROUP);
$table_forum = Database :: get_course_table(TABLE_FORUM); $table_forum = Database :: get_course_table(TABLE_FORUM);
//$forum_id = get_forums_of_group($group_id); //$forum_id = get_forums_of_group($group_id);
@ -506,6 +509,7 @@ class GroupManager {
announcements_state = '".Database::escape_string($announcements_state)."', announcements_state = '".Database::escape_string($announcements_state)."',
forum_state = '".Database::escape_string($forum_state)."', forum_state = '".Database::escape_string($forum_state)."',
wiki_state = '".Database::escape_string($wiki_state)."', wiki_state = '".Database::escape_string($wiki_state)."',
chat_state = '".Database::escape_string($chat_state)."',
description='".Database::escape_string(trim($description))."', description='".Database::escape_string(trim($description))."',
max_student=".Database::escape_string($maximum_number_of_students).", max_student=".Database::escape_string($maximum_number_of_students).",
self_registration_allowed='".Database::escape_string($self_registration_allowed)."', self_registration_allowed='".Database::escape_string($self_registration_allowed)."',
@ -642,7 +646,7 @@ class GroupManager {
* @param int $max_number_of_students * @param int $max_number_of_students
* @param int $groups_per_user * @param int $groups_per_user
*/ */
public static function create_category ($title, $description, $doc_state, $work_state, $calendar_state, $announcements_state, $forum_state, $wiki_state, $self_registration_allowed, $self_unregistration_allowed, $maximum_number_of_students, $groups_per_user) { public static function create_category ($title, $description, $doc_state, $work_state, $calendar_state, $announcements_state, $forum_state, $wiki_state, $chat_state, $self_registration_allowed, $self_unregistration_allowed, $maximum_number_of_students, $groups_per_user) {
$table_group_category = Database :: get_course_table(TABLE_GROUP_CATEGORY); $table_group_category = Database :: get_course_table(TABLE_GROUP_CATEGORY);
$sql = "SELECT MAX(display_order)+1 as new_order FROM $table_group_category "; $sql = "SELECT MAX(display_order)+1 as new_order FROM $table_group_category ";
$res = Database::query($sql,__FILE__,__LINE__); $res = Database::query($sql,__FILE__,__LINE__);
@ -661,6 +665,7 @@ class GroupManager {
announcements_state = '".Database::escape_string($announcements_state)."', announcements_state = '".Database::escape_string($announcements_state)."',
forum_state = '".Database::escape_string($forum_state)."', forum_state = '".Database::escape_string($forum_state)."',
wiki_state = '".Database::escape_string($wiki_state)."', wiki_state = '".Database::escape_string($wiki_state)."',
chat_state = '".Database::escape_string($chat_state)."',
groups_per_user = '".Database::escape_string($groups_per_user)."', groups_per_user = '".Database::escape_string($groups_per_user)."',
self_reg_allowed = '".Database::escape_string($self_registration_allowed)."', self_reg_allowed = '".Database::escape_string($self_registration_allowed)."',
self_unreg_allowed = '".Database::escape_string($self_unregistration_allowed)."', self_unreg_allowed = '".Database::escape_string($self_unregistration_allowed)."',
@ -686,7 +691,7 @@ class GroupManager {
* @param int $max_number_of_students * @param int $max_number_of_students
* @param int $groups_per_user * @param int $groups_per_user
*/ */
public static function update_category ($id, $title, $description, $doc_state, $work_state, $calendar_state, $announcements_state, $forum_state, $wiki_state, $self_registration_allowed, $self_unregistration_allowed, $maximum_number_of_students, $groups_per_user) { public static function update_category ($id, $title, $description, $doc_state, $work_state, $calendar_state, $announcements_state, $forum_state, $wiki_state, $chat_state, $self_registration_allowed, $self_unregistration_allowed, $maximum_number_of_students, $groups_per_user) {
$table_group_category = Database :: get_course_table(TABLE_GROUP_CATEGORY); $table_group_category = Database :: get_course_table(TABLE_GROUP_CATEGORY);
$id = Database::escape_string($id); $id = Database::escape_string($id);
$sql = "UPDATE ".$table_group_category." $sql = "UPDATE ".$table_group_category."
@ -698,6 +703,7 @@ class GroupManager {
announcements_state = '".Database::escape_string($announcements_state)."', announcements_state = '".Database::escape_string($announcements_state)."',
forum_state = '".Database::escape_string($forum_state)."', forum_state = '".Database::escape_string($forum_state)."',
wiki_state = '".Database::escape_string($wiki_state)."', wiki_state = '".Database::escape_string($wiki_state)."',
chat_state = '".Database::escape_string($chat_state)."',
groups_per_user = ".Database::escape_string($groups_per_user).", groups_per_user = ".Database::escape_string($groups_per_user).",
self_reg_allowed = '".Database::escape_string($self_registration_allowed)."', self_reg_allowed = '".Database::escape_string($self_registration_allowed)."',
self_unreg_allowed = '".Database::escape_string($self_unregistration_allowed)."', self_unreg_allowed = '".Database::escape_string($self_unregistration_allowed)."',
@ -1485,6 +1491,9 @@ class GroupManager {
case GROUP_TOOL_WIKI : case GROUP_TOOL_WIKI :
$state_key = 'wiki_state'; $state_key = 'wiki_state';
break; break;
case GROUP_TOOL_CHAT :
$state_key = 'chat_state';
break;
default: default:
return false; return false;
} }

@ -57,3 +57,5 @@ ALTER TABLE link_category ADD COLUMN session_id smallint DEFAULT 0, ADD INDEX (s
ALTER TABLE item_property ADD id_session INT NOT NULL DEFAULT 0; ALTER TABLE item_property ADD id_session INT NOT NULL DEFAULT 0;
ALTER TABLE item_property DROP INDEX idx_item_property_toolref, ADD INDEX idx_item_property_toolref (tool, ref, id_session); ALTER TABLE item_property DROP INDEX idx_item_property_toolref, ADD INDEX idx_item_property_toolref (tool, ref, id_session);
ALTER TABLE quiz ADD COLUMN expired_time int NOT NULL DEFAULT '0' AFTER feedback_type; ALTER TABLE quiz ADD COLUMN expired_time int NOT NULL DEFAULT '0' AFTER feedback_type;
ALTER TABLE group_info ADD COLUMN chat_state TINYINT DEFAULT 1, ADD INDEX (chat_state);
ALTER TABLE group_category ADD COLUMN chat_state TINYINT DEFAULT 1, ADD INDEX (chat_state);

@ -511,8 +511,13 @@ if (!empty ($_GET['student'])) {
$rs = Database::query($sql, __FILE__, __LINE__); $rs = Database::query($sql, __FILE__, __LINE__);
$num_row = Database :: num_rows($rs); $num_row = Database :: num_rows($rs);
if ($num_row > 0) { if ($num_row > 0) {
$le_session_id = intval(Database :: result($rs, 0, 0)); $le_session_id = intval(Database :: result($rs, 0, 0));
if ($le_session_id > 0) { if ($le_session_id > 0) {
// get session name and coach of the session // get session name and coach of the session
$sql = 'SELECT name, id_coach FROM ' . $tbl_session . ' $sql = 'SELECT name, id_coach FROM ' . $tbl_session . '
WHERE id=' . $le_session_id; WHERE id=' . $le_session_id;
@ -521,16 +526,35 @@ if (!empty ($_GET['student'])) {
$session_coach_id = intval(Database :: result($rs, 0, 'id_coach')); $session_coach_id = intval(Database :: result($rs, 0, 'id_coach'));
// get coach of the course in the session // get coach of the course in the session
$sql = 'SELECT id_user FROM ' . $tbl_session_course_user . '
WHERE id_session=' . $le_session_id . '
AND course_code = "' . Database :: escape_string($_GET['course']) . '" AND status=2';
/*
$sql = 'SELECT id_coach FROM ' . $tbl_session_course . ' $sql = 'SELECT id_coach FROM ' . $tbl_session_course . '
WHERE id_session=' . $le_session_id . ' WHERE id_session=' . $le_session_id . '
AND course_code = "' . Database :: escape_string($_GET['course']) . '"'; AND course_code = "' . Database :: escape_string($_GET['course']) . '"';
*/
$rs = Database::query($sql, __FILE__, __LINE__); $rs = Database::query($sql, __FILE__, __LINE__);
$session_course_coach_id = intval(Database :: result($rs, 0, 0)); //$session_course_coach_id = intval(Database :: result($rs, 0, 0));
$course_coachs = array();
while ($row_coachs = Database::fetch_array($rs)) {
$course_coachs[] = $row_coachs['id_user'];
}
if ($session_course_coach_id != 0) { if (!empty($course_coachs)) {
$info_tutor_name = array();
foreach ($course_coachs as $course_coach) {
$coach_infos = UserManager :: get_user_info_by_id($course_coach);
$info_tutor_name[] = api_get_person_name($coach_infos['firstname'], $coach_infos['lastname']);
}
$info_course['tutor_name'] = implode(",",$info_tutor_name);
}
/*if ($session_course_coach_id != 0) {
$coach_infos = UserManager :: get_user_info_by_id($session_course_coach_id); $coach_infos = UserManager :: get_user_info_by_id($session_course_coach_id);
$info_course['tutor_name'] = api_get_person_name($coach_infos['firstname'], $coach_infos['lastname']); $info_course['tutor_name'] = api_get_person_name($coach_infos['firstname'], $coach_infos['lastname']);
} }*/
elseif ($session_coach_id != 0) { elseif ($session_coach_id != 0) {
$coach_infos = UserManager :: get_user_info_by_id($session_coach_id); $coach_infos = UserManager :: get_user_info_by_id($session_coach_id);
$info_course['tutor_name'] = api_get_person_name($coach_infos['firstname'], $coach_infos['lastname']); $info_course['tutor_name'] = api_get_person_name($coach_infos['firstname'], $coach_infos['lastname']);

Loading…
Cancel
Save