Adding Event and ExerciseLib classes.

1.10.x
Julio Montoya 11 years ago
parent 56aa4696af
commit 7bf47ed59c
  1. 6
      index.php
  2. 20
      main/admin/configure_homepage.php
  3. 4
      main/admin/event_type.php
  4. 10
      main/admin/settings.lib.php
  5. 6
      main/admin/settings.php
  6. 2
      main/admin/special_exports.php
  7. 2
      main/admin/sub_language.class.php
  8. 2
      main/announcements/download.php
  9. 2
      main/attendance/layout.php
  10. 3
      main/auth/external_login/login.ldap.php
  11. 3
      main/auth/external_login/login.ws.php
  12. 32
      main/auth/external_login/newUser.ldap.php
  13. 2
      main/auth/external_login/newUser.php
  14. 2
      main/auth/inscription.php
  15. 2
      main/auth/ldap/login.php
  16. 6
      main/auth/shibboleth/lib/shibboleth_session.class.php
  17. 42
      main/auth/sso/sso.Drupal.class.php
  18. 36
      main/auth/sso/sso.class.php
  19. 2
      main/blog/download.php
  20. 2
      main/calendar/agenda.php
  21. 2
      main/calendar/download.php
  22. 2
      main/chat/chat.php
  23. 34
      main/course_description/ajax_controller.class.php
  24. 54
      main/course_description/controller.class.php
  25. 6
      main/course_description/layout.php
  26. 2
      main/course_home/course_home.php
  27. 6
      main/course_progress/layout.php
  28. 2
      main/course_progress/layout_no_header.php
  29. 2
      main/document/create_audio.php
  30. 2
      main/document/create_document.php
  31. 2
      main/document/create_draw.php
  32. 2
      main/document/create_paint.php
  33. 6
      main/document/document.php
  34. 4
      main/document/document_lite.php
  35. 2
      main/document/download.php
  36. 10
      main/document/download_scorm.php
  37. 2
      main/document/downloadfolder.inc.php
  38. 2
      main/document/edit_document.php
  39. 2
      main/document/edit_draw.php
  40. 2
      main/document/edit_paint.php
  41. 4
      main/document/file.php
  42. 3
      main/document/record_audio.php
  43. 2
      main/document/record_audio_wami.php
  44. 3
      main/document/webcam_clip.php
  45. 2
      main/dropbox/index.php
  46. 4
      main/exercice/Hpdownload.php
  47. 7
      main/exercice/admin.php
  48. 16
      main/exercice/exercice.php
  49. 49
      main/exercice/exercise.class.php
  50. 2990
      main/exercice/exercise.lib.php
  51. 4
      main/exercice/exercise_reminder.php
  52. 2
      main/exercice/exercise_report.php
  53. 12
      main/exercice/exercise_result.php
  54. 10
      main/exercice/exercise_show.php
  55. 20
      main/exercice/exercise_submit.php
  56. 8
      main/exercice/overview.php
  57. 2
      main/exercice/question_list_admin.inc.php
  58. 4
      main/exercice/question_pool.php
  59. 2
      main/exercice/result.php
  60. 14
      main/exercice/stats.php
  61. 12
      main/exercice/testcategory.class.php
  62. 2
      main/forum/download.php
  63. 2
      main/forum/forumsearch.php
  64. 2
      main/forum/index.php
  65. 16
      main/glossary/ajax_controller.class.php
  66. 36
      main/glossary/controller.class.php
  67. 2
      main/glossary/index.php
  68. 2
      main/gradebook/lib/be/category.class.php
  69. 2
      main/inc/ajax/course.ajax.php
  70. 4
      main/inc/ajax/events.ajax.php
  71. 10
      main/inc/ajax/exercise.ajax.php
  72. 12
      main/inc/ajax/model.ajax.php
  73. 4
      main/inc/ajax/user_manager.ajax.php
  74. 4
      main/inc/global.inc.php
  75. 2
      main/inc/lib/add_course.lib.inc.php
  76. 4
      main/inc/lib/career.lib.php
  77. 10
      main/inc/lib/course.lib.php
  78. 3175
      main/inc/lib/events.lib.inc.php
  79. 3620
      main/inc/lib/exercise.lib.php
  80. 14
      main/inc/lib/exercise_show_functions.lib.php
  81. 12
      main/inc/lib/group_portal_manager.lib.php
  82. 2
      main/inc/lib/login.lib.php
  83. 4
      main/inc/lib/promotion.lib.php
  84. 10
      main/inc/lib/sessionmanager.lib.php
  85. 64
      main/inc/lib/tracking.lib.php
  86. 16
      main/inc/lib/usermanager.lib.php
  87. 3
      main/inc/lib/userportal.lib.php
  88. 14
      main/inc/local.inc.php
  89. 36
      main/link/ajax_controller.class.php
  90. 48
      main/link/controller.class.php
  91. 2
      main/link/link.php
  92. 2
      main/link/link_goto.php
  93. 2
      main/messages/download.php
  94. 2
      main/mySpace/myStudents.php
  95. 2
      main/newscorm/download.php
  96. 3
      main/newscorm/learnpath_functions.inc.php
  97. 2
      main/newscorm/lp_edit.php
  98. 2
      main/newscorm/lp_list.php
  99. 2
      main/newscorm/lp_list_search.php
  100. 18
      main/notebook/ajax_controller.class.php
  101. Some files were not shown because too many files have changed in this diff Show More

