skala
Julio Montoya 15 years ago
commit bc343962f9
  1. 5
      documentation/changelog.html
  2. 8
      index.php
  3. 33
      main/admin/calendar.lib.php
  4. 2
      main/admin/dashboard_add_courses_to_user.php
  5. 72
      main/admin/statistics/index.php
  6. 191
      main/admin/statistics/statistics.lib.php
  7. 19
      main/calendar/agenda.inc.php
  8. 6
      main/course_progress/thematic.php
  9. 3
      main/coursecopy/classes/CourseRestorer.class.php
  10. 15
      main/exercice/fill_blanks.class.php
  11. 8
      main/exercice/freeanswer.class.php
  12. 16
      main/exercice/matching.class.php
  13. 15
      main/exercice/multiple_answer.class.php
  14. 13
      main/exercice/multiple_answer_combination.class.php
  15. 21
      main/exercice/question.class.php
  16. 5
      main/exercice/question_create.php
  17. 14
      main/exercice/unique_answer.class.php
  18. 4
      main/forum/forumfunction.inc.php
  19. 2
      main/gradebook/gradebook_view_result.php
  20. 6
      main/gradebook/lib/fe/evalform.class.php
  21. 4
      main/gradebook/lib/fe/linkaddeditform.class.php
  22. 3
      main/inc/lib/add_course.lib.inc.php
  23. 8
      main/inc/lib/course_home.lib.php
  24. 37
      main/inc/lib/usermanager.lib.php
  25. 0
      main/install/db_main.sql
  26. 6
      main/install/migrate-db-1.8.6.2-1.8.7-pre.sql
  27. 40
      main/install/update-db-1.8.6.2-1.8.7.inc.php
  28. 3
      main/lang/bulgarian/document.inc.php
  29. 2
      main/lang/bulgarian/exercice.inc.php
  30. 6
      main/lang/bulgarian/gradebook.inc.php
  31. 1
      main/lang/bulgarian/learnpath.inc.php
  32. 1
      main/lang/english/admin.inc.php
  33. 1
      main/lang/english/exercice.inc.php
  34. 3
      main/lang/english/trad4all.inc.php
  35. 3
      main/lang/spanish/admin.inc.php
  36. 1
      main/lang/spanish/document.inc.php
  37. 1
      main/lang/spanish/exercice.inc.php
  38. 1
      main/lang/spanish/trad4all.inc.php
  39. 2
      main/mySpace/lp_tracking.php
  40. 2
      main/mySpace/myStudents.php
  41. 2
      main/tracking/courseLog.php
  42. 183
      main/user/userInfo.php
  43. 31
      main/work/work.lib.php
  44. 55
      main/work/work.php

