Removing require_once already loaded with composer.

1.10.x
Julio Montoya 10 years ago
parent fe219a6e94
commit 57eeea7543
  1. 2
      composer.json
  2. 2
      composer.lock
  3. 9
      custompages/registration-dist.php
  4. 3
      main/admin/access_url_edit_course_category_to_url.php
  5. 6
      main/admin/access_urls.php
  6. 68
      main/admin/career_dashboard.php
  7. 4
      main/admin/configure_homepage.php
  8. 3
      main/admin/configure_inscription.php
  9. 3
      main/admin/course_add.php
  10. 1
      main/admin/course_category.php
  11. 3
      main/admin/course_edit.php
  12. 1
      main/admin/course_import.php
  13. 3
      main/admin/course_list.php
  14. 6
      main/admin/course_request_edit.php
  15. 5
      main/admin/course_request_rejected.php
  16. 5
      main/admin/course_request_review.php
  17. 1
      main/admin/group_edit.php
  18. 3
      main/admin/ldap_import_students.php
  19. 2
      main/admin/ldap_import_students_to_session.php
  20. 3
      main/admin/session_import.php
  21. 1
      main/admin/session_list.php
  22. 3
      main/admin/session_user_import.php
  23. 9
      main/admin/skills_import.php
  24. 3
      main/admin/system_announcements.php
  25. 3
      main/admin/user_add.php
  26. 4
      main/admin/user_edit.php
  27. 5
      main/admin/user_import.php
  28. 28
      main/admin/user_update_import.php
  29. 3
      main/announcements/announcements.php
  30. 2
      main/auth/cas/logincas.php
  31. 7
      main/auth/cas/logout.php
  32. 5
      main/auth/courses.php
  33. 9
      main/auth/external_login/functions.inc.php
  34. 4
      main/auth/external_login/newUser.php
  35. 4
      main/auth/external_login/updateUser.php
  36. 2
      main/auth/inscription.php
  37. 1
      main/auth/lostPassword.php
  38. 2
      main/auth/my_progress.php
  39. 7
      main/auth/profile.php
  40. 6
      main/conference/api.php
  41. 1
      main/conference/checksession.php
  42. 25
      main/course_description/index.php
  43. 1
      main/course_info/infocours.php
  44. 1
      main/coursecopy/classes/CourseSelectForm.class.php
  45. 7
      main/create_course/add_course.php
  46. 1
      main/cron/document/finddoc.php
  47. 4
      main/cron/document/index_all_docs.php
  48. 5
      main/document/remote.php
  49. 5
      main/dropbox/dropbox_download.php
  50. 5
      main/dropbox/dropbox_init.inc.php
  51. 10
      main/exercice/addlimits.php
  52. 5
      main/exercice/admin.php
  53. 8
      main/exercice/adminhp.php
  54. 7
      main/exercice/aiken.php
  55. 9
      main/exercice/exercice.php
  56. 18
      main/exercice/exercise.class.php
  57. 7
      main/exercice/exercise_admin.php
  58. 16
      main/exercice/exercise_reminder.php
  59. 7
      main/exercice/exercise_report.php
  60. 16
      main/exercice/exercise_result.php
  61. 8
      main/exercice/exercise_show.php
  62. 6
      main/exercice/exercise_submit.php
  63. 287
      main/exercice/exercise_submit_modal.php
  64. 9
      main/exercice/export/aiken/aiken_classes.php
  65. 9
      main/exercice/export/exercise_import.php
  66. 23
      main/exercice/export/qti2/qti2_classes.php
  67. 19
      main/exercice/export/scorm/scorm_classes.php
  68. 11
      main/exercice/feedback.php
  69. 7
      main/exercice/hotpotatoes_exercise_report.php
  70. 19
      main/exercice/hotspot_actionscript.as.php
  71. 16
      main/exercice/hotspot_actionscript_admin.as.php
  72. 32
      main/exercice/hotspot_answers.as.php
  73. 12
      main/exercice/hotspot_save.inc.php
  74. 8
      main/exercice/hotspot_savescore.inc.php
  75. 4
      main/exercice/hotspot_updatescore.inc.php
  76. 5
      main/exercice/live_stats.php
  77. 12
      main/exercice/mark_free_answer.php
  78. 3
      main/exercice/overview.php
  79. 56
      main/exercice/qti2.php
  80. 24
      main/exercice/question.class.php
  81. 5
      main/exercice/question_create.php
  82. 4
      main/exercice/question_pool.php
  83. 11
      main/exercice/result.php
  84. 11
      main/exercice/savescores.php
  85. 4
      main/exercice/stats.php
  86. 7
      main/exercice/upload_exercise.php
  87. 3
      main/forum/forumfunction.inc.php
  88. 5
      main/inc/ajax/course.ajax.php
  89. 4
      main/inc/ajax/exercise.ajax.php
  90. 7
      main/inc/email_editor.php
  91. 9
      main/inc/global.inc.php
  92. 9
      main/inc/lib/WCAG/WCAG_rendering.php
  93. 4
      main/inc/lib/add_course.lib.inc.php
  94. 44
      main/inc/lib/api.lib.php
  95. 3
      main/inc/lib/auth.lib.php
  96. 23
      main/inc/lib/classmanager.lib.php
  97. 1
      main/inc/lib/course.lib.php
  98. 8
      main/inc/lib/course_description.lib.php
  99. 1
      main/inc/lib/course_request.lib.php
  100. 1
      main/inc/lib/display.lib.php
  101. Some files were not shown because too many files have changed in this diff Show More

@ -17,6 +17,8 @@
"main/admin",
"main/cron/lang",
"main/coursecopy",
"main/course_description",
"main/dropbox",
"main/exercice",
"main/gradebook/lib",
"main/newscorm",