@ -66,7 +66,7 @@ $_setting['display_courses_to_anonymous_users'] = 'true';
*/
if (isset($_GET['submitAuth']) && $_GET['submitAuth'] == 1) {
$i = api_get_anonymous_id();
event_system(LOG_ATTEMPTED_FORCED_LOGIN, 'tried_hacking_get', $_SERVER['REMOTE_ADDR'].(empty($_POST['login'])?'':'/'.$_POST['login']),null,$i);
Event::addEvent(LOG_ATTEMPTED_FORCED_LOGIN, 'tried_hacking_get', $_SERVER['REMOTE_ADDR'].(empty($_POST['login'])?'':'/'.$_POST['login']),null,$i);
echo 'Attempted breakin - sysadmins notified.';
session_destroy();
die();
@ -110,7 +110,7 @@ if (!empty($_POST['submitAuth'])) {
}
Database::free_result($result_last_login);
//event_login();
//Event::event_login();
if (api_is_platform_admin()) {
// decode all open event informations and fill the track_c_* tables
include api_get_path(LIBRARY_PATH).'stats.lib.inc.php';
@ -120,7 +120,7 @@ if (!empty($_POST['submitAuth'])) {
// End login -- if ($_POST['submitAuth'])
} else {
// Only if login form was not sent because if the form is sent the user was already on the page.
event_open();
Event::event_open();
}
if (api_get_setting('display_categories_on_homepage') == 'true') {

@ -272,7 +272,7 @@ if (!empty($action)) {
if (EventsMail::check_if_using_class('portal_homepage_edited')) {
EventsDispatcher::events('portal_homepage_edited',array('about_user' => api_get_user_id()));
}
event_system(
Event::addEvent(
LOG_HOMEPAGE_CHANGED,
'edit_top',
cut(strip_tags($home_top), 254),
@ -330,7 +330,7 @@ if (!empty($action)) {
fputs($fp, "<b>$notice_title</b><br />\n$notice_text");
fclose($fp);
}
event_system(LOG_HOMEPAGE_CHANGED, 'edit_notice', cut(strip_tags($notice_title), 254), api_get_utc_datetime(), api_get_user_id());
Event::addEvent(LOG_HOMEPAGE_CHANGED, 'edit_notice', cut(strip_tags($notice_title), 254), api_get_utc_datetime(), api_get_user_id());
break;
case 'edit_news':
//Filter
@ -376,7 +376,7 @@ if (!empty($action)) {
}
}
}
event_system(LOG_HOMEPAGE_CHANGED, 'edit_news', strip_tags(cut($home_news, 254)), api_get_utc_datetime(), api_get_user_id());
Event::addEvent(LOG_HOMEPAGE_CHANGED, 'edit_news', strip_tags(cut($home_news, 254)), api_get_utc_datetime(), api_get_user_id());
break;
case 'insert_tabs':
case 'edit_tabs':
@ -541,13 +541,13 @@ if (!empty($action)) {
}
}
}
event_system(
LOG_HOMEPAGE_CHANGED,
$action,
cut($link_name . ':' . $link_url, 254),
api_get_utc_datetime(),
api_get_user_id()
);
Event::addEvent(
LOG_HOMEPAGE_CHANGED,
$action,
cut($link_name . ':' . $link_url, 254),
api_get_utc_datetime(),
api_get_user_id()
);
break;
} //end of switch($action)

@ -38,12 +38,12 @@ if ($action == 'modEventType') {
if (!empty($event_name)) {
$eventName = $event_name;
}
save_event_type_message($eventName, $users, $eventMessage, $eventSubject, $eventMessageLanguage, $activated);
Event::save_event_type_message($eventName, $users, $eventMessage, $eventSubject, $eventMessageLanguage, $activated);
header('location: event_controller.php');
exit;
}
$ets = get_all_event_types();
$ets = Event::get_all_event_types();
$languages = api_get_languages();

@ -22,7 +22,7 @@ function handle_regions()
// Add event to the system log.
$user_id = api_get_user_id();
$category = $_GET['category'];
event_system(
Event::addEvent(
LOG_CONFIGURATION_SETTINGS_CHANGE,
LOG_CONFIGURATION_SETTINGS_CATEGORY,
$category,
@ -116,7 +116,7 @@ function handle_plugins()
// Add event to the system log.
$user_id = api_get_user_id();
$category = $_GET['category'];
event_system(
Event::addEvent(
LOG_CONFIGURATION_SETTINGS_CHANGE,
LOG_CONFIGURATION_SETTINGS_CATEGORY,
$category,
@ -255,7 +255,7 @@ function handle_stylesheets()
// Add event to the system log.
$user_id = api_get_user_id();
$category = $_GET['category'];
event_system(
Event::addEvent(
LOG_CONFIGURATION_SETTINGS_CHANGE,
LOG_CONFIGURATION_SETTINGS_CATEGORY,
$category,
@ -755,7 +755,7 @@ function handle_templates() {
// Add event to the system log.
$user_id = api_get_user_id();
$category = $_GET['category'];
event_system(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_CATEGORY, $category, api_get_utc_datetime(), $user_id);
Event::addEvent(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_CATEGORY, $category, api_get_utc_datetime(), $user_id);
} else {
if ($action == 'delete' && is_numeric($_GET['id'])) {
delete_template($_GET['id']);
@ -763,7 +763,7 @@ function handle_templates() {
// Add event to the system log
$user_id = api_get_user_id();
$category = $_GET['category'];
event_system(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_CATEGORY, $category, api_get_utc_datetime(), $user_id);
Event::addEvent(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_CATEGORY, $category, api_get_utc_datetime(), $user_id);
}
display_templates();
}

@ -330,7 +330,7 @@ if (!empty($_GET['category']) &&
// Add event configuration settings category to the system log.
$user_id = api_get_user_id();
$category = $_GET['category'];
event_system(
Event::addEvent(
LOG_CONFIGURATION_SETTINGS_CHANGE,
LOG_CONFIGURATION_SETTINGS_CATEGORY,
$category,
@ -342,7 +342,7 @@ if (!empty($_GET['category']) &&
if (is_array($keys) && count($keys) > 0) {
foreach ($keys as $variable) {
if (in_array($key, $settings_to_avoid)) { continue; }
event_system(
Event::addEvent(
LOG_CONFIGURATION_SETTINGS_CHANGE,
LOG_CONFIGURATION_SETTINGS_VARIABLE,
$variable,
@ -482,7 +482,7 @@ if (!empty($_GET['category'])) {
// add event to system log
$user_id = api_get_user_id();
$category = $_GET['category'];
event_system(
Event::addEvent(
LOG_CONFIGURATION_SETTINGS_CHANGE,
LOG_CONFIGURATION_SETTINGS_CATEGORY,
$category,

@ -190,7 +190,7 @@ function create_zip(){
}
function rename_zip($FileZip) {
event_download(($FileZip['PATH'] == '/')?'full_export_'.date('Ymd').'.zip (folder)': basename($FileZip['PATH']).'.zip (folder)');
Event::event_download(($FileZip['PATH'] == '/')?'full_export_'.date('Ymd').'.zip (folder)': basename($FileZip['PATH']).'.zip (folder)');
$name = ($FileZip['PATH']=='/')? 'full_export_'.date('Ymd').'.zip':basename($FileZip['PATH']).'.zip';
if(file_exists($FileZip['PATH_TEMP_ARCHIVE'].'/'.$name)){ unlink($FileZip['PATH_TEMP_ARCHIVE'].'/'.$name); }
if(file_exists($FileZip['TEMP_FILE_ZIP'])) {

@ -355,7 +355,7 @@ class SubLanguageManager
$lang = Database::fetch_array($result);
$sql_update_2 = "UPDATE " . $tbl_settings_current . " SET selected_value='" . $lang['english_name'] . "' WHERE variable='platformLanguage'";
$result_2 = Database::query($sql_update_2);
event_system(LOG_PLATFORM_LANGUAGE_CHANGE, LOG_PLATFORM_LANGUAGE, $lang['english_name']);
Event::addEvent(LOG_PLATFORM_LANGUAGE_CHANGE, LOG_PLATFORM_LANGUAGE, $lang['english_name']);
return $result_2 !== false;
}

@ -53,7 +53,7 @@ if (is_dir($full_file_name)) {
$tbl_announcement_attachment = Database::get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT);
// launch event
event_download($doc_url);
Event::event_download($doc_url);
$course_id = api_get_course_int_id();

@ -18,7 +18,7 @@ Display :: display_header('');
Display::display_introduction_section($tool);
// Tracking
event_access_tool($tool);
Event::event_access_tool($tool);
// Display
echo $content;

@ -65,8 +65,7 @@ if ($ldap_user !== false) {
Session::write('_user', $_user);
$uidReset = true;
$logging_in = true;
event_login();
error_log("Calling event_login");
Event::event_login();
} else {
error_log('extldap_authenticate error');
$loginFailed = true;

@ -27,8 +27,7 @@ if ($isValid === 1) {
Session::write('_user', $_user);
$uidReset = true;
$logging_in = true;
event_login();
//error_log('Calling event_login');
Event::event_login();
} else {
//error_log('WS authentication error - user not approved by external WS');
$loginFailed = true;

@ -2,38 +2,38 @@
// External login module : LDAP
/**
* This file is included by main/inc/local.inc.php when extldap is activated, a user try to login
* This file is included by main/inc/local.inc.php when extldap is activated, a user try to login
* and chamilo does not find his user
* Variables that can be used :
* Variables that can be used :
* - $login : string containing the username posted by the user
* - $password : string containing the password posted by the user
*
* Please configure the exldap module in main/auth/external_login/ldap.conf.php
*
* If login succeeds, we have to add the user in the chamilo database and then
* we have 2 choices :
* 1. - set $loginFailed to false,
* - set $_SESSION['_user']['user_id'] with the dokeos user_id
*
* If login succeeds, we have to add the user in the chamilo database and then
* we have 2 choices :
* 1. - set $loginFailed to false,
* - set $_SESSION['_user']['user_id'] with the dokeos user_id
* - set $uidReset to true
* - let the script local.inc.php continue
*
* 2. - set $_SESSION['_user']['user_id'] with the dokeos user_id
* 2. - set $_SESSION['_user']['user_id'] with the dokeos user_id
* - set $_SESSION['_user']['uidReset'] to true
* - upgrade user info in dokeos database if needeed
* - redirect to any page and let local.inc.php do the magic
*
*
* If login fails we have also 2 choices :
* 1. - unset $_user['user_id']
* - set $loginFailed=true
* 1. - unset $_user['user_id']
* - set $loginFailed=true
* - set $uidReset = false
* User wil then have the user password incorrect message
*
* 2. We redirect the user to index.php with appropriate message :
* Possible messages are :
* 2. We redirect the user to index.php with appropriate message :
* Possible messages are :
* - index.php?loginFailed=1&error=access_url_inactive
* - index.php?loginFailed=1&error=account_expired
* - index.php?loginFailed=1&error=account_inactive
* - index.php?loginFailed=1&error=user_password_incorrect
* - index.php?loginFailed=1&error=user_password_incorrect
* - index.php?loginFailed=1&error=unrecognize_sso_origin');
* */
@ -55,13 +55,13 @@ if ($ldap_user !== false) {
$_user['uidReset'] = true;
Session::write('_user', $_user);
$uidReset = true;
// Is user admin?
// Is user admin?
if ($chamilo_user['admin'] === true) {
$is_platformAdmin = true;
Database::query("INSERT INTO admin values ('$chamilo_uid')");
}
}
event_login();
Event::event_login();
} else {
$loginFailed = true;
$uidReset = false;

@ -46,7 +46,7 @@ if ($user !== false && ($chamilo_uid = external_add_user($user)) !== false) {
// Can user create course
$is_allowedCreateCourse = (bool) (($user['status'] == COURSEMANAGER) or (api_get_setting('drhCourseManagerRights') and $user['status'] == SESSIONADMIN));
event_login();
Event::event_login();
} else {
$loginFailed = true;
unset($_user['user_id']);

@ -601,7 +601,7 @@ if ($form->validate()) {
Session::write('is_allowedCreateCourse', $is_allowedCreateCourse);
// Stats
event_login();
Event::event_login();
// last user login date is now
$user_last_login_datetime = 0; // used as a unix timestamp it will correspond to : 1 1 1970

@ -34,7 +34,7 @@ if ($loginLdapSucces)
$_user['user_id'] = $uData['user_id'];
Session::write('_uid',$_uid);
// Jand: copied from event_login in events.lib.php to enable login statistics:
event_login();
Event::event_login();
}
else
{

@ -80,14 +80,14 @@ class ShibbolethSession
$_SESSION['noredirection'] = true;
//must be called before 'init_local.inc.php'
event_login();
Event::event_login();
//used in 'init_local.inc.php' this is BAD but and should be changed
$loginFailed = false;
$uidReset = true;
$gidReset = true;
$cidReset = false; //FALSE !!
$cidReset = false; //FALSE !!
$mainDbName = Database :: get_main_database();
$includePath = api_get_path(INCLUDE_PATH);
@ -98,4 +98,4 @@ class ShibbolethSession
return $_user;
}
}
}

@ -4,7 +4,7 @@ use \ChamiloSession as Session;
/* For licensing terms, see /license.txt */
/**
* This file contains the necessary elements to implement a Single Sign On
* This file contains the necessary elements to implement a Single Sign On
* mechanism with an external Drupal application (on which the Chamilo module
* 7.x-1.0-alpha3 or above must be implemented)
*
@ -16,7 +16,7 @@ use \ChamiloSession as Session;
*
* @package chamilo.auth.sso
*/
/**
* The SSO class allows for management of remote Single Sign On resources
*/
@ -44,9 +44,9 @@ class ssoDrupal {
$this->master_url = $this->protocol.$this->domain.$this->auth_uri;
$this->target = api_get_path(WEB_PATH);
}
/**
* Unlogs the user from the remote server
* Unlogs the user from the remote server
*/
public function logout() {
header('Location: '.$this->deauth_url);
@ -69,7 +69,7 @@ class ssoDrupal {
header('Location: '.$this->master_url.$params);
exit;
}
/**
* Validates the received active connection data with the database
* @return bool Return the loginFailed variable value to local.inc.php
@ -100,29 +100,29 @@ class ssoDrupal {
//Check the user's password
if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE) {
if ($sso['secret'] === sha1($uData['username'].$sso_challenge.api_get_security_key())
if ($sso['secret'] === sha1($uData['username'].$sso_challenge.api_get_security_key())
&& ($sso['username'] == $uData['username'])) {
//Check if the account is active (not locked)
if ($uData['active']=='1') {
// check if the expiration date has not been reached
if ($uData['expiration_date'] > date('Y-m-d H:i:s') OR $uData['expiration_date']=='0000-00-00 00:00:00') {
if ($uData['expiration_date'] > date('Y-m-d H:i:s') OR $uData['expiration_date']=='0000-00-00 00:00:00') {
//If Multiple URL is enabled
if (api_get_multiple_access_url()) {
//Check the access_url configuration setting if the user is registered in the access_url_rel_user table
//Getting the current access_url_id of the platform
$current_access_url_id = api_get_current_access_url_id();
// my user is subscribed in these
// my user is subscribed in these
//sites: $my_url_list
$my_url_list = api_get_access_url_from_user($uData['user_id']);
} else {
$current_access_url_id = 1;
$my_url_list = array(1);
}
$my_user_is_admin = UserManager::is_admin($uData['user_id']);
if ($my_user_is_admin === false) {
if (is_array($my_url_list) && count($my_url_list) > 0 ) {
if (in_array($current_access_url_id, $my_url_list)) {
@ -130,7 +130,7 @@ class ssoDrupal {
$_user['user_id'] = $uData['user_id'];
$_user = api_get_user_info($_user['user_id']);
Session::write('_user', $_user);
event_login();
Event::event_login();
// Redirect to homepage
$sso_target = isset($sso['target']) ? $sso['target'] : api_get_path(WEB_PATH) .'.index.php';
header('Location: '. $sso_target);
@ -143,7 +143,7 @@ class ssoDrupal {
exit;
}
} else {
// there is no URL in the multiple
// there is no URL in the multiple
// urls list for this user
$loginFailed = true;
Session::erase('_uid');
@ -153,23 +153,23 @@ class ssoDrupal {
} else {
//Only admins of the "main" (first) Chamilo
// portal can login wherever they want
if (in_array(1, $my_url_list)) {
//Check if this admin is admin on the
if (in_array(1, $my_url_list)) {
//Check if this admin is admin on the
// principal portal
$_user['user_id'] = $uData['user_id'];
$_user = api_get_user_info($_user['user_id']);
$is_platformAdmin = $uData['status'] == COURSEMANAGER;
Session::write('is_platformAdmin', $is_platformAdmin);
Session::write('_user', $_user);
event_login();
Event::event_login();
} else {
//Secondary URL admin wants to login
//Secondary URL admin wants to login
// so we check as a normal user
if (in_array($current_access_url_id, $my_url_list)) {
$_user['user_id'] = $uData['user_id'];
$_user = api_get_user_info($_user['user_id']);
Session::write('_user',$_user);
event_login();
Event::event_login();
} else {
$loginFailed = true;
Session::erase('_uid');
@ -177,7 +177,7 @@ class ssoDrupal {
exit;
}
}
}
}
} else {
// user account expired
$loginFailed = true;
@ -215,7 +215,7 @@ class ssoDrupal {
}
return $loginFailed;
}
/**
* Decode the cookie (this function may vary depending on the
* Single Sign On implementation
@ -230,7 +230,7 @@ class ssoDrupal {
* Generate the URL for profile editing for a any user or the current user
* @param int $userId Optional. The user id
* @param boolean $asAdmin Optional. Whether get the URL for the platform admin
* @return string If the URL is obtained return the drupal_user_id. Otherwise return false
* @return string If the URL is obtained return the drupal_user_id. Otherwise return false
*/
public function generateProfileEditingURL($userId = 0, $asAdmin = false)
{

@ -4,11 +4,11 @@ use \ChamiloSession as Session;
/* For licensing terms, see /license.txt */
/**
* This file contains the necessary elements to implement a Single Sign On
* mechanism with an arbitrary external web application (given some light
* This file contains the necessary elements to implement a Single Sign On
* mechanism with an arbitrary external web application (given some light
* development there) and is based on the Drupal-Chamilo module implementation.
* To develop a new authentication mechanism, please extend this class and
* overwrite its method, then modify the corresponding calling code in
* overwrite its method, then modify the corresponding calling code in
* main/inc/local.inc.php
* @package chamilo.auth.sso
*/
@ -40,16 +40,16 @@ class sso {
$this->master_url = $this->protocol.$this->domain.$this->auth_uri;
$this->target = api_get_path(WEB_PATH);
}
/**
* Unlogs the user from the remote server
* Unlogs the user from the remote server
*/
public function logout()
{
header('Location: '.$this->deauth_url);
exit;
}
/**
* Sends the user to the master URL for a check of active connection
*/
@ -68,7 +68,7 @@ class sso {
header('Location: '.$this->master_url.$params);
exit;
}
/**
* Validates the received active connection data with the database
* @return bool Return the loginFailed variable value to local.inc.php
@ -79,10 +79,10 @@ class sso {
$loginFailed = false;
//change the way we recover the cookie depending on how it is formed
$sso = $this->decode_cookie($_GET['sso_cookie']);
//error_log('check_user');
//error_log('sso decode cookie: '.print_r($sso,1));
//lookup the user in the main database
$user_table = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT user_id, username, password, auth_source, active, expiration_date, status
@ -97,7 +97,7 @@ class sso {
//This user's authentification is managed by Chamilo itself
// check the user's password
// password hash comes already parsed in sha1, md5 or none
/*
error_log($sso['secret']);
error_log($uData['password']);
@ -125,7 +125,7 @@ class sso {
// check if the expiration date has not been reached
if ($uData['expiration_date'] > date('Y-m-d H:i:s')
or $uData['expiration_date']=='0000-00-00 00:00:00') {
//If Multiple URL is enabled
if (api_get_multiple_access_url()) {
//Check the access_url configuration setting if
@ -139,9 +139,9 @@ class sso {
$current_access_url_id = 1;
$my_url_list = array(1);
}
$my_user_is_admin = UserManager::is_admin($uData['user_id']);
if ($my_user_is_admin === false) {
if (is_array($my_url_list) && count($my_url_list) > 0) {
if (in_array($current_access_url_id, $my_url_list)) {
@ -149,7 +149,7 @@ class sso {
$_user['user_id'] = $uData['user_id'];
$_user = api_get_user_info($_user['user_id']);
Session::write('_user', $_user);
event_login();
Event::event_login();
// Redirect to homepage
$sso_target = isset($sso['target']) ? $sso['target'] : api_get_path(WEB_PATH) .'.index.php';
header('Location: '. $sso_target);
@ -180,7 +180,7 @@ class sso {
$is_platformAdmin = $uData['status'] == COURSEMANAGER;
Session::write('is_platformAdmin', $is_platformAdmin);
Session::write('_user', $_user);
event_login();
Event::event_login();
} else {
//Secondary URL admin wants to login
// so we check as a normal user
@ -188,7 +188,7 @@ class sso {
$_user['user_id'] = $uData['user_id'];
$_user = api_get_user_info($_user['user_id']);
Session::write('_user', $_user);
event_login();
Event::event_login();
} else {
$loginFailed = true;
Session::erase('_uid');
@ -243,7 +243,7 @@ class sso {
}
return $loginFailed;
}
/**
* Decode the cookie (this function may vary depending on the
* Single Sign On implementation
@ -259,7 +259,7 @@ class sso {
* Generate the URL for profile editing for a any user or the current user
* @param int $userId Optional. The user id
* @param boolean $asAdmin Optional. Whether get the URL for the platform admin
* @return string The SSO URL
* @return string The SSO URL
*/
public function generateProfileEditingURL($userId = 0, $asAdmin = false)
{

@ -51,7 +51,7 @@ $tbl_blogs_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
$course_id = api_get_course_int_id();
// launch event
event_download($doc_url);
Event::event_download($doc_url);
$sql = 'SELECT filename FROM '.$tbl_blogs_attachment.'
WHERE c_id = '.$course_id.' AND path LIKE BINARY "'.Database::escape_string($doc_url).'"';

@ -63,7 +63,7 @@ function plus_repeated_event() {
// setting the name of the tool
$nameTools = get_lang('Agenda');
event_access_tool(TOOL_CALENDAR_EVENT);
Event::event_access_tool(TOOL_CALENDAR_EVENT);
// permission stuff - also used by loading from global in agenda.inc.php
$is_allowed_to_edit = api_is_allowed_to_edit(false, true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous());

@ -67,7 +67,7 @@ if (is_dir($full_file_name)) {
$tbl_agenda_attachment = Database::get_course_table(TABLE_AGENDA_ATTACHMENT);
// launch event
event_download($doc_url);
Event::event_download($doc_url);
$sql='SELECT filename FROM '.$tbl_agenda_attachment.'
WHERE c_id = '.$course_id.' AND path LIKE BINARY "'.Database::escape_string($doc_url).'"';

@ -26,7 +26,7 @@ if ($origin != 'whoisonline') {
/* TRACKING */
event_access_tool(TOOL_CHAT);
Event::event_access_tool(TOOL_CHAT);
header('Content-Type: text/html; charset='.api_get_system_encoding());
/*

@ -19,14 +19,14 @@ use Header;
/**
* Ajax controller. Dispatch request and perform required action.
*
* - delete category/link
*
*
* - delete category/link
*
* Usage:
*
*
* $controller = AjaxController::instance();
* $controller->run();
*
*
* @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Genevas
* @license /license.txt
*/
@ -38,7 +38,7 @@ class AjaxController extends \Controller
/**
* Return the instance of the controller.
*
*
* @return \CourseDescription\AjaxController
*/
public static function instance()
@ -52,15 +52,15 @@ class AjaxController extends \Controller
protected function __construct()
{
}
/**
* Prepare the environment. Set up breadcrumps and raise tracking event.
* Prepare the environment. Set up breadcrumps and raise tracking event.
*/
protected function prolog()
{
event_access_tool(TOOL_COURSE_DESCRIPTION);
Event::event_access_tool(TOOL_COURSE_DESCRIPTION);
}
public function is_allowed_to_edit()
@ -79,7 +79,7 @@ class AjaxController extends \Controller
}
return true;
}
public function authorize()
{
$authorize = api_protect_course_script();
@ -102,7 +102,7 @@ class AjaxController extends \Controller
}
/**
*
*
*/
public function delete()
{
@ -120,7 +120,7 @@ class AjaxController extends \Controller
$this->response($success);
}
/**
*
*
*/
public function delete_by_course()
{
@ -128,11 +128,11 @@ class AjaxController extends \Controller
$this->forbidden();
return;
}
$course = (object) array();
$course->c_id = Request::get_c_id();
$course->session_id = Request::get_session_id();
$success = CourseDescription::repository()->remove_by_course($course);
$this->response($success);
@ -149,7 +149,7 @@ class AjaxController extends \Controller
}
/**
* Action exists but implementation is missing.
* Action exists but implementation is missing.
*/
public function missing()
{
@ -158,9 +158,9 @@ class AjaxController extends \Controller
/**
* Display a standard json responce.
*
*
* @param bool $success
* @param string $message
* @param string $message
* @param object $data
*/
public function response($success = false, $message = '', $data = null)

@ -13,18 +13,18 @@ use Javascript;
/**
* Controller for course description. Dispatch request and peform required action.
*
*
* - list course description for course
* - add a new course description to a course/session
* - edit a course session
* - delete a course session
*
*
* Usage:
*
*
* $controller = CourseDescriptionController::instance();
* $controller->run();
*
* @package chamilo.course_description
*
* @package chamilo.course_description
* @author Christian Fasanando <christian1827@gmail.com>
* @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Genevas
* @license see /license.txt
@ -42,8 +42,8 @@ class Controller extends \Controller
/**
* Return the instance of the controller.
*
* @return CourseDescriptionController
*
* @return CourseDescriptionController
*/
public static function instance()
{
@ -56,13 +56,13 @@ class Controller extends \Controller
protected function __construct()
{
}
/**
* Action to perform.
* Action to perform.
* Returns the request parameter.
*
*
* @return string
*/
public function get_action()
@ -95,8 +95,8 @@ class Controller extends \Controller
/**
* Whether the call is authorized or not.
*
* @return boolean
*
* @return boolean
*/
public function authorize()
{
@ -114,7 +114,7 @@ class Controller extends \Controller
}
/**
* Prepare the environment. Set up breadcrumps and raise tracking event.
* Prepare the environment. Set up breadcrumps and raise tracking event.
*/
protected function prolog()
{
@ -135,12 +135,12 @@ class Controller extends \Controller
$current_course_tool = TOOL_COURSE_DESCRIPTION;
// Tracking
event_access_tool(TOOL_COURSE_DESCRIPTION);
Event::event_access_tool(TOOL_COURSE_DESCRIPTION);
}
/**
* Javascript used by the controller
*
*
* @return string
*/
public function javascript()
@ -156,10 +156,10 @@ class Controller extends \Controller
/**
* Returns a url for an action that the controller can process
*
*
* @param string $action
* @param array $params
* @return string
* @return string
*/
public function url($action = '', $params = array())
{
@ -185,8 +185,8 @@ class Controller extends \Controller
/**
* List course descriptions.
*
* @param array messages
*
* @param array messages
*/
public function listing()
{
@ -203,7 +203,7 @@ class Controller extends \Controller
}
/**
* Performs the edit action.
* Performs the edit action.
*/
public function edit()
{
@ -211,7 +211,7 @@ class Controller extends \Controller
$this->forbidden();
return;
}
$id = Request::get_id();
$c_id = Request::get_c_id();
@ -223,13 +223,13 @@ class Controller extends \Controller
if ($form->validate()) {
$success = $repo->save($description);
$message = $success ? get_lang('DescriptionUpdated') : get_lang('Error');
$home = $this->url(self::ACTION_DEFAULT);
Redirect::go($home);
}
$data = (object) array();
$data->form = $form;
$this->render('edit', $data);
@ -285,7 +285,7 @@ class Controller extends \Controller
/**
* Performs the delete action.
*
*
* @todo: could be worth to require a security token in the url and check it. Currently confirmation is done through javascript confirmation only.
*/
public function delete()
@ -344,7 +344,7 @@ class Controller extends \Controller
$path = $file->tmp_name;
$reader = new CsvReader($path);
$descriptions = $reader->get_items();
$c_id = Request::get_c_id();
$session_id = Request::get_session_id();
$course = (object) array();
@ -364,10 +364,10 @@ class Controller extends \Controller
/**
* Render a template using data. Adds a few common parameters to the data array.
*
*
* @see /main/template/default/course_description/
* @param string $template
* @param array $data
* @param array $data
*/
protected function render($template, $data)
{

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */
/**
* Layout (principal view) used for structuring other views
* Layout (principal view) used for structuring other views
* @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.course_description
*/
@ -17,10 +17,10 @@ Display :: display_header('');
Display::display_introduction_section(TOOL_COURSE_DESCRIPTION);
// Tracking
event_access_tool(TOOL_COURSE_DESCRIPTION);
Event::event_access_tool(TOOL_COURSE_DESCRIPTION);
// Display
echo $content;
// Footer
Display :: display_footer();
Display :: display_footer();

@ -183,7 +183,7 @@ api_protect_course_script(true);
/* STATISTICS */
if (!isset($coursesAlreadyVisited[$course_code])) {
event_access_course();
Event::accessCourse();
$coursesAlreadyVisited[$course_code] = 1;
Session::write('coursesAlreadyVisited', $coursesAlreadyVisited);
}

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */
/**
* Layout (principal view) used for structuring other views
* Layout (principal view) used for structuring other views
* @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.course_progress
*/
@ -18,10 +18,10 @@ Display :: display_header('');
Display::display_introduction_section($tool);
// Tracking
event_access_tool($tool);
Event::event_access_tool($tool);
// Display
echo $content;
// Footer
Display :: display_footer();
Display :: display_footer();

@ -7,7 +7,7 @@ api_protect_course_script(true);
Display :: display_reduced_header();
// Tracking
event_access_tool($tool);
Event::event_access_tool($tool);
// Display

@ -93,7 +93,7 @@ if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] ||
/* Header */
event_access_tool(TOOL_DOCUMENT);
Event::event_access_tool(TOOL_DOCUMENT);
$display_dir = $dir;
if (isset ($group)) {

@ -307,7 +307,7 @@ if (!($is_allowed_to_edit ||
/* Header */
event_access_tool(TOOL_DOCUMENT);
Event::event_access_tool(TOOL_DOCUMENT);
$display_dir = $dir;
if (isset($group_properties)) {

@ -97,7 +97,7 @@ if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] ||
/* Header */
event_access_tool(TOOL_DOCUMENT);
Event::event_access_tool(TOOL_DOCUMENT);
$display_dir = $dir;
if (isset ($group)) {
$display_dir = explode('/', $dir);

@ -97,7 +97,7 @@ if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] ||
}
/* Header */
event_access_tool(TOOL_DOCUMENT);
Event::event_access_tool(TOOL_DOCUMENT);
$display_dir = $dir;
if (isset ($group)) {
$display_dir = explode('/', $dir);

@ -268,7 +268,7 @@ switch ($action) {
api_not_allowed();
}
// Launch event
event_download($document_data['url']);
Event::event_download($document_data['url']);
// Check visibility of document and paths
if (!($is_allowed_to_edit || $group_member_with_upload_rights)
&& !DocumentManager::is_visible_by_id($document_id, $courseInfo, $sessionId, api_get_user_id())) {
@ -314,7 +314,7 @@ switch ($action) {
require 'downloadfolder.inc.php';
}
// Launch event
event_download($document_data['url']);
Event::event_download($document_data['url']);
exit;
}
break;
@ -927,7 +927,7 @@ $(document).ready( function() {
</script>';
// Lib for event log, stats & tracking & record of the access
event_access_tool(TOOL_DOCUMENT);
Event::event_access_tool(TOOL_DOCUMENT);
/* DISPLAY */
if ($groupId != 0) { // Add group name after for group documents

@ -71,7 +71,7 @@ switch ($action) {
exit;
}
// Launch event
event_download($document_data['url']);
Event::event_download($document_data['url']);
// Check visibility of document and paths
if (!($is_allowed_to_edit || $group_member_with_upload_rights) && !DocumentManager::is_visible_by_id($document_id, $course_info, api_get_session_id(), api_get_user_id())) {
api_not_allowed(true);
@ -294,7 +294,7 @@ $(document).ready( function() {
// Lib for event log, stats & tracking & record of the access
event_access_tool(TOOL_DOCUMENT);
Event::event_access_tool(TOOL_DOCUMENT);
/* DISPLAY */
if ($to_group_id != 0) { // Add group name after for group documents

@ -96,7 +96,7 @@ if (Security::check_abs_path($sys_course_path.$doc_url, $sys_course_path.'/')) {
exit; // You shouldn't be here anyway.
}
// Launch event
event_download($doc_url);
Event::event_download($doc_url);
DocumentManager::file_send_for_download($full_file_name);
}
exit;

@ -6,7 +6,7 @@
* @package chamilo.document
*/
/**
* Code
* Code
*/
session_cache_limiter('none');
@ -53,12 +53,12 @@ $sys_course_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/scorm';
if (is_dir($sys_course_path.$doc_url)) {
api_not_allowed();
}
if (Security::check_abs_path($sys_course_path.$doc_url, $sys_course_path.'/')) {
$full_file_name = $sys_course_path.$doc_url;
// Launch event
event_download($doc_url);
Event::event_download($doc_url);
DocumentManager::file_send_for_download($full_file_name);
}
exit;
exit;

@ -279,7 +279,7 @@ if (api_is_allowed_to_edit()) {
}
// Launch event
event_download(($path == '/') ? 'documents.zip (folder)' : basename($path).'.zip (folder)');
Event::event_download(($path == '/') ? 'documents.zip (folder)' : basename($path).'.zip (folder)');
// Start download of created file
$name = ($path == '/') ? 'documents.zip' : $documentInfo['title'].'.zip';

@ -178,7 +178,7 @@ if (!api_is_allowed_to_edit()) {
api_not_allowed(true);
}
event_access_tool(TOOL_DOCUMENT);
Event::event_access_tool(TOOL_DOCUMENT);
//TODO:check the below code and his funcionality
if (!is_allowed_to_edit()) {

@ -115,7 +115,7 @@ if (!$is_allowedToEdit) {
api_not_allowed(true);
}
event_access_tool(TOOL_DOCUMENT);
Event::event_access_tool(TOOL_DOCUMENT);
Display :: display_header($nameTools, 'Doc');
echo '<div class="actions">';

@ -120,7 +120,7 @@ if (!$is_allowedToEdit) {
api_not_allowed(true);
}
event_access_tool(TOOL_DOCUMENT);
Event::event_access_tool(TOOL_DOCUMENT);
Display :: display_header($nameTools, 'Doc');
echo '<div class="actions">';

@ -69,7 +69,7 @@ if (count($ids) == 1) {
Response::not_found();
}
event_download(Uri::here());
Event::event_download(Uri::here());
DocumentManager::file_send_for_download($doc);
exit;
}
@ -156,5 +156,5 @@ foreach ($files as $file) {
/**
* Send file for download
*/
event_download(Uri::here());
Event::event_download(Uri::here());
DocumentManager::file_send_for_download($temp_zip_path, false, get_lang('Documents') . '.zip');

@ -86,9 +86,8 @@ if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] ||
api_not_allowed(true);
}
/* Header */
event_access_tool(TOOL_DOCUMENT);
Event::event_access_tool(TOOL_DOCUMENT);
$display_dir = $dir;
if (isset ($group)) {

@ -94,7 +94,7 @@ if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] ||
}
/* Header */
event_access_tool(TOOL_DOCUMENT);
Event::event_access_tool(TOOL_DOCUMENT);
$display_dir = $dir;
if (isset ($group)) {

@ -92,9 +92,8 @@ if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] ||
api_not_allowed(true);
}
/* Header */
event_access_tool(TOOL_DOCUMENT);
Event::event_access_tool(TOOL_DOCUMENT);
$display_dir = $dir;
if (isset ($group)) {

@ -18,7 +18,7 @@ $viewReceivedCategory = isset($_GET['view_received_category']) ? Security::remov
$viewSentCategory = isset($_GET['view_sent_category']) ? Security::remove_XSS($_GET['view_sent_category']) : null;
// Do the tracking
event_access_tool(TOOL_DROPBOX);
Event::event_access_tool(TOOL_DROPBOX);
// This var is used to give a unique value to every page request. This is to prevent resubmiting data
$dropbox_unid = md5(uniqid(rand(), true));

@ -20,7 +20,7 @@ $doc_url=str_replace(array('../','\\..','\\0','..\\'),array('','','',''),urldeco
$filename=basename($doc_url);
// launch event
//event_download($doc_url);
//Event::event_download($doc_url);
if (isset($_course['path'])) {
$course_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$full_file_name = $course_path.Security::remove_XSS($doc_url);
@ -34,7 +34,7 @@ if(!is_file($full_file_name)) {
}
if (!Security::check_abs_path($full_file_name, $course_path.'/')) {
exit;
exit;
}
$extension=explode('.',$filename);

@ -113,7 +113,12 @@ $cancelQuestion = isset($cancelQuestion) ? $cancelQuestion : null;
/* Cleaning all incomplete attempts of the admin/teacher to avoid weird problems
when changing the exercise settings, number of questions, etc */
delete_all_incomplete_attempts(api_get_user_id(), $exerciseId, api_get_course_id(), api_get_session_id());
Event::delete_all_incomplete_attempts(
api_get_user_id(),
$exerciseId,
api_get_course_id(),
api_get_session_id()
);
// get from session
$objExercise = isset($_SESSION['objExercise']) ? $_SESSION['objExercise'] : null;

@ -162,7 +162,7 @@ if ($origin != 'learnpath') {
Display :: display_reduced_header();
}
event_access_tool(TOOL_QUIZ);
Event::event_access_tool(TOOL_QUIZ);
// Tool introduction
Display :: display_introduction_section(TOOL_QUIZ);
@ -183,7 +183,7 @@ if ($is_allowedToEdit) {
if ($check) {
// list des exercices dans un test
// we got variable $courseId $courseInfo session api_get_session_id()
$exerciseList = get_all_exercises_for_course_id(
$exerciseList = ExerciseLib::get_all_exercises_for_course_id(
$courseInfo,
api_get_session_id(),
$courseId,
@ -623,7 +623,7 @@ if (!empty($exercise_list)) {
$title = $cut_title;
}
$count_exercise_not_validated = intval(count_exercise_result_not_validated($my_exercise_id, $course_code, $session_id));
$count_exercise_not_validated = intval(Event::count_exercise_result_not_validated($my_exercise_id, $course_code, $session_id));
$move = Display::return_icon('all_directions.png',get_lang('Move'), array('class'=>'moved', 'style'=>'margin-bottom:-0.5em;'));
$move = null;
@ -744,7 +744,7 @@ if (!empty($exercise_list)) {
}
//Attempts
//$attempts = get_count_exam_results($row['id']).' '.get_lang('Attempts');
//$attempts = ExerciseLib::get_count_exam_results($row['id']).' '.get_lang('Attempts');
//$item .= Display::tag('td',$attempts);
$item .= Display::tag('td', $number_of_questions);
} else {
@ -803,7 +803,7 @@ if (!empty($exercise_list)) {
if ($num > 0) {
$row_track = Database :: fetch_array($qryres);
$attempt_text = get_lang('LatestAttempt').' : ';
$attempt_text .= show_score($row_track['exe_result'], $row_track['exe_weighting']);
$attempt_text .= ExerciseLib::show_score($row_track['exe_result'], $row_track['exe_weighting']);
} else {
//No attempts
$attempt_text = get_lang('NotAttempted');
@ -843,7 +843,7 @@ if (!empty($exercise_list)) {
if ($num > 0) {
$row_track = Database :: fetch_array($qryres);
$attempt_text = get_lang('LatestAttempt').' : ';
$attempt_text .= show_score($row_track['exe_result'], $row_track['exe_weighting']);
$attempt_text .= ExerciseLib::show_score($row_track['exe_result'], $row_track['exe_weighting']);
} else {
$attempt_text = get_lang('NotAttempted');
}
@ -986,7 +986,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
} else {
// Student only
if ($active == 1) {
$attempt = getLatestHotPotatoResult(
$attempt = ExerciseLib::getLatestHotPotatoResult(
$path,
$userId,
api_get_course_int_id(),
@ -999,7 +999,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
if (!empty($attempt)) {
$actions = '<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'&filter_by_user='.$userId.'">'.Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
$attemptText = get_lang('LatestAttempt').' : ';
$attemptText .= show_score($attempt['exe_result'], $attempt['exe_weighting']).' ';
$attemptText .= ExerciseLib::show_score($attempt['exe_result'], $attempt['exe_weighting']).' ';
$attemptText .= $actions;
} else {
// No attempts.

@ -1625,7 +1625,7 @@ class Exercise
AND session_id = ".$session_id."";
Database::query($sql);
event_system(
Event::addEvent(
LOG_EXERCISE_RESULT_DELETE,
LOG_EXERCISE_ID,
$this->id,
@ -2192,7 +2192,7 @@ class Exercise
$nano = null;
if ($answerType == ORAL_EXPRESSION) {
$exe_info = get_exercise_results_by_attempt($exeId);
$exe_info = Event::get_exercise_results_by_attempt($exeId);
$exe_info = isset($exe_info[$exeId]) ? $exe_info[$exeId] : null;
$params = array();
@ -3461,24 +3461,24 @@ class Exercise
if ($final_answer == 0) {
$questionScore = 0;
}
exercise_attempt($questionScore, 1, $quesId, $exeId, 0); // we always insert the answer_id 1 = delineation
Event::saveQuestionAttempt($questionScore, 1, $quesId, $exeId, 0); // we always insert the answer_id 1 = delineation
//in delineation mode, get the answer from $hotspot_delineation_result[1]
exercise_attempt_hotspot($exeId,$quesId,1, $hotspot_delineation_result[1], $exerciseResultCoordinates[$quesId]);
Event::saveExerciseAttemptHotspot($exeId,$quesId,1, $hotspot_delineation_result[1], $exerciseResultCoordinates[$quesId]);
} else {
if ($final_answer==0) {
$questionScore = 0;
$answer=0;
exercise_attempt($questionScore, $answer, $quesId, $exeId, 0);
Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0);
if (is_array($exerciseResultCoordinates[$quesId])) {
foreach($exerciseResultCoordinates[$quesId] as $idx => $val) {
exercise_attempt_hotspot($exeId,$quesId,$idx,0,$val);
Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,0,$val);
}
}
} else {
exercise_attempt($questionScore, $answer, $quesId, $exeId, 0);
Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0);
if (is_array($exerciseResultCoordinates[$quesId])) {
foreach($exerciseResultCoordinates[$quesId] as $idx => $val) {
exercise_attempt_hotspot($exeId,$quesId,$idx,$choice[$idx],$val);
Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,$choice[$idx],$val);
}
}
}
@ -3531,11 +3531,11 @@ class Exercise
$reply = array_keys($choice);
for ($i = 0; $i < sizeof($reply); $i++) {
$ans = $reply[$i];
exercise_attempt($questionScore, $ans.':'.$choice[$ans], $quesId, $exeId, $i, $this->id);
Event::saveQuestionAttempt($questionScore, $ans.':'.$choice[$ans], $quesId, $exeId, $i, $this->id);
if ($debug) error_log('result =>'.$questionScore.' '.$ans.':'.$choice[$ans]);
}
} else {
exercise_attempt($questionScore, 0, $quesId, $exeId, 0, $this->id);
Event::saveQuestionAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id);
}
} elseif ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) {
if ($choice != 0) {
@ -3544,47 +3544,47 @@ class Exercise
if ($debug) error_log("reply ".print_r($reply, 1)."");
for ($i = 0; $i < sizeof($reply); $i++) {
$ans = $reply[$i];
exercise_attempt($questionScore, $ans, $quesId, $exeId, $i, $this->id);
Event::saveQuestionAttempt($questionScore, $ans, $quesId, $exeId, $i, $this->id);
}
} else {
exercise_attempt($questionScore, 0, $quesId, $exeId, 0, $this->id);
Event::saveQuestionAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id);
}
} elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) {
if ($choice != 0) {
$reply = array_keys($choice);
for ($i = 0; $i < sizeof($reply); $i++) {
$ans = $reply[$i];
exercise_attempt($questionScore, $ans, $quesId, $exeId, $i, $this->id);
Event::saveQuestionAttempt($questionScore, $ans, $quesId, $exeId, $i, $this->id);
}
} else {
exercise_attempt($questionScore, 0, $quesId, $exeId, 0, $this->id);
Event::saveQuestionAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id);
}
} elseif ($answerType == MATCHING) {
if (isset($matching)) {
foreach ($matching as $j => $val) {
exercise_attempt($questionScore, $val, $quesId, $exeId, $j, $this->id);
Event::saveQuestionAttempt($questionScore, $val, $quesId, $exeId, $j, $this->id);
}
}
} elseif ($answerType == FREE_ANSWER) {
$answer = $choice;
exercise_attempt($questionScore, $answer, $quesId, $exeId, 0, $this->id);
Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id);
} elseif ($answerType == ORAL_EXPRESSION) {
$answer = $choice;
exercise_attempt($questionScore, $answer, $quesId, $exeId, 0, $this->id, $nano);
Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id, $nano);
} elseif ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_NO_OPTION) {
$answer = $choice;
exercise_attempt($questionScore, $answer, $quesId, $exeId, 0, $this->id);
Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id);
// } elseif ($answerType == HOT_SPOT || $answerType == HOT_SPOT_DELINEATION) {
} elseif ($answerType == HOT_SPOT) {
exercise_attempt($questionScore, $answer, $quesId, $exeId, 0, $this->id);
Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id);
if (isset($exerciseResultCoordinates[$questionId]) && !empty($exerciseResultCoordinates[$questionId])) {
foreach ($exerciseResultCoordinates[$questionId] as $idx => $val) {
exercise_attempt_hotspot($exeId,$quesId,$idx,$choice[$idx],$val,$this->id);
Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,$choice[$idx],$val,$this->id);
}
}
} else {
exercise_attempt($questionScore, $answer, $quesId, $exeId, 0,$this->id);
Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0,$this->id);
}
}
@ -3962,9 +3962,10 @@ class Exercise
* @param int attempt id
* @return float exercise result
*/
public function get_exercise_result($exe_id) {
public function get_exercise_result($exe_id)
{
$result = array();
$track_exercise_info = get_exercise_track_exercise_info($exe_id);
$track_exercise_info = ExerciseLib::get_exercise_track_exercise_info($exe_id);
if (!empty($track_exercise_info)) {
$totalScore = 0;
@ -4091,7 +4092,7 @@ class Exercise
if ($is_visible) {
if ($exerciseAttempts > 0) {
$attempt_count = get_attempt_count_not_finished(
$attempt_count = Event::get_attempt_count_not_finished(
api_get_user_id(),
$this->id,
$lp_id,

File diff suppressed because it is too large Load Diff

@ -36,7 +36,7 @@ if (!$objExercise) {
}
$time_control = false;
$clock_expired_time = get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
$clock_expired_time = ExerciseLib::get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
if ($objExercise->expired_time != 0 && !empty($clock_expired_time)) {
$time_control = true;
@ -133,7 +133,7 @@ echo '<script>
}
</script>';
$attempt_list = get_all_exercise_event_by_exe_id($exe_id);
$attempt_list = Event::getAllExerciseEventByExeId($exe_id);
$remind_list = $exercise_stat_info['questions_to_check'];
$remind_list = explode(',', $remind_list);

@ -130,7 +130,7 @@ if (isset($_REQUEST['comments']) &&
$_REQUEST['comments'] == 'update' &&
($is_allowedToEdit || $is_tutor) && $_GET['exeid'] == strval(intval($_GET['exeid']))) {
$id = intval($_GET['exeid']); //filtered by post-condition
$track_exercise_info = get_exercise_track_exercise_info($id);
$track_exercise_info = ExerciseLib::get_exercise_track_exercise_info($id);
if (empty($track_exercise_info)) {
api_not_allowed();
}

@ -110,7 +110,7 @@ $i = $total_score = $total_weight = 0;
//We check if the user attempts before sending to the exercise_result.php
if ($objExercise->selectAttempts() > 0) {
$attempt_count = get_attempt_count(
$attempt_count = Event::get_attempt_count(
api_get_user_id(),
$objExercise->id,
$learnpath_id,
@ -133,21 +133,21 @@ if ($objExercise->selectAttempts() > 0) {
Display :: display_normal_message(get_lang('Saved').'<br />',false);
// Display and save questions
display_question_list_by_attempt($objExercise, $exe_id, true);
ExerciseLib::display_question_list_by_attempt($objExercise, $exe_id, true);
//If is not valid
/*
$session_control_key = get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
if (isset($session_control_key) && !exercise_time_control_is_valid($objExercise->id, $learnpath_id, $learnpath_item_id)) {
$session_control_key = ExerciseLib::get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
if (isset($session_control_key) && !ExerciseLib::exercise_time_control_is_valid($objExercise->id, $learnpath_id, $learnpath_item_id)) {
$TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$sql_fraud = "UPDATE $TBL_TRACK_ATTEMPT SET answer = 0, marks = 0, position = 0 WHERE exe_id = $exe_id ";
Database::query($sql_fraud);
}*/
//Unset session for clock time
exercise_time_control_delete($objExercise->id, $learnpath_id, $learnpath_item_id);
delete_chat_exercise_session($exe_id);
ExerciseLib::exercise_time_control_delete($objExercise->id, $learnpath_id, $learnpath_item_id);
ExerciseLib::delete_chat_exercise_session($exe_id);
if ($origin != 'learnpath') {
echo '<hr>';

@ -70,7 +70,7 @@ $maxEditors = isset($_configuration['exercise_max_fckeditors_in_page']) ? $_conf
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $is_courseTutor || api_is_session_admin() || api_is_drh() || api_is_student_boss();
//Getting results from the exe_id. This variable also contain all the information about the exercise
$track_exercise_info = get_exercise_track_exercise_info($id);
$track_exercise_info = ExerciseLib::get_exercise_track_exercise_info($id);
//No track info
if (empty($track_exercise_info)) {
@ -527,7 +527,7 @@ foreach ($questionList as $questionId) {
echo '<br />';
echo '<div id="feedback_'.$name.'" style="width:100%">';
$comnt = trim(get_comments($id, $questionId));
$comnt = trim(Event::get_comments($id, $questionId));
if (empty($comnt)) {
echo '<br />';
} else {
@ -542,7 +542,7 @@ foreach ($questionList as $questionId) {
$renderer =& $feedback_form->defaultRenderer();
$renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>');
$renderer->setElementTemplate('<div align="left">{element}</div>');
$comnt = get_comments($id, $questionId);
$comnt = Event::get_comments($id, $questionId);
$default = array('comments_'.$questionId => $comnt);
if ($useAdvancedEditor) {
$feedback_form->addElement(
@ -565,7 +565,7 @@ foreach ($questionList as $questionId) {
echo '</div>';
} else {
$comnt = get_comments($id, $questionId);
$comnt = Event::get_comments($id, $questionId);
echo '<br />';
if (!empty($comnt)) {
echo '<b>'.get_lang('Feedback').'</b>';
@ -650,7 +650,7 @@ foreach ($questionList as $questionId) {
$score = array();
if ($show_results) {
$score['result'] = get_lang('Score')." : ".show_score($my_total_score, $my_total_weight, false, false);
$score['result'] = get_lang('Score')." : ".ExerciseLib::show_score($my_total_score, $my_total_weight, false, false);
$score['pass'] = $my_total_score >= $my_total_weight ? true : false;
$score['type'] = $answerType;
$score['score'] = $my_total_score;

@ -148,7 +148,7 @@ if ($objExercise->expired_time != 0) {
}
// Generating the time control key for the user
$current_expired_time_key = get_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
$current_expired_time_key = ExerciseLib::get_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
$_SESSION['duration_time'][$current_expired_time_key] = $current_timestamp;
@ -161,7 +161,7 @@ $show_clock = true;
$user_id = api_get_user_id();
if ($objExercise->selectAttempts() > 0) {
$attempt_html = '';
$attempt_count = get_attempt_count(
$attempt_count = Event::get_attempt_count(
$user_id,
$exerciseId,
$learnpath_id,
@ -175,7 +175,7 @@ if ($objExercise->selectAttempts() > 0) {
if ($objExercise->results_disabled == 0 && $origin != 'learnpath') {
// Showing latest attempt according with task BT#1628
$exercise_stat_info = get_exercise_results_by_user(
$exercise_stat_info = Event::getExerciseResultsByUser(
$user_id,
$exerciseId,
api_get_course_id(),
@ -199,7 +199,7 @@ if ($objExercise->selectAttempts() > 0) {
$attempt_html .= Display::div(get_lang('Score').' '.$marks, array('id'=>'question_score'));
}
}
$score = show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']);
$score = ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']);
$attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score'));
} else {
$attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
@ -281,7 +281,7 @@ if (empty($exercise_stat_info)) {
// Remember last question id position.
$isFirstTime = Session::read('firstTime');
if ($isFirstTime && $objExercise->type == ONE_PER_PAGE) {
$resolvedQuestions = get_all_exercise_event_by_exe_id($exe_id);
$resolvedQuestions = Event::getAllExerciseEventByExeId($exe_id);
if (!empty($resolvedQuestions) &&
!empty($exercise_stat_info['data_tracking'])
) {
@ -337,7 +337,7 @@ if ($time_control) {
$expired_time_of_this_attempt = $exercise_stat_info['expired_time_control'];
if ($debug) {error_log('7.5 $expired_time_of_this_attempt: '.$expired_time_of_this_attempt); }
// Get the last attempt of an exercise
$last_attempt_date = get_last_attempt_date_of_exercise($exercise_stat_info['exe_id']);
$last_attempt_date = Event::getLastAttemptDateOfExercise($exercise_stat_info['exe_id']);
/* This means that the user enters the exam but do not answer the
first question we get the date from the track_e_exercises not from
@ -504,7 +504,7 @@ if ($formSent && isset($_POST)) {
//We check if the user attempts before sending to the exercise_result.php
if ($objExercise->selectAttempts() > 0) {
$attempt_count = get_attempt_count(
$attempt_count = Event::get_attempt_count(
api_get_user_id(),
$exerciseId,
$learnpath_id,
@ -563,7 +563,7 @@ if ($question_count != 0) {
//We check if the user attempts before sending to the exercise_result.php
if ($objExercise->selectAttempts() > 0) {
$attempt_count = get_attempt_count(
$attempt_count = Event::get_attempt_count(
api_get_user_id(),
$exerciseId,
$learnpath_id,
@ -1028,7 +1028,7 @@ if (!empty($error)) {
$attempt_list = array();
if (isset($exe_id)) {
$attempt_list = get_all_exercise_event_by_exe_id($exe_id);
$attempt_list = Event::getAllExerciseEventByExeId($exe_id);
}
$remind_list = array();
@ -1086,7 +1086,7 @@ if (!empty($error)) {
echo '<div id="question_div_'.$questionId.'" class="main_question '.$remind_highlight.'" >';
// Shows the question and its answers
showQuestion($questionId, false, $origin, $i, true, false, $user_choice, false);
ExerciseLib::showQuestion($questionId, false, $origin, $i, true, false, $user_choice, false);
// Button save and continue
switch ($objExercise->type) {

@ -42,7 +42,7 @@ $interbreadcrumb[] = array("url" => "exercice.php?gradebook=$gradebook", "name"
$interbreadcrumb[] = array("url" => "#", "name" => $objExercise->name);
$time_control = false;
$clock_expired_time = get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
$clock_expired_time = ExerciseLib::get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
if ($objExercise->expired_time != 0 && !empty($clock_expired_time)) {
$time_control = true;
@ -94,7 +94,7 @@ if (isset($_GET['preview'])) {
$exercise_stat_info = $objExercise->get_stat_track_exercise_info($learnpath_id, $learnpath_item_id, 0);
$attempt_list = null;
if (isset($exercise_stat_info['exe_id'])) {
$attempt_list = get_all_exercise_event_by_exe_id($exercise_stat_info['exe_id']);
$attempt_list = Event::getAllExerciseEventByExeId($exercise_stat_info['exe_id']);
}
//1. Check if this is a new attempt or a previous
@ -130,7 +130,7 @@ if ($visible_return['value'] == false) {
}
}
$attempts = get_exercise_results_by_user(
$attempts = Event::getExerciseResultsByUser(
api_get_user_id(),
$objExercise->id,
api_get_course_id(),
@ -160,7 +160,7 @@ if (!empty($attempts) && $visible_return['value'] == true) {
$i = $counter;
foreach ($attempts as $attempt_result) {
$score = show_score(
$score = ExerciseLib::show_score(
$attempt_result['exe_result'],
$attempt_result['exe_weighting']
);

@ -247,7 +247,7 @@ if (!$inATest) {
echo '<br />';
//echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
echo '<br />';
showQuestion($id, false, null, null, false, true, false, true, $objExercise->feedback_type, true);
ExerciseLib::showQuestion($id, false, null, null, false, true, false, true, $objExercise->feedback_type, true);
echo '</p>';
echo '</div>';
echo '</div>';

@ -337,7 +337,7 @@ echo Display::form_row(get_lang("QuestionCategory"), $selectCourseCategory);
// Get exercise list for this course
$exercise_list = get_all_exercises_for_course_id(
$exercise_list = ExerciseLib::get_all_exercises_for_course_id(
$course_info,
$session_id,
$selected_course,
@ -558,7 +558,7 @@ if ($exerciseId > 0) {
}
}
$exerciseList = get_all_exercises($course_item, $session_id);
$exerciseList = ExerciseLib::get_all_exercises($course_item, $session_id);
if (!empty($exerciseList)) {
foreach ($exerciseList as $exercise) {

@ -32,7 +32,7 @@ if (empty($id)) {
$is_allowedToEdit = api_is_allowed_to_edit(null,true) || $is_courseTutor;
//Getting results from the exe_id. This variable also contain all the information about the exercise
$track_exercise_info = get_exercise_track_exercise_info($id);
$track_exercise_info = ExerciseLib::get_exercise_track_exercise_info($id);
//No track info
if (empty($track_exercise_info)) {

@ -42,14 +42,14 @@ if (!empty($question_list)) {
foreach ($question_list as $question_id) {
$question_obj = Question::read($question_id);
$exercise_stats = get_student_stats_by_question(
$exercise_stats = ExerciseLib::get_student_stats_by_question(
$question_id,
$exercise_id,
$courseCode,
$sessionId
);
$count_users = get_number_students_question_with_answer_count(
$count_users = ExerciseLib::get_number_students_question_with_answer_count(
$question_id,
$exercise_id,
$courseCode,
@ -111,7 +111,7 @@ if (!empty($question_list)) {
$id = 0;
foreach ($question_list as $question_id) {
$question_obj = Question::read($question_id);
$exercise_stats = get_student_stats_by_question(
$exercise_stats = ExerciseLib::get_student_stats_by_question(
$question_id,
$exercise_id,
$courseCode,
@ -148,7 +148,7 @@ if (!empty($question_list)) {
$data[$id]['correct'] = '-';
$count = get_number_students_answer_count(
$count = ExerciseLib::get_number_students_answer_count(
$real_answer_id,
$question_id,
$exercise_id,
@ -188,7 +188,7 @@ if (!empty($question_list)) {
$data[$id]['answer'] = $correct;
$data[$id]['correct'] = $answer_info;
$count = get_number_students_answer_count(
$count = ExerciseLib::get_number_students_answer_count(
$answer_id,
$question_id,
$exercise_id,
@ -212,7 +212,7 @@ if (!empty($question_list)) {
$data[$id]['answer'] = $answer_info;
$data[$id]['correct'] = '-';
$count = get_number_students_answer_hotspot_count(
$count = ExerciseLib::get_number_students_answer_hotspot_count(
$answer_id,
$question_id,
$exercise_id,
@ -234,7 +234,7 @@ if (!empty($question_list)) {
$data[$id]['answer'] = $answer_info;
$data[$id]['correct'] = $correct_answer;
$count = get_number_students_answer_count(
$count = ExerciseLib::get_number_students_answer_count(
$real_answer_id,
$question_id,
$exercise_id,

@ -572,21 +572,21 @@ class Testcategory
if (count($category_list) > 1) {
foreach ($category_list as $category_id => $category_item) {
$table->setCellContents($row, 0, $category_name_list[$category_id]);
$table->setCellContents($row, 1, show_score($category_item['score'], $category_item['total'], false));
$table->setCellContents($row, 2, show_score($category_item['score'], $category_item['total'], true, false, true));
$table->setCellContents($row, 1, ExerciseLib::show_score($category_item['score'], $category_item['total'], false));
$table->setCellContents($row, 2, ExerciseLib::show_score($category_item['score'], $category_item['total'], true, false, true));
$row++;
}
if (!empty($none_category)) {
$table->setCellContents($row, 0, get_lang('None'));
$table->setCellContents($row, 1, show_score($none_category['score'], $none_category['total'], false));
$table->setCellContents($row, 2, show_score($none_category['score'], $none_category['total'], true, false, true));
$table->setCellContents($row, 1, ExerciseLib::show_score($none_category['score'], $none_category['total'], false));
$table->setCellContents($row, 2, ExerciseLib::show_score($none_category['score'], $none_category['total'], true, false, true));
$row++;
}
if (!empty($total)) {
$table->setCellContents($row, 0, get_lang('Total'));
$table->setCellContents($row, 1, show_score($total['score'], $total['total'], false));
$table->setCellContents($row, 2, show_score($total['score'], $total['total'], true, false, true));
$table->setCellContents($row, 1, ExerciseLib::show_score($total['score'], $total['total'], false));
$table->setCellContents($row, 2, ExerciseLib::show_score($total['score'], $total['total'], true, false, true));
}
return $table->toHtml();
}

@ -56,7 +56,7 @@ $tbl_forum_post = Database::get_course_table(TABLE_FORUM_POST);
$course_id = api_get_course_int_id();
// launch event
event_download($doc_url);
Event::event_download($doc_url);
$sql = 'SELECT thread_id, forum_id,filename
FROM '.$tbl_forum_post.' f

@ -91,7 +91,7 @@ if ($origin == 'learnpath') {
Display::display_introduction_section(TOOL_FORUM);
// Tracking
event_access_tool(TOOL_FORUM);
Event::event_access_tool(TOOL_FORUM);
// Forum search
forum_search();

@ -131,7 +131,7 @@ $whatsnew_post_info = Session::read('whatsnew_post_info');
/* TRACKING */
event_access_tool(TOOL_FORUM);
Event::event_access_tool(TOOL_FORUM);
/*
RETRIEVING ALL THE FORUM CATEGORIES AND FORUMS

@ -18,16 +18,16 @@ use Header;
/**
* Ajax controller. Dispatch request and perform required action.
*
*
* - delete one glossary entry
* - delete all glossary entried in a course/session
* - returns a glossary entry from its id
*
*
* Usage:
*
*
* $controller = AjaxController::instance();
* $controller->run();
*
*
* @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Genevas
* @license /license.txt
*/
@ -40,7 +40,7 @@ class AjaxController extends \AjaxController
/**
* Return the instance of the controller.
*
*
* @return \Glossary\AjaxController
*/
public static function instance()
@ -53,12 +53,12 @@ class AjaxController extends \AjaxController
}
/**
* Prepare the environment. Set up breadcrumps and raise tracking event.
* Prepare the environment. Set up breadcrumps and raise tracking event.
*/
protected function prolog()
{
event_access_tool(TOOL_GLOSSARY);
}
Event::event_access_tool(TOOL_GLOSSARY);
}
public function is_allowed_to_edit()
{

@ -21,17 +21,17 @@ use Javascript;
/**
* Controller for glossary. Dispatch request and peform required action.
*
*
* - list glossary entries for course
* - add/edit glossary entry
* - change view from table to details
*
*
* Usage:
*
*
* $controller = Controller::instance();
* $controller->run();
*
* @package chamilo.course_description
*
* @package chamilo.course_description
* @author Christian Fasanando <christian1827@gmail.com>
* @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Genevas
* @license see /license.txt
@ -49,7 +49,7 @@ class Controller extends \Controller
/**
* Return the instance of the controller.
*
*
* @return \Glossary\Controller
*/
public static function instance()
@ -62,9 +62,9 @@ class Controller extends \Controller
}
/**
* Action to perform.
* Action to perform.
* Returns the request parameter.
*
*
* @return string
*/
public function get_action()
@ -84,7 +84,7 @@ class Controller extends \Controller
}
/**
* Prepare the environment. Set up breadcrumps and raise tracking event.
* Prepare the environment. Set up breadcrumps and raise tracking event.
*/
protected function prolog()
{
@ -100,15 +100,15 @@ class Controller extends \Controller
$current_course_tool = TOOL_GLOSSARY;
// Tracking
event_access_tool(TOOL_GLOSSARY);
Event::event_access_tool(TOOL_GLOSSARY);
}
/**
* Returns a url for an action that the controller can process
*
*
* @param string $action
* @param array $params
* @return string
* @return string
*/
public function url($action = '', $params = array())
{
@ -136,8 +136,8 @@ class Controller extends \Controller
/**
* List course descriptions.
*
* @param array messages
*
* @param array messages
*/
public function index()
{
@ -156,7 +156,7 @@ class Controller extends \Controller
}
/**
* Performs the edit action.
* Performs the edit action.
*/
public function edit()
{
@ -226,7 +226,7 @@ class Controller extends \Controller
/**
* Performs the delete action.
*
*
* @see AjaxController
*/
public function delete()
@ -288,10 +288,10 @@ class Controller extends \Controller
/**
* Render a template using data. Adds a few common parameters to the data array.
*
*
* @see /main/template/default/course_description/
* @param string $template
* @param array $data
* @param array $data
*/
protected function render($template, $data)
{

@ -34,7 +34,7 @@ $(document).ready(function () {
$tool = TOOL_GLOSSARY;
// Tracking
event_access_tool(TOOL_GLOSSARY);
Event::event_access_tool(TOOL_GLOSSARY);
function sorter($item1, $item2) {
if ($item1[2] == $item2[2])

@ -1600,7 +1600,7 @@ class Category implements GradebookItem
if ($locked == 1) {
$event_type = LOG_GRADEBOOK_LOCKED;
}
event_system($event_type, LOG_GRADEBOOK_ID, $this->id);
Event::addEvent($event_type, LOG_GRADEBOOK_ID, $this->id);
}
}

@ -180,7 +180,7 @@ switch ($action) {
if (api_is_platform_admin()) {
$course = api_get_course_info_by_id($_GET['course_id']);
$session_id = (!empty($_GET['session_id'])) ? intval($_GET['session_id']) : 0 ;
$exercises = get_all_exercises($course, $session_id, false, $_GET['q'], true, 3);
$exercises = ExerciseLib::get_all_exercises($course, $session_id, false, $_GET['q'], true, 3);
foreach ($exercises as $exercise) {
$data[] = array('id' => $exercise['id'], 'text' => html_entity_decode($exercise['title']) );

@ -10,7 +10,7 @@ api_protect_admin_script();
switch ($action) {
case 'getEventTypes':
$events = get_all_event_types();
$events = Event::get_all_event_types();
print json_encode($events);
break;
case 'getUsers':
@ -18,7 +18,7 @@ switch ($action) {
print json_encode($users);
break;
case 'get_event_users':
$users = get_event_users($event_name);
$users = Event::get_event_users($event_name);
print json_encode($users);
break;
}

@ -290,7 +290,7 @@ switch ($action) {
$total_score = $exercise_stat_info['exe_result'];
//Getting the list of attempts
$attempt_list = get_all_exercise_event_by_exe_id($exe_id);
$attempt_list = Event::getAllExerciseEventByExeId($exe_id);
}
// Updating Reminder algorythm.
@ -399,9 +399,9 @@ switch ($action) {
if ($debug) {
error_log("delete_attempt exe_id : $exe_id, my_question_id: $my_question_id");
}
delete_attempt($exe_id, api_get_user_id(), $course_code, $session_id, $my_question_id);
Event::delete_attempt($exe_id, api_get_user_id(), $course_code, $session_id, $my_question_id);
if ($objQuestionTmp->type == HOT_SPOT) {
delete_attempt_hotspot($exe_id, api_get_user_id(), $course_code, $session_id, $my_question_id);
Event::delete_attempt_hotspot($exe_id, api_get_user_id(), $course_code, $session_id, $my_question_id);
}
if (isset($attempt_list[$my_question_id]) && isset($attempt_list[$my_question_id]['marks'])) {
@ -438,7 +438,7 @@ switch ($action) {
$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id);
}
$key = get_time_control_key($exercise_id, $exercise_stat_info['orig_lp_id'], $exercise_stat_info['orig_lp_item_id']);
$key = ExerciseLib::get_time_control_key($exercise_id, $exercise_stat_info['orig_lp_id'], $exercise_stat_info['orig_lp_item_id']);
if (isset($_SESSION['duration_time'][$key]) && !empty($_SESSION['duration_time'][$key])) {
$duration = $now - $_SESSION['duration_time'][$key];
@ -454,7 +454,7 @@ switch ($action) {
$_SESSION['duration_time'][$key] = time();
update_event_exercice(
Event::update_event_exercice(
$exe_id,
$objExercise->selectId(),
$total_score,

@ -280,11 +280,11 @@ switch ($action) {
$filter_user = intval($_GET['filter_by_user']);
$whereCondition .= " AND te.exe_user_id = '$filter_user'";
}
$count = get_count_exam_results($exercise_id, $whereCondition);
$count = ExerciseLib::get_count_exam_results($exercise_id, $whereCondition);
break;
case 'get_hotpotatoes_exercise_results':
$hotpot_path = $_REQUEST['path'];
$count = get_count_exam_hotpotatoes_results($hotpot_path);
$count = ExerciseLib::get_count_exam_hotpotatoes_results($hotpot_path);
break;
case 'get_sessions_tracking':
$keyword = isset($_REQUEST['keyword']) ? $_REQUEST['keyword'] : null;
@ -654,7 +654,7 @@ switch ($action) {
break;
case 'get_exercise_results':
$course = api_get_course_info();
// Used inside get_exam_results_data()
// Used inside ExerciseLib::get_exam_results_data()
$documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
if ($is_allowedToEdit || api_is_student_boss()) {
$columns = array(
@ -665,7 +665,7 @@ switch ($action) {
$columns = array_merge(array('official_code'), $columns);
}
}
$result = get_exam_results_data($start, $limit, $sidx, $sord, $exercise_id, $whereCondition);
$result = ExerciseLib::get_exam_results_data($start, $limit, $sidx, $sord, $exercise_id, $whereCondition);
break;
case 'get_hotpotatoes_exercise_results':
$course = api_get_course_info();
@ -675,7 +675,7 @@ switch ($action) {
} else {
$columns = array('exe_date', 'score', 'actions');
}
$result = get_exam_results_hotpotatoes_data($start, $limit, $sidx, $sord, $hotpot_path, $whereCondition);
$result = ExerciseLib::get_exam_results_hotpotatoes_data($start, $limit, $sidx, $sord, $hotpot_path, $whereCondition);
break;
case 'get_work_student_list_overview':
if (!(api_is_allowed_to_edit() || api_is_coach())) {
@ -706,7 +706,7 @@ switch ($action) {
} else {
$columns = array('exe_date', 'score', 'actions');
}
$result = get_exam_results_hotpotatoes_data($start, $limit, $sidx, $sord, $hotpot_path, $whereCondition);
$result = ExerciseLib::get_exam_results_hotpotatoes_data($start, $limit, $sidx, $sord, $hotpot_path, $whereCondition);
break;
case 'get_sessions_tracking':
if (api_is_drh()) {

@ -112,9 +112,9 @@ switch ($action) {
null,
$additionalParameters
);
event_system(LOG_USER_ENABLE, LOG_USER_ID, $user_id);
Event::addEvent(LOG_USER_ENABLE, LOG_USER_ID, $user_id);
} else {
event_system(LOG_USER_DISABLE, LOG_USER_ID, $user_id);
Event::addEvent(LOG_USER_DISABLE, LOG_USER_ID, $user_id);
}
echo $status;
}

@ -102,14 +102,12 @@ require_once dirname(__FILE__).'/../../vendor/autoload.php';
require_once $lib_path.'database.lib.php';
require_once $lib_path.'text.lib.php';
require_once $lib_path.'array.lib.php';
require_once $lib_path.'events.lib.inc.php';
require_once $lib_path.'course.lib.php';
require_once $lib_path.'online.inc.php';
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 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/');
@ -622,7 +620,7 @@ if (!isset($_SESSION['login_as']) && isset($_user)) {
if ($res_logout_date < time() - $_configuration['session_lifetime']) {
// it isn't, we should create a fresh entry
event_login();
Event::event_login();
// now that it's created, we can get its ID and carry on
$q_last_connection = Database::query($sql_last_connection);
$i_id_last_connection = Database::result($q_last_connection, 0, 'login_id');

@ -3168,7 +3168,7 @@ class AddCourse
// Add event to the system log.
$user_id = api_get_user_id();
event_system(
Event::addEvent(
LOG_COURSE_CREATE,
LOG_COURSE_CODE,
$code,

@ -213,7 +213,7 @@ class Career extends Model
{
$id = parent::save($params);
if (!empty($id)) {
event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
Event::addEvent(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
}
return $id;
@ -226,6 +226,6 @@ class Career extends Model
public function delete($id)
{
parent::delete($id);
event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
Event::addEvent(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
}
}

@ -464,7 +464,7 @@ class CourseManager
// add event to system log
$user_id = api_get_user_id();
event_system(
Event::addEvent(
LOG_UNSUBSCRIBE_USER_FROM_COURSE,
LOG_COURSE_CODE,
$course_code,
@ -474,7 +474,7 @@ class CourseManager
foreach ($user_list as $userId) {
$userInfo = api_get_user_info($userId);
event_system(
Event::addEvent(
LOG_UNSUBSCRIBE_USER_FROM_COURSE,
LOG_USER_OBJECT,
$userInfo,
@ -592,7 +592,7 @@ class CourseManager
$result = @Database::query($sql);
// Add event to the system log
event_system(
Event::addEvent(
LOG_SUBSCRIBE_USER_TO_COURSE,
LOG_COURSE_CODE,
$course_code,
@ -601,7 +601,7 @@ class CourseManager
);
$user_info = api_get_user_info($user_id);
event_system(
Event::addEvent(
LOG_SUBSCRIBE_USER_TO_COURSE,
LOG_USER_OBJECT,
$user_info,
@ -2405,7 +2405,7 @@ class CourseManager
// Add event to system log
$user_id = api_get_user_id();
event_system(
Event::addEvent(
LOG_COURSE_DELETE,
LOG_COURSE_CODE,
$code,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -41,7 +41,7 @@ class ExerciseShowFunctions
if (!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td>
<?php
$comm = get_comments($id,$questionId);
$comm = Event::get_comments($id,$questionId);
?>
</td>
<?php } ?>
@ -74,7 +74,7 @@ class ExerciseShowFunctions
if (!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td>
<?php
$comm = get_comments($id,$questionId);
$comm = Event::get_comments($id,$questionId);
?>
</td>
<?php } ?>
@ -92,7 +92,7 @@ class ExerciseShowFunctions
*/
static function display_free_answer($feedback_type, $answer, $exe_id, $questionId, $questionScore = null)
{
$comments = get_comments($exe_id, $questionId);
$comments = Event::get_comments($exe_id, $questionId);
if (!empty($answer)) {
echo '<tr><td>';
@ -137,7 +137,7 @@ class ExerciseShowFunctions
if (!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
echo '<td>';
$comm = get_comments($id,$questionId);
$comm = Event::get_comments($id,$questionId);
echo '</td>';
}
echo '</tr>';
@ -281,7 +281,7 @@ class ExerciseShowFunctions
</td>
<?php
if ($ans==1) {
$comm = get_comments($id,$questionId);
$comm = Event::get_comments($id,$questionId);
}
?>
<?php } else { ?>
@ -371,7 +371,7 @@ class ExerciseShowFunctions
</td>
<?php
if ($ans==1) {
$comm = get_comments($id, $questionId);
$comm = Event::get_comments($id, $questionId);
}
?>
<?php } else { ?>
@ -469,7 +469,7 @@ class ExerciseShowFunctions
</td>
<?php
if ($ans==1) {
$comm = get_comments($id,$questionId);
$comm = Event::get_comments($id,$questionId);
}
?>
<?php } else { ?>

@ -38,7 +38,7 @@ class GroupPortalManager
Database::query($sql);
$id = Database::insert_id();
if ($id) {
event_system(LOG_GROUP_PORTAL_CREATED, LOG_GROUP_PORTAL_ID, $id);
Event::addEvent(LOG_GROUP_PORTAL_CREATED, LOG_GROUP_PORTAL_ID, $id);
return $id;
}
@ -99,7 +99,7 @@ class GroupPortalManager
self::delete_users($id);
// Delete group image
self::delete_group_picture($id);
event_system(LOG_GROUP_PORTAL_DELETED, LOG_GROUP_PORTAL_ID, $id);
Event::addEvent(LOG_GROUP_PORTAL_DELETED, LOG_GROUP_PORTAL_ID, $id);
return $result;
}
@ -594,7 +594,7 @@ class GroupPortalManager
$sql = "INSERT INTO $table_url_rel_group
SET user_id = ".intval($user_id).", group_id = ".intval($group_id).", relation_type = ".intval($relation_type);
$result = Database::query($sql);
event_system(
Event::addEvent(
LOG_GROUP_PORTAL_USER_SUBSCRIBED,
LOG_GROUP_PORTAL_REL_USER_ARRAY,
array('user_id' => $user_id, 'group_id' => $group_id, 'relation_type' => $relation_type)
@ -653,7 +653,7 @@ class GroupPortalManager
$sql = "DELETE FROM $table_ WHERE group_id = ".intval($group_id).$condition_relation;
$result = Database::query($sql);
event_system(
Event::addEvent(
LOG_GROUP_PORTAL_USER_DELETE_ALL,
LOG_GROUP_PORTAL_REL_USER_ARRAY,
array('group_id' => $group_id, 'relation_type' => $relation_type)
@ -675,7 +675,7 @@ class GroupPortalManager
$sql = "DELETE FROM $table WHERE user_id = ".intval($user_id)." AND group_id=".intval($group_id);
$result = Database::query($sql);
event_system(
Event::addEvent(
LOG_GROUP_PORTAL_USER_UNSUBSCRIBED,
LOG_GROUP_PORTAL_REL_USER_ARRAY,
array('user_id' => $user_id, 'group_id' => $group_id)
@ -710,7 +710,7 @@ class GroupPortalManager
";
Database::query($sql);
event_system(
Event::addEvent(
LOG_GROUP_PORTAL_USER_UPDATE_ROLE,
LOG_GROUP_PORTAL_REL_USER_ARRAY,
array('user_id' => $user_id, 'group_id' => $group_id, 'relation_type' => $relation_type)

@ -396,7 +396,7 @@ class Login
if (!isset($_SESSION['login_as'])) {
//Course login
if (isset($_user['user_id'])) {
event_course_login($_course['sysCode'], $_user['user_id'], api_get_session_id());
Event::event_course_login($_course['sysCode'], $_user['user_id'], api_get_session_id());
}
}
} else {

@ -211,7 +211,7 @@ class Promotion extends Model
{
$id = parent::save($params, $show_query);
if (!empty($id)) {
event_system(LOG_PROMOTION_CREATE, LOG_PROMOTION_ID, $id, api_get_utc_datetime(), api_get_user_id());
Event::addEvent(LOG_PROMOTION_CREATE, LOG_PROMOTION_ID, $id, api_get_utc_datetime(), api_get_user_id());
}
return $id;
}
@ -220,7 +220,7 @@ class Promotion extends Model
{
if (parent::delete($id)) {
SessionManager::clear_session_ref_promotion($id);
event_system(LOG_PROMOTION_DELETE, LOG_PROMOTION_ID, $id, api_get_utc_datetime(), api_get_user_id());
Event::addEvent(LOG_PROMOTION_DELETE, LOG_PROMOTION_ID, $id, api_get_utc_datetime(), api_get_user_id());
} else {
return false;
}

@ -228,7 +228,7 @@ class SessionManager
// add event to system log
$user_id = api_get_user_id();
event_system(LOG_SESSION_CREATE, LOG_SESSION_ID, $session_id, api_get_utc_datetime(), $user_id);
Event::addEvent(LOG_SESSION_CREATE, LOG_SESSION_ID, $session_id, api_get_utc_datetime(), $user_id);
}
return $session_id;
}
@ -902,7 +902,7 @@ class SessionManager
/**
* Exercises
*/
$exercises = get_all_exercises($course, $sessionId, false, '', $getAllSessions);
$exercises = ExerciseLib::get_all_exercises($course, $sessionId, false, '', $getAllSessions);
$exercises_total = count($exercises);
/**
@ -1496,7 +1496,7 @@ class SessionManager
Database::query($sql_delete_sfv);
// Add event to system log
event_system(LOG_SESSION_DELETE, LOG_SESSION_ID, $id_checked, api_get_utc_datetime(), $userId);
Event::addEvent(LOG_SESSION_DELETE, LOG_SESSION_ID, $id_checked, api_get_utc_datetime(), $userId);
}
/**
@ -2334,7 +2334,7 @@ class SessionManager
$id_session = Database::insert_id();
// Add event to system log
$user_id = api_get_user_id();
event_system(LOG_SESSION_CATEGORY_CREATE, LOG_SESSION_CATEGORY_ID, $id_session, api_get_utc_datetime(), $user_id);
Event::addEvent(LOG_SESSION_CATEGORY_CREATE, LOG_SESSION_CATEGORY_ID, $id_session, api_get_utc_datetime(), $user_id);
return $id_session;
}
@ -2433,7 +2433,7 @@ class SessionManager
// Add event to system log
$user_id = api_get_user_id();
event_system(
Event::addEvent(
LOG_SESSION_CATEGORY_DELETE,
LOG_SESSION_CATEGORY_ID,
$id_checked,

@ -346,14 +346,14 @@ class Tracking
if ($maxscore == 0) {
$view_score = $score;
} else {
$view_score = show_score($score, $maxscore, false);
$view_score = ExerciseLib::show_score($score, $maxscore, false);
}
break;
case 'document':
$view_score = ($score == 0 ? '/' : show_score($score, $maxscore, false));
$view_score = ($score == 0 ? '/' : ExerciseLib::show_score($score, $maxscore, false));
break;
default:
$view_score = show_score($score, $maxscore, false);
$view_score = ExerciseLib::show_score($score, $maxscore, false);
break;
}
}
@ -717,7 +717,7 @@ class Tracking
get_lang('ResultsHiddenByExerciseSetting')
);
} else {
$scoreItem .= show_score($score, $maxscore, false);
$scoreItem .= ExerciseLib::show_score($score, $maxscore, false);
}
} else {
$scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore);
@ -857,12 +857,12 @@ class Tracking
} else {
// Show only float when need it
if ($my_score == 0) {
$view_score = show_score(0, $my_maxscore, false);
$view_score = ExerciseLib::show_score(0, $my_maxscore, false);
} else {
if ($my_maxscore == 0) {
$view_score = $my_score;
} else {
$view_score = show_score($my_score, $my_maxscore, false);
$view_score = ExerciseLib::show_score($my_score, $my_maxscore, false);
}
}
}
@ -1832,7 +1832,7 @@ class Tracking
if (!empty($exercise_list)) {
foreach ($exercise_list as $exercise_data) {
$exercise_id = $exercise_data['id'];
$best_attempt = get_best_attempt_exercise_results_per_user(
$best_attempt = Event::get_best_attempt_exercise_results_per_user(
$user_id,
$exercise_id,
$course_code,
@ -4075,7 +4075,7 @@ class Tracking
$exercise_graph_list = array();
foreach ($course_list as $course_data) {
$exercise_list = get_all_exercises(
$exercise_list = ExerciseLib::get_all_exercises(
$course_data,
$my_session_id,
false,
@ -4092,7 +4092,7 @@ class Tracking
if ($exercise_data['results_disabled'] == 0 || $exercise_data['results_disabled'] == 2) {
$best_average = intval(
get_best_average_score_by_exercise(
ExerciseLib::get_best_average_score_by_exercise(
$exercise_data['id'],
$course_data['code'],
$my_session_id,
@ -4102,7 +4102,7 @@ class Tracking
$exercise_graph_list[] = $best_average;
$all_exercise_graph_list[] = $best_average;
$user_result_data = get_best_attempt_by_user(
$user_result_data = ExerciseLib::get_best_attempt_by_user(
api_get_user_id(),
$exercise_data['id'],
$course_data['code'],
@ -4187,20 +4187,20 @@ class Tracking
foreach($course_list as $course_data) {
//All exercises in the course @todo change for a real count
$exercises = get_all_exercises($course_data, $my_session_id);
$exercises = ExerciseLib::get_all_exercises($course_data, $my_session_id);
$count_exercises = 0;
if (is_array($exercises) && !empty($exercises)) {
$count_exercises = count($exercises);
}
//Count of user results
//$done_exercises = get_count_exercises_attempted_by_course($course_data['code'], $my_session_id);
//$done_exercises = Event::get_count_exercises_attempted_by_course($course_data['code'], $my_session_id);
$done_exercises = null;
$answered_exercises = 0;
if (!empty($exercises)) {
foreach($exercises as $exercise_item) {
$attempts = count_exercise_attempts_by_user(api_get_user_id(), $exercise_item['id'], $course_data['code'], $my_session_id);
$attempts = Event::count_exercise_attempts_by_user(api_get_user_id(), $exercise_item['id'], $course_data['code'], $my_session_id);
if ($attempts > 1) {
$answered_exercises++;
}
@ -4208,7 +4208,7 @@ class Tracking
}
// Average
$average = get_average_score_by_course($course_data['code'], $my_session_id);
$average = ExerciseLib::get_average_score_by_course($course_data['code'], $my_session_id);
$all_exercises += $count_exercises;
@ -4232,7 +4232,7 @@ class Tracking
$html .= Display::tag('td', $all_unanswered_exercises_by_user);
//$html .= Display::tag('td', $all_done_exercise);
$html .= Display::tag('td', convert_to_percentage($all_average));
$html .= Display::tag('td', ExerciseLib::convert_to_percentage($all_average));
if (isset($_GET['session_id']) && $my_session_id == $_GET['session_id']) {
$icon = Display::url(Display::return_icon('2rightarrow_na.gif', get_lang('Details')), '?session_id='.$my_session_id);
@ -4276,7 +4276,7 @@ class Tracking
$course_title = $course_data['title'];
//All exercises in the course @todo change for a real count
$exercises = get_all_exercises($course_data, $session_id_from_get);
$exercises = ExerciseLib::get_all_exercises($course_data, $session_id_from_get);
$count_exercises = 0;
if (!empty($exercises)) {
$count_exercises = count($exercises);
@ -4285,10 +4285,10 @@ class Tracking
//$done_exercises = get_best_exercise_results_by_course($course_code, $session_id_from_get);
//From course exercises NOT from LP exercises!!!
//$done_exercises = get_count_exercises_attempted_by_course($course_code, $session_id_from_get);
//$done_exercises = Event::get_count_exercises_attempted_by_course($course_code, $session_id_from_get);
$answered_exercises = 0;
foreach($exercises as $exercise_item) {
$attempts = count_exercise_attempts_by_user(api_get_user_id(), $exercise_item['id'], $course_code, $session_id_from_get);
$attempts = Event::count_exercise_attempts_by_user(api_get_user_id(), $exercise_item['id'], $course_code, $session_id_from_get);
if ($attempts > 1) {
$answered_exercises++;
}
@ -4297,8 +4297,8 @@ class Tracking
$unanswered_exercises = $count_exercises - $answered_exercises;
// Average
$average = get_average_score_by_course($course_code, $session_id_from_get);
$my_average = get_average_score_by_course_by_user(api_get_user_id(), $course_code, $session_id_from_get);
$average = ExerciseLib::get_average_score_by_course($course_code, $session_id_from_get);
$my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $course_code, $session_id_from_get);
$stats_array[$course_code] = array(
'exercises' => $count_exercises,
@ -4329,9 +4329,9 @@ class Tracking
$html .= Display::tag('td', $stats_array[$course_code]['exercises']);
$html .= Display::tag('td', $stats_array[$course_code]['unanswered_exercises_by_user']);
//$html .= Display::tag('td', $stats_array[$course_code]['done_exercises']);
$html .= Display::tag('td', convert_to_percentage($stats_array[$course_code]['my_average']));
$html .= Display::tag('td', ExerciseLib::convert_to_percentage($stats_array[$course_code]['my_average']));
$html .= Display::tag('td', $stats_array[$course_code]['average'] == 0 ? '-' : '('.convert_to_percentage($stats_array[$course_code]['average']).')');
$html .= Display::tag('td', $stats_array[$course_code]['average'] == 0 ? '-' : '('.ExerciseLib::convert_to_percentage($stats_array[$course_code]['average']).')');
$html .= Display::tag('td', $time, array('align'=>'center'));
if (is_numeric($progress)) {
@ -4412,9 +4412,9 @@ class Tracking
$user_list = CourseManager::get_user_list_from_course_code($course, $session_id, null, null, 0);
}
//$exercise_list = get_all_exercises($course_info, $session_id, true);
//$exercise_list = ExerciseLib::get_all_exercises($course_info, $session_id, true);
// Show exercise results of invisible exercises? see BT#4091
$exercise_list = get_all_exercises(
$exercise_list = ExerciseLib::get_all_exercises(
$course_info,
$session_id,
false,
@ -4436,7 +4436,7 @@ class Tracking
$score = $weighting = $attempts = 0;
//Getting count of attempts by user
$attempts = count_exercise_attempts_by_user(api_get_user_id(), $exercices['id'], $course_info['code'], $session_id);
$attempts = Event::count_exercise_attempts_by_user(api_get_user_id(), $exercices['id'], $course_info['code'], $session_id);
$html .= '<tr class="row_even">';
$url = api_get_path(WEB_CODE_PATH)."exercice/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}";
@ -4450,7 +4450,7 @@ class Tracking
//Exercise configuration show results or show only score
if ($exercices['results_disabled'] == 0 || $exercices['results_disabled'] == 2) {
//For graphics
$best_exercise_stats = get_best_exercise_results_by_user($exercices['id'], $course_info['code'], $session_id);
$best_exercise_stats = Event::get_best_exercise_results_by_user($exercices['id'], $course_info['code'], $session_id);
$to_graph_exercise_result[$exercices['id']] = array('title'=>$exercices['title'], 'data'=>$best_exercise_stats);
$latest_attempt_url = '';
@ -4458,11 +4458,11 @@ class Tracking
$graph = $normal_graph = null;
//Getting best results
$best_score_data = get_best_attempt_in_course($exercices['id'], $course_info['code'], $session_id);
$best_score = show_score($best_score_data['exe_result'], $best_score_data['exe_weighting']);
$best_score_data = ExerciseLib::get_best_attempt_in_course($exercices['id'], $course_info['code'], $session_id);
$best_score = ExerciseLib::show_score($best_score_data['exe_result'], $best_score_data['exe_weighting']);
if ($attempts > 0) {
$exercise_stat = get_best_attempt_by_user(api_get_user_id(), $exercices['id'], $course_info['code'], $session_id);
$exercise_stat = ExerciseLib::get_best_attempt_by_user(api_get_user_id(), $exercices['id'], $course_info['code'], $session_id);
if (!empty($exercise_stat)) {
//Always getting the BEST attempt
@ -4471,13 +4471,13 @@ class Tracking
$exe_id = $exercise_stat['exe_id'];
$latest_attempt_url .= api_get_path(WEB_CODE_PATH).'exercice/result.php?id='.$exe_id.'&cidReq='.$course_info['code'].'&show_headers=1&id_session='.$session_id;
$percentage_score_result = Display::url(show_score($score, $weighting), $latest_attempt_url);
$percentage_score_result = Display::url(ExerciseLib::show_score($score, $weighting), $latest_attempt_url);
$my_score = 0;
if (!empty($weighting) && intval($weighting) != 0) {
$my_score = $score/$weighting;
}
//@todo this function slows the page
$position = get_exercise_result_ranking($my_score, $exe_id, $exercices['id'], $course_info['code'], $session_id, $user_list);
$position = ExerciseLib::get_exercise_result_ranking($my_score, $exe_id, $exercices['id'], $course_info['code'], $session_id, $user_list);
$graph = self::generate_exercise_result_thumbnail_graph($to_graph_exercise_result[$exercices['id']]);
$normal_graph = self::generate_exercise_result_graph($to_graph_exercise_result[$exercices['id']]);
@ -5944,7 +5944,7 @@ class TrackingCourseLog
$course_info = api_get_course_info($course_code);
$total_surveys = 0;
$total_exercises = get_all_exercises(
$total_exercises = ExerciseLib::get_all_exercises(
$course_info,
$session_id,
false,

@ -234,7 +234,7 @@ class UserManager
}
/* ENDS MANAGE EVENT WITH MAIL */
}
event_system(LOG_USER_CREATE, LOG_USER_ID, $return);
Event::addEvent(LOG_USER_CREATE, LOG_USER_ID, $return);
} else {
return api_set_failure('error inserting in Database');
}
@ -438,8 +438,8 @@ class UserManager
// Add event to system log
$user_id_manager = api_get_user_id();
event_system(LOG_USER_DELETE, LOG_USER_ID, $user_id, api_get_utc_datetime(), $user_id_manager, null, $user_info);
event_system(LOG_USER_DELETE, LOG_USER_OBJECT, $user_info, api_get_utc_datetime(), $user_id_manager, null, $user_info);
Event::addEvent(LOG_USER_DELETE, LOG_USER_ID, $user_id, api_get_utc_datetime(), $user_id_manager, null, $user_info);
Event::addEvent(LOG_USER_DELETE, LOG_USER_OBJECT, $user_info, api_get_utc_datetime(), $user_id_manager, null, $user_info);
return true;
}
@ -494,7 +494,7 @@ class UserManager
$sql = "UPDATE $table_user SET active = 0 WHERE user_id IN ($ids)";
$r = Database::query($sql);
if ($r !== false) {
event_system(LOG_USER_DISABLE,LOG_USER_ID,$ids);
Event::addEvent(LOG_USER_DISABLE,LOG_USER_ID,$ids);
}
return $r;
}
@ -524,7 +524,7 @@ class UserManager
$sql = "UPDATE $table_user SET active = 1 WHERE user_id IN ($ids)";
$r = Database::query($sql);
if ($r !== false) {
event_system(LOG_USER_ENABLE,LOG_USER_ID,$ids);
Event::addEvent(LOG_USER_ENABLE,LOG_USER_ID,$ids);
}
return $r;
}
@ -676,7 +676,7 @@ class UserManager
} else {
$event_title = LOG_USER_DISABLE;
}
event_system($event_title, LOG_USER_ID, $user_id);
Event::addEvent($event_title, LOG_USER_ID, $user_id);
}
if (is_array($extra) && count($extra) > 0) {
$res = true;
@ -735,7 +735,7 @@ class UserManager
$ev = LOG_USER_ENABLE;
}
if ($r !== false) {
event_system($ev,LOG_USER_ID,$user_id);
Event::addEvent($ev,LOG_USER_ID,$user_id);
}
return $r;
}
@ -1924,7 +1924,7 @@ class UserManager
if ($result) {
//echo "id returned";
$return = Database::insert_id();
event_system(LOG_USER_FIELD_CREATE, LOG_USER_FIELD_VARIABLE, Database::escape_string($fieldvarname));
Event::addEvent(LOG_USER_FIELD_CREATE, LOG_USER_FIELD_VARIABLE, Database::escape_string($fieldvarname));
} else {
//echo "false - failed" ;
return false;

@ -67,14 +67,13 @@ class IndexManager
function return_exercise_block($personal_course_list)
{
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
$exercise_list = array();
if (!empty($personal_course_list)) {
foreach($personal_course_list as $course_item) {
$course_code = $course_item['c'];
$session_id = $course_item['id_session'];
$exercises = get_exercises_to_be_taken($course_code, $session_id);
$exercises = ExerciseLib::get_exercises_to_be_taken($course_code, $session_id);
foreach($exercises as $exercise_item) {
$exercise_item['course_code'] = $course_code;

@ -128,7 +128,7 @@ if (isset($_SESSION['conditional_login']['uid']) && $_SESSION['conditional_login
Session::write('_user', $_user);
Session::erase('conditional_login');
$uidReset=true;
event_login();
Event::event_login();
}
// parameters passed via GET
@ -351,7 +351,7 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
$_user['user_id'] = $uData['user_id'];
$_user['status'] = $uData['status'];
Session::write('_user', $_user);
event_login();
Event::event_login();
$logging_in = true;
} else {
$loginFailed = true;
@ -377,14 +377,14 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
$_user['user_id'] = $uData['user_id'];
$_user['status'] = $uData['status'];
Session::write('_user', $_user);
event_login();
Event::event_login();
} else {
//This means a secondary admin wants to login so we check as he's a normal user
if (in_array($current_access_url_id, $my_url_list)) {
$_user['user_id'] = $uData['user_id'];
$_user['status'] = $uData['status'];
Session::write('_user', $_user);
event_login();
Event::event_login();
} else {
$loginFailed = true;
Session::erase('_uid');
@ -403,7 +403,7 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
$_user['status'] = $uData['status'];
Session::write('_user', $_user);
event_login();
Event::event_login();
$logging_in = true;
}
} else {
@ -650,7 +650,7 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
$_user['status'] = $uData['status'];
Session::write('_user', $_user);
event_login();
Event::event_login();
} else {
$loginFailed = true;
Session::erase('_uid');
@ -837,7 +837,7 @@ if (isset($cidReset) && $cidReset) {
if (!isset($_SESSION['login_as'])) {
//Course login
if (isset($_user['user_id'])) {
event_course_login($_course['code'], $_user['user_id'], api_get_session_id());
Event::event_course_login($_course['code'], $_user['user_id'], api_get_session_id());
}
}
} else {

@ -21,16 +21,16 @@ use Header;
/**
* Ajax controller. Dispatch request and perform required action.
*
* - delete category/link
*
* - delete category/link
* - hide/show link
* - sort links/categories
*
*
* Usage:
*
*
* $controller = AjaxController::instance();
* $controller->run();
*
*
* @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Genevas
* @license /license.txt
*/
@ -48,7 +48,7 @@ class AjaxController extends \Controller
/**
* Return the instance of the controller.
*
*
* @return \Link\AjaxController
*/
public static function instance()
@ -62,15 +62,15 @@ class AjaxController extends \Controller
protected function __construct()
{
}
/**
* Prepare the environment. Set up breadcrumps and raise tracking event.
* Prepare the environment. Set up breadcrumps and raise tracking event.
*/
protected function prolog()
{
event_access_tool(TOOL_LINK);
Event::event_access_tool(TOOL_LINK);
}
public function authorize()
@ -113,7 +113,7 @@ class AjaxController extends \Controller
}
/**
*
*
*/
public function hide_link()
{
@ -131,7 +131,7 @@ class AjaxController extends \Controller
}
/**
*
*
*/
public function show_link()
{
@ -149,7 +149,7 @@ class AjaxController extends \Controller
}
/**
*
*
*/
public function delete_link()
{
@ -168,7 +168,7 @@ class AjaxController extends \Controller
}
/**
*
*
*/
public function delete_category()
{
@ -186,7 +186,7 @@ class AjaxController extends \Controller
$this->response($success);
}
/**
*
*
*/
public function delete_by_course()
{
@ -250,7 +250,7 @@ class AjaxController extends \Controller
$repo = LinkRepository::instance();
$link = $repo->find_one_by_id($c_id, $id);
$success = $link ? $link->validate() : false;
$this->response($success);
}
@ -265,7 +265,7 @@ class AjaxController extends \Controller
}
/**
* Action exists but implementation is missing.
* Action exists but implementation is missing.
*/
public function missing()
{
@ -274,9 +274,9 @@ class AjaxController extends \Controller
/**
* Display a standard json responce.
*
*
* @param bool $success
* @param string $message
* @param string $message
* @param object $data
*/
public function response($success = false, $message = '', $data = null)

@ -18,16 +18,16 @@ use Header;
/**
* Html controller. Dispatch request and perform required action:
*
*
* - list
* - add/edit/delete link
* - add/edit/delete category
* - make visible/invisible link
* - go to link target
*
*
* Note:
* Currently some actions are only implemented in the Ajax controller.
*
*
* @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Genevas
* @license /license.txt
*/
@ -50,7 +50,7 @@ class Controller extends \Controller
const ACTION_DEFAULT = 'listing';
/**
*
*
* @return \Link\Controller
*/
public static function instance()
@ -82,9 +82,9 @@ class Controller extends \Controller
}
/**
* Action to perform.
* Action to perform.
* Returns the request parameter.
*
*
* @return string
*/
public function get_action()
@ -101,7 +101,7 @@ class Controller extends \Controller
public function prolog()
{
event_access_tool(TOOL_LINK);
Event::event_access_tool(TOOL_LINK);
//legacy
global $interbreadcrumb;
@ -118,8 +118,8 @@ class Controller extends \Controller
/**
* Whether the call is authorized or not.
*
* @return boolean
*
* @return boolean
*/
public function authorize()
{
@ -138,7 +138,7 @@ class Controller extends \Controller
/**
* Javascript used by the controller
*
*
* @return string
*/
public function javascript()
@ -153,10 +153,10 @@ class Controller extends \Controller
/**
* Returns a url for an action that the controller can process
*
*
* @param string $action
* @param array $params
* @return string
* @return string
*/
public function url($action, $params = array())
{
@ -213,7 +213,7 @@ class Controller extends \Controller
$link->c_id = Request::get_c_id();
$link->session_id = Request::get_session_id();
/**
* @todo: ensure session_id is correctly defaulted
* @todo: ensure session_id is correctly defaulted
*/
$action = $this->url(self::ACTION_ADD_LINK);
$form = new LinkForm('link', 'post', $action);
@ -242,13 +242,13 @@ class Controller extends \Controller
if (!$this->is_allowed_to_edit()) {
$this->forbidden();
return;
}
}
$action = $this->url(self::ACTION_IMPORT_CSV);
$form = new UploadFileForm('import_csv', 'post', $action);
$form->init();
if ($form->validate()) {
$file = $form->get_file();
$file = $form->get_file();
$path = $file['tmp_name'];
$c_id = Request::get_c_id();
$session_id = Request::get_session_id();
@ -310,7 +310,7 @@ class Controller extends \Controller
$writer->put($data);
}
}
\DocumentManager :: file_send_for_download($temp, true, get_lang('Links').'.csv');
}
@ -322,7 +322,7 @@ class Controller extends \Controller
}
/**
* See AjaxController
* See AjaxController
*/
$this->missing();
}
@ -369,7 +369,7 @@ class Controller extends \Controller
}
/**
* See AjaxController
* See AjaxController
*/
$this->missing();
}
@ -382,7 +382,7 @@ class Controller extends \Controller
}
/**
* See AjaxController
* See AjaxController
*/
$this->missing();
}
@ -486,7 +486,7 @@ class Controller extends \Controller
$link = $repo->find_one_by_id($c_id, $id);
$url = $link->url;
event_link($id);
Event::event_link($id);
Header::cache_control('no-store, no-cache, must-revalidate');
Header::pragma('no-cache');
@ -495,15 +495,15 @@ class Controller extends \Controller
/**
* Render a template using data. Adds a few common parameters to the data array.
*
*
* @see /main/template/default/course_description/
* @param string $template
* @param array $data
* @param array $data
*/
protected function render($template, $data)
{
$data = $data ? $data : (object) array();
$_user = api_get_user_info();
$session_id = Request::get_session_id();
$data->session_image = api_get_session_image($session_id, $_user);

@ -99,7 +99,7 @@ $tbl_link = Database::get_course_table(TABLE_LINK);
$tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
// Statistics
event_access_tool(TOOL_LINK);
Event::event_access_tool(TOOL_LINK);
Display::display_header($nameTools, 'Links');

@ -25,7 +25,7 @@ $link_url = html_entity_decode(Security::remove_XSS($_GET['link_url']));
$link_id = intval($_GET['link_id']);
// Launch event
event_link($link_id);
Event::event_link($link_id);
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);

@ -85,7 +85,7 @@ $full_file_name = $path_user_info['dir'].'message_attachments/'.$file_url;
if (Security::check_abs_path($full_file_name, $path_user_info['dir'].'message_attachments/')) {
// launch event
event_download($file_url);
Event::event_download($file_url);
DocumentManager::file_send_for_download($full_file_name,TRUE, $title);
}
exit;

@ -194,7 +194,7 @@ if ($check) {
!empty($student_id)
) {
$course_info = api_get_course_info($course);
delete_student_lp_events(
Event::delete_student_lp_events(
$student_id,
$lp_id,
$course_info,

@ -39,7 +39,7 @@ if ($_SESSION['oLP']) {
$visible = learnpath::is_lp_visible_for_student($lp_id, $user_id);
if ($visible) {
event_download($doc_url);
Event::event_download($doc_url);
if (Security::check_abs_path($sys_course_path.$doc_url, $sys_course_path.'/')) {
$full_file_name = $sys_course_path.$doc_url;
DocumentManager::file_send_for_download($full_file_name);

@ -1250,8 +1250,7 @@ function export_exercise($item_id) {
$i ++;
echo $s = "<tr bgcolor='#e6e6e6'><td valign='top' colspan='2'>".get_lang('Question')." ";
// Call the showQuestion() function from exercise.lib.php. This basically displays the question in a table.
$test .= showQuestion($questionId, false, 'export', $i);
$test .= ExerciseLib::showQuestion($questionId, false, 'export', $i);
} // end foreach()

@ -13,7 +13,7 @@ global $charset;
$show_description_field = false; //for now
$nameTools = get_lang('Doc');
$this_section = SECTION_COURSES;
event_access_tool(TOOL_LEARNPATH);
Event::event_access_tool(TOOL_LEARNPATH);
api_protect_course_script();

@ -36,7 +36,7 @@ function confirmation(name) {
}
</script>";
$nameTools = get_lang('LearningPaths');
event_access_tool(TOOL_LEARNPATH);
Event::event_access_tool(TOOL_LEARNPATH);
api_protect_course_script();
//if (!$is_allowed_in_course) api_not_allowed();

@ -18,7 +18,7 @@ require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php';
require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'. api_get_path(WEB_PATH) .'main/newscorm/lp_list_search.css" />';
event_access_tool(TOOL_SEARCH);
Event::event_access_tool(TOOL_SEARCH);
if (isset($_SESSION['gradebook'])){
$gradebook = $_SESSION['gradebook'];

@ -11,16 +11,16 @@ use Header;
/**
* Ajax controller. Dispatch request and perform required action.
*
*
* - delete one note
* - delete all notes in a course/session
* - returns a note from its id
*
*
* Usage:
*
*
* $controller = AjaxController::instance();
* $controller->run();
*
*
* @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Genevas
* @license /license.txt
*/
@ -33,7 +33,7 @@ class AjaxController extends \AjaxController
/**
* Return the instance of the controller.
*
*
* @return \Notebook\AjaxController
*/
public static function instance()
@ -46,12 +46,12 @@ class AjaxController extends \AjaxController
}
/**
* Prepare the environment. Set up breadcrumps and raise tracking event.
* Prepare the environment. Set up breadcrumps and raise tracking event.
*/
protected function prolog()
{
event_access_tool(TOOL_NOTEBOOK);
}
Event::event_access_tool(TOOL_NOTEBOOK);
}
public function is_allowed_to_edit()
{
@ -105,4 +105,4 @@ class AjaxController extends \AjaxController
$this->response($success, '', $data);
}
}
}

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

Loading…
Cancel
Save