Merge with 9309 from Dokeos

skala
Julio Montoya 15 years ago
commit 7976a75f55
  1. 17
      main/exercice/exercice_submit.php
  2. 0
      main/inc/lib/course.lib.php
  3. 60
      main/inc/lib/usermanager.lib.php
  4. 3
      user_portal.php

@ -1,5 +1,5 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /chamilo_license.txt */
/**
* Exercise submission
@ -47,10 +47,9 @@ $this_section = SECTION_COURSES;
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.corners.min.js" type="text/javascript"></script>';
if (api_get_setting('show_glossary_in_extra_tools') == 'true') {
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/glossary.js" type="text/javascript" language="javascript"></script>'; //Glossary
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
if (api_get_setting('show_glossary_in_extra_tools') == 'true') {
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/glossary.js" type="text/javascript" language="javascript"></script>'; //Glossary
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
}
//This library is necessary for the time control feature
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.epiclock.min.js" type="text/javascript" language="javascript"></script>'; //jQuery
@ -124,7 +123,6 @@ $error = '';
if (!isset ($exerciseType)) {
$exe_start_date = time();
$_SESSION['exercice_start_date'] = $exe_start_date;
error_log($_SESSION['exercice_start_date']);
}
// if the user has clicked on the "Cancel" button
if ($buttonCancel) {
@ -1227,19 +1225,20 @@ if ($_configuration['live_exercise_tracking'] == true && $exerciseFeedbackType !
} else {
$sql_fields = "";
$sql_fields_values = "";
} error_log($exerciseType);
}
if ($exerciseType == 2) {
$sql = "INSERT INTO $stat_table($sql_fields exe_exo_id,exe_user_id,exe_cours_id,status,session_id,data_tracking,start_date,orig_lp_id,orig_lp_item_id)
VALUES($sql_fields_values '$exerciseId','" . api_get_user_id() . "','" . $_course['id'] . "','incomplete','" . api_get_session_id() . "','" . implode(',', $questionList) . "','" . date('Y-m-d H:i:s') . "',$safe_lp_id,$safe_lp_item_id)";
error_log($sql);
Database::query($sql, __FILE__, __LINE__);
} else {
$sql = "INSERT INTO $stat_table ($sql_fields exe_exo_id,exe_user_id,exe_cours_id,status,session_id,start_date,orig_lp_id,orig_lp_item_id)
VALUES($sql_fields_values '$exerciseId','" . api_get_user_id() . "','" . $_course['id'] . "','incomplete','" . api_get_session_id() . "','" . date('Y-m-d H:i:s') . "',$safe_lp_id,$safe_lp_item_id)";
error_log($sql);
Database::query($sql, __FILE__, __LINE__);
}
}
}

@ -2786,6 +2786,66 @@ class UserManager
$code_special_courses = ' course.code IN ('.join($special_course_list, ',').') ';
}
// variable initialisation
$course_list_sql = '';
$course_list = array();
if(!empty($code_special_courses)){
$course_list_sql = "SELECT course.code k, course.directory d, course.visual_code c, course.db_name db, course.title i, course.tutor_name t, course.course_language l, course_rel_user.status s, course_rel_user.sort sort, course_rel_user.user_course_cat user_course_cat
FROM ".$tbl_course_user." course_rel_user
LEFT JOIN ".$tbl_course." course
ON course.code = course_rel_user.course_code
LEFT JOIN ".$tbl_user_course_category." user_course_category
ON course_rel_user.user_course_cat = user_course_category.id
$join_access_url
WHERE $code_special_courses $where_access_url
GROUP BY course.code
ORDER BY user_course_category.sort,course.title,course_rel_user.sort ASC";
$course_list_sql_result = api_sql_query($course_list_sql, __FILE__, __LINE__);
while ($result_row = Database::fetch_array($course_list_sql_result)) {
$course_list[] = $result_row;
}
}
return $course_list;
}
/**
* Gives a list of course auto-register (field special_course)
* @return array list of course
* @author Jhon Hinojosa <jhon.hinojosa@dokeos.com>
* @since Dokeos 1.8.6.2
*/
public static function get_special_course_list() {
// Database Table Definitions
$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$tbl_course_field = Database :: get_main_table(TABLE_MAIN_COURSE_FIELD);
$tbl_course_field_value = Database :: get_main_table(TABLE_MAIN_COURSE_FIELD_VALUES);
$tbl_user_course_category = Database :: get_user_personal_table(TABLE_USER_COURSE_CATEGORY);
//we filter the courses from the URL
$join_access_url=$where_access_url='';
global $_configuration;
if ($_configuration['multiple_access_urls']==true) {
$access_url_id = api_get_current_access_url_id();
if($access_url_id!=-1) {
$tbl_url_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$join_access_url= "LEFT JOIN $tbl_url_course url_rel_course ON url_rel_course.course_code= course.code";
$where_access_url=" AND access_url_id = $access_url_id ";
}
}
// Filter special courses
$sql_special_course = "SELECT course_code FROM $tbl_course_field_value tcfv INNER JOIN $tbl_course_field tcf ON " .
" tcfv.field_id = tcf.id WHERE tcf.field_variable = 'special_course' AND tcfv.field_value = 1 ";
$special_course_result = Database::query($sql_special_course, __FILE__, __LINE__);
$code_special_courses = '';
if(Database::num_rows($special_course_result)>0) {
$special_course_list = array();
while ($result_row = Database::fetch_array($special_course_result)) {
$special_course_list[] = '"'.$result_row['course_code'].'"';
}
$code_special_courses = ' course.code IN ('.join($special_course_list, ',').') ';
}
// variable initialisation
$course_list_sql = '';
$course_list = array();

@ -863,8 +863,7 @@ if (!empty ($_GET['include']) && preg_match('/^[a-zA-Z0-9_-]*\.html$/',$_GET['in
}
foreach ($courses_tree as $cat => $sessions) {
$courses_tree[$cat]['details'] = SessionManager::get_session_category($cat);
if ($cat == 0) {
if ($cat == 0) {
$courses_tree[$cat]['courses'] = CourseManager::get_courses_list_by_user_id($_user['user_id'],false);
}
$courses_tree[$cat]['sessions'] = array_flip(array_flip($sessions));

Loading…
Cancel
Save