@ -65,13 +65,14 @@
<li>Quiz tool: Answer list fixed when using "matching" question type (BT#801). Reported by Noa Orizales</li> <li>Quiz tool: Answer list fixed when using "matching" question type (BT#801). Reported by Noa Orizales</li>
<li>Quiz tool + LP : Fixed bug when adding a exercise twice in the same LP with multiple attempts or not.</li> <li>Quiz tool + LP : Fixed bug when adding a exercise twice in the same LP with multiple attempts or not.</li>
<li>Quiz tool + LP + Multiple attempts : Pre requisites will work the first time a student pass the LP. <li>Quiz tool + LP + Multiple attempts : Pre requisites will work the first time a student pass the LP.
If an student finished all steps correctly he will view all steps, prerequisites will not work here.</li> If a student finished all steps correctly he will view all steps, prerequisites will not work here.</li>
<li>Learning Path (Courses): PHP sessions of a LP are destroyed when visiting the main course page.</li> <li>Learning Path (Courses): PHP sessions of a LP are destroyed when visiting the main course page.</li>
<li>Assignment tool: Work.php deletes all homeworks bugs fixed. Reported and fixed by carlosbrolotobar <a href="http://www.chamilo.org/node/143" target="_blank">http://www.chamilo.org/node/143</a></li> <li>Assignment tool: Work.php deletes all homeworks bugs fixed. Reported and fixed by carlosbrolotobar <a href="http://www.chamilo.org/node/143" target="_blank">http://www.chamilo.org/node/143</a></li>
<li>Core API: Support has been implemented for json_encode() function for PHP version < 5.2. The correspondent bug-report "Hide and show not working" and testing have been done by Hubert Borderiou <a href="http://support.chamilo.org/issues/761" target="_blank">http://support.chamilo.org/issues/761</a></li> <li>Core API: Support has been implemented for json_encode() function for PHP version < 5.2. The correspondent bug-report "Hide and show not working" and testing have been done by Hubert Borderiou <a href="http://support.chamilo.org/issues/761" target="_blank">http://support.chamilo.org/issues/761</a></li>
<li>Fixed target problems in links tool link edition</li> <li>Fixed target problems in links tool link edition</li>
<li>Fixed minor bug in online mail editor in order to show the sender's name and e-mail</li> <li>Fixed minor bug in online mail editor in order to show the sender's name and e-mail</li>
<li>Fixing a bug that prevented importing SCORM resource from course archives (Bug #872)</li> <li>A bug that prevented importing SCORM resource from course archives has been fixed (Bug #872)</li>
<li>A bug that prevented proper importing tests from course zip-archives created on systems prior Chamilo 1.8.6.2 has been fixed (Bug #879)</li>
</ul> </ul>
<br /> <br />
<h3>CSS changes</h3> <h3>CSS changes</h3>

@ -699,11 +699,11 @@ function display_anonymous_course_list() {
$courses_list_string .= "<hr size=\"1\" noshade=\"noshade\">\n"; $courses_list_string .= "<hr size=\"1\" noshade=\"noshade\">\n";
} }
$courses_list_string .= '<h4 style="margin-top: 0px;">'.get_lang('CourseList')."</h4>\n<ul>\n"; $courses_list_string .= '<h4 style="margin-top: 0px;">'.get_lang('CourseList')."</h4>\n<ul>\n";
if (api_get_user_id()) { if (api_get_user_id()) {
$courses_of_user = get_courses_of_user(api_get_user_id()); $courses_of_user = get_courses_of_user(api_get_user_id());
} }
foreach ($course_list as $course) { foreach ($course_list as $course) {
// $setting_show_also_closed_courses // $setting_show_also_closed_courses
@ -757,7 +757,7 @@ function display_anonymous_course_list() {
$courses_list_string .= '</a><br />'; $courses_list_string .= '</a><br />';
} }
if (api_get_setting('display_coursecode_in_courselist') == 'true') { if (api_get_setting('display_coursecode_in_courselist') == 'true') {
$courses_list_string .= $course['visual_code']; $courses_list_string .= ' '.$course['visual_code'];
} }
if (api_get_setting('display_coursecode_in_courselist') == 'true' && api_get_setting('display_teacher_in_courselist') == 'true') { if (api_get_setting('display_coursecode_in_courselist') == 'true' && api_get_setting('display_teacher_in_courselist') == 'true') {
$courses_list_string .= ' - '; $courses_list_string .= ' - ';
@ -809,7 +809,6 @@ function display_anonymous_course_list() {
function get_courses_of_user($user_id) { function get_courses_of_user($user_id) {
$table_course = Database::get_main_table(TABLE_MAIN_COURSE); $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); $table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
// Secondly we select the courses that are in a category (user_course_cat <> 0) and sort these according to the sort of the category // Secondly we select the courses that are in a category (user_course_cat <> 0) and sort these according to the sort of the category
$user_id = intval($user_id); $user_id = intval($user_id);
$sql_select_courses = "SELECT course.code k, course.visual_code vc, course.subscribe subscr, course.unsubscribe unsubscr, $sql_select_courses = "SELECT course.code k, course.visual_code vc, course.subscribe subscr, course.unsubscribe unsubscr,
@ -822,6 +821,7 @@ function get_courses_of_user($user_id) {
AND course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
ORDER BY course_rel_user.sort ASC"; ORDER BY course_rel_user.sort ASC";
$result = Database::query($sql_select_courses); $result = Database::query($sql_select_courses);
$courses = array();
while ($row = Database::fetch_array($result)) { while ($row = Database::fetch_array($result)) {
// We only need the database name of the course // We only need the database name of the course
$courses[$row['k']] = array('db' => $row['db'], 'code' => $row['k'], 'visual_code' => $row['vc'], 'title' => $row['i'], 'directory' => $row['dir'], 'status' => $row['status'], 'tutor' => $row['t'], 'subscribe' => $row['subscr'], 'unsubscribe' => $row['unsubscr'], 'sort' => $row['sort'], 'user_course_category' => $row['user_course_cat']); $courses[$row['k']] = array('db' => $row['db'], 'code' => $row['k'], 'visual_code' => $row['vc'], 'title' => $row['i'], 'directory' => $row['dir'], 'status' => $row['status'], 'tutor' => $row['t'], 'subscribe' => $row['subscr'], 'unsubscribe' => $row['unsubscr'], 'sort' => $row['sort'], 'user_course_category' => $row['user_course_cat']);

@ -410,6 +410,7 @@ echo "</table>";
function store_new_agenda_item() function store_new_agenda_item()
{ {
global $_user /*, $_course*/; global $_user /*, $_course*/;
$TABLEAGENDA = Database::get_main_table(TABLE_MAIN_SYSTEM_CALENDAR); $TABLEAGENDA = Database::get_main_table(TABLE_MAIN_SYSTEM_CALENDAR);
//$t_agenda_repeat = Database::get_course_Table(TABLE_AGENDA_REPEAT); //$t_agenda_repeat = Database::get_course_Table(TABLE_AGENDA_REPEAT);
@ -581,12 +582,12 @@ function store_edited_agenda_item()
function save_edit_agenda_item($id,$title,$content,$start_date,$end_date) function save_edit_agenda_item($id,$title,$content,$start_date,$end_date)
{ {
$TABLEAGENDA = Database::get_main_table(TABLE_MAIN_SYSTEM_CALENDAR); $TABLEAGENDA = Database::get_main_table(TABLE_MAIN_SYSTEM_CALENDAR);
$id=Database::escape_string($id);
$title=Database::escape_string($title); $id=Database::escape_string($id);
$content=Database::escape_string($content); $title=Database::escape_string($title);
$start_date=Database::escape_string($start_date); $content=Database::escape_string($content);
$end_date=Database::escape_string($end_date); $start_date=Database::escape_string($start_date);
$end_date=Database::escape_string($end_date);
// store the modifications in the table calendar_event // store the modifications in the table calendar_event
$sql = "UPDATE ".$TABLEAGENDA." $sql = "UPDATE ".$TABLEAGENDA."
@ -656,11 +657,12 @@ function showhide_agenda_item($id)
*/ */
function display_agenda_items() function display_agenda_items()
{ {
$TABLEAGENDA = Database::get_main_table(TABLE_MAIN_SYSTEM_CALENDAR);
global $select_month, $select_year; global $select_month, $select_year;
global $DaysShort, $DaysLong, $MonthsLong; global $DaysShort, $DaysLong, $MonthsLong;
global $is_courseAdmin; global $is_courseAdmin;
global $dateFormatLong, $timeNoSecFormat,$charset, $_user, $_course; global $dateFormatLong, $timeNoSecFormat,$charset, $_user, $_course;
$TABLEAGENDA = Database::get_main_table(TABLE_MAIN_SYSTEM_CALENDAR);
// getting the group memberships // getting the group memberships
//$group_memberships=GroupManager::get_group_ids($_course['dbName'],$_user['user_id']); //$group_memberships=GroupManager::get_group_ids($_course['dbName'],$_user['user_id']);
@ -953,13 +955,15 @@ function display_agenda_items()
*/ */
function display_one_agenda_item($agenda_id) function display_one_agenda_item($agenda_id)
{ {
$TABLEAGENDA = Database::get_main_table(TABLE_MAIN_SYSTEM_CALENDAR);
global $TABLE_ITEM_PROPERTY;
global $select_month, $select_year; global $select_month, $select_year;
global $DaysShort, $DaysLong, $MonthsLong; global $DaysShort, $DaysLong, $MonthsLong;
global $is_courseAdmin; global $is_courseAdmin;
global $dateFormatLong, $timeNoSecFormat, $charset; global $dateFormatLong, $timeNoSecFormat, $charset;
global $_user; global $_user;
$TABLEAGENDA = Database::get_main_table(TABLE_MAIN_SYSTEM_CALENDAR);
$TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$agenda_id=Database::escape_string($agenda_id); $agenda_id=Database::escape_string($agenda_id);
//echo "displaying agenda items"; //echo "displaying agenda items";
@ -1214,8 +1218,8 @@ function show_user_group_filter_form()
function show_add_form($id = '') function show_add_form($id = '')
{ {
global $MonthsLong; global $MonthsLong;
$htmlHeadXtra[] = to_javascript(); $htmlHeadXtra[] = to_javascript();
// the default values for the forms // the default values for the forms
if ($_GET['originalresource'] !== 'no') if ($_GET['originalresource'] !== 'no')
@ -1537,7 +1541,7 @@ function show_add_form($id = '')
<td colspan="4"> <td colspan="4">
<?php <?php
require_once(api_get_path(LIBRARY_PATH) . "/fckeditor/fckeditor.php"); require_once api_get_path(LIBRARY_PATH) . "/fckeditor/fckeditor.php";
$oFCKeditor = new FCKeditor('content') ; $oFCKeditor = new FCKeditor('content') ;
@ -2038,10 +2042,11 @@ function get_day_agendaitems($courses_dbs, $month, $year, $day)
*/ */
function get_week_agendaitems($courses_dbs, $month, $year, $week = '') function get_week_agendaitems($courses_dbs, $month, $year, $week = '')
{ {
$TABLEAGENDA = Database :: get_main_table(TABLE_MAIN_SYSTEM_CALENDAR);
global $_user; global $_user;
global $_configuration; global $_configuration;
global $setting_agenda_link; global $setting_agenda_link;
$TABLEAGENDA = Database :: get_main_table(TABLE_MAIN_SYSTEM_CALENDAR);
$items = array (); $items = array ();
// The default value of the week // The default value of the week
@ -3063,7 +3068,7 @@ function agenda_add_repeat_item($course_info,$orig_id,$type,$end,$orig_dest)
function agenda_import_ical($course_info,$file) function agenda_import_ical($course_info,$file)
{ {
require_once(api_get_path(LIBRARY_PATH).'fileUpload.lib.php'); require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
$charset = api_get_setting('platform_charset'); $charset = api_get_setting('platform_charset');
$filepath = api_get_path(SYS_ARCHIVE_PATH).$file['name']; $filepath = api_get_path(SYS_ARCHIVE_PATH).$file['name'];
if(!@move_uploaded_file($file['tmp_name'],$filepath)) if(!@move_uploaded_file($file['tmp_name'],$filepath))
@ -3071,7 +3076,7 @@ function agenda_import_ical($course_info,$file)
error_log('Problem moving uploaded file: '.$file['error'].' in '.__FILE__.' line '.__LINE__); error_log('Problem moving uploaded file: '.$file['error'].' in '.__FILE__.' line '.__LINE__);
return false; return false;
} }
require_once (api_get_path(LIBRARY_PATH).'icalcreator/iCalcreator.class.php'); require_once api_get_path(LIBRARY_PATH).'icalcreator/iCalcreator.class.php';
$ical = new vcalendar(); $ical = new vcalendar();
$ical->setConfig( 'directory', dirname($filepath) ); $ical->setConfig( 'directory', dirname($filepath) );
$ical->setConfig( 'filename', basename($filepath) ); $ical->setConfig( 'filename', basename($filepath) );

@ -230,7 +230,7 @@ if(!empty($msg)) {
<?php if($add_type == 'multiple') { ?> <?php if($add_type == 'multiple') { ?>
<tr><td width="45%" align="center"> <tr><td width="45%" align="center">
<?php echo get_lang('FirstLetterCourse');?> : <?php echo get_lang('FirstLetterCourse');?> :
<select name="firstLetterCourse" onchange = "xajax_search_course(this.value,'multiple')"> <select name="firstLetterCourse" onchange = "xajax_search_courses(this.value,'multiple')">
<option value="%">--</option> <option value="%">--</option>
<?php <?php
echo Display :: get_alphabet_options($_POST['firstLetterCourse']); echo Display :: get_alphabet_options($_POST['firstLetterCourse']);

@ -1,29 +1,8 @@
<?php <?php
// $Id: index.php 8216 2006-11-3 18:03:15 NushiFirefox $ /* For licensing terms, see /license.txt */
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2006 Bart Mollet <bart.mollet@hogent.be>
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
==============================================================================
*/
/** /**
============================================================================== * This tool show global statistics on general platform events
* This tool allows the use statistics * @package chamilo.statistics
* @package dokeos.statistics
==============================================================================
*/ */
// Language files that need to be included // Language files that need to be included
$language_file = array('admin', 'tracking'); $language_file = array('admin', 'tracking');
@ -39,8 +18,7 @@ $tool_name = get_lang('Statistics');
Display::display_header($tool_name); Display::display_header($tool_name);
api_display_tool_title($tool_name); api_display_tool_title($tool_name);
if(!$_configuration['tracking_enabled']) if (!$_configuration['tracking_enabled']) {
{
Display::display_warning_message(get_lang('TrackingDisabled')); Display::display_warning_message(get_lang('TrackingDisabled'));
Display::display_footer(); Display::display_footer();
exit; exit;
@ -76,27 +54,23 @@ $tools[$strSocial]['action=messagereceived'] = get_lang('MessagesReceived');
$tools[$strSocial]['action=friends'] = get_lang('CountFriends'); $tools[$strSocial]['action=friends'] = get_lang('CountFriends');
echo '<table><tr>'; echo '<table><tr>';
foreach($tools as $section => $items) foreach ($tools as $section => $items) {
{ echo '<td valign="top">';
echo '<td valign="top">'; echo '<b>'.$section.'</b>';
echo '<b>'.$section.'</b>'; echo '<ul>';
echo '<ul>'; foreach ($items as $key => $value) {
foreach($items as $key => $value) echo '<li><a href="index.php?'.$key.'">'.$value.'</a></li>';
{ }
echo '<li><a href="index.php?'.$key.'">'.$value.'</a></li>'; echo '</ul>';
} echo '</td>';
echo '</ul>';
echo '</td>';
} }
echo '</tr></table>'; echo '</tr></table>';
$course_categories = statistics::get_course_categories(); $course_categories = statistics::get_course_categories();
echo '<br/><br/>'; echo '<br/><br/>';
switch($_GET['action']) switch ($_GET['action']) {
{
case 'courses': case 'courses':
// total amount of courses // total amount of courses
foreach($course_categories as $code => $name) foreach ($course_categories as $code => $name) {
{
$courses[$name] = statistics::count_courses($code); $courses[$name] = statistics::count_courses($code);
} }
// courses for each course category // courses for each course category
@ -105,14 +79,13 @@ switch($_GET['action'])
case 'users': case 'users':
// total amount of users // total amount of users
statistics::print_stats( statistics::print_stats(
get_lang('NumberOfUsers'), get_lang('NumberOfUsers'),
array( array(
get_lang('Teachers') => statistics::count_users(1,null,$_GET['count_invisible_courses']), get_lang('Teachers') => statistics::count_users(1,null,$_GET['count_invisible_courses']),
get_lang('Students') => statistics::count_users(5,null,$_GET['count_invisible_courses']) get_lang('Students') => statistics::count_users(5,null,$_GET['count_invisible_courses'])
) )
); );
foreach($course_categories as $code => $name) foreach ($course_categories as $code => $name) {
{
$name = str_replace(get_lang('Department'),"",$name); $name = str_replace(get_lang('Department'),"",$name);
$teachers[$name] = statistics::count_users(1,$code,$_GET['count_invisible_courses']); $teachers[$name] = statistics::count_users(1,$code,$_GET['count_invisible_courses']);
$students[$name] = statistics::count_users(5,$code,$_GET['count_invisible_courses']); $students[$name] = statistics::count_users(5,$code,$_GET['count_invisible_courses']);
@ -159,4 +132,3 @@ switch($_GET['action'])
} }
Display::display_footer(); Display::display_footer();
?>

@ -1,14 +1,11 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'); require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
/** /**
==============================================================================
* This class provides some functions for statistics * This class provides some functions for statistics
* @package dokeos.statistics * @package chamilo.statistics
==============================================================================
*/ */
class Statistics class Statistics {
{
/** /**
* Converts a number of bytes in a formatted string * Converts a number of bytes in a formatted string
* @param int $size * @param int $size
@ -26,8 +23,7 @@ class Statistics
* all courses. * all courses.
* @return int Number of courses counted * @return int Number of courses counted
*/ */
function count_courses($category_code = NULL) function count_courses($category_code = NULL) {
{
$course_table = Database :: get_main_table(TABLE_MAIN_COURSE); $course_table = Database :: get_main_table(TABLE_MAIN_COURSE);
$sql = "SELECT COUNT(*) AS number FROM ".$course_table." "; $sql = "SELECT COUNT(*) AS number FROM ".$course_table." ";
if (isset ($category_code)) { if (isset ($category_code)) {
@ -44,8 +40,7 @@ class Statistics
* all users. * all users.
* @return int Number of users counted * @return int Number of users counted
*/ */
function count_users($status, $category_code = NULL, $count_invisible_courses = true) function count_users($status, $category_code = NULL, $count_invisible_courses = true) {
{
// Database table definitions // Database table definitions
$course_user_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER); $course_user_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$course_table = Database :: get_main_table(TABLE_MAIN_COURSE); $course_table = Database :: get_main_table(TABLE_MAIN_COURSE);
@ -64,8 +59,7 @@ class Statistics
* Count activities from track_e_default_table * Count activities from track_e_default_table
* @return int Number of activities counted * @return int Number of activities counted
*/ */
function get_number_of_activities() function get_number_of_activities() {
{
// Database table definitions // Database table definitions
$track_e_default = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_DEFAULT); $track_e_default = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
$table_user = Database::get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
@ -83,8 +77,7 @@ class Statistics
/** /**
* Get activities data to display * Get activities data to display
*/ */
function get_activities_data($from, $number_of_items, $column, $direction) function get_activities_data($from, $number_of_items, $column, $direction) {
{
global $dateTimeFormatLong; global $dateTimeFormatLong;
$track_e_default = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_DEFAULT); $track_e_default = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
$table_user = Database::get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
@ -94,8 +87,8 @@ class Statistics
$from = intval($from); $from = intval($from);
$number_of_items = intval($number_of_items); $number_of_items = intval($number_of_items);
if(!in_array($direction, array('ASC','DESC'))){ if (!in_array($direction, array('ASC','DESC'))) {
$direction = 'DESC'; $direction = 'DESC';
} }
$sql = "SELECT $sql = "SELECT
@ -108,8 +101,8 @@ class Statistics
WHERE track_default.default_user_id = user.user_id "; WHERE track_default.default_user_id = user.user_id ";
if (isset($_GET['keyword'])) { if (isset($_GET['keyword'])) {
$keyword = Database::escape_string(trim($_GET['keyword'])); $keyword = Database::escape_string(trim($_GET['keyword']));
$sql .= " AND (user.username LIKE '%".$keyword."%' OR default_event_type LIKE '%".$keyword."%' OR default_value_type LIKE '%".$keyword."%' OR default_value LIKE '%".$keyword."%') "; $sql .= " AND (user.username LIKE '%".$keyword."%' OR default_event_type LIKE '%".$keyword."%' OR default_value_type LIKE '%".$keyword."%' OR default_value LIKE '%".$keyword."%') ";
} }
if (!empty($column) && !empty($direction)) { if (!empty($column) && !empty($direction)) {
@ -132,14 +125,12 @@ class Statistics
* Get all course categories * Get all course categories
* @return array All course categories (code => name) * @return array All course categories (code => name)
*/ */
function get_course_categories() function get_course_categories() {
{
$category_table = Database :: get_main_table(TABLE_MAIN_CATEGORY); $category_table = Database :: get_main_table(TABLE_MAIN_CATEGORY);
$sql = "SELECT code, name FROM $category_table ORDER BY tree_pos"; $sql = "SELECT code, name FROM $category_table ORDER BY tree_pos";
$res = Database::query($sql); $res = Database::query($sql);
$categories = array (); $categories = array ();
while ($category = Database::fetch_object($res)) while ($category = Database::fetch_object($res)) {
{
$categories[$category->code] = $category->name; $categories[$category->code] = $category->name;
} }
return $categories; return $categories;
@ -150,18 +141,15 @@ class Statistics
* @param int $max The maximum value in the rescaled data (default = 500); * @param int $max The maximum value in the rescaled data (default = 500);
* @return array The rescaled data, same key as $data * @return array The rescaled data, same key as $data
*/ */
function rescale($data, $max = 500) function rescale($data, $max = 500) {
{
$data_max = 1; $data_max = 1;
foreach ($data as $index => $value) foreach ($data as $index => $value) {
{
$data_max = ($data_max < $value ? $value : $data_max); $data_max = ($data_max < $value ? $value : $data_max);
} }
reset($data); reset($data);
$result = array (); $result = array ();
$delta = $max / $data_max; $delta = $max / $data_max;
foreach ($data as $index => $value) foreach ($data as $index => $value) {
{
$result[$index] = (int) round($value * $delta); $result[$index] = (int) round($value * $delta);
} }
return $result; return $result;
@ -173,30 +161,23 @@ class Statistics
* @param bool $show_total * @param bool $show_total
* @param bool $is_file_size * @param bool $is_file_size
*/ */
function print_stats($title, $stats, $show_total = true, $is_file_size = false) function print_stats($title, $stats, $show_total = true, $is_file_size = false) {
{
$total = 0; $total = 0;
$data = Statistics::rescale($stats); $data = Statistics::rescale($stats);
echo '<table class="data_table" cellspacing="0" cellpadding="3"> echo '<table class="data_table" cellspacing="0" cellpadding="3">
<tr><th colspan="'.($show_total ? '4' : '3').'">'.$title.'</th></tr>'; <tr><th colspan="'.($show_total ? '4' : '3').'">'.$title.'</th></tr>';
$i = 0; $i = 0;
foreach($stats as $subtitle => $number) foreach ($stats as $subtitle => $number) {
{
$total += $number; $total += $number;
} }
foreach ($stats as $subtitle => $number) foreach ($stats as $subtitle => $number) {
{ //$i = $i % 13;
$i = $i % 13; if (api_strlen($subtitle) > 30) {
if (api_strlen($subtitle) > 30)
{
$subtitle = '<acronym title="'.$subtitle.'">'.api_substr($subtitle, 0, 27).'...</acronym>'; $subtitle = '<acronym title="'.$subtitle.'">'.api_substr($subtitle, 0, 27).'...</acronym>';
} }
if(!$is_file_size) if (!$is_file_size) {
{
$number_label = number_format($number, 0, ',', '.'); $number_label = number_format($number, 0, ',', '.');
} } else {
else
{
$number_label = Statistics::make_size_string($number); $number_label = Statistics::make_size_string($number);
} }
echo '<tr class="row_'.($i%2 == 0 ? 'odd' : 'even').'"> echo '<tr class="row_'.($i%2 == 0 ? 'odd' : 'even').'">
@ -205,21 +186,16 @@ class Statistics
'.Display::return_icon('bar_1u.gif', get_lang('Statistics') ,array('width' => $data[$subtitle], 'height' => '10')).' '.Display::return_icon('bar_1u.gif', get_lang('Statistics') ,array('width' => $data[$subtitle], 'height' => '10')).'
</td> </td>
<td align="right">'.$number_label.'</td>'; <td align="right">'.$number_label.'</td>';
if($show_total) if ($show_total) {
{
echo '<td align="right"> '.($total>0?number_format(100*$number/$total, 1, ',', '.'):'0').'%</td>'; echo '<td align="right"> '.($total>0?number_format(100*$number/$total, 1, ',', '.'):'0').'%</td>';
} }
echo '</tr>'; echo '</tr>';
$i ++; $i ++;
} }
if ($show_total) if ($show_total) {
{ if (!$is_file_size) {
if(!$is_file_size)
{
$total_label = number_format($total, 0, ',', '.'); $total_label = number_format($total, 0, ',', '.');
} } else {
else
{
$total_label = Statistics::make_size_string($total); $total_label = Statistics::make_size_string($total);
} }
echo '<tr><th colspan="4" align="right">'.get_lang('Total').': '.$total_label.'</td></tr>'; echo '<tr><th colspan="4" align="right">'.get_lang('Total').': '.$total_label.'</td></tr>';
@ -230,11 +206,9 @@ class Statistics
* Show some stats about the number of logins * Show some stats about the number of logins
* @param string $type month, hour or day * @param string $type month, hour or day
*/ */
function print_login_stats($type) function print_login_stats($type) {
{
$table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);
switch($type) switch ($type) {
{
case 'month': case 'month':
$months = api_get_months_long(); $months = api_get_months_long();
$period = get_lang('PeriodMonth'); $period = get_lang('PeriodMonth');
@ -252,11 +226,9 @@ class Statistics
} }
$res = Database::query($sql); $res = Database::query($sql);
$result = array(); $result = array();
while($obj = Database::fetch_object($res)) while ($obj = Database::fetch_object($res)) {
{
$stat_date = $obj->stat_date; $stat_date = $obj->stat_date;
switch($type) switch ($type) {
{
case 'month': case 'month':
$stat_date = explode('-', $stat_date); $stat_date = explode('-', $stat_date);
$stat_date[1] = $months[$stat_date[1] - 1]; $stat_date[1] = $months[$stat_date[1] - 1];
@ -273,16 +245,14 @@ class Statistics
/** /**
* Print the number of recent logins * Print the number of recent logins
*/ */
function print_recent_login_stats() function print_recent_login_stats() {
{
$total_logins = array(); $total_logins = array();
$table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); $table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$sql[get_lang('Thisday')] = "SELECT count(login_user_id) AS number FROM $table WHERE DATE_ADD(login_date, INTERVAL 1 DAY) >= NOW()"; $sql[get_lang('Thisday')] = "SELECT count(login_user_id) AS number FROM $table WHERE DATE_ADD(login_date, INTERVAL 1 DAY) >= NOW()";
$sql[get_lang('Last7days')] = "SELECT count(login_user_id) AS number FROM $table WHERE DATE_ADD(login_date, INTERVAL 7 DAY) >= NOW()"; $sql[get_lang('Last7days')] = "SELECT count(login_user_id) AS number FROM $table WHERE DATE_ADD(login_date, INTERVAL 7 DAY) >= NOW()";
$sql[get_lang('Last31days')] = "SELECT count(login_user_id) AS number FROM $table WHERE DATE_ADD(login_date, INTERVAL 31 DAY) >= NOW()"; $sql[get_lang('Last31days')] = "SELECT count(login_user_id) AS number FROM $table WHERE DATE_ADD(login_date, INTERVAL 31 DAY) >= NOW()";
$sql[get_lang('Total')] = "SELECT count(login_user_id) AS number FROM $table"; $sql[get_lang('Total')] = "SELECT count(login_user_id) AS number FROM $table";
foreach($sql as $index => $query) foreach ($sql as $index => $query) {
{
$res = Database::query($query); $res = Database::query($query);
$obj = Database::fetch_object($res); $obj = Database::fetch_object($res);
$total_logins[$index] = $obj->number; $total_logins[$index] = $obj->number;
@ -292,19 +262,23 @@ class Statistics
/** /**
* Show some stats about the accesses to the different course tools * Show some stats about the accesses to the different course tools
*/ */
function print_tool_stats() function print_tool_stats() {
{
$table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS); $table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$tools = array('announcement','assignment','calendar_event','chat','conference','course_description','document','dropbox','group','learnpath','link','quiz','student_publication','user','forum'); $tools = array('announcement','assignment','calendar_event',
'chat','conference','course_description','document',
'dropbox','group','learnpath','link','quiz',
'student_publication','user','forum');
$tool_names = array(); $tool_names = array();
foreach ($tools as $tool) { foreach ($tools as $tool) {
$tool_names[$tool] = get_lang(ucfirst($tool), ''); $tool_names[$tool] = get_lang(ucfirst($tool), '');
} }
$sql = "SELECT access_tool, count( access_id ) AS number_of_logins FROM $table WHERE access_tool IN ('".implode("','",$tools)."') GROUP BY access_tool "; $sql = "SELECT access_tool, count( access_id )
AS number_of_logins FROM $table
WHERE access_tool IN ('".implode("','",$tools)."')
GROUP BY access_tool ";
$res = Database::query($sql); $res = Database::query($sql);
$result = array(); $result = array();
while($obj = Database::fetch_object($res)) while ($obj = Database::fetch_object($res)) {
{
$result[$tool_names[$obj->access_tool]] = $obj->number_of_logins; $result[$tool_names[$obj->access_tool]] = $obj->number_of_logins;
} }
Statistics::print_stats(get_lang('PlatformToolAccess'),$result,true); Statistics::print_stats(get_lang('PlatformToolAccess'),$result,true);
@ -312,14 +286,14 @@ class Statistics
/** /**
* Show some stats about the number of courses per language * Show some stats about the number of courses per language
*/ */
function print_course_by_language_stats() function print_course_by_language_stats() {
{
$table = Database::get_main_table(TABLE_MAIN_COURSE); $table = Database::get_main_table(TABLE_MAIN_COURSE);
$sql = "SELECT course_language, count( code ) AS number_of_courses FROM $table GROUP BY course_language "; $sql = "SELECT course_language, count( code )
AS number_of_courses
FROM $table GROUP BY course_language ";
$res = Database::query($sql); $res = Database::query($sql);
$result = array(); $result = array();
while($obj = Database::fetch_object($res)) while ($obj = Database::fetch_object($res)) {
{
$result[$obj->course_language] = $obj->number_of_courses; $result[$obj->course_language] = $obj->number_of_courses;
} }
Statistics::print_stats(get_lang('CountCourseByLanguage'),$result,true); Statistics::print_stats(get_lang('CountCourseByLanguage'),$result,true);
@ -327,16 +301,17 @@ class Statistics
/** /**
* Shows the number of users having their picture uploaded in Dokeos. * Shows the number of users having their picture uploaded in Dokeos.
*/ */
function print_user_pictures_stats() function print_user_pictures_stats() {
{
$user_table = Database :: get_main_table(TABLE_MAIN_USER); $user_table = Database :: get_main_table(TABLE_MAIN_USER);
$sql = "SELECT COUNT(*) AS n FROM $user_table"; $sql = "SELECT COUNT(*) AS n FROM $user_table";
$res = Database::query($sql); $res = Database::query($sql);
$count1 = Database::fetch_object($res); $count1 = Database::fetch_object($res);
$sql = "SELECT COUNT(*) AS n FROM $user_table WHERE LENGTH(picture_uri) > 0"; $sql = "SELECT COUNT(*) AS n FROM $user_table
WHERE LENGTH(picture_uri) > 0";
$res = Database::query($sql); $res = Database::query($sql);
$count2 = Database::fetch_object($res); $count2 = Database::fetch_object($res);
$result[get_lang('No')] = $count1->n - $count2->n; // #users without picture // #users without picture
$result[get_lang('No')] = $count1->n - $count2->n;
$result[get_lang('Yes')] = $count2->n; // #users with picture $result[get_lang('Yes')] = $count2->n; // #users with picture
Statistics::print_stats(get_lang('CountUsers').' ('.get_lang('UserPicture').')',$result,true); Statistics::print_stats(get_lang('CountUsers').' ('.get_lang('UserPicture').')',$result,true);
} }
@ -374,27 +349,25 @@ class Statistics
$table->set_header(3, get_lang('UserName')); $table->set_header(3, get_lang('UserName'));
$table->set_header(4, get_lang('Date')); $table->set_header(4, get_lang('Date'));
$table->display(); $table->display();
} }
/** /**
* Shows statistics about the time of last visit to each course. * Shows statistics about the time of last visit to each course.
*/ */
function print_course_last_visit() function print_course_last_visit() {
{
$columns[0] = 'access_cours_code'; $columns[0] = 'access_cours_code';
$columns[1] = 'access_date'; $columns[1] = 'access_date';
$sql_order[SORT_ASC] = 'ASC'; $sql_order[SORT_ASC] = 'ASC';
$sql_order[SORT_DESC] = 'DESC'; $sql_order[SORT_DESC] = 'DESC';
$per_page = isset($_GET['per_page']) ? intval($_GET['per_page']) : 10; $per_page = isset($_GET['per_page'])?intval($_GET['per_page']) : 10;
$page_nr = isset($_GET['page_nr']) ? intval($_GET['page_nr']) : 1; $page_nr = isset($_GET['page_nr'])?intval($_GET['page_nr']) : 1;
$column = isset($_GET['column']) ? intval($_GET['column']) : 0; $column = isset($_GET['column'])?intval($_GET['column']) : 0;
$date_diff = isset($_GET['date_diff'])? intval($_GET['date_diff']) : 60; $date_diff = isset($_GET['date_diff'])?intval($_GET['date_diff']) : 60;
if(!in_array($_GET['direction'],array(SORT_ASC,SORT_DESC))){ if (!in_array($_GET['direction'],array(SORT_ASC,SORT_DESC))) {
$direction = SORT_ASC; $direction = SORT_ASC;
} else { } else {
$direction = isset($_GET['direction']) ? $_GET['direction'] : SORT_ASC; $direction = isset($_GET['direction']) ? $_GET['direction'] : SORT_ASC;
} }
$form = new FormValidator('courselastvisit','get'); $form = new FormValidator('courselastvisit','get');
$form->addElement('hidden','action','courselastvisit'); $form->addElement('hidden','action','courselastvisit');
$form->add_textfield('date_diff',get_lang('Days'),true); $form->add_textfield('date_diff',get_lang('Days'),true);
@ -410,7 +383,10 @@ class Statistics
$values = $form->exportValues(); $values = $form->exportValues();
$date_diff = $values['date_diff']; $date_diff = $values['date_diff'];
$table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); $table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$sql = "SELECT * FROM $table GROUP BY access_cours_code HAVING access_cours_code <> '' AND DATEDIFF( NOW() , access_date ) <= ". $date_diff; $sql = "SELECT * FROM $table
GROUP BY access_cours_code
HAVING access_cours_code <> ''
AND DATEDIFF( NOW() , access_date ) <= ". $date_diff;
$res = Database::query($sql); $res = Database::query($sql);
$number_of_courses = Database::num_rows($res); $number_of_courses = Database::num_rows($res);
$sql .= ' ORDER BY '.$columns[$column].' '.$sql_order[$direction]; $sql .= ' ORDER BY '.$columns[$column].' '.$sql_order[$direction];
@ -418,11 +394,9 @@ class Statistics
$sql .= ' LIMIT '.$from.','.$per_page; $sql .= ' LIMIT '.$from.','.$per_page;
echo '<p>'.get_lang('LastAccess').' &gt;= '.$date_diff.' '.get_lang('Days').'</p>'; echo '<p>'.get_lang('LastAccess').' &gt;= '.$date_diff.' '.get_lang('Days').'</p>';
$res = Database::query($sql); $res = Database::query($sql);
if (Database::num_rows($res) > 0) if (Database::num_rows($res) > 0) {
{
$courses = array (); $courses = array ();
while ($obj = Database::fetch_object($res)) while ($obj = Database::fetch_object($res)) {
{
$course = array (); $course = array ();
$course[]= '<a href="'.api_get_path(WEB_PATH).'courses/'.$obj->access_cours_code.'">'.$obj->access_cours_code.' <a>'; $course[]= '<a href="'.api_get_path(WEB_PATH).'courses/'.$obj->access_cours_code.'">'.$obj->access_cours_code.' <a>';
$course[] = api_convert_and_format_date($obj->access_date, null, date_default_timezone_get()); $course[] = api_convert_and_format_date($obj->access_date, null, date_default_timezone_get());
@ -434,16 +408,14 @@ class Statistics
$table_header[] = array ("Coursecode", true); $table_header[] = array ("Coursecode", true);
$table_header[] = array ("Last login", true); $table_header[] = array ("Last login", true);
Display :: display_sortable_table($table_header, $courses, array ('column'=>$column,'direction'=>$direction), array (), $parameters); Display :: display_sortable_table($table_header, $courses, array ('column'=>$column,'direction'=>$direction), array (), $parameters);
} } else {
else
{
echo get_lang('NoSearchResults'); echo get_lang('NoSearchResults');
} }
} }
/** /**
* Displays the statistics of the messages sent and received by each user in the social network * Displays the statistics of the messages sent and received by each user in the social network
* @param string Type of message sent or received * @param string Type of message: 'sent' or 'received'
* @return array Message list * @return array Message list
*/ */
function get_messages($message_type) { function get_messages($message_type) {
@ -457,12 +429,17 @@ class Statistics
$field = 'user_receiver_id'; $field = 'user_receiver_id';
break; break;
} }
$sql = "SELECT lastname, firstname, username, COUNT($field) AS count_message $sql = "SELECT lastname, firstname, username,
FROM ".$message_table." m LEFT JOIN ".$user_table." u ON m.$field = u.user_id COUNT($field) AS count_message
GROUP BY m.$field"; FROM ".$message_table." m
LEFT JOIN ".$user_table." u ON m.$field = u.user_id
GROUP BY m.$field";
$res = Database::query($sql); $res = Database::query($sql);
$messages_sent = array(); $messages_sent = array();
while ($messages = Database::fetch_array($res)) { while ($messages = Database::fetch_array($res)) {
if (empty($messages['username'])) {
$messages['username'] = get_lang('Unknown');
}
$users = $messages['firstname'].' '.$messages['lastname'].' ('.$messages['username'].')'; $users = $messages['firstname'].' '.$messages['lastname'].' ('.$messages['username'].')';
$messages_sent[$users] = $messages['count_message']; $messages_sent[$users] = $messages['count_message'];
} }
@ -475,9 +452,12 @@ class Statistics
function get_friends() { function get_friends() {
$user_friend_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); $user_friend_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
$user_table = Database::get_main_table(TABLE_MAIN_USER); $user_table = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT lastname, firstname, username, COUNT(friend_user_id) AS count_friend $sql = "SELECT lastname, firstname, username,
FROM ".$user_friend_table." uf LEFT JOIN ".$user_table." u ON uf.user_id = u.user_id WHERE uf.relation_type <> '".USER_RELATION_TYPE_RRHH."' COUNT(friend_user_id) AS count_friend
GROUP BY uf.user_id"; FROM ".$user_friend_table." uf
LEFT JOIN ".$user_table." u ON uf.user_id = u.user_id
WHERE uf.relation_type <> '".USER_RELATION_TYPE_RRHH."'
GROUP BY uf.user_id";
$res = Database::query($sql); $res = Database::query($sql);
$list_friends = array(); $list_friends = array();
while ($friends = Database::fetch_array($res)) { while ($friends = Database::fetch_array($res)) {
@ -487,4 +467,3 @@ class Statistics
return $list_friends; return $list_friends;
} }
} }
?>

@ -760,10 +760,12 @@ function MM_jumpMenu(targ,selObj,restore){
*/ */
function get_course_users() function get_course_users()
{ {
global $tbl_user;
global $tbl_courseUser, $tbl_session_course_user;
global $_cid; global $_cid;
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_courseUser = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_session_course_user= Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
// not 100% if this is necessary, this however prevents a notice // not 100% if this is necessary, this however prevents a notice
if (!isset($courseadmin_filter)) if (!isset($courseadmin_filter))
{$courseadmin_filter='';} {$courseadmin_filter='';}
@ -1169,6 +1171,7 @@ function separate_users_groups($to)
function sent_to($tool, $id) function sent_to($tool, $id)
{ {
global $_course; global $_course;
$TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY); $TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$tool=Database::escape_string($tool); $tool=Database::escape_string($tool);
@ -2861,7 +2864,7 @@ function show_add_form($id = '')
<span class="form_required">*</span>'.get_lang('Description').' <span class="form_required">*</span>'.get_lang('Description').'
</div> </div>
<div class="formw">'; <div class="formw">';
require_once(api_get_path(LIBRARY_PATH) . "/fckeditor/fckeditor.php"); require_once api_get_path(LIBRARY_PATH) . "/fckeditor/fckeditor.php";
$oFCKeditor = new FCKeditor('content') ; $oFCKeditor = new FCKeditor('content') ;
@ -3512,11 +3515,13 @@ function get_day_agendaitems($courses_dbs, $month, $year, $day)
*/ */
function get_week_agendaitems($courses_dbs, $month, $year, $week = '') function get_week_agendaitems($courses_dbs, $month, $year, $week = '')
{ {
global $TABLEAGENDA, $TABLE_ITEMPROPERTY;
global $_user; global $_user;
global $_configuration; global $_configuration;
global $setting_agenda_link; global $setting_agenda_link;
$TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA);
$TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$items = array (); $items = array ();
// The default value of the week // The default value of the week
if ($week == '') if ($week == '')
@ -4656,7 +4661,7 @@ function agenda_add_repeat_item($course_info,$orig_id,$type,$end,$orig_dest,$fil
* @return boolean True on success, false otherwise * @return boolean True on success, false otherwise
*/ */
function agenda_import_ical($course_info,$file) { function agenda_import_ical($course_info,$file) {
require_once(api_get_path(LIBRARY_PATH).'fileUpload.lib.php'); require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
$charset = api_get_setting('platform_charset'); $charset = api_get_setting('platform_charset');
$filepath = api_get_path(SYS_ARCHIVE_PATH).$file['name']; $filepath = api_get_path(SYS_ARCHIVE_PATH).$file['name'];
if(!@move_uploaded_file($file['tmp_name'],$filepath)) if(!@move_uploaded_file($file['tmp_name'],$filepath))
@ -4664,7 +4669,7 @@ function agenda_import_ical($course_info,$file) {
error_log('Problem moving uploaded file: '.$file['error'].' in '.__FILE__.' line '.__LINE__); error_log('Problem moving uploaded file: '.$file['error'].' in '.__FILE__.' line '.__LINE__);
return false; return false;
} }
require_once (api_get_path(LIBRARY_PATH).'icalcreator/iCalcreator.class.php'); require_once api_get_path(LIBRARY_PATH).'icalcreator/iCalcreator.class.php';
$ical = new vcalendar(); $ical = new vcalendar();
$ical->setConfig( 'directory', dirname($filepath) ); $ical->setConfig( 'directory', dirname($filepath) );
$ical->setConfig( 'filename', basename($filepath) ); $ical->setConfig( 'filename', basename($filepath) );

@ -54,9 +54,9 @@ if ($action == 'thematic_list') {
} else if ($action == 'thematic_details') { } else if ($action == 'thematic_details') {
if ($last_id) { if ($last_id) {
$link_to_thematic_plan = '<a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$last_id.'">'.Display::return_icon('info.gif',get_lang('ThematicPlan')).'</a>'; $link_to_thematic_plan = '<a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$last_id.'">'.Display::return_icon('info.gif', get_lang('ThematicPlan'), array('style'=>'vertical-align:middle')).'</a>';
$link_to_thematic_advance = '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$last_id.'">'.Display::return_icon('porcent.png',get_lang('ThematicAdvance')).'</a>'; $link_to_thematic_advance = '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$last_id.'">'.Display::return_icon('porcent.png', get_lang('ThematicAdvance'), array('style'=>'vertical-align:middle')).'</a>';
Display::display_confirmation_message(get_lang('ThematicSectionHasBeenCreatedSuccessfull').'<br />'.sprintf(get_lang('NowYouShouldAddThematicPlanXAndThematicAdvanceX'),$link_to_thematic_plan, $link_to_thematic_advance)); Display::display_confirmation_message(get_lang('ThematicSectionHasBeenCreatedSuccessfull').'<br />'.sprintf(get_lang('NowYouShouldAddThematicPlanXAndThematicAdvanceX'),$link_to_thematic_plan, $link_to_thematic_advance), false);
} }
// display title // display title

@ -871,7 +871,8 @@ class CourseRestorer
$this->course->resources[RESOURCE_QUIZ][$id]->destination_id = $new_id; $this->course->resources[RESOURCE_QUIZ][$id]->destination_id = $new_id;
foreach ($quiz->question_ids as $index => $question_id) { foreach ($quiz->question_ids as $index => $question_id) {
$qid = $this->restore_quiz_question($question_id); $qid = $this->restore_quiz_question($question_id);
$sql = "INSERT IGNORE INTO ".$table_rel." SET question_id = ".$qid.", exercice_id = ".$new_id.", question_order = ".$quiz->question_orders[$index].""; $question_order = $quiz->question_orders[$index] ? $quiz->question_orders[$index] : 1;
$sql = "INSERT IGNORE INTO ".$table_rel." SET question_id = ".$qid.", exercice_id = ".$new_id.", question_order = ".$question_order;
Database::query($sql); Database::query($sql);
} }
} }

@ -36,6 +36,7 @@ class FillBlanks extends Question
{ {
parent::question(); parent::question();
$this -> type = FILL_IN_BLANKS; $this -> type = FILL_IN_BLANKS;
$this -> isContent = $this-> getIsContent();
} }
/** /**
@ -45,7 +46,7 @@ class FillBlanks extends Question
function createAnswersForm ($form) function createAnswersForm ($form)
{ {
$defaults = array(); $defaults = array();
if(!empty($this->id)) { if(!empty($this->id)) {
$objAnswer = new answer($this->id); $objAnswer = new answer($this->id);
@ -148,10 +149,14 @@ class FillBlanks extends Question
global $text, $class; global $text, $class;
// setting the save button here and not in the question class.php // setting the save button here and not in the question class.php
$form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"'); $form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
if (!empty($this -> id)) {
$form -> setDefaults($defaults); $form -> setDefaults($defaults);
} else {
if ($this -> isContent == 1) {
$form -> setDefaults($defaults);
}
}
} }

@ -41,6 +41,7 @@ class FreeAnswer extends Question {
function FreeAnswer(){ function FreeAnswer(){
parent::question(); parent::question();
$this -> type = FREE_ANSWER; $this -> type = FREE_ANSWER;
$this -> isContent = $this-> getIsContent();
} }
/** /**
@ -53,11 +54,12 @@ class FreeAnswer extends Question {
global $text, $class; global $text, $class;
// setting the save button here and not in the question class.php // setting the save button here and not in the question class.php
$form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"'); $form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
if (!empty($this->id)) {
if(!empty($this->id)) {
$form -> setDefaults(array('weighting' => float_format($this->weighting, 1))); $form -> setDefaults(array('weighting' => float_format($this->weighting, 1)));
} else { } else {
$form -> setDefaults(array('weighting' => '10')); if ($this -> isContent == 1) {
$form -> setDefaults(array('weighting' => '10'));
}
} }
} }

@ -34,6 +34,7 @@ class Matching extends Question {
function Matching(){ function Matching(){
parent::question(); parent::question();
$this -> type = MATCHING; $this -> type = MATCHING;
$this -> isContent = $this-> getIsContent();
} }
/** /**
@ -210,13 +211,18 @@ class Matching extends Question {
$group[] = FormValidator :: createElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"'); $group[] = FormValidator :: createElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
} }
$form -> addGroup($group); $form -> addGroup($group);
$form -> setDefaults($defaults);
if (!empty($this -> id)) {
$form -> setDefaults($defaults);
} else {
if ($this -> isContent == 1) {
$form -> setDefaults($defaults);
}
}
$form->setConstants(array('nb_matches' => $nb_matches,'nb_options' => $nb_options)); $form->setConstants(array('nb_matches' => $nb_matches,'nb_options' => $nb_options));
} }

@ -31,6 +31,7 @@ class MultipleAnswer extends Question {
function MultipleAnswer(){ function MultipleAnswer(){
parent::question(); parent::question();
$this -> type = MULTIPLE_ANSWER; $this -> type = MULTIPLE_ANSWER;
$this -> isContent = $this-> getIsContent();
} }
/** /**
@ -156,12 +157,18 @@ class MultipleAnswer extends Question {
$renderer->setElementTemplate('{element}&nbsp;','submitQuestion'); $renderer->setElementTemplate('{element}&nbsp;','submitQuestion');
$renderer->setElementTemplate('{element}','moreAnswers'); $renderer->setElementTemplate('{element}','moreAnswers');
$form -> addElement ('html', '</div></div>'); $form -> addElement ('html', '</div></div>');
$defaults['correct'] = $correct; $defaults['correct'] = $correct;
$form -> setDefaults($defaults);
if (!empty($this -> id)) {
$form -> setDefaults($defaults);
} else {
if ($this -> isContent == 1) {
$form -> setDefaults($defaults);
}
}
$form->setConstants(array('nb_answers' => $nb_answers)); $form->setConstants(array('nb_answers' => $nb_answers));
} }

@ -31,6 +31,7 @@ class MultipleAnswerCombination extends Question {
function MultipleAnswerCombination(){ function MultipleAnswerCombination(){
parent::question(); parent::question();
$this -> type = MULTIPLE_ANSWER_COMBINATION; $this -> type = MULTIPLE_ANSWER_COMBINATION;
$this -> isContent = $this-> getIsContent();
} }
/** /**
@ -39,7 +40,6 @@ class MultipleAnswerCombination extends Question {
* @param the answers number to display * @param the answers number to display
*/ */
function createAnswersForm ($form) { function createAnswersForm ($form) {
$nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 2; $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 2;
$nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0)); $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0));
$obj_ex = $_SESSION['objExercise']; $obj_ex = $_SESSION['objExercise'];
@ -162,12 +162,15 @@ class MultipleAnswerCombination extends Question {
$renderer->setElementTemplate('{element}&nbsp;','submitQuestion'); $renderer->setElementTemplate('{element}&nbsp;','submitQuestion');
$renderer->setElementTemplate('{element}','moreAnswers'); $renderer->setElementTemplate('{element}','moreAnswers');
$form -> addElement ('html', '</div></div>'); $form -> addElement ('html', '</div></div>');
$defaults['correct'] = $correct; $defaults['correct'] = $correct;
$form -> setDefaults($defaults); if (!empty($this->id)) {
$form -> setDefaults($defaults);
} else {
if ($this -> isContent == 1) {
$form -> setDefaults($defaults);
}
}
$form->setConstants(array('nb_answers' => $nb_answers)); $form->setConstants(array('nb_answers' => $nb_answers));
} }

@ -41,7 +41,8 @@ abstract class Question
var $level; var $level;
var $picture; var $picture;
var $exerciseList; // array with the list of exercises which this question is in var $exerciseList; // array with the list of exercises which this question is in
private $isContent;
static $typePicture = 'new_question.png'; static $typePicture = 'new_question.png';
static $explanationLangVar = ''; static $explanationLangVar = '';
static $questionTypes = array( static $questionTypes = array(
@ -69,6 +70,11 @@ abstract class Question
$this->level = 1; $this->level = 1;
$this->exerciseList=array(); $this->exerciseList=array();
} }
public function getIsContent() {
$isContent = intval($_REQUEST['isContent']);
return $this->isContent = $isContent;
}
/** /**
* Reads question informations from the data base * Reads question informations from the data base
@ -996,7 +1002,10 @@ abstract class Question
$renderer->setElementTemplate('<div class="row"><div class="label">{label}</div><div class="formw" >{element}</div></div>','questionName'); $renderer->setElementTemplate('<div class="row"><div class="label">{label}</div><div class="formw" >{element}</div></div>','questionName');
$renderer->setElementTemplate('<div class="row"><div class="label">{label}</div><div class="formw">{element}</div></div>','questionLevel'); $renderer->setElementTemplate('<div class="row"><div class="label">{label}</div><div class="formw">{element}</div></div>','questionLevel');
$form->addRule('questionName', get_lang('GiveQuestion'), 'required'); $form->addRule('questionName', get_lang('GiveQuestion'), 'required');
// default content
$isContent = intval($_REQUEST['isContent']);
// question type // question type
$answerType= intval($_REQUEST['answerType']); $answerType= intval($_REQUEST['answerType']);
$form->addElement('hidden','answerType',$_REQUEST['answerType']); $form->addElement('hidden','answerType',$_REQUEST['answerType']);
@ -1038,7 +1047,13 @@ abstract class Question
$defaults['questionName'] = $this -> question; $defaults['questionName'] = $this -> question;
$defaults['questionDescription'] = $this -> description; $defaults['questionDescription'] = $this -> description;
$defaults['questionLevel'] = $this -> level; $defaults['questionLevel'] = $this -> level;
$form -> setDefaults($defaults); if (!empty($_REQUEST['myid'])) {
$form -> setDefaults($defaults);
} else {
if ($isContent == 1) {
$form -> setDefaults($defaults);
}
}
} }
/** /**

@ -54,6 +54,9 @@ while ($row = Database :: fetch_array($result)) {
} }
$form->addElement('select', 'exercice', get_lang('Exercice'), $exercises); $form->addElement('select', 'exercice', get_lang('Exercice'), $exercises);
// generate default content
$form->addElement('checkbox', 'is_content', get_lang('DefaultContent'), null, array('checked' => true));
// the submit button // the submit button
$form->addElement('style_submit_button', 'SubmitCreateQuestion', get_lang('CreateQuestion'), 'class="add"'); $form->addElement('style_submit_button', 'SubmitCreateQuestion', get_lang('CreateQuestion'), 'class="add"');
@ -74,7 +77,7 @@ if ($form->validate()) {
$answer_type = $question_type_id; $answer_type = $question_type_id;
} }
} }
header('Location: admin.php?exerciseId='.$values['exercice'].'&newQuestion=yes&answerType='.$answer_type); header('Location: admin.php?exerciseId='.$values['exercice'].'&newQuestion=yes&isContent='.$values['is_content'].'&answerType='.$answer_type);
exit; exit;
} else { } else {
// header // header

@ -34,6 +34,7 @@ class UniqueAnswer extends Question {
//this is highly important //this is highly important
parent::question(); parent::question();
$this -> type = UNIQUE_ANSWER; $this -> type = UNIQUE_ANSWER;
$this -> isContent = $this-> getIsContent();
} }
/** /**
@ -44,7 +45,7 @@ class UniqueAnswer extends Question {
function createAnswersForm ($form) { function createAnswersForm ($form) {
// getting the exercise list // getting the exercise list
$obj_ex =$_SESSION['objExercise']; $obj_ex =$_SESSION['objExercise'];
$editor_config = array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '125'); $editor_config = array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '125');
//this line define how many question by default appear when creating a choice question //this line define how many question by default appear when creating a choice question
@ -266,10 +267,15 @@ class UniqueAnswer extends Question {
$correct=1; $correct=1;
} }
$defaults['correct'] = $correct; $defaults['correct'] = $correct;
$form -> setDefaults($defaults);
if (!empty($this -> id)) {
$form -> setDefaults($defaults);
} else {
if ($this -> isContent == 1) {
$form -> setDefaults($defaults);
}
}
$form->setConstants(array('nb_answers' => $nb_answers)); $form->setConstants(array('nb_answers' => $nb_answers));
} }

@ -1950,7 +1950,7 @@ function show_add_post_form($action='', $id='', $form_values='') {
$form->applyFilter('numeric_calification', 'html_filter'); $form->applyFilter('numeric_calification', 'html_filter');
$form->addElement('checkbox', 'thread_qualify_gradebook', '', get_lang('QualifyThreadGradebook'),'onclick="javascript:if(this.checked==true){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"'); $form->addElement('checkbox', 'thread_qualify_gradebook', '', get_lang('QualifyThreadGradebook'),'onclick="javascript:if(this.checked==true){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
$form -> addElement('html','<div id="options_field" style="display:none">'); $form -> addElement('html','<div id="options_field" style="display:none">');
$form->addElement('text', 'numeric_calification', get_lang('QualifyNumeric'),'Style="width:40px"'); $form->addElement('text', 'numeric_calification', get_lang('QualificationNumeric'),'Style="width:40px"');
$form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook')); $form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook'));
$form->applyFilter('calification_notebook_title', 'html_filter'); $form->applyFilter('calification_notebook_title', 'html_filter');
$form->addElement('text', 'weight_calification', get_lang('QualifyWeight'),'value="0.00" Style="width:40px" onfocus="this.select();"'); $form->addElement('text', 'weight_calification', get_lang('QualifyWeight'),'value="0.00" Style="width:40px" onfocus="this.select();"');
@ -2384,7 +2384,7 @@ function show_edit_post_form($current_post, $current_thread, $current_forum, $fo
} else { } else {
$form -> addElement('html','<div id="options_field" style="display:none">'); $form -> addElement('html','<div id="options_field" style="display:none">');
} }
$form->addElement('text', 'numeric_calification', get_lang('QualifyNumeric'),'value="'.$current_thread['thread_qualify_max'].'" Style="width:40px"'); $form->addElement('text', 'numeric_calification', get_lang('QualificationNumeric'),'value="'.$current_thread['thread_qualify_max'].'" Style="width:40px"');
$form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook'),'value="'.$current_thread['thread_title_qualify'].'"'); $form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook'),'value="'.$current_thread['thread_title_qualify'].'"');
$form->applyFilter('calification_notebook_title', 'html_filter'); $form->applyFilter('calification_notebook_title', 'html_filter');
$form->addElement('text', 'weight_calification', get_lang('QualifyWeight'),'value="'.$current_thread['thread_weight'].'" Style="width:40px"'); $form->addElement('text', 'weight_calification', get_lang('QualifyWeight'),'value="'.$current_thread['thread_weight'].'" Style="width:40px"');

@ -217,7 +217,7 @@ if ($export_result_form->validate()) {
$pdf->ezText(get_lang('Weight') . ' : ' . $eval[0]->get_weight(), 12, array ( $pdf->ezText(get_lang('Weight') . ' : ' . $eval[0]->get_weight(), 12, array (
'justification' => 'left' 'justification' => 'left'
)); ));
$pdf->ezText(get_lang('Max') . ' : ' . $eval[0]->get_max(), 12, array ( $pdf->ezText(get_lang('QualificationNumeric') . ' : ' . $eval[0]->get_max(), 12, array (
'justification' => 'left' 'justification' => 'left'
)); ));
$pdf->ezText($average, 12, array ( $pdf->ezText($average, 12, array (

@ -312,12 +312,12 @@ class EvalForm extends FormValidator
)); ));
if ($edit) { if ($edit) {
if (!$this->evaluation_object->has_results()) { if (!$this->evaluation_object->has_results()) {
$this->add_textfield('max', get_lang('Max'), true, array ( $this->add_textfield('max', get_lang('QualificationNumeric'), true, array (
'size' => '4', 'size' => '4',
'maxlength' => '4' 'maxlength' => '4'
)); ));
} else { } else {
$this->add_textfield('max', get_lang('Max'), false, array ( $this->add_textfield('max', get_lang('QualificationNumeric'), false, array (
'size' => '4', 'size' => '4',
'maxlength' => '4', 'maxlength' => '4',
'disabled' => 'disabled' 'disabled' => 'disabled'
@ -325,7 +325,7 @@ class EvalForm extends FormValidator
$this->addElement('static','label','','<small>'.get_lang('CannotChangeTheMaxNote').'</small>'); $this->addElement('static','label','','<small>'.get_lang('CannotChangeTheMaxNote').'</small>');
} }
} else { } else {
$this->add_textfield('max', get_lang('Max'), true, array ( $this->add_textfield('max', get_lang('QualificationNumeric'), true, array (
'size' => '4', 'size' => '4',
'maxlength' => '4' 'maxlength' => '4'
)); ));

@ -80,9 +80,9 @@ class LinkAddEditForm extends FormValidator
// ELEMENT: max // ELEMENT: max
if ($link->needs_max()) { if ($link->needs_max()) {
if ($form_type == self :: TYPE_EDIT && $link->has_results()) { if ($form_type == self :: TYPE_EDIT && $link->has_results()) {
$this->add_textfield('max', get_lang('Max'), false, array ('size' => '4','maxlength' => '4', 'disabled' => 'disabled')); $this->add_textfield('max', get_lang('QualificationNumeric'), false, array ('size' => '4','maxlength' => '4', 'disabled' => 'disabled'));
} else { } else {
$this->add_textfield('max', get_lang('Max'), true, array ('size' => '4','maxlength' => '4')); $this->add_textfield('max', get_lang('QualificationNumeric'), true, array ('size' => '4','maxlength' => '4'));
$this->addRule('max', get_lang('OnlyNumbers'), 'numeric'); $this->addRule('max', get_lang('OnlyNumbers'), 'numeric');
$this->addRule(array ('max', 'zero'), get_lang('NegativeValue'), 'compare', '>='); $this->addRule(array ('max', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
} }

@ -850,6 +850,7 @@ function update_Db_course($courseDbName, $language = null)
qualificator_id INT UNSIGNED NOT NULL DEFAULT 0, qualificator_id INT UNSIGNED NOT NULL DEFAULT 0,
weight float(6,2) UNSIGNED NOT NULL default 0, weight float(6,2) UNSIGNED NOT NULL default 0,
session_id INT UNSIGNED NOT NULL default 0, session_id INT UNSIGNED NOT NULL default 0,
user_id INTEGER NOT NULL,
PRIMARY KEY (id) PRIMARY KEY (id)
)" . $charset_clause; )" . $charset_clause;
Database::query($sql); Database::query($sql);
@ -2538,7 +2539,7 @@ function register_course($courseSysCode, $courseScreenCode, $courseRepository, $
user_id = '".Database::escape_string($uidCreator) . "', user_id = '".Database::escape_string($uidCreator) . "',
status = '1', status = '1',
role = '".lang2db(get_lang('Professor')) . "', role = '".lang2db(get_lang('Professor')) . "',
tutor_id='1', tutor_id='0',
sort='". ($i_course_sort) . "', sort='". ($i_course_sort) . "',
user_course_cat='0'"; user_course_cat='0'";
Database::query($sql); Database::query($sql);

@ -24,7 +24,7 @@ class CourseHome {
case 'Basic' : case 'Basic' :
$condition_display_tools = ' WHERE a.link=t.link AND t.position="basic" '; $condition_display_tools = ' WHERE a.link=t.link AND t.position="basic" ';
if (api_is_coach()) { if (api_is_coach() || api_is_course_tutor()) {
$condition_display_tools = ' WHERE a.link=t.link AND (t.position="basic" OR a.name = "'.TOOL_TRACKING.'") '; $condition_display_tools = ' WHERE a.link=t.link AND (t.position="basic" OR a.name = "'.TOOL_TRACKING.'") ';
} }
@ -137,7 +137,7 @@ class CourseHome {
$tool['img'] = api_get_path(WEB_IMG_PATH).$tool['img']; $tool['img'] = api_get_path(WEB_IMG_PATH).$tool['img'];
// VISIBLE // VISIBLE
if (($tool['visibility'] || (api_is_coach() && $tool['name'] == TOOL_TRACKING)) || $cat == 'courseAdmin' || $cat == 'platformAdmin') { if (($tool['visibility'] || ((api_is_coach() || api_is_course_tutor()) && $tool['name'] == TOOL_TRACKING)) || $cat == 'courseAdmin' || $cat == 'platformAdmin') {
if (strpos($tool['name'], 'visio_') !== false) { if (strpos($tool['name'], 'visio_') !== false) {
$cell_content .= '<a href="javascript: void(0);" onclick="javascript: window.open(\'' . $tool['link'].$link_annex . '\',\'window_visio'.$_SESSION['_cid'].'\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $tool['target'] . '"><img src="'.$tool['img'].'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'.$tool_name.'</a>'; $cell_content .= '<a href="javascript: void(0);" onclick="javascript: window.open(\'' . $tool['link'].$link_annex . '\',\'window_visio'.$_SESSION['_cid'].'\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $tool['target'] . '"><img src="'.$tool['img'].'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'.$tool_name.'</a>';
} elseif (strpos($tool['name'], 'chat') !== false && api_get_course_setting('allow_open_chat_window')) { } elseif (strpos($tool['name'], 'chat') !== false && api_get_course_setting('allow_open_chat_window')) {
@ -224,7 +224,7 @@ class CourseHome {
case TOOL_PUBLIC: case TOOL_PUBLIC:
$condition_display_tools = ' WHERE visibility = 1 '; $condition_display_tools = ' WHERE visibility = 1 ';
if (api_is_coach()) { if (api_is_coach() || api_is_course_tutor()) {
$condition_display_tools = ' WHERE visibility = 1 OR (visibility = 0 AND name = "'.TOOL_TRACKING.'") '; $condition_display_tools = ' WHERE visibility = 1 OR (visibility = 0 AND name = "'.TOOL_TRACKING.'") ';
} }
@ -438,7 +438,7 @@ class CourseHome {
switch ($course_tool_category) { switch ($course_tool_category) {
case TOOL_STUDENT_VIEW: case TOOL_STUDENT_VIEW:
$condition_display_tools = ' WHERE visibility = 1 AND (category = "authoring" OR category = "interaction") '; $condition_display_tools = ' WHERE visibility = 1 AND (category = "authoring" OR category = "interaction") ';
if (api_is_coach()) { if (api_is_coach() || api_is_course_tutor()) {
$condition_display_tools = ' WHERE (visibility = 1 AND (category = "authoring" OR category = "interaction") OR (name = "'.TOOL_TRACKING.'") ) '; $condition_display_tools = ' WHERE (visibility = 1 AND (category = "authoring" OR category = "interaction") OR (name = "'.TOOL_TRACKING.'") ) ';
} }
$sql = "SELECT * FROM $course_tool_table $condition_display_tools $condition_session ORDER BY id"; $sql = "SELECT * FROM $course_tool_table $condition_display_tools $condition_session ORDER BY id";

@ -3000,7 +3000,7 @@ class UserManager
* @param string The course id * @param string The course id
* @return int The user id * @return int The user id
*/ */
function get_user_id_of_course_admin_or_session_admin ($course_id) { public function get_user_id_of_course_admin_or_session_admin ($course_id) {
$session=api_get_session_id(); $session=api_get_session_id();
$table_user = Database::get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); $table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
@ -3036,7 +3036,7 @@ class UserManager
* @param int The user id * @param int The user id
* @return boolean * @return boolean
*/ */
function is_user_certified($cat_id,$user_id) { public function is_user_certified($cat_id,$user_id) {
$table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
$sql='SELECT path_certificate FROM '.$table_certificate.' WHERE cat_id="'.Database::escape_string($cat_id).'" AND user_id="'.Database::escape_string($user_id).'" '; $sql='SELECT path_certificate FROM '.$table_certificate.' WHERE cat_id="'.Database::escape_string($cat_id).'" AND user_id="'.Database::escape_string($user_id).'" ';
$rs=Database::query($sql,__FILE__,__LINE__); $rs=Database::query($sql,__FILE__,__LINE__);
@ -3054,7 +3054,7 @@ class UserManager
* @param int The user id * @param int The user id
* @return array if there is not information return false * @return array if there is not information return false
*/ */
function get_info_gradebook_certificate($course_code,$user_id) { public function get_info_gradebook_certificate($course_code,$user_id) {
$tbl_grade_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); $tbl_grade_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
$tbl_grade_category = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); $tbl_grade_category = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql='SELECT * FROM '.$tbl_grade_certificate.' WHERE cat_id= (SELECT id FROM '.$tbl_grade_category.' WHERE course_code = "'.Database::escape_string($course_code).'" ) AND user_id="'.Database::escape_string($user_id).'" '; $sql='SELECT * FROM '.$tbl_grade_certificate.' WHERE cat_id= (SELECT id FROM '.$tbl_grade_category.' WHERE course_code = "'.Database::escape_string($course_code).'" ) AND user_id="'.Database::escape_string($user_id).'" ';
@ -3071,7 +3071,7 @@ class UserManager
* @param int The user id * @param int The user id
* @return array containing path_certificate and cat_id * @return array containing path_certificate and cat_id
*/ */
function get_user_path_certificate($user_id) { public function get_user_path_certificate($user_id) {
$my_certificate = array(); $my_certificate = array();
$table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
$table_gradebook_category = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); $table_gradebook_category = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
@ -3096,4 +3096,33 @@ class UserManager
} }
/**
* This function check if the user is a coach inside session course
* @param int User id
* @param string Course code
* @param int Session id
* @return bool True if the user is a coach
*
*/
public function is_session_course_coach($user_id, $course_code, $session_id) {
$tbl_session_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
// protect data
$user_id = intval($user_id);
$course_code = Database::escape_string($course_code);
$session_id = intval($session_id);
$result = false;
$sql = "SELECT id_session FROM $tbl_session_course_rel_user WHERE id_session=$session_id AND course_code='$course_code' AND id_user = $user_id AND status=2 ";
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
$result = true;
}
return $result;
}
} }

@ -19,7 +19,6 @@ ALTER TABLE session_rel_user ADD COLUMN relation_type int NOT NULL default 0;
ALTER TABLE course_rel_user ADD COLUMN relation_type int NOT NULL default 0; ALTER TABLE course_rel_user ADD COLUMN relation_type int NOT NULL default 0;
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url, access_url_changeable) VALUES ('course_create_active_tools','notebook','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Notebook',1,0); INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url, access_url_changeable) VALUES ('course_create_active_tools','notebook','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Notebook',1,0);
INSERT INTO course_module (name, link, image, `row`, `column`, position) VALUES ('notebook','notebook/index.php','notebook.gif',2,1,'basic');
ALTER TABLE course DROP PRIMARY KEY , ADD UNIQUE KEY code (code); ALTER TABLE course DROP PRIMARY KEY , ADD UNIQUE KEY code (code);
ALTER TABLE course ADD id int NOT NULL auto_increment PRIMARY KEY FIRST; ALTER TABLE course ADD id int NOT NULL auto_increment PRIMARY KEY FIRST;
CREATE TABLE block (id INT NOT NULL auto_increment, name VARCHAR(255) NULL, description TEXT NULL, path VARCHAR(255) NOT NULL, controller VARCHAR(100) NOT NULL, active TINYINT NOT NULL default 1, PRIMARY KEY(id)); CREATE TABLE block (id INT NOT NULL auto_increment, name VARCHAR(255) NULL, description TEXT NULL, path VARCHAR(255) NOT NULL, controller VARCHAR(100) NOT NULL, active TINYINT NOT NULL default 1, PRIMARY KEY(id));
@ -124,11 +123,12 @@ INSERT INTO course_setting (variable,value,category) VALUES ('allow_user_view_us
ALTER TABLE tool_intro ADD COLUMN session_id INT NOT NULL DEFAULT 0 AFTER intro_text, DROP PRIMARY KEY, ADD PRIMARY KEY USING BTREE(id, session_id); ALTER TABLE tool_intro ADD COLUMN session_id INT NOT NULL DEFAULT 0 AFTER intro_text, DROP PRIMARY KEY, ADD PRIMARY KEY USING BTREE(id, session_id);
CREATE TABLE thematic (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, title VARCHAR( 255 ) NOT NULL, content TEXT NULL, display_order int unsigned not null default 0, active TINYINT NOT NULL default 0, session_id INT NOT NULL DEFAULT 0); CREATE TABLE thematic (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, title VARCHAR( 255 ) NOT NULL, content TEXT NULL, display_order int unsigned not null default 0, active TINYINT NOT NULL default 0, session_id INT NOT NULL DEFAULT 0);
ALTER TABLE thematic ADD INDEX (active, session_id); ALTER TABLE thematic ADD INDEX (active, session_id);
CREATE TABLE thematic_plan (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, thematic_id INT NOT NULL, title VARCHAR(255) NOT NULL, description TEXT NULL, description_type` INT NOT NULL); CREATE TABLE thematic_plan (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, thematic_id INT NOT NULL, title VARCHAR(255) NOT NULL, description TEXT NULL, description_type INT NOT NULL);
ALTER TABLE thematic_plan ADD INDEX (thematic_id, description_type); ALTER TABLE thematic_plan ADD INDEX (thematic_id, description_type);
CREATE TABLE thematic_advance (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, thematic_id INT NOT NULL, attendance_id INT NOT NULL DEFAULT 0, content TEXT NOT NULL, start_date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', duration INT NOT NULL DEFAULT 0, done_advance tinyint NOT NULL DEFAULT 0); CREATE TABLE thematic_advance (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, thematic_id INT NOT NULL, attendance_id INT NOT NULL DEFAULT 0, content TEXT NOT NULL, start_date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', duration INT NOT NULL DEFAULT 0, done_advance tinyint NOT NULL DEFAULT 0);
ALTER TABLE thematic_advance ADD INDEX (thematic_id); ALTER TABLE thematic_advance ADD INDEX (thematic_id);
INSERT INTO course_setting (variable,value,category) VALUES ('display_info_advance_inside_homecourse',1,'thematic_advance'); INSERT INTO course_setting (variable,value,category) VALUES ('display_info_advance_inside_homecourse',1,'thematic_advance');
INSERT INTO tool(name, link, image, visibility, admin, address, added_tool, target, category) VALUES ('course_progress','course_progress/index.php','course_progress.gif',0,'0','squaregrey.gif',0,'_self','authoring'); INSERT INTO tool(name, link, image, visibility, admin, address, added_tool, target, category) VALUES ('course_progress','course_progress/index.php','course_progress.gif',0,'0','squaregrey.gif',0,'_self','authoring');
ALTER TABLE lp ADD prerequisite int unsigned NOT NULL DEFAULT 0; ALTER TABLE lp ADD prerequisite int unsigned NOT NULL DEFAULT 0;
ALTER TABLE student_publication MODIFY COLUMN description TEXT DEFAULT NULL; ALTER TABLE student_publication MODIFY COLUMN description TEXT DEFAULT NULL;
ALTER TABLE student_publication ADD COLUMN user_id INTEGER NOT NULL AFTER session_id;

@ -347,8 +347,31 @@ if (defined('SYSTEM_INSTALLATION')) {
error_log('Error in '.$query.': '.Database::error()); error_log('Error in '.$query.': '.Database::error());
} }
} }
$t_student_publication = $row_course['db_name'].".student_publication";
//updating parent_id of the student_publication table $t_item_property = $row_course['db_name'].".item_property";
if ($singleDbForm) {
$t_student_publication = "$prefix{$row_course['db_name']}_student_publication";
$t_item_property = "$prefix{$row_course['db_name']}_item_property";
}
$sql_insert_user = "SELECT ref, insert_user_id FROM $t_item_property WHERE tool='work'";
$rs_insert_user = Database::query($sql_insert_user);
if ($rs_insert_user === false) {
error_log('Could not query insert_user_id table: '.Database::error());
} else {
if (Database::num_rows($rs_insert_user) > 0) {
while ($row_ids = Database::fetch_array($rs_insert_user)) {
$user_id = $row_ids['insert_user_id'];
$ref = $row_ids['ref'];
$sql_upd = "UPDATE $t_student_publication SET user_id='$user_id' WHERE id='$ref'";
Database::query($sql_upd);
}
}
}
//updating parent_id of the student_publication table
$sql = 'SELECT id, url, parent_id FROM '.$row_course['db_name'].'.student_publication '; $sql = 'SELECT id, url, parent_id FROM '.$row_course['db_name'].'.student_publication ';
$result = Database::query($sql); $result = Database::query($sql);
if (Database::num_rows($result) > 0) { if (Database::num_rows($result) > 0) {
@ -387,10 +410,17 @@ if (defined('SYSTEM_INSTALLATION')) {
} }
} }
} }
}
}
}
}
}
}
} }
} else { } else {
echo 'You are not allowed here !'; echo 'You are not allowed here !';

@ -215,4 +215,7 @@ $HelpDefaultDirDocuments = "Тази директория е създадена
$HelpSharedFolder = "Тази директория съдържа файлове, които са създадени от курсистите при използване на текстовия редактор (това не важи за групи). По подразбиране вложените папки и файлове са видими за всеки инструктор, но са скрити за курсистите. Ако направите някоя от папките на курсистите видима, то останалите курсисти ще могат да видят нейното съдържание."; $HelpSharedFolder = "Тази директория съдържа файлове, които са създадени от курсистите при използване на текстовия редактор (това не важи за групи). По подразбиране вложените папки и файлове са видими за всеки инструктор, но са скрити за курсистите. Ако направите някоя от папките на курсистите видима, то останалите курсисти ще могат да видят нейното съдържание.";
$TemplateImage = "Изображение на шаблона"; $TemplateImage = "Изображение на шаблона";
$MoveElement = "Преместване"; $MoveElement = "Преместване";
$CertificateName = "Име на сертификата";
$CreateCertificate = "Създаване на сертификат";
$CertificateOverview = "списъка със сертификатите";
?> ?>

@ -364,4 +364,6 @@ $XResultsCleaned = "%d резултата са изтрити.";
$CopyExercise = "Копиране на теста в нов"; $CopyExercise = "Копиране на теста в нов";
$CleanStudentResults = "Изтриване на всички резултати на курсистите за теста"; $CleanStudentResults = "Изтриване на всички резултати на курсистите за теста";
$ImportQtiQuiz = "Qti2 импорт на тестове."; $ImportQtiQuiz = "Qti2 импорт на тестове.";
$Copy = "Копиране";
$DefaultContent = "Създаване на примерно съдържание";
?> ?>

@ -135,8 +135,8 @@ $GradebookPreviousWeight = "Предишно тегро на ресурса";
$FolderView = "Начална страница на оценяванията"; $FolderView = "Начална страница на оценяванията";
$GradebookSkillsRanking = "Оценка на уменията"; $GradebookSkillsRanking = "Оценка на уменията";
$SaveScoringRules = "Записване на правилата за оценяване"; $SaveScoringRules = "Записване на правилата за оценяване";
$AttachCertificate = "Прилагане на сертификат"; $AttachCertificate = "Задаване на сертификат";
$GradebookSeeListOfStudentsCertificates = "Списък на сертификатите на курсистите"; $GradebookSeeListOfStudentsCertificates = "Сертификати на курсистите";
$CreateCertificate = "Създаване на сертификат"; $CreateCertificate = "Създаване на сертификат";
$UploadCertificate = "Качване на сертификат"; $UploadCertificate = "Качване на сертификат";
$CertificateName = "Име на сертификата"; $CertificateName = "Име на сертификата";
@ -158,7 +158,7 @@ $IsDefaultCertificate = "Сертификатът е зададен по под
$ImportPresences = "Импортиране на присъствия"; $ImportPresences = "Импортиране на присъствия";
$AddPresences = "Добавяне на присъствия"; $AddPresences = "Добавяне на присъствия";
$DeletePresences = "Изтриване на присъствия"; $DeletePresences = "Изтриване на присъствия";
$GradebookListOfStudentsCertificates = "Списък на сертификатите"; $GradebookListOfStudentsCertificates = "Сертификати на курсистите";
$NewPresence = "Ново присъствие"; $NewPresence = "Ново присъствие";
$EditPresence = "Редактиране на присъствие"; $EditPresence = "Редактиране на присъствие";
$SavedEditPresence = "Записване на присъствието"; $SavedEditPresence = "Записване на присъствието";

@ -246,4 +246,5 @@ $SaveAudioAndOrganization = "Запис на аудиофайловете и т
$UploadOnlyMp3Files = "Моля, качвайте само mp3 файлове."; $UploadOnlyMp3Files = "Моля, качвайте само mp3 файлове.";
$ModifyHotPotatoes = "Промяна на HotPotatoes"; $ModifyHotPotatoes = "Промяна на HotPotatoes";
$SaveHotpotatoes = "Запис на HotPotatoes"; $SaveHotpotatoes = "Запис на HotPotatoes";
$ReturnToLPList = "Изход";
?> ?>

@ -1213,4 +1213,5 @@ $TheSubLanguageForThisLanguageHasBeenAdded = "The sub-language of this language
$ReturnToLanguagesList = "Return to the languages list"; $ReturnToLanguagesList = "Return to the languages list";
$ActivityCoach = "The coach of the session, shall have all rights and privileges on all the courses that belong to the session."; $ActivityCoach = "The coach of the session, shall have all rights and privileges on all the courses that belong to the session.";
$CategoriesNumber = "Categories"; $CategoriesNumber = "Categories";
$CourseProgress = "Course progress";
?> ?>

@ -364,4 +364,5 @@ $XResultsCleaned = "%d results cleaned";
$CopyExercise = "Copy this exercise as a new one"; $CopyExercise = "Copy this exercise as a new one";
$CleanStudentResults = "Clear all students results for this exercise"; $CleanStudentResults = "Clear all students results for this exercise";
$ImportQtiQuiz = "Import exercises Qti2"; $ImportQtiQuiz = "Import exercises Qti2";
$DefaultContent = "Generate default content";
?> ?>

@ -94,7 +94,7 @@ $dateFormatShort = "%b %d, %y";
$dateFormatLong = "%A %B %d, %Y"; $dateFormatLong = "%A %B %d, %Y";
$dateTimeFormatLong = "%B %d, %Y at %I:%M %p"; $dateTimeFormatLong = "%B %d, %Y at %I:%M %p";
$timeNoSecFormat = "%I:%M %p"; $timeNoSecFormat = "%I:%M %p";
$langYes = "yes"; $langYes = "Yes";
$langNo = "No"; $langNo = "No";
$Next = "Next"; $Next = "Next";
$langAllowed = "Allowed"; $langAllowed = "Allowed";
@ -859,4 +859,5 @@ $NewThematicAdvance = "New thematic advance";
$ResultsHiddenByExerciseSetting = "Results hidden by the exercise setting"; $ResultsHiddenByExerciseSetting = "Results hidden by the exercise setting";
$ThematicSectionHasBeenCreatedSuccessfull = "Thematic section has been created success full"; $ThematicSectionHasBeenCreatedSuccessfull = "Thematic section has been created success full";
$NowYouShouldAddThematicPlanXAndThematicAdvanceX = "Now you should add thematic plan %s and thematic advance %s"; $NowYouShouldAddThematicPlanXAndThematicAdvanceX = "Now you should add thematic plan %s and thematic advance %s";
$QualificationNumeric = "Numeric score under";
?> ?>

@ -1213,4 +1213,7 @@ $TheSubLanguageForThisLanguageHasBeenAdded = "El sub-lenguaje de este idioma ha
$ReturnToLanguagesList = "Volver a la lista de idiomas"; $ReturnToLanguagesList = "Volver a la lista de idiomas";
$ActivityCoach = "El tutor de la sesion, tendrá todos los derechos y permisos en todos los cursos que pertenecen a la sesion."; $ActivityCoach = "El tutor de la sesion, tendrá todos los derechos y permisos en todos los cursos que pertenecen a la sesion.";
$CategoriesNumber = "Categorías"; $CategoriesNumber = "Categorías";
$ExportAllCoursesList = "Exportar toda la lista de cursos";
$ExportSelectedCoursesFromCoursesList = "Exportar solo algunos cursos de la lista";
$WhichCoursesToExport = "Seleccione los cursos que desea exportar";
?> ?>

@ -215,4 +215,5 @@ $HelpDefaultDirDocuments = "Este directorio contiene los archivos suministrados
$HelpSharedFolder = "Este directorio contiene los archivos que los estudiantes (y Ud.) envían a un curso a través del editor si no lo hacen desde la herramienta grupos. Por defecto serán visibles por cualquier profesor, pero estarán ocultos para otros estudiantes salvo que accedan a ellos mediante un acceso directo. Si hace visible el directorio de un estudiante otros estudiantes podrán ver todo lo que contenga."; $HelpSharedFolder = "Este directorio contiene los archivos que los estudiantes (y Ud.) envían a un curso a través del editor si no lo hacen desde la herramienta grupos. Por defecto serán visibles por cualquier profesor, pero estarán ocultos para otros estudiantes salvo que accedan a ellos mediante un acceso directo. Si hace visible el directorio de un estudiante otros estudiantes podrán ver todo lo que contenga.";
$TemplateImage = "Imagen de la plantilla"; $TemplateImage = "Imagen de la plantilla";
$MoveElement = "Mover elemento"; $MoveElement = "Mover elemento";
$CertificateName = "Nombre del certificado";
?> ?>

@ -366,4 +366,5 @@ $CleanStudentResults = "Borrar todos los resultados de los estudiantes en este e
$ImportQtiQuiz = "Importar ejercicios de Qti2"; $ImportQtiQuiz = "Importar ejercicios de Qti2";
$ReUseACopyInCurrentTest = "Reutilizar una copia de esta pregunta en el ejercicio actual"; $ReUseACopyInCurrentTest = "Reutilizar una copia de esta pregunta en el ejercicio actual";
$Copy = "Copia"; $Copy = "Copia";
$DefaultContent = "Generar contenido por defecto";
?> ?>

@ -887,4 +887,5 @@ $SelectAnAttendance = "Seleccionar hoja de asistencia";
$ResultsHiddenByExerciseSetting = "Resultados ocultos por la configuración del ejercicio"; $ResultsHiddenByExerciseSetting = "Resultados ocultos por la configuración del ejercicio";
$ThematicSectionHasBeenCreatedSuccessfull = "Sección temática ha sido creado con éxito"; $ThematicSectionHasBeenCreatedSuccessfull = "Sección temática ha sido creado con éxito";
$NowYouShouldAddThematicPlanXAndThematicAdvanceX = "Ahora debes añadir plan temático %s y avance temático %s"; $NowYouShouldAddThematicPlanXAndThematicAdvanceX = "Ahora debes añadir plan temático %s y avance temático %s";
$QualificationNumeric = "Calificación numérica sobre";
?> ?>

@ -41,7 +41,7 @@ if (isset($_GET['course'])) {
$user_infos = UserManager :: get_user_info_by_id($user_id); $user_infos = UserManager :: get_user_info_by_id($user_id);
$name = api_get_person_name($user_infos['firstname'], $user_infos['lastname']); $name = api_get_person_name($user_infos['firstname'], $user_infos['lastname']);
if (!api_is_platform_admin(true) && !CourseManager :: is_course_teacher($_user['user_id'], $cidReq) && !Tracking :: is_allowed_to_coach_student($_user['user_id'],$_GET['student_id']) && !api_is_drh()) { if (!api_is_platform_admin(true) && !CourseManager :: is_course_teacher($_user['user_id'], $cidReq) && !Tracking :: is_allowed_to_coach_student($_user['user_id'],$_GET['student_id']) && !api_is_drh() && !api_is_course_tutor()) {
Display::display_header(''); Display::display_header('');
api_not_allowed(); api_not_allowed();
Display::display_footer(); Display::display_footer();

@ -158,7 +158,7 @@ if (isset ($_GET['details'])) {
api_block_anonymous_users(); api_block_anonymous_users();
if (!api_is_allowed_to_edit() && !api_is_coach() && !api_is_drh() && $_user['status'] != SESSIONADMIN && !api_is_platform_admin(true)) { if (!api_is_allowed_to_edit() && !api_is_coach() && !api_is_drh() && !api_is_course_tutor() && $_user['status'] != SESSIONADMIN && !api_is_platform_admin(true)) {
api_not_allowed(true); api_not_allowed(true);
} }

@ -34,7 +34,7 @@ if (isset($_GET['from']) && $_GET['from'] == 'myspace') {
} }
// access restrictions // access restrictions
$is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || $is_courseCoach || $is_sessionAdmin || api_is_drh(); $is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || $is_courseCoach || $is_sessionAdmin || api_is_drh() || api_is_course_tutor();
if (!$is_allowedToTrack && !api_is_session_admin()) { if (!$is_allowedToTrack && !api_is_session_admin()) {
Display :: display_header(null); Display :: display_header(null);

@ -23,6 +23,7 @@ $language_file = array ('registration', 'userInfo');
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'; require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php'; require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
$htmlHeadXtra[] = '<script type="text/javascript"> $htmlHeadXtra[] = '<script type="text/javascript">
@ -65,7 +66,7 @@ else
} }
$currentCourse = $currentCourseID; $currentCourse = $currentCourseID;
$current_session_id = api_get_session_id();
// api_display_tool_title(get_lang("Users")); // api_display_tool_title(get_lang("Users"));
/* /*
@ -208,23 +209,29 @@ if ($allowedToEditDef)
//get information about one user - task #3009 //get information about one user - task #3009
if(!empty($_POST['promoteCourseAdmin']) && $_POST['promoteCourseAdmin']){
$userProperties['status'] = 1;
}else{
$userProperties['status'] = 5;
}
if(!empty($_POST['promoteTutor']) && $_POST['promoteTutor']){
$userProperties['tutor'] = 1;
}else{
$userProperties['tutor'] = 0;
}
$userProperties['role'] = $_POST['role']; if ($current_session_id) {
update_user_course_properties($userIdViewed, $courseCode, $userProperties); $nocoach = isset($_POST['promoteTutor'])?false:true;
$res = SessionManager::set_coach_to_course_session($userIdViewed, $current_session_id, $courseCode, $nocoach);
$displayMode = "viewContentList"; } else {
if (!empty($_POST['promoteCourseAdmin']) && $_POST['promoteCourseAdmin']){
$userProperties['status'] = 1;
} else{
$userProperties['status'] = 5;
}
if (!empty($_POST['promoteTutor']) && $_POST['promoteTutor']){
$userProperties['tutor'] = 1;
} else{
$userProperties['tutor'] = 0;
}
$userProperties['role'] = $_POST['role'];
update_user_course_properties($userIdViewed, $courseCode, $userProperties);
}
$displayMode = "viewContentList";
} }
} }
@ -275,7 +282,9 @@ if (api_is_allowed_to_edit()) {
} }
} }
// get information about user id viewed
$user_info_viewed = api_get_user_info($userIdViewed);
$is_session_course_coach = UserManager::is_session_course_coach($userIdViewed, $_course['sysCode'], $current_session_id);
if ($displayMode == "viewDefEdit") if ($displayMode == "viewDefEdit")
{ {
@ -369,9 +378,14 @@ elseif ($displayMode == "viewMainInfoEdit")
if ($mainUserInfo) if ($mainUserInfo)
{ {
($mainUserInfo['status'] == 1) ? $courseAdminChecked = "checked" : $courseAdminChecked = ""; ($mainUserInfo['status'] == COURSEMANAGER) ? $courseAdminChecked = "checked" : $courseAdminChecked = "";
($mainUserInfo['tutor_id'] == 1) ? $tutorChecked = "checked" : $tutorChecked = "";
if ($current_session_id) {
($is_session_course_coach)? $tutorChecked = "checked" : $tutorChecked = "";
} else {
($mainUserInfo['tutor_id'] == 1) ? $tutorChecked = "checked" : $tutorChecked = "";
}
$image_array=UserManager::get_user_picture_path_by_id($userIdViewed,'web',false,true); $image_array=UserManager::get_user_picture_path_by_id($userIdViewed,'web',false,true);
// get the path,width and height from original picture // get the path,width and height from original picture
$big_image = $image_array['dir'].'big_'.$image_array['file']; $big_image = $image_array['dir'].'big_'.$image_array['file'];
@ -392,25 +406,52 @@ elseif ($displayMode == "viewMainInfoEdit")
"<table width=\"80%\" border=\"0\">", "<table width=\"80%\" border=\"0\">",
"<tr align=\"center\" bgcolor=\"#E6E6E6\">\n", "<tr align=\"center\" bgcolor=\"#E6E6E6\">\n",
"<td align=\"left\">", get_lang('Name'), "</td>\n", "<td align=\"left\">", get_lang('Name'), "</td>\n",
"<td width=\"100px\" align=\"left\">", get_lang('Description'), "</td>\n", "<td width=\"100px\" align=\"left\">", get_lang('Description'), "</td>\n";
//"<td>", get_lang('Tutor'), "</td>\n",
"<td>", get_lang('CourseManager'), "</td>\n", if ($current_session_id) {
"</tr>\n", if ($user_info_viewed['status'] == COURSEMANAGER) {
echo "<td>", get_lang('Tutor'), "</td>\n";
}
} else {
if ($user_info_viewed['status'] == STUDENT) {
echo "<td>", get_lang('Tutor'), "</td>\n";
} else {
echo "<td>", get_lang('CourseManager'), "</td>\n";
}
}
echo "</tr>\n",
"<tr align=\"center\">", "<tr align=\"center\">",
"<td align=\"left\"><b>", htmlize(api_get_person_name($mainUserInfo['firstName'], $mainUserInfo['lastName'])), "</b></td>\n", "<td align=\"left\"><b>", htmlize(api_get_person_name($mainUserInfo['firstName'], $mainUserInfo['lastName'])), "</b></td>\n",
"<td align=\"left\"><input type=\"text\" name =\"role\" value=\"", $mainUserInfo['role'], "\" maxlength=\"40\" /></td>"; "<td align=\"left\"><input type=\"text\" name =\"role\" value=\"", $mainUserInfo['role'], "\" maxlength=\"40\" /></td>";
//"<td><input class=\"checkbox\" type=\"checkbox\" name=\"promoteTutor\" value=\"1\" ", $tutorChecked, " /></td>"; //"<td><input class=\"checkbox\" type=\"checkbox\" name=\"promoteTutor\" value=\"1\" ", $tutorChecked, " /></td>";
if (!($is_courseAdmin && $_user['user_id'] == $userIdViewed))
{ //aca
echo "<td><input class=\"checkbox\" type=\"checkbox\" name=\"promoteCourseAdmin\" value=\"1\"", $courseAdminChecked, " /></td>\n";
} if (!($is_courseAdmin && $_user['user_id'] == $userIdViewed)) {
else
{ if ($current_session_id) {
if ($user_info_viewed['status'] == COURSEMANAGER) {
echo "<td><input class=\"checkbox\" type=\"checkbox\" name=\"promoteTutor\" value=\"1\" ", $tutorChecked, " /></td>";
}
} else {
if ($user_info_viewed['status'] == STUDENT) {
echo "<td><input class=\"checkbox\" type=\"checkbox\" name=\"promoteTutor\" value=\"1\" ", $tutorChecked, " /></td>";
} else {
echo "<td><input class=\"checkbox\" type=\"checkbox\" name=\"promoteCourseAdmin\" value=\"1\"", $courseAdminChecked, " /></td>\n";
}
}
} else {
echo "<td>", get_lang('CourseManager'), "</td>\n"; echo "<td>", get_lang('CourseManager'), "</td>\n";
} }
echo "<td><button class=\"save\" type=\"submit\" name=\"submit\">".get_lang('SaveChanges')."</button></td>\n", "</tr>", "</table>", "</form>\n"; echo "<td><button class=\"save\" type=\"submit\" name=\"submit\">".get_lang('SaveChanges')."</button></td>\n", "</tr>", "</table>", "</form>\n";
echo "<p>".Display :: encrypted_mailto_link($mainUserInfo['email'], $mainUserInfo['email'])."</p>"; echo "<p>".Display :: encrypted_mailto_link($mainUserInfo['email'], $mainUserInfo['email'])."</p>";
@ -483,12 +524,23 @@ elseif ($displayMode == "viewContentList") // default display
echo "<table width=\"80%\" border=\"0\">", echo "<table width=\"80%\" border=\"0\">",
"<tr align=\"center\" bgcolor=\"#E6E6E6\">\n", "<tr align=\"center\" bgcolor=\"#E6E6E6\">\n",
"<td align=\"left\">",get_lang('Name'),"</td>\n", "<td align=\"left\">".get_lang('Name')."</td>\n",
"<td width=\"20%\" align=\"left\">",get_lang('Description'),"</td>\n", "<td width=\"20%\" align=\"left\">".get_lang('Description')."</td>\n";
//"<td>",get_lang('Tutor'),"</td>\n",
"<td>",get_lang('CourseManager'),"</td>\n", if ($current_session_id) {
($allowedToEditDef?"<td>".get_lang('Edit')."</td>\n":""), if ($user_info_viewed['status'] == COURSEMANAGER) {
($is_allowedToTrack?"<td>".get_lang('Tracking')."</td>\n":""), echo "<td>".get_lang('Tutor')."</td>\n";
}
} else {
if ($user_info_viewed['status'] == STUDENT) {
echo "<td>".get_lang('Tutor')."</td>\n";
} else {
echo "<td>".get_lang('CourseManager')."</td>\n";
}
}
echo ($allowedToEditDef?"<td>".get_lang('Edit')."</td>\n":""),
($is_allowedToTrack?"<td>".get_lang('Tracking')."</td>\n":""),
"</tr>\n", "</tr>\n",
"<tr align=\"center\">\n", "<tr align=\"center\">\n",
@ -498,36 +550,38 @@ elseif ($displayMode == "viewContentList") // default display
//DISPLAY TABLE CONTENT //DISPLAY TABLE CONTENT
if ($current_session_id) {
if ($user_info_viewed['status'] == COURSEMANAGER) {
if ($is_session_course_coach) {
echo "<td>",get_lang('Tutor'),"</td>\n";
} else {
echo "<td> - </td>\n";
}
}
} else {
if ($user_info_viewed['status'] == STUDENT) {
if ($mainUserInfo['tutor_id'] == 1) {
echo "<td>",get_lang('Tutor'),"</td>\n";
} else {
echo "<td> - </td>\n";
}
} else {
if ($mainUserInfo['status'] == 1) {
echo "<td>",get_lang('CourseManager'),"</td>";
} else {
echo "<td> - </td>\n";
}
}
}
// deprecated feature if ($allowedToEditDef) {
if ($mainUserInfo['tutor_id'] == 1)
{
//echo "<td>",get_lang('Tutor'),"</td>\n";
}
else
{
//echo "<td> - </td>\n";
}
if ($mainUserInfo['status'] == 1)
{
echo "<td>",get_lang('CourseManager'),"</td>";
}
else
{
echo "<td> - </td>\n";
}
if ($allowedToEditDef)
{
echo "<td>", echo "<td>",
"<a href=\"".api_get_self()."?".api_get_cidreq()."&editMainUserInfo=$userIdViewed\">", "<a href=\"".api_get_self()."?".api_get_cidreq()."&editMainUserInfo=$userIdViewed\">",
"<img border=\"0\" alt=\"\" src=\"../img/edit.gif\" />", "<img border=\"0\" alt=\"\" src=\"../img/edit.gif\" />",
"</a>", "</a>",
"</td>"; "</td>";
} }
if ($is_allowedToTrack) if ($is_allowedToTrack) {
{
echo "<td>", echo "<td>",
"<a href=\"../mySpace/myStudents.php?".api_get_cidreq()."&origin=user_course&student=$userIdViewed&details=true&course=".$_course['id']."\">", "<a href=\"../mySpace/myStudents.php?".api_get_cidreq()."&origin=user_course&student=$userIdViewed&details=true&course=".$_course['id']."\">",
"<img border=\"0\" alt=\"".get_lang('Tracking')." : $userIdViewed\" src=\"../img/statistics.gif\" />", "<img border=\"0\" alt=\"".get_lang('Tracking')." : $userIdViewed\" src=\"../img/statistics.gif\" />",
@ -538,20 +592,15 @@ elseif ($displayMode == "viewContentList") // default display
"</table>"; "</table>";
//"<p><a href=\"mailto:",$mainUserInfo['email'],"\">",$mainUserInfo['email'],"</a>", //"<p><a href=\"mailto:",$mainUserInfo['email'],"\">",$mainUserInfo['email'],"</a>",
if (api_get_setting("show_email_addresses") == "true") if (api_get_setting("show_email_addresses") == "true") {
{
echo "<p>". Display::encrypted_mailto_link($mainUserInfo['email'],$mainUserInfo['email']). "</p>"; echo "<p>". Display::encrypted_mailto_link($mainUserInfo['email'],$mainUserInfo['email']). "</p>";
} } else {
else if (api_is_allowed_to_edit()) {
{
if (api_is_allowed_to_edit())
{
echo "<p>". Display::encrypted_mailto_link($mainUserInfo['email'],$mainUserInfo['email']). "</p>"; echo "<p>". Display::encrypted_mailto_link($mainUserInfo['email'],$mainUserInfo['email']). "</p>";
} }
} }
if (api_get_setting('extended_profile') == 'true') if (api_get_setting('extended_profile') == 'true') {
{
echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyCompetences').'</strong></div><div>'.$mainUserInfo['competences'].'</div>'; echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyCompetences').'</strong></div><div>'.$mainUserInfo['competences'].'</div>';
echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div><div>'.$mainUserInfo['diplomas'].'</div>'; echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div><div>'.$mainUserInfo['diplomas'].'</div>';
echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyTeach').'</strong></div><div>'.$mainUserInfo['teach'].'</div>'; echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyTeach').'</strong></div><div>'.$mainUserInfo['teach'].'</div>';

@ -461,7 +461,7 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
$form_folder->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'profile', 'Width' => '100%', 'Height' => '200')); $form_folder->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'profile', 'Width' => '100%', 'Height' => '200'));
$qualification_input[] = FormValidator :: createElement('text','qualification'); $qualification_input[] = FormValidator :: createElement('text','qualification');
$form_folder -> addGroup($qualification_input, 'qualification', get_lang('QualificationNumberOver'), 'size="10"'); $form_folder -> addGroup($qualification_input, 'qualification', get_lang('QualificationNumeric'), 'size="10"');
if ($row['weight'] > 0) { if ($row['weight'] > 0) {
$weight_input[] = FormValidator :: createElement('text', 'weight'); $weight_input[] = FormValidator :: createElement('text', 'weight');
@ -888,6 +888,7 @@ function build_work_directory_selector($folders, $curdirpath, $group_dir = '') {
*/ */
function build_work_move_to_selector($folders, $curdirpath, $move_file, $group_dir = '') { function build_work_move_to_selector($folders, $curdirpath, $move_file, $group_dir = '') {
//gets file title //gets file title
$move_file = intval($move_file); $move_file = intval($move_file);
$tbl_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION); $tbl_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$sql = "SELECT title FROM $tbl_work WHERE id ='".$move_file."'"; $sql = "SELECT title FROM $tbl_work WHERE id ='".$move_file."'";
@ -908,29 +909,29 @@ function build_work_move_to_selector($folders, $curdirpath, $move_file, $group_d
//group documents cannot be uploaded in the root //group documents cannot be uploaded in the root
if ($group_dir == '') { if ($group_dir == '') {
if ($curdirpath != '/') { if ($curdirpath != '/') {
$form .= '<option value="/">/ ('.get_lang('Root').')</option>'; $form .= '<option value="0">/ ('.get_lang('Root').')</option>';
} }
if (is_array($folders)) { if (is_array($folders)) {
foreach ($folders as $folder) { foreach ($folders as $fid => $folder) {
//you cannot move a file to: //you cannot move a file to:
//1. current directory //1. current directory
//2. inside the folder you want to move //2. inside the folder you want to move
//3. inside a subfolder of the folder you want to move //3. inside a subfolder of the folder you want to move
if (($curdirpath != $folder) && ($folder != $move_file) && (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/')) { if (($curdirpath != $folder) && ($folder != $move_file) && (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/')) {
$form .= '<option value="'.$folder.'">'.$folder.'</option>'."\n"; $form .= '<option value="'.$fid.'">'.$folder.'</option>'."\n";
} }
} }
} }
} else { } else {
if ($curdirpath != '/') { if ($curdirpath != '/') {
$form .= '<option value="/">/ ('.get_lang('Root').')</option>'; $form .= '<option value="0">/ ('.get_lang('Root').')</option>';
} }
foreach ($folders as $folder) { foreach ($folders as $fid => $folder) {
if (($curdirpath != $folder) && ($folder != $move_file) && (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/')) { if (($curdirpath != $folder) && ($folder != $move_file) && (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/')) {
//cannot copy dir into his own subdir //cannot copy dir into his own subdir
$display_folder = substr($folder, strlen($group_dir)); $display_folder = substr($folder, strlen($group_dir));
$display_folder = ($display_folder == '') ? '/ ('.get_lang('Root').')' : $display_folder; $display_folder = ($display_folder == '') ? '/ ('.get_lang('Root').')' : $display_folder;
$form .= '<option value="'.$folder.'">'.$display_folder.'</option>'."\n"; $form .= '<option value="'.$fid.'">'.$display_folder.'</option>'."\n";
} }
} }
} }
@ -1054,7 +1055,7 @@ function get_work_path($id) {
* @param string Destination directory where the work has been moved (must end with a '/') * @param string Destination directory where the work has been moved (must end with a '/')
* @return -1 on error, sql query result on success * @return -1 on error, sql query result on success
*/ */
function update_work_url($id, $new_path) { function update_work_url($id, $new_path, $parent_id) {
if (empty($id)) return -1; if (empty($id)) return -1;
$table = Database::get_course_table(TABLE_STUDENT_PUBLICATION); $table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$sql = "SELECT * FROM $table WHERE id=$id"; $sql = "SELECT * FROM $table WHERE id=$id";
@ -1064,8 +1065,8 @@ function update_work_url($id, $new_path) {
} else { } else {
$row = Database::fetch_array($res); $row = Database::fetch_array($res);
$filename = basename($row['url']); $filename = basename($row['url']);
$new_url = $new_path.$filename; $new_url = $new_path .$filename;
$sql2 = "UPDATE $table SET url = '$new_url' WHERE id=$id"; $sql2 = "UPDATE $table SET url = '$new_url', parent_id = '$parent_id' WHERE id=$id";
$res2 = Database::query($sql2); $res2 = Database::query($sql2);
return $res2; return $res2;
} }
@ -1429,9 +1430,10 @@ function get_list_users_without_publication($task_id) {
$session_id = api_get_session_id(); $session_id = api_get_session_id();
if (!empty($session_id)){ if (!empty($session_id)){
$sql = "SELECT C.id_user as id FROM $work_table AS S, $session_course_rel_user AS C, $iprop_table AS I WHERE C.id_user=I.insert_user_id and S.id=I.ref and S.parent_id='$task_id' and course_code='".api_get_course_id()."' and S.session_id='".$session_id."'"; $sql = "SELECT user_id as id FROM $work_table WHERE parent_id='$task_id' and session_id='".$session_id."'";
} else { } else {
$sql = "SELECT C.user_id as id FROM $work_table AS S, $table_course_user AS C, $iprop_table AS I WHERE C.user_id=I.insert_user_id and S.id=I.ref and C.status=5 and S.parent_id='$task_id' and course_code='".api_get_course_id()."'"; $sql = "SELECT user_id as id FROM $work_table WHERE parent_id='$task_id'";
} }
$result = Database::query($sql); $result = Database::query($sql);
$users_with_tasks = array(); $users_with_tasks = array();
@ -1440,10 +1442,11 @@ function get_list_users_without_publication($task_id) {
} }
if (!empty($session_id)){ if (!empty($session_id)){
$sql_users = "SELECT cu.id_user, u.lastname, u.firstname, u.email FROM $session_course_rel_user AS cu, $table_user AS u WHERE cu.status!=1 and cu.course_code='".api_get_course_id()."' AND u.user_id=cu.id_user and cu.id_session='".$session_id."'"; $sql_users = "SELECT cu.id_user, u.lastname, u.firstname, u.email FROM $session_course_rel_user AS cu, $table_user AS u WHERE u.status!=1 and cu.course_code='".api_get_course_id()."' AND u.user_id=cu.id_user and cu.id_session='".$session_id."'";
} else { } else {
$sql_users = "SELECT cu.user_id, u.lastname, u.firstname, u.email FROM $table_course_user AS cu, $table_user AS u WHERE cu.status!=1 and cu.course_code='".api_get_course_id()."' AND u.user_id=cu.user_id"; $sql_users = "SELECT cu.user_id, u.lastname, u.firstname, u.email FROM $table_course_user AS cu, $table_user AS u WHERE u.status!=1 and cu.course_code='".api_get_course_id()."' AND u.user_id=cu.user_id";
} }
$result_users = Database::query($sql_users); $result_users = Database::query($sql_users);
$users_without_tasks = array(); $users_without_tasks = array();
while ($row_users = Database::fetch_row($result_users)) { while ($row_users = Database::fetch_row($result_users)) {

@ -558,10 +558,11 @@ if (!empty($_REQUEST['new_dir'])) {
qualificator_id = '', qualificator_id = '',
date_of_qualification = '0000-00-00 00:00:00', date_of_qualification = '0000-00-00 00:00:00',
weight = '".Database::escape_string($_POST['weight'])."', weight = '".Database::escape_string($_POST['weight'])."',
session_id = ".intval($id_session); session_id = '".intval($id_session)."',
user_id = '".$user_id."'";
Database::query($sql_add_publication); Database::query($sql_add_publication);
// add the directory // add the directory
$id = Database::insert_id(); $id = Database::insert_id();
//Folder created //Folder created
@ -674,10 +675,13 @@ if (!empty($_REQUEST['delete2'])) {
if (!empty ($_REQUEST['move'])) { if (!empty ($_REQUEST['move'])) {
$folders = array(); $folders = array();
$sql = "SELECT url FROM $work_table WHERE url LIKE '/%' AND post_group_id = '".(empty($_SESSION['toolgroup'])?0:intval($_SESSION['toolgroup']))."'"; $session_id = api_get_session_id();
$session_id == 0 ? $withsession = " AND session_id = 0 " : $withsession = " AND session_id='".$session_id."'";
$sql = "SELECT id, url FROM $work_table WHERE url LIKE '/%' AND post_group_id = '".(empty($_SESSION['toolgroup'])?0:intval($_SESSION['toolgroup']))."'".$withsession;
$res = Database::query($sql); $res = Database::query($sql);
while($folder = Database::fetch_array($res)) { while($folder = Database::fetch_array($res)) {
$folders[] = substr($folder['url'], 1, strlen($folder['url']) - 1); $folders[$folder['id']] = substr($folder['url'], 1, strlen($folder['url']) - 1);
} }
echo build_work_move_to_selector($folders, $cur_dir_path, $_REQUEST['move']); echo build_work_move_to_selector($folders, $cur_dir_path, $_REQUEST['move']);
} }
@ -687,21 +691,28 @@ if (!empty ($_REQUEST['move'])) {
if (isset ($_POST['move_to']) && isset ($_POST['move_file'])) { if (isset ($_POST['move_to']) && isset ($_POST['move_file'])) {
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php'; require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
$move_to = $_POST['move_to']; $move_to = $_POST['move_to'];
if ($move_to == '/' or empty ($move_to)) {
$move_to = '';
} elseif (substr($move_to, -1, 1) != '/') {
$move_to = $move_to . '/';
}
$move_to_path = get_work_path($move_to);
// var_dump($move_to_path);
if ($move_to_path==-1) {
$move_to_path = '/';
} elseif (substr($move_to_path, -1, 1) != '/') {
$move_to_path = $move_to_path .'/';
}
//security fix: make sure they can't move files that are not in the document table //security fix: make sure they can't move files that are not in the document table
if ($path = get_work_path($_POST['move_file'])) { $move_file_id = intval($_POST['move_file']);
if ($path = get_work_path($move_file_id)) {
//Display::display_normal_message('We want to move '.$_POST['move_file'].' to '.$_POST['move_to']); //Display::display_normal_message('We want to move '.$_POST['move_file'].' to '.$_POST['move_to']);
if (move($course_dir . '/' . $path, $base_work_dir . '/' . $move_to)) { //var_dump($base_work_dir . $move_to_path);
if (move($course_dir . '/' . $path, $base_work_dir . $move_to_path)) {
//update db //update db
update_work_url($_POST['move_file'], 'work/' . $move_to);
update_work_url($move_file_id, 'work' . $move_to_path, $move_to);
//set the current path //set the current path
$cur_dir_path = $move_to; $cur_dir_path = $move_to_path;
$cur_dir_path_url = urlencode($move_to); $cur_dir_path_url = urlencode($move_to_path);
// update all the parents in the table item propery // update all the parents in the table item propery
$list_id = get_parent_directories($cur_dir_path); $list_id = get_parent_directories($cur_dir_path);
@ -875,6 +886,8 @@ if ($ctok == $_POST['sec_token']) { //check the token inserted into the form
$current_date = date('Y-m-d H:i:s'); $current_date = date('Y-m-d H:i:s');
$parent_id = ''; $parent_id = '';
$active = ''; $active = '';
$user_id = api_get_user_id();
$sql = Database::query('SELECT id FROM '.Database::get_course_table(TABLE_STUDENT_PUBLICATION).' WHERE url = '."'/".Database::escape_string($_GET['curdirpath'])."' AND filetype='folder' LIMIT 1"); $sql = Database::query('SELECT id FROM '.Database::get_course_table(TABLE_STUDENT_PUBLICATION).' WHERE url = '."'/".Database::escape_string($_GET['curdirpath'])."' AND filetype='folder' LIMIT 1");
if (Database::num_rows($sql) > 0) { if (Database::num_rows($sql) > 0) {
$dir_row = Database::fetch_array($sql); $dir_row = Database::fetch_array($sql);
@ -890,7 +903,8 @@ if ($ctok == $_POST['sec_token']) { //check the token inserted into the form
post_group_id = '" . $post_group_id . "', post_group_id = '" . $post_group_id . "',
sent_date = '".$current_date ."', sent_date = '".$current_date ."',
parent_id = '".$parent_id ."' , parent_id = '".$parent_id ."' ,
session_id = ".intval($id_session); session_id = '".intval($id_session)."' ,
user_id = '".$user_id."'";
Database::query($sql_add_publication); Database::query($sql_add_publication);
@ -935,7 +949,8 @@ if ($ctok == $_POST['sec_token']) { //check the token inserted into the form
author = '" . Database::escape_string($authors) . "', author = '" . Database::escape_string($authors) . "',
post_group_id = '".$post_group_id."', post_group_id = '".$post_group_id."',
sent_date = '".$current_date."', sent_date = '".$current_date."',
session_id = ".intval($id_session); session_id = '".intval($id_session)."',
user_id = '".$user_id."'";
Database::query($sql); Database::query($sql);
@ -1232,7 +1247,7 @@ if ($is_course_member) {
$row = Database::fetch_array($result); $row = Database::fetch_array($result);
$qualification_over = $row['qualification']; $qualification_over = $row['qualification'];
$form->addElement('text', 'qualification', get_lang('Qualification'), 'size="10"'); $form->addElement('text', 'qualification', get_lang('Qualification'), 'size="10"');
$form->addElement('html', '<div style="margin-left:20%">'.get_lang('QualificationOver').'&nbsp;:&nbsp;'.$qualification_over.'</div>'); $form->addElement('html', '<div style="margin-left:20%">'.get_lang('QualificationNumeric').'&nbsp;:&nbsp;'.$qualification_over.'</div>');
$form->addElement('hidden', 'qualification_over', $qualification_over); $form->addElement('hidden', 'qualification_over', $qualification_over);
} }
@ -1317,7 +1332,7 @@ if ($is_course_member) {
$addtext .= '<div style="padding:10px">'; $addtext .= '<div style="padding:10px">';
$addtext .= '<b>'.get_lang('QualificationOfAssignment').'</b>'; $addtext .= '<b>'.get_lang('QualificationOfAssignment').'</b>';
$addtext .= '<table cellspacing="0" cellpading="0" border="0"><tr>'; $addtext .= '<table cellspacing="0" cellpading="0" border="0"><tr>';
$addtext .= '<td colspan="2">&nbsp;&nbsp;'.get_lang('QualificationNumberOver').'&nbsp;'; $addtext .= '<td colspan="2">&nbsp;&nbsp;'.get_lang('QualificationNumeric').'&nbsp;';
$addtext .= '<input type="text" name="qualification_value" value="" size="5"/></td><tr><td colspan="2">'; $addtext .= '<input type="text" name="qualification_value" value="" size="5"/></td><tr><td colspan="2">';
$addtext .= '<input type="checkbox" value="1" name="make_calification" onclick="if(this.checked==true){document.getElementById(\'option1\').style.display=\'block\';}else{document.getElementById(\'option1\').style.display=\'none\';}"/>'.get_lang('MakeQualifiable').'</td></tr><tr>'; $addtext .= '<input type="checkbox" value="1" name="make_calification" onclick="if(this.checked==true){document.getElementById(\'option1\').style.display=\'block\';}else{document.getElementById(\'option1\').style.display=\'none\';}"/>'.get_lang('MakeQualifiable').'</td></tr><tr>';
$addtext .= '<td colspan="2"><div id="option1" style="display:none">'; $addtext .= '<td colspan="2"><div id="option1" style="display:none">';
@ -1428,9 +1443,7 @@ if (!$display_upload_form && !$display_tool_options) {
} }
if (!empty($publication['description'])) { if (!empty($publication['description'])) {
echo '<div class="actions">'; echo '<p><div><strong>'.get_lang('Description').':</strong><p>'.Security::remove_XSS($publication['description'], STUDENT).'</p></div></p>';
echo '<br /><b>'.get_lang('Description').':</b>&nbsp;&nbsp;'.Security::remove_XSS($publication['description'], STUDENT).'<br /><br />';
echo '</div>';
} }
if ($display_list_users_without_publication) { if ($display_list_users_without_publication) {
display_list_users_without_publication($publication['id']); display_list_users_without_publication($publication['id']);

Loading…
Cancel
Save