2
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "b9a64081b907e6968045cc2c894d141f",
"hash": "37cea40c8d66240c56600ba583a25719",
"packages": [
{
"name": "aferrandini/phpqrcode",

@ -7,15 +7,10 @@
* Copyright: CBlue SPRL, 20XX (GNU/GPLv3)
* @package chamilo.custompages
**/
/**
* Initialization
*/
require_once('language.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).'usermanager.lib.php';
require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
/**
* Removes some unwanted elementend of the form object
*/

@ -12,9 +12,6 @@ $language_file = 'admin';
$cidReset = true;
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
require_once api_get_path(LIBRARY_PATH).'xajax/xajax.inc.php';
$xajax = new xajax();
$xajax->registerFunction(array('searchCourseCategoryAjax', 'UrlManager', 'searchCourseCategoryAjax'));

@ -24,10 +24,6 @@ $interbreadcrumb[] = array ("url" => 'index.php', 'name' => get_lang('PlatformAd
$tool_name = get_lang('MultipleAccessURLs');
Display :: display_header($tool_name);
require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'usergroup.lib.php';
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
$my_user_url_list = api_get_access_url_from_user(api_get_user_id());
$current_access_url_id = api_get_current_access_url_id();
$url_list = UrlManager::get_url_data();
@ -171,4 +167,4 @@ $table->set_header(2, get_lang('Active'));
$table->set_header(3, get_lang('Modify'), false);
$table->display();
Display :: display_footer();
Display :: display_footer();

@ -13,12 +13,6 @@ $language_file = array('courses', 'index', 'admin');
$cidReset = true;
require_once '../inc/global.inc.php';
$libpath = api_get_path(LIBRARY_PATH);
require_once $libpath.'career.lib.php';
require_once $libpath.'promotion.lib.php';
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php';
api_protect_admin_script();
@ -39,8 +33,8 @@ $career = new Career();
$condition = array('status = ?' => 1);
if ($form->validate()) {
$data = $form->getSubmitValues();
$filter = intval($data['filter']);
$data = $form->getSubmitValues();
$filter = intval($data['filter']);
if (!empty($filter)) {
$condition = array('status = ? AND id = ? ' => array(1, $filter));
}
@ -49,7 +43,7 @@ if ($form->validate()) {
$careers = $career->get_all(array('status = ?' => 1)); //only status =1
$career_select_list = array();
$career_select_list[0] = ' -- '.get_lang('Select').' --';
foreach ($careers as $item) {
foreach ($careers as $item) {
$career_select_list[$item['id']] = $item['name'];
}
@ -61,7 +55,7 @@ $form->addElement('style_submit_button', 'submit', get_lang('Filter'), 'class="s
echo '<div class="actions" style="margin-bottom:20px">';
echo '<a href="../admin/index.php">'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'),'',ICON_SIZE_MEDIUM).'</a>';
echo '<a href="careers.php">'.Display::return_icon('career.png',get_lang('Careers'),'',ICON_SIZE_MEDIUM).'</a>';
echo '<a href="promotions.php">'.Display::return_icon('promotion.png',get_lang('Promotions'),'',ICON_SIZE_MEDIUM).'</a>';
echo '<a href="promotions.php">'.Display::return_icon('promotion.png',get_lang('Promotions'),'',ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
$form->display();
@ -73,78 +67,78 @@ $i = 0;
$grid_js = '';
$career_array = array();
if (!empty($careers)) {
foreach($careers as $career_item) {
foreach($careers as $career_item) {
$promotion = new Promotion();
//Getting all promotions
$promotions = $promotion->get_all_promotions_by_career_id($career_item['id'], 'name DESC');
$career_content = '';
$promotions = $promotion->get_all_promotions_by_career_id($career_item['id'], 'name DESC');
$career_content = '';
$promotion_array = array();
if (!empty($promotions)) {
if (!empty($promotions)) {
foreach($promotions as $promotion_item) {
if (!$promotion_item['status']) {
continue; //avoid status = 0
}
//Getting all sessions from this promotion
$sessions = SessionManager::get_all_sessions_by_promotion($promotion_item['id']);
$session_list = array();
foreach($sessions as $session_item) {
//Getting all sessions from this promotion
$sessions = SessionManager::get_all_sessions_by_promotion($promotion_item['id']);
$session_list = array();
foreach($sessions as $session_item) {
$course_list = SessionManager::get_course_list_by_session_id($session_item['id']);
$session_list[] = array('data'=>$session_item,'courses'=>$course_list);
}
$promotion_array[$promotion_item['id']] =array('name'=>$promotion_item['name'], 'sessions'=>$session_list);
}
$promotion_array[$promotion_item['id']] =array('name'=>$promotion_item['name'], 'sessions'=>$session_list);
}
}
$career_array[$career_item['id']] = array('name'=>$career_item['name'],'promotions'=>$promotion_array);
}
}
}
echo '<table class="data_table">';
foreach($career_array as $career_id => $data) {
$career = $data['name'];
$promotions = $data['promotions'];
$promotions = $data['promotions'];
$career = Display::url($career,'careers.php?action=edit&id='.$career_id);
$career = Display::tag('h3',$career);
echo '<tr><td style="background-color:#eee" colspan="3">'.$career.'</td></tr>';
foreach($promotions as $promotion_id => $promotion) {
echo '<tr><td style="background-color:#eee" colspan="3">'.$career.'</td></tr>';
foreach($promotions as $promotion_id => $promotion) {
$promotion_name = $promotion['name'];
$promotion_url = Display::url($promotion_name,'promotions.php?action=edit&id='.$promotion_id);
$sessions = $promotion['sessions'];
echo '<tr>';
$count = count($sessions);
$rowspan = '';
if (!empty($count)) {
if (!empty($count)) {
$count++;
$rowspan = 'rowspan="'.$count.'"';
}
echo '<td '.$rowspan.'>';
echo '<td '.$rowspan.'>';
//echo $promotion_url;
echo Display::tag('h4',$promotion_url);
echo '</td>';
echo '</tr>';
echo '</tr>';
if (!empty($sessions))
foreach($sessions as $session) {
$course_list = $session['courses'];
$url = Display::url($session['data']['name'], 'resume_session.php?id_session='.$session['data']['id']);
$url = Display::url($session['data']['name'], 'resume_session.php?id_session='.$session['data']['id']);
echo '<tr>';
//Session name
echo Display::tag('td',$url);
echo Display::tag('td',$url);
echo '<td>';
//Courses
echo '<table>';
foreach($course_list as $course) {
echo '<tr>';
$url = Display::url($course['title'], api_get_path(WEB_COURSE_PATH).$course['directory'].'/?id_session='.$session['data']['id']);
$url = Display::url($course['title'], api_get_path(WEB_COURSE_PATH).$course['directory'].'/?id_session='.$session['data']['id']);
echo Display::tag('td',$url);
echo '</tr>';
echo '</tr>';
}
echo '</table>';
echo '</td>';
echo '</tr>';
echo '</td>';
echo '</tr>';
}
}
}

@ -56,10 +56,6 @@ $this_page = '';
api_protect_admin_script();
require_once api_get_path(LIBRARY_PATH).'WCAG/WCAG_rendering.php';
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
$htmlHeadXtra[] = '<script>
$(function() {
$("#all_langs").change(function() {

@ -12,9 +12,6 @@ require_once '../inc/global.inc.php';
api_protect_admin_script();
require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php';
require_once api_get_path(INCLUDE_PATH).'lib/mail.lib.inc.php';
// Load terms & conditions from the current lang
if (get_setting('allow_terms_conditions') == 'true') {
$get = array_keys($_GET);

@ -16,9 +16,6 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
$tool_name = get_lang('AddCourse');
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList'));

@ -10,7 +10,6 @@
$language_file = 'admin';
$cidReset = true;
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();

@ -12,9 +12,6 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
require_once api_get_path(LIBRARY_PATH) . 'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'course_category.lib.php';
$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>';
$course_table = Database::get_main_table(TABLE_MAIN_COURSE);

@ -63,7 +63,6 @@ function validate_data($courses)
// 4. Check whether course category exists.
if (isset($course['CourseCategory']) && strlen($course['CourseCategory']) != 0) {
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
$categoryInfo = getCategory($course['CourseCategory']);
if (empty($categoryInfo)) {
//@todo this is so bad even all lang variables are wrong ...

@ -14,9 +14,6 @@ require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
require_once '../gradebook/lib/be/gradebookitem.class.php';
require_once '../gradebook/lib/be/category.class.php';
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
$sessionId = isset($_GET['session_id']) ? $_GET['session_id'] : null;

@ -19,16 +19,10 @@ api_protect_admin_script();
require_once api_get_path(LIBRARY_PATH).'add_course.lib.inc.php';
require_once api_get_path(CONFIGURATION_PATH).'course_info.conf.php';
require_once api_get_path(LIBRARY_PATH).'course_request.lib.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
// Including a configuration file.
require_once api_get_path(CONFIGURATION_PATH).'add_course.conf.php';
// Including additional libraries.
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
// A check whether the course validation feature is enabled.
$course_validation_feature = api_get_setting('course_validation') == 'true';

@ -24,15 +24,10 @@ api_protect_admin_script();
require_once api_get_path(LIBRARY_PATH).'add_course.lib.inc.php';
require_once api_get_path(CONFIGURATION_PATH).'course_info.conf.php';
require_once api_get_path(LIBRARY_PATH).'course_request.lib.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
// Including a configuration file.
require api_get_path(CONFIGURATION_PATH).'add_course.conf.php';
// Including additional libraries.
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
// A check whether the course validation feature is enabled.
$course_validation_feature = api_get_setting('course_validation') == 'true';

@ -21,15 +21,10 @@ api_protect_admin_script();
require_once api_get_path(LIBRARY_PATH).'add_course.lib.inc.php';
require_once api_get_path(CONFIGURATION_PATH).'course_info.conf.php';
require_once api_get_path(LIBRARY_PATH).'course_request.lib.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
// Including a configuration file.
require_once api_get_path(CONFIGURATION_PATH).'add_course.conf.php';
// Including additional libraries.
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
// The delete action should be deactivated in this page.
// Better reject the target request, after that you can delete it.
// see DELETE_ACTION_ENABLED constant in main_api.lib.php

@ -12,7 +12,6 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
$libpath = api_get_path(LIBRARY_PATH);
require_once $libpath.'mail.lib.inc.php';
$group_id = isset($_GET['id']) ? intval($_GET['id']) : intval($_POST['id']);
$tool_name = get_lang('GroupEdit');

@ -16,8 +16,7 @@ $cidReset=true;
require_once('../inc/global.inc.php');
// setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;
require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
require_once(api_get_path(LIBRARY_PATH).'usermanager.lib.php');
// Access restrictions
api_protect_admin_script();
require('../auth/ldap/authldap.php');

@ -16,8 +16,6 @@ $cidReset=true;
require_once('../inc/global.inc.php');
// setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;
require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
require_once(api_get_path(LIBRARY_PATH).'usermanager.lib.php');
// Access restrictions
api_protect_admin_script();
require('../auth/ldap/authldap.php');

@ -13,9 +13,6 @@ require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(true);
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
$form_sent = 0;
$error_message = ''; // Avoid conflict with the global variable $error_msg (array type) in add_course.conf.php.
if (isset($_GET['action']) && $_GET['action'] == 'show_message') {

@ -48,7 +48,6 @@ $url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_course';
$courseList = array();
$courseId = isset($_GET['course_id']) ? $_GET['course_id'] : null;
if (!empty($courseId)) {
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
$courseInfo = api_get_course_info_by_id($courseId);
$parents = getParentsToString($courseInfo['categoryCode']);
$courseList[] = array('id' => $courseInfo['id'], 'text' => $parents.$courseInfo['title']);

@ -15,9 +15,6 @@ set_time_limit(0);
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(true);
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
$form_sent = 0;
$error_message = ''; // Avoid conflict with the global variable $error_msg (array type) in add_course.conf.php.
if (isset($_GET['action']) && $_GET['action'] == 'show_message') {

@ -12,9 +12,6 @@ $language_file = array ('admin', 'registration');
$cidReset = true;
require '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH).'import.lib.php';
function validate_data($skills) {
$errors = array();
@ -191,7 +188,7 @@ if ($_POST['formSent'] AND $_FILES['import_file']['size'] !== 0) {
$skill_id_error[] = $my_errors['SkillName'];
}
}
if (is_array($skills)) {
foreach ($skills as $my_skill) {
if (!in_array($my_skill['SkillName'], $skill_id_error)) {
@ -200,9 +197,9 @@ if ($_POST['formSent'] AND $_FILES['import_file']['size'] !== 0) {
}
}
if (strcmp($file_type, 'csv') === 0) {
if (strcmp($file_type, 'csv') === 0) {
save_data($skills_to_insert);
} elseif (strcmp($file_type, 'xml') === 0) {
} elseif (strcmp($file_type, 'xml') === 0) {
save_data($skills_to_insert);
} else {
$error_message = get_lang('YouMustImportAFileAccordingToSelectedOption');

@ -17,9 +17,6 @@ $cidReset = true;
// Including the global initialization file.
require_once '../inc/global.inc.php';
// Including additional libraries.
require_once api_get_path(LIBRARY_PATH).'WCAG/WCAG_rendering.php';
// Setting the section (for the tabs).
$this_section = SECTION_PLATFORM_ADMIN;
$_SESSION['this_section']=$this_section;

@ -10,9 +10,6 @@ $cidReset = true;
// Including necessary libraries.
require_once '../inc/global.inc.php';
$libpath = api_get_path(LIBRARY_PATH);
require_once $libpath.'fileManage.lib.php';
require_once $libpath.'fileUpload.lib.php';
require_once $libpath.'mail.lib.inc.php';
// Section for the tabs
$this_section = SECTION_PLATFORM_ADMIN;

@ -73,10 +73,6 @@ function confirmation(name) {
</script>';
$libpath = api_get_path(LIBRARY_PATH);
require_once $libpath.'fileManage.lib.php';
require_once $libpath.'fileUpload.lib.php';
require_once $libpath.'mail.lib.inc.php';
$noPHP_SELF = true;
$tool_name = get_lang('ModifyUserInfo');

@ -13,11 +13,6 @@ $language_file = array('admin', 'registration');
$cidReset = true;
require '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH).'classmanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'usergroup.lib.php';
require_once api_get_path(LIBRARY_PATH).'import.lib.php';
// Set this option to true to enforce strict purification for usenames.
$purification_option_for_usernames = false;

@ -13,11 +13,6 @@ $language_file = array ('admin', 'registration');
$cidReset = true;
require '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH).'classmanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'usergroup.lib.php';
require_once api_get_path(LIBRARY_PATH).'import.lib.php';
// Set this option to true to enforce strict purification for usenames.
$purification_option_for_usernames = false;
@ -48,7 +43,7 @@ function validate_data($users)
}
// 2. Check username, first, check whether it is empty.
if (isset($user['NewUserName'])) {
if (!UserManager::is_username_empty($user['NewUserName'])) {
// 2.1. Check whether username is too long.
@ -69,7 +64,7 @@ function validate_data($users)
}
}
}
// 3. Check status.
if (isset($user['Status']) && !api_status_exists($user['Status'])) {
$user['error'] = get_lang('WrongStatus');
@ -138,7 +133,7 @@ function complete_missing_data($user)
* @return void
* @uses global variable $inserted_in_course, which returns the list of courses the user was inserted in
*/
function updateUsers($users)
{
global $insertedIn_course;
@ -146,7 +141,6 @@ function updateUsers($users)
if (!isset($inserted_in_course)) {
$inserted_in_course = array();
}
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
$usergroup = new UserGroup();
$send_mail = $_POST['sendMail'] ? true : false;
if (is_array($users)) {
@ -158,7 +152,7 @@ function updateUsers($users)
$user_id = $userInfo['user_id'];
if ($user_id == 0) {
return false;
}
}
$firstName = isset($user['FirstName']) ? $user['FirstName'] : $userInfo['firstname'];
$lastName = isset($user['LastName']) ? $user['LastName'] : $userInfo['lastname'];
$userName = isset($user['NewUserName']) ? $user['NewUserName'] : $userInfo['username'];
@ -193,10 +187,10 @@ function updateUsers($users)
$hrDeptId,
null,
$language,
'',
'',
'',
''
);
if (!is_array($user['Courses']) && !empty($user['Courses'])) {
$user['Courses'] = array($user['Courses']);
@ -357,9 +351,9 @@ $user_id_error = array();
$error_message = '';
if (isset($_POST['formSent']) && $_POST['formSent'] AND $_FILES['import_file']['size'] !== 0) {
$file_type = 'csv';
$file_type = 'csv';
Security::clear_token();
$tok = Security::get_token();
$allowed_file_mimetype = array('csv', 'xml');
@ -378,7 +372,7 @@ if (isset($_POST['formSent']) && $_POST['formSent'] AND $_FILES['import_file']['
$errors = validate_data($users);
$error_kind_file = false;
} else {
$error_kind_file = true;
}
} else {
@ -480,7 +474,7 @@ if ($count_fields > 0) {
?>
<p><?php echo get_lang('CSVMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p>
<blockquote>
<pre>
<b>UserName</b>;LastName;FirstName;Email;NewUserName;Password;AuthSource;OfficialCode;PhoneNumber;Status;ExpiryDate;Active;Language;Courses;ClassId;

@ -56,9 +56,6 @@ $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
/* Libraries */
$lib = api_get_path(LIBRARY_PATH); //avoid useless function calls
require_once $lib.'mail.lib.inc.php';
require_once $lib.'tracking.lib.php';
require_once 'announcements.inc.php';
$course_id = api_get_course_int_id();

@ -12,7 +12,7 @@
//----------------------------------------------------------------------
// Load required
require('../../inc/global.inc.php');
require_once (api_get_path(LIBRARY_PATH).'events.lib.inc.php');
require_once('authcas.php');
use \ChamiloSession as Session;
global $cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri;

@ -6,13 +6,12 @@
because of security reason.
*/
require('../..//inc/global.inc.php');
require_once (api_get_path(LIBRARY_PATH).'events.lib.inc.php');
require_once('authcas.php');
global $cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri;
global $cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri;
phpCAS::client($cas_auth_ver,$cas_auth_server,$cas_auth_port,$cas_auth_uri);
phpCAS::logout();
?>
?>

@ -19,11 +19,6 @@ require_once '../inc/global.inc.php';
$ctok = Security::get_existing_token();
require_once api_get_path(LIBRARY_PATH).'auth.lib.php';
require_once api_get_path(LIBRARY_PATH).'app_view.php';
require_once 'courses_controller.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
$htmlHeadXtra[] = '
<script>

@ -1,13 +1,10 @@
<?php
require_once api_get_path(LIBRARY_PATH) . 'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'course.lib.php';
//define('USERINFO_TABLE', 'danone_userinfo');
//define('DEFAULT_PASSWORD', 'danonelearning');
//TODO : Please implements this function for this module to work.
/**
* Gets user info from external source
* Gets user info from external source
* @param string login
* @param string password
* @return user array with at least the following fields:
@ -128,7 +125,7 @@ function external_add_user($u) {
}
/**
* Update the user in chamilo database. It upgrade only info that is present in the
* Update the user in chamilo database. It upgrade only info that is present in the
* new_user array
*
* @param $new_user associative array with the value to upgrade
@ -150,7 +147,7 @@ function external_add_user($u) {
* - extra : array of custom fields
* - language
* - courses : string of all courses code separated by '|'
* - admin : boolean
* - admin : boolean
* @return boolean
* @author ndiechburg <noel@cblue.be>
* */

@ -1,5 +1,4 @@
<?php
/*
Template to automatically create a new user with information from anywhere.
This file is loaded by main/inc/local.inc.php
@ -11,11 +10,8 @@
use \ChamiloSession as Session;
require_once(api_get_path(LIBRARY_PATH) . 'usermanager.lib.php');
require_once(api_get_path(LIBRARY_PATH) . 'course.lib.php');
require_once(dirname(__FILE__) . '/functions.inc.php');
//MAIN CODE
//$login and $password variables are setted in main/inc/local.inc.php

@ -7,8 +7,6 @@
use \ChamiloSession as Session;
require_once(api_get_path(LIBRARY_PATH) . 'usermanager.lib.php');
require_once(api_get_path(LIBRARY_PATH) . 'course.lib.php');
require_once(dirname(__FILE__) . '/functions.inc.php');
//MAIN CODE
@ -27,7 +25,7 @@ $user['manager'] = $new_user['manager'];
$user['country_bu'] = $new_user['country_bu'];
$user['extra'] = $new_user['extra'];
if ($new_user !== false) { //User can login
if ($new_user !== false) { //User can login
external_update_user($user);
$loginFailed = false;
$_user['user_id'] = $user['user_id'];

@ -15,8 +15,6 @@ if (!empty($_POST['language'])) {
$_GET['language'] = $_POST['language'];
}
require_once '../inc/global.inc.php';
require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
$htmlHeadXtra[] = api_get_password_checker_js('#username', '#pass1');

@ -21,7 +21,6 @@
$language_file = array('registration', 'index');
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
// Custom pages
// Had to move the form handling in here, because otherwise there would

@ -12,8 +12,6 @@ $language_file = array('registration', 'tracking', 'exercice', 'admin', 'learnpa
$cidReset = true;
require_once '../inc/global.inc.php';
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
$this_section = SECTION_TRACKING;

@ -93,13 +93,6 @@ if (api_get_setting('allow_message_tool') == 'true') {
EOF;
}
// Configuration file
require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php';
// Libraries
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
$tool_name = is_profile_editable() ? get_lang('ModifProfile') : get_lang('ViewProfile');
$table_user = Database :: get_main_table(TABLE_MAIN_USER);

@ -43,10 +43,6 @@ if ($_SERVER['HTTP_USER_AGENT'] == 'Shockwave Flash') {
/*==== INCLUDE ====*/
require_once '../inc/global.inc.php';
api_block_anonymous_users();
require_once (api_get_path(LIBRARY_PATH)."course.lib.php");
require_once (api_get_path(LIBRARY_PATH)."document.lib.php");
require_once (api_get_path(LIBRARY_PATH)."fileUpload.lib.php");
require_once ("../newscorm/learnpath.class.php");
require_once ("../newscorm/openoffice_presentation.class.php");
/*==== Variables initialisation ====*/
@ -248,4 +244,4 @@ else if ($action == "service")
DocumentManager::file_send_for_download($full_file_name,false);
}
exit;
}
}

@ -29,7 +29,6 @@ api_block_anonymous_users();
$confkey = api_get_setting('service_visio','visio_pass');
$challenge = api_generate_password(32); //generate a 32 characters-long challenge key
require_once (api_get_path(LIBRARY_PATH)."course.lib.php");
printf ('<?xml version="1.0" encoding="UTF-8" ?>');
printf('<dokeosobject>');

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */
/**
* Template (front controller in MVC pattern) used for distpaching to the controllers depend on the current action
* Template (front controller in MVC pattern) used for distpaching to the controllers depend on the current action
* @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.course_description
*/
@ -10,15 +10,10 @@
// name of the language file that needs to be included
$language_file = array ('course_description', 'accessibility');
// including files
// including files
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_COURSE_DESCRIPTION;
require_once api_get_path(LIBRARY_PATH).'course_description.lib.php';
require_once api_get_path(LIBRARY_PATH).'app_view.php';
require_once 'course_description_controller.php';
require_once api_get_path(LIBRARY_PATH).'WCAG/WCAG_rendering.php';
// defining constants
define('ADD_BLOCK', 8);
@ -65,28 +60,28 @@ if(intval($description_type) >= 9) $interbreadcrumb[] = array ("url" => "#", "na
$course_description_controller = new CourseDescriptionController();
// distpacher actions to controller
switch ($action) {
case 'listing':
switch ($action) {
case 'listing':
$course_description_controller->listing();
break;
case 'history':
break;
case 'history':
$course_description_controller->listing(true);
break;
case 'add' :
case 'add' :
if (api_is_allowed_to_edit(null,true)) {
$course_description_controller->add();
}
break;
case 'edit' :
case 'edit' :
if (api_is_allowed_to_edit(null,true)) {
$course_description_controller->edit($id, $description_type);
}
break;
case 'delete' :
case 'delete' :
if (api_is_allowed_to_edit(null,true)) {
$course_description_controller->destroy($id);
}
break;
default :
default :
$course_description_controller->listing();
}

@ -24,7 +24,6 @@ $nameTools = get_lang('ModifInfo');
/* Libraries */
require_once api_get_path(INCLUDE_PATH).'conf/course_info.conf.php';
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
api_protect_course_script(true);
api_block_anonymous_users();

@ -607,7 +607,6 @@ class CourseSelectForm
//get destination course title
if(!empty($hidden_fields['destination_course'])) {
require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
if (!empty($hidden_fields['destination_session'])) {
$sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')';
} else {

@ -21,7 +21,6 @@ $cidReset = true;
// Including the global initialization file.
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
// Section for the tabs.
$this_section = SECTION_COURSES;
@ -35,14 +34,8 @@ if (api_get_setting('course_validation') == 'true' && !api_is_platform_admin())
}
// Require additional libraries.
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
require_once api_get_path(CONFIGURATION_PATH).'course_info.conf.php';
if ($course_validation_feature) {
require_once api_get_path(LIBRARY_PATH).'course_request.lib.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
}
$htmlHeadXtra[] = '<script type="text/javascript">
function setFocus(){
$("#title").focus();

@ -7,7 +7,6 @@
*/
die();
require '../../inc/global.inc.php';
require_once '../../inc/lib/course.lib.php';
if (empty($_GET['doc'])) {
echo "To add a document name to search, add ?doc=abc to the URL";
} else {

@ -7,8 +7,6 @@
*/
die();
require '../../inc/global.inc.php';
require_once '../../inc/lib/course.lib.php';
require_once '../../inc/lib/document.lib.php';
if (empty($_GET['doc'])) {
echo "To add a document name to search, add ?doc=abc to the URL\n";
} else {
@ -29,7 +27,7 @@ $td = Database::get_course_table(TABLE_DOCUMENT);
foreach ($courses_list as $course) {
$course_dir = $course['directory'].'/document';
$title = Database::escape_string($_GET['doc']);
$title = Database::escape_string($_GET['doc']);
$sql = "SELECT id, path, session_id FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' or title LIKE '%$title%'";
$res = Database::query($sql);
if (Database::num_rows($res)>0) {

@ -11,7 +11,7 @@
* @param string Course code (cidReq=...)
* @param string Current working directory (cwd=...)
* @return string JSON output
*/
*/
/* FIX for IE cache when using https */
session_cache_limiter('none');
/*==== DEBUG ====*/
@ -31,9 +31,6 @@ if ($debug>0) {
/*==== INCLUDE ====*/
require_once '../inc/global.inc.php';
api_block_anonymous_users();
require_once (api_get_path(LIBRARY_PATH).'course.lib.php');
require_once (api_get_path(LIBRARY_PATH).'document.lib.php');
require_once ('../newscorm/learnpath.class.php');
/*==== Variables initialisation ====*/
$action = $_REQUEST['action']; //safe as only used in if()'s
$seek = array('/','%2F','..');

@ -19,11 +19,6 @@ require_once 'dropbox_config.inc.php';
// the dropbox file that contains additional functions
require_once 'dropbox_functions.inc.php';
// the dropbox class
require_once 'dropbox_class.inc.php';
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
/* DOWNLOAD A FOLDER */
$course_id = api_get_course_int_id();
$user_id = api_get_user_id();

@ -138,17 +138,12 @@ Session::write('dropbox_conf', $dropbox_cnf);
// the dropbox file that contains additional functions
require_once 'dropbox_functions.inc.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
// protecting the script
api_protect_course_script();
/* Libraries */
// including the library for the dropbox
require_once 'dropbox_class.inc.php';
// including some libraries that are also used in the documents tool
require_once api_get_path(SYS_CODE_PATH).'document/document.inc.php'; // we use a function build_document_icon_tag

@ -11,14 +11,6 @@
*/
require_once '../inc/global.inc.php';
/*
Including necessary files
*/
require_once 'exercise.class.php';
require_once 'question.class.php';
require_once 'answer.class.php';
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
// name of the language file that needs to be included
$language_file='exercice';
@ -185,7 +177,7 @@ if (isset($_POST['ok'])) {
Database::query($query);
} else {
$query = "UPDATE ".$TBL_EXERCICES." SET num_attempts = 0 WHERE id= $exercise_id";
Database::query($query);
Database::query($query);
}
}
?>

@ -47,15 +47,10 @@
use \ChamiloSession as Session;
require_once 'exercise.class.php';
require_once 'question.class.php';
require_once 'answer.class.php';
// Name of the language file that needs to be included
$language_file = 'exercice';
require_once '../inc/global.inc.php';
require_once 'exercise.lib.php';
$current_course_tool = TOOL_QUIZ;
$this_section = SECTION_COURSES;

@ -6,17 +6,11 @@
* @author Istvan Mandak
* @version $Id: adminhp.php 20089 2009-04-24 21:12:54Z cvargas1 $
*/
/**
* Code
*/
require_once 'exercise.class.php';
require_once 'question.class.php';
require_once 'answer.class.php';
// name of the language file that needs to be included
$language_file='exercice';
require_once '../inc/global.inc.php';
require_once 'exercise.lib.php';
$this_section=SECTION_COURSES;

@ -16,15 +16,8 @@ $language_file = array('exercice', 'gradebook');
require_once '../inc/global.inc.php';
$lib_path = api_get_path(LIBRARY_PATH);
$main_path = api_get_path(SYS_CODE_PATH);
require_once $lib_path.'document.lib.php';
require_once $lib_path.'fileUpload.lib.php';
require_once $lib_path.'fileManage.lib.php';
// including additional libraries
require_once 'exercise.class.php';
require_once 'question.class.php';
require_once 'answer.class.php';
require_once 'unique_answer.class.php';
require_once $main_path.'exercice/export/aiken/aiken_import.inc.php';
require_once $main_path.'exercice/export/aiken/aiken_classes.php';

@ -33,15 +33,8 @@ $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/qtip2/j
api_protect_course_script(true);
// including additional libraries
require_once 'exercise.class.php';
require_once 'exercise.lib.php';
require_once 'question.class.php';
require_once 'answer.class.php';
require_once 'testcategory.class.php';
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
require_once 'hotpotatoes.lib.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
/* Constants and variables */
$is_allowedToEdit = api_is_allowed_to_edit(null, true);

@ -1,23 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
define('ALL_ON_ONE_PAGE', 1);
define('ONE_PER_PAGE', 2);
define('EXERCISE_FEEDBACK_TYPE_END', 0); //Feedback - show score and expected answers
define('EXERCISE_FEEDBACK_TYPE_DIRECT', 1); //DirectFeedback - Do not show score nor answers
define('EXERCISE_FEEDBACK_TYPE_EXAM', 2); //NoFeedback - Show score only
define('RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS', 0); //show score and expected answers
define('RESULT_DISABLE_NO_SCORE_AND_EXPECTED_ANSWERS', 1); //Do not show score nor answers
define('RESULT_DISABLE_SHOW_SCORE_ONLY', 2); //Show score only
define('RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES', 3); //Show final score only with categories
define('EXERCISE_MAX_NAME_SIZE', 80);
$debug = false; //All exercise scripts should depend in this debug variable
require_once dirname(__FILE__).'/../inc/lib/exercise_show_functions.lib.php';
/**
* Class Exercise
*
@ -60,6 +43,7 @@ class Exercise
public $exercise_was_added_in_lp = false;
public $force_edit_exercise_in_lp = false;
public $sessionId = 0;
public $debug = false;
/**
* Constructor of the class

@ -14,13 +14,8 @@
use \ChamiloSession as Session;
$language_file='exercice';
require_once 'exercise.class.php';
require_once 'question.class.php';
require_once 'answer.class.php';
$language_file = 'exercice';
require_once '../inc/global.inc.php';
require_once 'exercise.lib.php';
$this_section = SECTION_COURSES;
if (!api_is_allowed_to_edit(null,true)) {

@ -7,24 +7,8 @@
* @author Julio Montoya Armas switchable fill in blank option added
*/
require_once 'exercise.class.php';
require_once 'question.class.php';
require_once 'answer.class.php';
$language_file = 'exercice';
require_once '../inc/global.inc.php';
require_once 'exercise.lib.php';
if ($_GET['origin']=='learnpath') {
require_once '../newscorm/learnpath.class.php';
require_once '../newscorm/learnpathItem.class.php';
require_once '../newscorm/scorm.class.php';
require_once '../newscorm/scormItem.class.php';
require_once '../newscorm/aicc.class.php';
require_once '../newscorm/aiccItem.class.php';
}
require_once api_get_path(LIBRARY_PATH).'exercise_show_functions.lib.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
$this_section = SECTION_COURSES;

@ -27,14 +27,7 @@ $htmlHeadXtra[] = api_get_datepicker_js();
api_protect_course_script(true, false, true);
// including additional libraries
require_once 'exercise.class.php';
require_once 'exercise.lib.php';
require_once 'question.class.php';
require_once 'answer.class.php';
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
require_once 'hotpotatoes.lib.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
// need functions of statsutils lib to display previous exercices scores
require_once api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php';

@ -17,26 +17,10 @@
use \ChamiloSession as Session;
require_once 'exercise.class.php';
require_once 'question.class.php';
require_once 'answer.class.php';
// Name of the language file that needs to be included
$language_file = 'exercice';
require_once '../inc/global.inc.php';
require_once 'exercise.lib.php';
if ($_GET['origin']=='learnpath') {
require_once '../newscorm/learnpath.class.php';
require_once '../newscorm/learnpathItem.class.php';
require_once '../newscorm/scorm.class.php';
require_once '../newscorm/scormItem.class.php';
require_once '../newscorm/aicc.class.php';
require_once '../newscorm/aiccItem.class.php';
}
require_once api_get_path(LIBRARY_PATH).'exercise_show_functions.lib.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
$this_section = SECTION_COURSES;

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Shows the exercise results
*
@ -17,14 +18,7 @@ use \ChamiloSession as Session;
$language_file = array('exercice');
// including additional libraries
require_once 'exercise.class.php';
require_once 'question.class.php'; //also defines answer type constants
require_once 'answer.class.php';
require_once '../inc/global.inc.php';
require_once 'exercise.lib.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
if (empty($origin) ) {
$origin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : null;

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Exercise submission
* This script allows to run an exercise. According to the exercise type, questions
@ -27,16 +28,11 @@
use \ChamiloSession as Session;
require_once 'exercise.class.php';
require_once 'question.class.php';
require_once 'answer.class.php';
// name of the language file that needs to be included
$language_file = 'exercice';
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_QUIZ;
require_once 'exercise.lib.php';
$this_section = SECTION_COURSES;

@ -20,11 +20,6 @@ Display::display_reduced_header();
$dbg_local = 0;
require_once 'exercise.class.php';
require_once 'question.class.php';
require_once 'answer.class.php';
require_once 'exercise.lib.php';
if (empty ($exerciseResult)) {
$exerciseResult = $_SESSION['exerciseResult'];
}
@ -57,7 +52,7 @@ $nbrQuestions = intval($_GET['nbrQuestions']);
Session::erase('objExerciseExtra'.$exerciseId);
Session::erase('exerciseResultExtra'.$exerciseId);
Session::erase('questionListExtra'.$exerciseId);
//round-up the coordinates
$coords = explode('/',$_GET['hotspot']);
$user_array = '';
@ -70,43 +65,43 @@ if (is_array($coords) && count($coords)>0){
$user_array = substr($user_array,0,-1);
if (isset($_GET['choice'])){
$choice_value = intval($_GET['choice']);
if (isset($_GET['choice'])){
$choice_value = intval($_GET['choice']);
}
// Getting the options by js
if (empty($choice_value)) {
echo "<script>
// this works for only radio buttons
echo "<script>
// this works for only radio buttons
var f= self.parent.window.document.frm_exercise;
var choice_js='';
var choice_js='';
var hotspot = new Array();
var hotspotcoord = new Array();
var counter=0;
for( var i = 0; i < f.elements.length; i++ ) {
if (f.elements[i].type=='radio' && f.elements[i].checked) {
//alert( f.elements[i].name);
for( var i = 0; i < f.elements.length; i++ ) {
if (f.elements[i].type=='radio' && f.elements[i].checked) {
//alert( f.elements[i].name);
choice_js = f.elements[i].value;
counter ++;
}
if (f.elements[i].type=='hidden' ) {
name = f.elements[i].name;
counter ++;
}
if (f.elements[i].type=='hidden' ) {
name = f.elements[i].name;
if (name.substr(0,7)=='hotspot')
hotspot.push(f.elements[i].value);
hotspot.push(f.elements[i].value);
if (name.substr(0,20)=='hotspot_coordinates')
hotspotcoord.push(f.elements[i].value);
//hotspot = f.elements[i].value;
}
}
hotspotcoord.push(f.elements[i].value);
//hotspot = f.elements[i].value;
}
}
if (counter==0) {
choice_js=-1; // this is an error
}
choice_js=-1; // this is an error
}
//alert(choice_js);
";
";
// IMPORTANT
//this is the real redirect function
echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";</script>';
@ -116,7 +111,7 @@ $choice = array();
$questionid= $questionList[$questionNum];
// $choice_value => value of the user selection
$choice[$questionid] = $choice_value;
// initializing
if(!is_array($exerciseResult)) {
$exerciseResult = array();
@ -127,39 +122,39 @@ if (is_array($choice)) {
if ($exerciseType == EXERCISE_FEEDBACK_TYPE_DIRECT) {
// $exerciseResult receives the content of the form.
// Each choice of the student is stored into the array $choice
$exerciseResult = $choice;
$exerciseResult = $choice;
} else {
// gets the question ID from $choice. It is the key of the array
list($key)=array_keys($choice);
// if the user didn't already answer this question
if(!isset($exerciseResult[$key])) {
// stores the user answer into the array
$exerciseResult[$key]=$choice[$key];
$exerciseResult[$key]=$choice[$key];
}
}
}
}
// the script "exercise_result.php" will take the variable $exerciseResult from the session
Session::write('exerciseResult', $exerciseResult);
Session::write('exerciseResultCoordinates', $exerciseResultCoordinates);
Session::write('exerciseResultCoordinates', $exerciseResultCoordinates);
/*
/*
// if it is the last question (only for a sequential exercise)
if($questionNum >= $nbrQuestions)
{
{
if($debug>0){echo str_repeat('&nbsp;',0).'Redirecting to exercise_result.php - Remove debug option to let this happen'."<br />\n";}
// goes to the script that will show the result of the exercise
// header("Location: exercise_result.php?origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id");
// echo 'location result';
// echo 'location result';
}*/
// gets the student choice for this question
// gets the student choice for this question
//print_r($choice); echo "<br>";
// creates a temporary Question object
if (in_array($questionid, $questionList)) {
if (in_array($questionid, $questionList)) {
$objQuestionTmp = Question :: read($questionid);
$questionName =$objQuestionTmp->selectTitle();
$questionDescription=$objQuestionTmp->selectDescription();
@ -188,70 +183,70 @@ $hot_spot_load = false;
if (!empty($choice_value)) {
for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
$answer = $objAnswerTmp->selectAnswer($answerId);
$answerComment = $objAnswerTmp->selectComment($answerId);
$answerComment = $objAnswerTmp->selectComment($answerId);
$answerDestination = $objAnswerTmp->selectDestination($answerId);
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
$answerWeighting = $objAnswerTmp->selectWeighting($answerId);
$numAnswer = $objAnswerTmp->selectAutoId($answerId);
//delineation
$delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1);
$answer_delineation_destination=$objAnswerTmp->selectDestination(1);
if ($dbg_local>0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination,0);}
switch($answerType) {
// for unique answer
case UNIQUE_ANSWER :
$studentChoice = ($choice_value == $numAnswer)?1:0;
if ($studentChoice) {
$studentChoice = ($choice_value == $numAnswer)?1:0;
if ($studentChoice) {
$questionScore +=$answerWeighting;
$totalScore +=$answerWeighting;
$newquestionList[]=$questionid;
$newquestionList[]=$questionid;
}
break;
case HOT_SPOT_DELINEATION :
case HOT_SPOT_DELINEATION :
$studentChoice=$choice[$answerId];
if ($studentChoice) {
$newquestionList[]=$questionid;
}
if ($answerId===1) {
if ($studentChoice) {
$newquestionList[]=$questionid;
}
if ($answerId===1) {
$questionScore +=$answerWeighting;
$totalScore +=$answerWeighting;
$totalScore +=$answerWeighting;
$_SESSION['hotspot_coord'][1] =$delineation_cord;
$_SESSION['hotspot_dest'][1] =$answer_delineation_destination;
}
break;
}
break;
}
if ($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER) {
if ($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER) {
//display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect);
//echo $questionScore;
if ($studentChoice) {
$destination = $answerDestination;
$comment = $answerComment;
$comment = $answerComment;
}
} elseif($answerType == HOT_SPOT_DELINEATION) {
if ($next) {
if ($next) {
if ($dbg_local>0) { error_log(__LINE__.' - next',0);}
$hot_spot_load = true; //apparently the script is called twice
$user_answer = $user_array;
$user_answer = $user_array;
$_SESSION['exerciseResultCoordinates'][$questionid]=$user_answer; //needed for exercise_result.php
// we compare only the delineation not the other points
$answer_question = $_SESSION['hotspot_coord'][1];
$answer_question = $_SESSION['hotspot_coord'][1];
$answerDestination = $_SESSION['hotspot_dest'][1];
$poly_user = convert_coordinates($user_answer,'/');
$poly_answer = convert_coordinates($answer_question,'|');
$poly_answer = convert_coordinates($answer_question,'|');
$max_coord = poly_get_max($poly_user,$poly_answer);
if (empty($_GET['hotspot'])) { //no user response
$overlap = -2;
} else {
$poly_user_compiled = poly_compile($poly_user,$max_coord);
$poly_answer_compiled = poly_compile($poly_answer,$max_coord);
$poly_answer_compiled = poly_compile($poly_answer,$max_coord);
$poly_results = poly_result($poly_answer_compiled,$poly_user_compiled,$max_coord);
$overlap = $poly_results['both'];
@ -280,46 +275,46 @@ if (!empty($choice_value)) {
if ($dbg_local>1) { error_log(__LINE__.' - Final excess is '.$final_excess,0);}
}
$destination_items= explode('@@', $answerDestination);
$threadhold_total = $destination_items[0];
$threadhold_items=explode(';',$threadhold_total);
$destination_items= explode('@@', $answerDestination);
$threadhold_total = $destination_items[0];
$threadhold_items=explode(';',$threadhold_total);
$threadhold1 = $threadhold_items[0]; // overlap
$threadhold2 = $threadhold_items[1]; // excess
$threadhold3 = $threadhold_items[2]; //missing
$threadhold3 = $threadhold_items[2]; //missing
// echo $final_overlap.' '.$threadhold1 .' - '. $final_missing.' '. $threadhold2 .' - '. $final_excess.' '. $threadhold3;
// if is delineation
if ($answerId===1) {
if ($answerId===1) {
//setting colors
if ($final_overlap>=$threadhold1) {
if ($final_overlap>=$threadhold1) {
$overlap_color=true; //echo 'a';
}
//echo $excess.'-'.$threadhold2;
if ($final_excess<=$threadhold2) {
if ($final_excess<=$threadhold2) {
$excess_color=true; //echo 'b';
}
//echo '--------'.$missing.'-'.$threadhold3;
if ($final_missing<=$threadhold3) {
if ($final_missing<=$threadhold3) {
$missing_color=true; //echo 'c';
}
}
// if pass
// if pass
//if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold2 && $final_excess<=$threadhold3) {
if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold3 && $final_excess<=$threadhold2) {
$next=1; //go to the oars
$result_comment=get_lang('Acceptable');
if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold3 && $final_excess<=$threadhold2) {
$next=1; //go to the oars
$result_comment=get_lang('Acceptable');
} else {
$next=1; //Go to the oars. If $next = 0 we will show this message: "One (or more) area at risk has been hit" instead of the table resume with the results
$wrong_results = true;
$result_comment=get_lang('Unacceptable');
$special_comment = $comment=$answerDestination=$objAnswerTmp->selectComment(1);
$result_comment=get_lang('Unacceptable');
$special_comment = $comment=$answerDestination=$objAnswerTmp->selectComment(1);
$answerDestination=$objAnswerTmp->selectDestination(1);
$destination_items= explode('@@', $answerDestination);
$try_hotspot=$destination_items[1];
$lp_hotspot=$destination_items[2];
$select_question_hotspot=$destination_items[3];
$url_hotspot=$destination_items[4];
$url_hotspot=$destination_items[4];
//echo 'show the feedback';
}
} elseif($answerId>1) {
@ -330,9 +325,9 @@ if (!empty($choice_value)) {
continue;
}
if ($dbg_local>0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0);}
//check the intersection between the oar and the user
//check the intersection between the oar and the user
//echo 'user'; print_r($x_user_list); print_r($y_user_list);
//echo 'official';print_r($x_list);print_r($y_list);
//echo 'official';print_r($x_list);print_r($y_list);
//$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list);
//$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId);
@ -340,14 +335,14 @@ if (!empty($choice_value)) {
$poly_answer = convert_coordinates($delineation_cord,'|');
$max_coord = poly_get_max($poly_user,$poly_answer); //getting max coordinates
$test = false;
$test = false;
// if ($answerId == 2 ){$test = true;} for test oars
if (empty($_GET['hotspot'])) { //no user response
$overlap = false;
} else {
// poly_compile really works tested with gnuplot
$poly_user_compiled = poly_compile($poly_user,$max_coord,$test);//$poly_user is already set when answerid = 1
// poly_compile really works tested with gnuplot
$poly_user_compiled = poly_compile($poly_user,$max_coord,$test);//$poly_user is already set when answerid = 1
$poly_answer_compiled = poly_compile($poly_answer,$max_coord,$test);
$overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord);
}
@ -359,26 +354,26 @@ if (!empty($choice_value)) {
} else {
if ($dbg_local>0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0);}
$organs_at_risk_hit++;
$organs_at_risk_hit++;
//show the feedback
$next=1;
$comment=$answerDestination=$objAnswerTmp->selectComment($answerId);
$answerDestination=$objAnswerTmp->selectDestination($answerId);
$comment=$answerDestination=$objAnswerTmp->selectComment($answerId);
$answerDestination=$objAnswerTmp->selectDestination($answerId);
$destination_items= explode('@@', $answerDestination);
$try_hotspot=$destination_items[1];
$lp_hotspot=$destination_items[2];
$select_question_hotspot=$destination_items[3];
$url_hotspot=$destination_items[4];
$url_hotspot=$destination_items[4];
}
}
} else {
// the first delineation feedback
if ($dbg_local>0) { error_log(__LINE__.' first',0);}
} else {
// the first delineation feedback
if ($dbg_local>0) { error_log(__LINE__.' first',0);}
//we send the error
}
}
}
}
if ($overlap_color) {
$overlap_color='green';
} else {
@ -394,89 +389,89 @@ if (!empty($choice_value)) {
} else {
$excess_color='red';
}
if (!is_numeric($final_overlap)) {
$final_overlap = 0;
}
if (!is_numeric($final_missing)) {
$final_missing = 0;
}
if (!is_numeric($final_excess)) {
$final_excess = 0;
}
if ($final_excess>100) {
$final_excess = 100;
}
$table_resume = '<table class="data_table" >
$table_resume = '<table class="data_table" >
<tr class="row_odd" >
<td></td>
<td ><b>'.get_lang('Requirements').'</b></td>
<td><b>'.get_lang('YourAnswer').'</b></td>
</tr>
<tr class="row_even">
<td><b>'.get_lang('Overlap').'</b></td>
<td>'.get_lang('Min').' '.$threadhold1.'</td>
<td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0)?0:intval($final_overlap)).'</div></td>
</tr>
<tr>
<td><b>'.get_lang('Excess').'</b></td>
<td>'.get_lang('Max').' '.$threadhold2.'</td>
<td><div style="color:'.$excess_color.'">'.(($final_excess < 0)?0:intval($final_excess)).'</div></td>
</tr>
<tr class="row_even">
<td><b>'.get_lang('Missing').'</b></td>
<td>'.get_lang('Max').' '.$threadhold3.'</td>
<td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td>
</tr>
</tr>
</table>';
//var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3);
}
}
$_SESSION['newquestionList'] = $newquestionList;
$links='';
if ($choice_value == -1) {
if ($choice_value == -1) {
if ($answerType != HOT_SPOT_DELINEATION) {
$links .= '<a href="#" onclick="self.parent.tb_remove();">'.get_lang('ChooseAnAnswer').'</a><br />';
}
}
if ($answerType != HOT_SPOT_DELINEATION) {
if ($answerType != HOT_SPOT_DELINEATION) {
if (!empty($destination)) {
$item_list = explode('@@',$destination);
//print_R($item_list);
$try = $item_list[0];
$lp = $item_list[1];
$destinationid= $item_list[2];
$url=$item_list[3];
}
$url=$item_list[3];
}
$table_resume='';
} else {
$try = $try_hotspot;
$lp = $lp_hotspot;
$destinationid= $select_question_hotspot;
$url=$url_hotspot;
if ($organs_at_risk_hit==0 && $wrong_results==false ) {
if ($organs_at_risk_hit==0 && $wrong_results==false ) {
// no error = no oar and no wrong result for delineation
//show if no error
//echo 'no error';
$comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
$answerDestination = $objAnswerTmp->selectDestination($nbrAnswers);
$comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
$answerDestination = $objAnswerTmp->selectDestination($nbrAnswers);
//we send the error
$destination_items= explode('@@', $answerDestination);
$try=$destination_items[1];
$lp=$destination_items[2];
$destinationid=$destination_items[3];
$url=$destination_items[4];
$exerciseResult[$questionid] = 1;
$url=$destination_items[4];
$exerciseResult[$questionid] = 1;
} else {
$exerciseResult[$questionid] = 0;
}
@ -484,17 +479,17 @@ if ($answerType != HOT_SPOT_DELINEATION) {
// the link to retry the question
if ($try==1) {
$num_value_array= (array_keys($questionList, $questionid));
if ($try==1) {
$num_value_array= (array_keys($questionList, $questionid));
$links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />';
}
// the link to theory (a learning path)
if (!empty($lp)) {
if (!empty($lp)) {
$lp_url= api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp;
require_once('../newscorm/learnpathList.class.php');
$list = new LearnpathList(api_get_user_id());
$flat_list = $list->get_flat_list();
$list = new LearnpathList(api_get_user_id());
$flat_list = $list->get_flat_list();
$links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />';
}
$links.='<br />';
@ -509,23 +504,23 @@ if ($destinationid==-1) {
$links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />';
} else {
// the link to other question
if (in_array($destinationid,$questionList)) {
if (in_array($destinationid,$questionList)) {
$objQuestionTmp = Question :: read($destinationid);
$questionName=$objQuestionTmp->selectTitle();
$num_value_array= (array_keys($questionList, $destinationid));
$num_value_array= (array_keys($questionList, $destinationid));
$links.= Display :: return_icon('quiz.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />';
}
}
echo '<script>
function SendEx(num) {
if (num == -1) {
self.parent.window.location.href = "exercise_result.php?take_session=1&exerciseId='.$exerciseId.'&num="+num+"&exerciseType='.$exerciseType.'&origin='.$origin.'&learnpath_item_id='.$learnpath_item_id.'&learnpath_id='.$learnpath_id.'";
self.parent.tb_remove();
function SendEx(num) {
if (num == -1) {
self.parent.window.location.href = "exercise_result.php?take_session=1&exerciseId='.$exerciseId.'&num="+num+"&exerciseType='.$exerciseType.'&origin='.$origin.'&learnpath_item_id='.$learnpath_item_id.'&learnpath_id='.$learnpath_id.'";
self.parent.tb_remove();
} else {
num -= 1;
self.parent.window.location.href = "exercise_submit.php?tryagain=1&exerciseId='.$exerciseId.'&num="+num+"&exerciseType='.$exerciseType.'&origin='.$origin.'&learnpath_item_id='.$learnpath_item_id.'&learnpath_id='.$learnpath_id.'";
self.parent.window.location.href = "exercise_submit.php?tryagain=1&exerciseId='.$exerciseId.'&num="+num+"&exerciseType='.$exerciseType.'&origin='.$origin.'&learnpath_item_id='.$learnpath_item_id.'&learnpath_id='.$learnpath_id.'";
self.parent.tb_remove();
}
}
@ -535,41 +530,41 @@ if ($links!='') {
echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;">
<a onclick="self.parent.tb_remove();" href="#" style="float:right; margin-top:-10px;">'.api_ucfirst(get_lang('Close')).'</a>
<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>';
if ($answerType == HOT_SPOT_DELINEATION) {
if ($answerType == HOT_SPOT_DELINEATION) {
if ($organs_at_risk_hit > 0) {
//$message='<p>'.get_lang('YourDelineation').'</p>';
//$message.=$table_resume;
//$message='<p>'.get_lang('YourDelineation').'</p>';
//$message.=$table_resume;
$message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />';
//if ($wrong_results) { }
$message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
$message.='<p>'.$comment.'</p>';
} else {
$message='<p>'.get_lang('YourDelineation').'</p>';
$message.=$table_resume;
$message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
$message.='<p>'.$comment.'</p>';
$message.='<p>'.$comment.'</p>';
} else {
$message='<p>'.get_lang('YourDelineation').'</p>';
$message.=$table_resume;
$message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
$message.='<p>'.$comment.'</p>';
}
echo $message;
} else {
echo '<p>'.$comment.'</p>';
}
}
echo '<h3>'.$links.'</h3>';
echo '</div>';
$_SESSION['hot_spot_result']=$message;
$_SESSION['hot_spot_result']=$message;
$_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]);
//reseting the exerciseResult variable
Session::write('exerciseResult',$exerciseResult);
//save this variables just in case the exercise loads an LP with other exercise
$_SESSION['objExerciseExtra'.$exerciseId] = $_SESSION['objExercise'];
$_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult'];
$_SESSION['questionListExtra'.$exerciseId] = $_SESSION['questionList'];
$_SESSION['questionListExtra'.$exerciseId] = $_SESSION['questionList'];
} else {
$questionNum++;
echo '<script>
self.parent.window.location.href = "exercise_submit.php?exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'";
//self.parent.tb_remove();
</script>';
self.parent.window.location.href = "exercise_submit.php?exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'";
//self.parent.tb_remove();
</script>';
}

@ -6,22 +6,15 @@
* @author César Perales <cesar.perales@gmail.com> Updated function names and import files for Aiken format support
* @package chamilo.exercise
*/
/**
* Code
*/
if ( count( get_included_files() ) == 1 ) die( '---' );
if (!function_exists('mime_content_type')) {
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
function mime_content_type($filename) {
return DocumentManager::file_get_mime_type((string)$filename);
}
}
require_once(api_get_path(SYS_CODE_PATH).'/exercice/answer.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/exercise.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/question.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/unique_answer.class.php');
/**
* Aiken2Question transformation class
*/

@ -17,14 +17,7 @@ if (api_is_platform_admin()) {
api_not_allowed();
}
//DECLARE NEEDED LIBRARIES
require_once api_get_path(LIBRARY_PATH) . 'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php';
require_once 'exercise_import.inc.php';
include_once '../exercise.class.php';
include_once '../question.class.php';
//SQL table name
@ -34,8 +27,6 @@ $tbl_rel_exercise_question = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION
// tool libraries
include_once '../exercise.class.php';
//Tool title
$nameTools = get_lang('ImportExercise');

@ -1,32 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @author Claro Team <cvs@claroline.net>
* @author Yannick Warnier <yannick.warnier@beeznest.com> - updated ImsAnswerHotspot to match QTI norms
* @package chamilo.exercise
*/
/**
* Code
*/
require_once(api_get_path(SYS_CODE_PATH).'/exercice/answer.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/exercise.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/question.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/hotspot.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/unique_answer.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/multiple_answer.class.php');
//require_once(api_get_path(SYS_CODE_PATH).'/exercice/multiple_answer_combination.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/matching.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/freeanswer.class.php');
require_once(api_get_path(SYS_CODE_PATH).'/exercice/fill_blanks.class.php');
//include_once $path . '/../../lib/answer_multiplechoice.class.php';
//include_once $path . '/../../lib/answer_truefalse.class.php';
//include_once $path . '/../../lib/answer_fib.class.php';
//include_once $path . '/../../lib/answer_matching.class.php';
/**
*
* @package chamilo.exercise
*/
class Ims2Question extends Question
{
/**

@ -5,23 +5,6 @@
* @author Yannick Warnier <yannick.warnier@beeznest.com>
* @package chamilo.exercise.scorm
*/
/**
* Code
*/
if ( count( get_included_files() ) == 1 ) die( '---' );
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/question.class.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/testcategory.class.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/answer.class.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/unique_answer.class.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/multiple_answer.class.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/multiple_answer_combination.class.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/fill_blanks.class.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/freeanswer.class.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/hotspot.class.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/matching.class.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/hotspot.class.php';
/**
* The ScormQuestion class is a gateway to getting the answers exported
@ -767,4 +750,4 @@ class ScormAnswerHotspot extends Answer
$html = '<tr><td colspan="2">'.get_lang('ThisItemIsNotExportable').'</td></tr>';
return array($js,$html);
}
}
}

@ -7,14 +7,6 @@
* @author
* @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
*/
/**
* Code
*/
include('exercise.class.php');
include('question.class.php');
include('answer.class.php');
include('exercise.lib.php');
// name of the language file that needs to be included
$language_file='exercice';
@ -22,9 +14,6 @@ $language_file='exercice';
include("../inc/global.inc.php");
$this_section=SECTION_COURSES;
include_once(api_get_path(LIBRARY_PATH).'fileUpload.lib.php');
include_once(api_get_path(LIBRARY_PATH).'document.lib.php');
include_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
$nameTools=get_lang('ExerciseManagement');
if (isset($_SESSION['gradebook'])){

@ -25,14 +25,7 @@ $htmlHeadXtra[] = api_get_jqgrid_js();
api_protect_course_script(true, false, true);
// including additional libraries
require_once 'exercise.class.php';
require_once 'exercise.lib.php';
require_once 'question.class.php';
require_once 'answer.class.php';
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
require_once 'hotpotatoes.lib.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
// need functions of statsutils lib to display previous exercices scores
require_once api_get_path(LIBRARY_PATH) . 'statsUtils.lib.inc.php';

@ -1,24 +1,21 @@
<?php //$id:$
<?php
/* For licensing terms, see /license.txt */
/**
* This file generates the ActionScript variables code used by the HotSpot .swf
* @package chamilo.exercise
* @author Toon Keppens
* @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
*/
/**
* Code
*/
session_cache_limiter("none");
include('exercise.class.php');
include('question.class.php');
include('answer.class.php');
include('../inc/global.inc.php');
// set vars
$questionId = intval($_GET['modifyAnswers']);
$objQuestion = Question::read($questionId);
$answer_type = $objQuestion->selectType(); //very important
$answer_type = $objQuestion->selectType(); //very important
$TBL_ANSWERS = Database::get_course_table(TABLE_QUIZ_ANSWER);
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$picturePath = $documentPath.'/images';
@ -36,10 +33,10 @@ $course_id = api_get_course_int_id();
// Query db for answers
if ($answer_type==HOT_SPOT_DELINEATION) {
$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS
$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS
WHERE c_id = $course_id AND question_id = ".intval($questionId)." AND hotspot_type = 'delineation' ORDER BY id";
} else {
$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS
$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS
WHERE c_id = $course_id AND question_id = ".intval($questionId)." ORDER BY id";
}
$result = Database::query($sql);
@ -76,7 +73,7 @@ while ($hotspot = Database::fetch_assoc($result))
if ($hotspot['hotspot_type'] == 'noerror')
{
$output .= "&hotspot_".$hotspot['id']."_type=noerror";
}
}
// This is a good answer, count + 1 for nmbr of clicks
if ($hotspot['hotspot_type'] > 0)

@ -1,18 +1,14 @@
<?php //$id:$
<?php
/* For licensing terms, see /license.txt */
/**
* This file generates the ActionScript variables code used by the HotSpot .swf
* @package chamilo.exercise
* @author Toon Keppens
* @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
*/
/**
* Code
*/
include('exercise.class.php');
include('question.class.php');
include('answer.class.php');
include('../inc/global.inc.php');
// set vars
$questionId = intval($_GET['modifyAnswers']);
$objQuestion = Question::read($questionId);
@ -42,10 +38,10 @@ $nbrAnswers = count($answers['answer']);
for($i=1;$i <= $nbrAnswers;$i++) {
$output .= "&hotspot_".$i."=true";
$output .= "&hotspot_".$i."_answer=".$answers['answer'][$i];
if ($answer_type==HOT_SPOT_DELINEATION) {
if ($answer_type==HOT_SPOT_DELINEATION) {
if ($i==1)
$output .= "&hotspot_".$i."_type=delineation";
$output .= "&hotspot_".$i."_type=delineation";
else
$output .= "&hotspot_".$i."_type=oar";
} else {

@ -1,17 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file generates the ActionScript variables code used by the
* This file generates the ActionScript variables code used by the
* HotSpot .swf
* @package chamilo.exercise
* @author Toon Keppens, Julio Montoya adding hotspot "medical" support
*/
/**
* Code
*/
include('exercise.class.php');
include('question.class.php');
include('answer.class.php');
include('../inc/global.inc.php');
// Set vars
@ -38,10 +34,10 @@ $course_id = api_get_course_int_id();
if ($answer_type == HOT_SPOT_DELINEATION) {
// Query db for answers
$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type FROM $TBL_ANSWERS
$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type FROM $TBL_ANSWERS
WHERE c_id = $course_id AND question_id = ".intval($questionId)." AND hotspot_type <> 'noerror' ORDER BY id";
} else {
$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type FROM $TBL_ANSWERS
$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type FROM $TBL_ANSWERS
WHERE c_id = $course_id AND question_id = ".intval($questionId)." ORDER BY id";
}
$result = Database::query($sql);
@ -69,11 +65,11 @@ while ($hotspot = Database::fetch_array($result)) {
// Delineation
if ($hotspot['hotspot_type'] == 'delineation') {
$output .= "&hotspot_".$hotspot['id']."_type=delineation";
}
}
// oar
if ($hotspot['hotspot_type'] == 'oar') {
$output .= "&hotspot_".$hotspot['id']."_type=delineation";
}
$output .= "&hotspot_".$hotspot['id']."_type=delineation";
}
$output .= "&hotspot_".$hotspot['id']."_coord=".$hotspot['hotspot_coordinates']."";
$i++;
}
@ -86,18 +82,18 @@ for ($i; $i <= 12; $i++) {
// Get clicks
if(isset($_SESSION['exerciseResultCoordinates']) && $from_db==0) {
if(isset($_SESSION['exerciseResultCoordinates']) && $from_db==0) {
foreach ($_SESSION['exerciseResultCoordinates'][$questionId] as $coordinate) {
$output2 .= $coordinate."|";
}
} else {
} else {
// get it from db
$tbl_track_e_hotspot = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
$sql = "SELECT hotspot_coordinate
FROM $tbl_track_e_hotspot
WHERE hotspot_question_id = $questionId AND
hotspot_course_code = '$course_code' AND
hotspot_exe_id = $exe_id
WHERE hotspot_question_id = $questionId AND
hotspot_course_code = '$course_code' AND
hotspot_exe_id = $exe_id
ORDER by hotspot_id";
$rs = @Database::query($sql); // don't output error because we are in Flash execution.
while($row = Database :: fetch_array($rs)) {
@ -106,4 +102,4 @@ if(isset($_SESSION['exerciseResultCoordinates']) && $from_db==0) {
}
$output .= "&p_hotspot_answers=".api_substr($output2,0,-1)."&done=done";
$explode = explode('&', $output);
echo $output;
echo $output;

@ -1,17 +1,13 @@
<?php //$id:$
<?php
/* For licensing terms, see /license.txt */
/**
*
* @package chamilo.exercise
* @author Toon Keppens
* @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
*/
/**
* Code
*/
include('exercise.class.php');
include('question.class.php');
include('answer.class.php');
include('../inc/global.inc.php');
$TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
@ -39,7 +35,7 @@ if ($_GET['type'] == "poly" || $_GET['type'] == "delineation" || $_GET['type'] =
$hotspot_coordinates = api_substr($hotspot_coordinates,0,-2);
}
$course_id = api_get_course_int_id();
$sql = "UPDATE $TBL_ANSWER SET hotspot_coordinates = '".Database::escape_string($hotspot_coordinates)."',hotspot_type = '".Database::escape_string($hotspot_type)."'
$sql = "UPDATE $TBL_ANSWER SET hotspot_coordinates = '".Database::escape_string($hotspot_coordinates)."',hotspot_type = '".Database::escape_string($hotspot_type)."'
WHERE c_id = $course_id AND id = ".intval($answerId)." AND question_id = ".intval($questionId)." LIMIT 1 ;";
$result = Database::query($sql);
echo "done=done";

@ -1,19 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file saves every click in the hotspot tool into track_e_hotspots
* @package chamilo.exercise
* @author Toon Keppens
* @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
*/
/**
* Code
*/
include('exercise.class.php');
include('question.class.php');
include('answer.class.php');
include('../inc/global.inc.php');
include('../inc/lib/database.lib.php');
$courseCode = $_GET['coursecode'];
$questionId = $_GET['questionId'];
$coordinates = $_GET['coord'];

@ -7,9 +7,7 @@
* @author Toon Keppens
* @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
*/
include 'exercise.class.php';
include 'question.class.php';
include 'answer.class.php';
include '../inc/global.inc.php';
$courseCode = $_GET['coursecode'];

@ -1,12 +1,9 @@
<?php
/* See license terms in /license.txt */
require_once 'exercise.class.php';
require_once 'question.class.php';
require_once 'answer.class.php';
$language_file = array('exercice','tracking');
require_once '../inc/global.inc.php';
require_once 'exercise.lib.php';
$this_section = SECTION_COURSES;
$exercise_id = (isset($_GET['exerciseId']) && !empty($_GET['exerciseId'])) ? intval($_GET['exerciseId']) : 0;

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Free answer marking script
* This script allows a course tutor to mark a student's free answer.
@ -9,20 +10,13 @@
*
* @todo respect coding guidelines
*/
/**
* Code
*/
// name of the language file that needs to be included
$language_file='exercice';
// name of the language file that needs to be included
include('../inc/global.inc.php');
// including additional libraries
require_once 'exercise.class.php';
require_once 'question.class.php';
require_once 'answer.class.php';
//debug param. 0: no display - 1: debug display
$debug=0;
if($debug>0){echo str_repeat('&nbsp;',0).'Entered exercise_result.php'."<br />\n";var_dump($_POST);}
@ -136,7 +130,7 @@ if ($action == 'mark') {
$my_msg = get_lang('MarkInserted');
}
//Database::query($sql);
//return 0;
//return 0;
} else {
$my_msg .= get_lang('TotalScoreTooBig');
}

@ -11,9 +11,8 @@
use \ChamiloSession as Session;
$language_file = 'exercice';
require_once 'exercise.class.php';
require_once '../inc/global.inc.php';
require_once 'exercise.lib.php';
$current_course_tool = TOOL_QUIZ;
// Clear the exercise session just in case

@ -1,11 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Code for Qti2 import integration.
* @package chamilo.exercise
* @author Ronny Velasquez
* @version $Id: qti2.php 2010-03-12 12:14:25Z $
*/
* Code for Qti2 import integration.
* @package chamilo.exercise
* @author Ronny Velasquez
* @version $Id: qti2.php 2010-03-12 12:14:25Z $
*/
/**
* Code
*/
@ -14,19 +14,13 @@ $language_file = array('exercice', 'document');
// including the global Chamilo file
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
// including additional libraries
require_once 'exercise.class.php';
require_once 'question.class.php';
require_once 'answer.class.php';
// section (for the tabs)
$this_section = SECTION_COURSES;
// access restriction: only teachers are allowed here
if (!api_is_allowed_to_edit(null, true)) {
api_not_allowed();
api_not_allowed();
}
// the breadcrumbs
@ -41,11 +35,11 @@ $is_allowedToEdit = api_is_allowed_to_edit(null, true);
*/
function ch_qti2_display_form()
{
$name_tools = get_lang('ImportQtiQuiz');
$form = '<div class="actions">';
$form .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercice.php?show=test&'.api_get_cidreq().'">'.
Display :: return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
$form .= '</div>';
$name_tools = get_lang('ImportQtiQuiz');
$form = '<div class="actions">';
$form .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercice.php?show=test&'.api_get_cidreq().'">'.
Display :: return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
$form .= '</div>';
$formValidator = new FormValidator(
'qti_upload',
'post',
@ -57,7 +51,7 @@ function ch_qti2_display_form()
$formValidator->addElement('file', 'userFile', get_lang('DownloadFile'));
$formValidator->addElement('style_submit_button', 'submit', get_lang('Send'), 'class="upload"');
$form .= $formValidator->return_form();
echo $form;
echo $form;
}
/**
@ -66,25 +60,25 @@ function ch_qti2_display_form()
*/
function ch_qti2_import_file($array_file)
{
$unzip = 0;
$lib_path = api_get_path(LIBRARY_PATH);
require_once $lib_path.'fileUpload.lib.php';
require_once $lib_path.'fileManage.lib.php';
$unzip = 0;
$lib_path = api_get_path(LIBRARY_PATH);
require_once $lib_path.'fileUpload.lib.php';
require_once $lib_path.'fileManage.lib.php';
$process = process_uploaded_file($array_file, false);
$process = process_uploaded_file($array_file, false);
if (preg_match('/\.zip$/i', $array_file['name'])) {
// if it's a zip, allow zip upload
$unzip = 1;
}
if (preg_match('/\.zip$/i', $array_file['name'])) {
// if it's a zip, allow zip upload
$unzip = 1;
}
if ($process && $unzip == 1) {
$main_path = api_get_path(SYS_CODE_PATH);
require_once $main_path.'exercice/export/exercise_import.inc.php';
if ($process && $unzip == 1) {
$main_path = api_get_path(SYS_CODE_PATH);
require_once $main_path.'exercice/export/exercise_import.inc.php';
require_once $main_path.'exercice/export/qti2/qti2_classes.php';
return import_exercise($array_file['name']);
}
}
return 'langFileError';
}

@ -1,30 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
// Question types
define('UNIQUE_ANSWER', 1);
define('MULTIPLE_ANSWER', 2);
define('FILL_IN_BLANKS', 3);
define('MATCHING', 4);
define('FREE_ANSWER', 5);
define('HOT_SPOT', 6);
define('HOT_SPOT_ORDER', 7);
define('HOT_SPOT_DELINEATION', 8);
define('MULTIPLE_ANSWER_COMBINATION', 9);
define('UNIQUE_ANSWER_NO_OPTION', 10);
define('MULTIPLE_ANSWER_TRUE_FALSE', 11);
define('MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE', 12);
define('ORAL_EXPRESSION', 13);
define('GLOBAL_MULTIPLE_ANSWER', 14);
define('MEDIA_QUESTION', 15);
define('CALCULATED_ANSWER', 16);
//Some alias used in the QTI exports
define('MCUA', 1);
define('TF', 1);
define('MCMA', 2);
define('FIB', 3);
/**
* Class Question
*

@ -9,13 +9,8 @@
// name of the language file that needs to be included
$language_file='exercice';
// including global Dokeos file
require_once '../inc/global.inc.php';
// including additional libraries
require_once 'question.class.php';
require_once 'exercise.class.php';
// the section (tabs)
$this_section=SECTION_COURSES;

@ -17,11 +17,7 @@ use \ChamiloSession as Session;
$language_file = 'exercice';
require_once 'exercise.class.php';
require_once 'question.class.php';
require_once 'answer.class.php';
require_once '../inc/global.inc.php';
require_once 'exercise.lib.php';
$this_section = SECTION_COURSES;

@ -7,19 +7,10 @@
*
*/
/**
* Code
*/
// name of the language file that needs to be included
$language_file = array('exercice');
// including additional libraries
require_once 'exercise.class.php';
require_once 'question.class.php';
require_once 'answer.class.php';
require_once '../inc/global.inc.php';
require_once 'exercise.lib.php';
if (empty($origin)) {
$origin = $_REQUEST['origin'];
@ -78,4 +69,4 @@ display_question_list_by_attempt($objExercise, $id, false);
if ($show_headers) {
Display::display_footer();
}
}

@ -9,22 +9,11 @@
// name of the language file that needs to be included
$language_file = 'learnpath';
if (isset($_GET['origin']) && $_GET['origin'] == 'learnpath') {
require_once '../newscorm/learnpath.class.php';
require_once '../newscorm/learnpathItem.class.php';
require_once '../newscorm/scorm.class.php';
require_once '../newscorm/scormItem.class.php';
require_once '../newscorm/aicc.class.php';
require_once '../newscorm/aiccItem.class.php';
}
require_once '../inc/global.inc.php';
$courseInfo = api_get_course_info();
$_user = api_get_user_info();
$this_section = SECTION_COURSES;
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
$documentPath = api_get_path(SYS_COURSE_PATH).$courseInfo['path']."/document";
$test = $_REQUEST['test'];

@ -1,12 +1,8 @@
<?php
/* See license terms in /license.txt */
require_once 'exercise.class.php';
require_once 'question.class.php';
require_once 'answer.class.php';
$language_file = array('exercice', 'tracking');
require_once '../inc/global.inc.php';
require_once 'exercise.lib.php';
$this_section = SECTION_COURSES;
$exercise_id = (isset($_GET['exerciseId']) && !empty($_GET['exerciseId'])) ? intval($_GET['exerciseId']) : 0;

@ -16,13 +16,8 @@ $help_content = 'exercise_upload';
// including the global Dokeos file
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'pear/excelreader/reader.php';
require_once 'exercise.class.php';
require_once 'question.class.php';
require_once 'unique_answer.class.php';
require_once '../newscorm/learnpath.class.php';
require_once '../newscorm/learnpathItem.class.php';
// Security check
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);

@ -23,9 +23,6 @@
use \ChamiloSession as Session;
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php';
define('FORUM_NEW_POST', 0);
get_notifications_of_user();

@ -39,7 +39,6 @@ switch ($action) {
}
break;
case 'search_category':
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
if (api_is_platform_admin() || api_is_allowed_to_create_course()) {
$results = searchCategoryByKeyword($_REQUEST['q']);
if (!empty($results)) {
@ -77,11 +76,7 @@ switch ($action) {
}
$results = array();
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
if (!empty($courseList)) {
foreach ($courseList as $courseInfo) {
$title = $courseInfo['title'];

@ -5,11 +5,7 @@
* Responses to AJAX calls
*/
require_once '../../exercice/exercise.class.php';
require_once '../../exercice/question.class.php';
require_once '../../exercice/answer.class.php';
require_once '../global.inc.php';
require_once '../../exercice/exercise.lib.php';
api_protect_course_script(true);

@ -16,7 +16,6 @@ use \ChamiloSession as Session;
$language_file = array('index', 'admin', 'registration');
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
if (empty($_user['user_id'])) {
api_not_allowed(true);
@ -46,7 +45,7 @@ $form->addElement('button', 'submit', get_lang('SendMail'));
switch ($action) {
case 'subscribe_me_to_session':
$sessionName = isset($_GET['session']) ? Security::remove_XSS($_GET['session']) : null;
$objTemplate = new Template();
$objTemplate->assign('session_name', $sessionName);
$objTemplate->assign('user', api_get_user_info());
@ -61,7 +60,7 @@ switch ($action) {
$emailTitle = Security::remove_XSS($_REQUEST['email_title']);
$emailText = Security::remove_XSS($_REQUEST['email_text']);
}
$defaults = array(
'dest' => $emailDest,
'email_address' => $emailDest,
@ -77,7 +76,7 @@ if ($form->validate()) {
$user_id=api_get_user_id();
$title=Security::remove_XSS($_POST['email_title']);
$content=Security::remove_XSS($_POST['email_text']);
if (!empty($_user['mail'])) {
if (!empty($_user['mail'])) {
api_mail_html('',$email_administrator,$title,$text,api_get_person_name($_user['firstname'],$_user['lastname']), $_user['mail']);
UserManager::send_message_in_outbox ($email_administrator,$user_id,$title, $content);
} else {

@ -98,6 +98,7 @@ ini_set('auto_detect_line_endings', '1');
// Include the libraries that are necessary everywhere
require_once dirname(__FILE__).'/../../vendor/autoload.php';
// @todo convert this libs in classes
require_once $lib_path.'database.lib.php';
require_once $lib_path.'text.lib.php';
require_once $lib_path.'array.lib.php';
@ -108,6 +109,9 @@ require_once $lib_path.'banner.lib.php';
require_once $lib_path.'fileManage.lib.php';
require_once $lib_path.'fileUpload.lib.php';
require_once $lib_path.'fileDisplay.lib.php';
require_once $lib_path.'mail.lib.inc.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
require_once $lib_path.'course_category.lib.php';
define('_MPDF_TEMP_PATH', api_get_path(SYS_ARCHIVE_PATH).'mpdf/');
if (!is_dir(_MPDF_TEMP_PATH)) {
@ -329,6 +333,11 @@ if (file_exists($mail_conf)) {
require_once $mail_conf;
}
$profileConf = api_get_path(CONFIGURATION_PATH).'profile.conf.php';
if (file_exists($profileConf)) {
require_once $profileConf;
}
if (api_get_setting('server_type') == 'test') {
ini_set('display_errors', '1');
ini_set('log_errors', '1');

@ -21,11 +21,6 @@
/**
* @package chamilo.include
*/
/**
* Code
*/
include_once ('../inc/global.inc.php');
include_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
/**
* helper for WCAG rendering.
@ -34,7 +29,8 @@ include_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'
* @version 1.0
* @package chamilo.include
*/
class WCAG_Rendering {
class WCAG_Rendering
{
function editor_header() {
return '<div id="WCAG-editor"><div class="title">'.get_lang('WCAGEditor').'</div><div class="body">';
@ -194,4 +190,3 @@ function &create_xhtml($xhtml) {
}
} // end class WAI_Rendering
?>

@ -8,10 +8,6 @@
* @todo Clean up horrible structure, script is unwieldy, for example easier way to deal with
* different tool visibility settings: ALL_TOOLS_INVISIBLE, ALL_TOOLS_VISIBLE, CORE_TOOLS_VISIBLE...
*/
/**
* Code
*/
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
/* FUNCTIONS */

@ -404,6 +404,49 @@ define('GROUP_IMAGE_SIZE_SMALL', 4);
define('GROUP_TITLE_LENGTH', 50);
// Exercise
// @todo move into a class
define('ALL_ON_ONE_PAGE', 1);
define('ONE_PER_PAGE', 2);
define('EXERCISE_FEEDBACK_TYPE_END', 0); //Feedback - show score and expected answers
define('EXERCISE_FEEDBACK_TYPE_DIRECT', 1); //DirectFeedback - Do not show score nor answers
define('EXERCISE_FEEDBACK_TYPE_EXAM', 2); //NoFeedback - Show score only
define('RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS', 0); //show score and expected answers
define('RESULT_DISABLE_NO_SCORE_AND_EXPECTED_ANSWERS', 1); //Do not show score nor answers
define('RESULT_DISABLE_SHOW_SCORE_ONLY', 2); //Show score only
define('RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES', 3); //Show final score only with categories
define('EXERCISE_MAX_NAME_SIZE', 80);
// Question types
// @todo move into a class
define('UNIQUE_ANSWER', 1);
define('MULTIPLE_ANSWER', 2);
define('FILL_IN_BLANKS', 3);
define('MATCHING', 4);
define('FREE_ANSWER', 5);
define('HOT_SPOT', 6);
define('HOT_SPOT_ORDER', 7);
define('HOT_SPOT_DELINEATION', 8);
define('MULTIPLE_ANSWER_COMBINATION', 9);
define('UNIQUE_ANSWER_NO_OPTION', 10);
define('MULTIPLE_ANSWER_TRUE_FALSE', 11);
define('MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE', 12);
define('ORAL_EXPRESSION', 13);
define('GLOBAL_MULTIPLE_ANSWER', 14);
define('MEDIA_QUESTION', 15);
define('CALCULATED_ANSWER', 16);
//Some alias used in the QTI exports
define('MCUA', 1);
define('TF', 1);
define('MCMA', 2);
define('FIB', 3);
/**
* Inclusion of internationalization libraries
*/
@ -1270,7 +1313,6 @@ function _api_format_user($user, $add_password = false)
$last_login = $user['last_login'];
} else {
if (!isset($user['lastLogin']) && !isset($user['last_login'])) {
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
$timestamp = Tracking::get_last_connection_date($result['user_id'], false, true);
// Convert the timestamp back into a datetime
// NOTE: this timestamp has ALREADY been converted to the local timezone in the get_last_connection_date function

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
/**
* Class Auth
* Auth can be used to instantiate objects or as a library to manage courses

@ -1,11 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This is the static class library for this application.
* @package chamilo.library
*/
/**
* Code
* Class ClassManager
*/
class ClassManager
{
@ -15,7 +12,7 @@ class ClassManager
* php-function.
*/
public static function get_class_info($class_id) {
$class_id = intval($class_id);
$class_id = intval($class_id);
$table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
$sql = "SELECT * FROM $table_class WHERE id='".$class_id."'";
$res = Database::query($sql);
@ -27,7 +24,7 @@ class ClassManager
* @param int $class_id The class id
*/
public static function set_name($name, $class_id) {
$class_id = intval($class_id);
$class_id = intval($class_id);
$table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
$sql = "UPDATE $table_class SET name='".Database::escape_string($name)."' WHERE id='".$class_id."'";
$res = Database::query($sql);
@ -59,7 +56,7 @@ class ClassManager
* class was subscibed to
*/
public static function delete_class($class_id) {
$class_id = intval($class_id);
$class_id = intval($class_id);
$table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
$table_class_course = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
$table_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER);
@ -76,7 +73,7 @@ class ClassManager
* @return array
*/
public static function get_users($class_id) {
$class_id = intval($class_id);
$class_id = intval($class_id);
$table_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER);
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
$sql = "SELECT * FROM $table_class_user cu, $table_user u WHERE cu.class_id = '".$class_id."' AND cu.user_id = u.user_id";
@ -111,9 +108,9 @@ class ClassManager
* @param int $class_id The class id
*/
public static function unsubscribe_user($user_id, $class_id) {
$class_id = intval($class_id);
$class_id = intval($class_id);
$user_id = intval($user_id);
$table_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER);
$table_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
$courses = ClassManager :: get_courses($class_id);
@ -138,7 +135,7 @@ class ClassManager
* @return array
*/
public static function get_courses($class_id) {
$class_id = intval($class_id);
$class_id = intval($class_id);
$table_class_course = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$sql = "SELECT * FROM $table_class_course cc, $table_course c WHERE cc.class_id = '".$class_id."' AND cc.course_code = c.code";
@ -224,4 +221,4 @@ class ClassManager
}
return $classes;
}
}
}

@ -2547,7 +2547,6 @@ class CourseManager
*/
public static function select_and_sort_categories($element, $defaultCode = null, $parentCode = null , $padding = null)
{
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
setCategoriesInForm($element, $defaultCode, $parentCode , $padding);
}

@ -7,11 +7,9 @@
* @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.course_description
*/
/**
* Code
*/
/**
* CourseDescription can be used to instanciate objects or as a library to manage course descriptions
* Class CourseDescription Lanage course descriptions
* @package chamilo.course_description
*/
class CourseDescription
@ -531,4 +529,4 @@ class CourseDescription
public function get_progress() {
return $this->progress;
}
}
}

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Course request manager
* @package chamilo.library

@ -1370,7 +1370,6 @@ class Display
}
// If it's a learning path, ensure it is currently visible to the user
if ($item_property['tool'] == TOOL_LEARNPATH) {
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php';
if (!learnpath::is_lp_visible_for_student($item_property['ref'], $user_id, $course_code)) {
continue;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save