Merge pull request #2757 from chamilo/minimun_view_time

Minimun view time
pull/2762/head
Julio Montoya 7 years ago committed by GitHub
commit 9a3b9b039c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      main/announcements/announcements.php
  2. 12
      main/auth/profile.php
  3. 10
      main/calendar/agenda.php
  4. 10
      main/calendar/agenda_list.php
  5. 12
      main/chat/chat.php
  6. 10
      main/course_description/index.php
  7. 9
      main/course_home/course_home.php
  8. 12
      main/dropbox/index.php
  9. 12
      main/exercise/exercise.php
  10. 12
      main/exercise/exercise_submit.php
  11. 16
      main/exercise/overview.php
  12. 135
      main/forum/forumfunction.inc.php
  13. 13
      main/forum/index.php
  14. 11
      main/forum/newthread.php
  15. 11
      main/forum/reply.php
  16. 11
      main/forum/viewforum.php
  17. 10
      main/forum/viewforumcategory.php
  18. 12
      main/forum/viewthread.php
  19. 24
      main/gradebook/gradebook_add_cat.php
  20. 23
      main/gradebook/gradebook_add_eval.php
  21. 24
      main/gradebook/gradebook_add_link.php
  22. 11
      main/gradebook/gradebook_edit_all.php
  23. 13
      main/gradebook/gradebook_edit_cat.php
  24. 12
      main/gradebook/gradebook_edit_eval.php
  25. 11
      main/gradebook/gradebook_edit_link.php
  26. 59
      main/gradebook/index.php
  27. 12
      main/gradebook/my_certificates.php
  28. 10
      main/inc/ajax/agenda.ajax.php
  29. 11
      main/inc/ajax/course.ajax.php
  30. 13
      main/inc/ajax/course_chat.ajax.php
  31. 30
      main/inc/lib/events.lib.php
  32. 10
      main/inc/lib/online.inc.php
  33. 614
      main/inc/lib/tracking.lib.php
  34. 19
      main/inc/lib/usermanager.lib.php
  35. 11
      main/install/configuration.dist.php
  36. 140
      main/lp/learnpath.class.php
  37. 64
      main/lp/learnpathItem.class.php
  38. 62
      main/lp/lp_ajax_switch_item.php
  39. 101
      main/lp/lp_controller.php
  40. 10
      main/lp/lp_edit.php
  41. 86
      main/lp/lp_list.php
  42. 63
      main/lp/lp_view.php
  43. 93
      main/lp/scorm_api.php
  44. 12
      main/messages/inbox.php
  45. 12
      main/messages/new_message.php
  46. 12
      main/messages/outbox.php
  47. 12
      main/messages/view_message.php
  48. 12
      main/mySpace/index.php
  49. 12
      main/notebook/index.php
  50. 12
      main/survey/fillsurvey.php
  51. 12
      main/survey/survey_list.php
  52. 22
      main/template/default/learnpath/list.tpl
  53. 91
      main/template/default/learnpath/view.tpl
  54. 7
      main/template/default/mail/content_ending_learnpath.tpl
  55. 12
      main/work/work.php
  56. 12
      plugin/bbb/start.php
  57. 10
      user_portal.php

@ -93,6 +93,18 @@ $homeUrl = api_get_self().'?action=list&'.api_get_cidreq();
$content = '';
$searchFormToString = '';
// ## NSR - log
$logInfo = [
'tool' => TOOL_ANNOUNCEMENT,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => $action,
'action_details' => '',
'current_id' => (int) $announcement_id,
'info' => '',
];
Event::registerLog($logInfo);
switch ($action) {
case 'move':
if (!$allowToEdit) {

@ -21,6 +21,18 @@ if ($allowSocialTool) {
$this_section = SECTION_SOCIAL;
}
// ## NSR - log
$logInfo = [
'tool' => 'profile',
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => $this_section,
'action_details' => '',
'current_id' => 0,
'info' => '',
];
Event::registerLog($logInfo);
$_SESSION['this_section'] = $this_section;
if (!(isset($_user['user_id']) && $_user['user_id']) || api_is_anonymous($_user['user_id'], true)) {

@ -29,6 +29,16 @@ if (empty($action)) {
exit;
}
// ## NSR
$logInfo = [
'tool' => TOOL_CALENDAR_EVENT,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => $action,
'info' => '',
];
Event::registerLog($logInfo);
$group_id = api_get_group_id();
$groupInfo = GroupManager::get_group_properties($group_id);
$eventId = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;

@ -6,6 +6,16 @@
*/
require_once __DIR__.'/../inc/global.inc.php';
// ## NSR
$logInfo = [
'tool' => TOOL_CALENDAR_EVENT,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => isset($_GET['action']) ? $_GET['action'] : 'calendar_list',
'info' => '',
];
Event::registerLog($logInfo);
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
$interbreadcrumb[] = [

@ -9,6 +9,18 @@ api_protect_course_script(true);
Event::event_access_tool(TOOL_CHAT);
// ## NSR - log
$logInfo = [
'tool' => TOOL_CHAT,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'start',
'action_details' => 'start-chat',
'current_id' => 0,
'info' => '',
];
Event::registerLog($logInfo);
// View
$externalCSS = [
'jquery-emojiarea/jquery.emojiarea.css',

@ -18,6 +18,16 @@ define('ADD_BLOCK', 8);
// current section
$this_section = SECTION_COURSES;
// ## NSR
$logInfo = [
'tool' => TOOL_COURSE_DESCRIPTION,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => !empty($_GET['action']) ? $_GET['action'] : 'listing',
'info' => '',
];
Event::registerLog($logInfo);
// protect a course script
api_protect_course_script(true);

@ -162,6 +162,15 @@ if (!isset($coursesAlreadyVisited[$course_code])) {
Session::write('coursesAlreadyVisited', $coursesAlreadyVisited);
}
$logInfo = [
'tool' => 'course-main',
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => isset($_GET['action']) ? $_GET['action'] : '',
'info' => '',
];
Event::registerLog($logInfo);
/*Auto launch code */
$autoLaunchWarning = '';
$showAutoLaunchLpWarning = false;

@ -26,6 +26,18 @@ $showSentReceivedTabs = true;
// Do the tracking
Event::event_access_tool(TOOL_DROPBOX);
// ## NSR - log
$logInfo = [
'tool' => TOOL_DROPBOX,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => $action,
'action_details' => '',
'current_id' => isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0,
'info' => '',
];
Event::registerLog($logInfo);
/* DISPLAY SECTION */
Display::display_introduction_section(TOOL_DROPBOX);

@ -153,6 +153,18 @@ if ($origin != 'learnpath') {
Event::event_access_tool(TOOL_QUIZ);
// ## NSR - log
$logInfo = [
'tool' => TOOL_QUIZ,
'tool_id' => (int) $exerciseId,
'tool_id_detail' => 0,
'action' => isset($_REQUEST['learnpath_id']) ? 'learnpath_id' : '',
'action_details' => isset($_REQUEST['learnpath_id']) ? (int) $_REQUEST['learnpath_id'] : '',
'current_id' => 0,
'info' => '',
];
Event::registerLog($logInfo);
// Tool introduction
Display::display_introduction_section(TOOL_QUIZ);

@ -93,6 +93,18 @@ $current_question = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : null;
$currentAnswer = isset($_REQUEST['num_answer']) ? intval($_REQUEST['num_answer']) : null;
$endExercise = isset($_REQUEST['end_exercise']) && $_REQUEST['end_exercise'] == 1 ? true : false;
// ## NSR - log
$logInfo = [
'tool' => TOOL_QUIZ,
'tool_id' => $exerciseId,
'tool_id_detail' => 0,
'action' => ((int) $_REQUEST['learnpath_id'] > 0) ? 'learnpath_id' : '',
'action_details' => ((int) $_REQUEST['learnpath_id'] > 0) ? (int) $_REQUEST['learnpath_id'] : '',
'current_id' => $current_question,
'info' => '',
];
Event::registerLog($logInfo);
// Error message
$error = '';

@ -39,9 +39,21 @@ $learnpath_item_id = isset($_REQUEST['learnpath_item_id']) ? intval($_REQUEST['l
$learnpathItemViewId = isset($_REQUEST['learnpath_item_view_id']) ? intval($_REQUEST['learnpath_item_view_id']) : null;
$origin = api_get_origin();
// ## NSR - log
$logInfo = [
'tool' => TOOL_QUIZ,
'tool_id' => $exercise_id,
'tool_id_detail' => 0,
'action' => isset($_REQUEST['learnpath_id']) ? 'learnpath_id' : '',
'action_details' => isset($_REQUEST['learnpath_id']) ? (int) $_REQUEST['learnpath_id'] : '',
'current_id' => 0,
'info' => '',
];
Event::registerLog($logInfo);
$interbreadcrumb[] = [
"url" => "exercise.php?".api_get_cidreq(),
"name" => get_lang('Exercises'),
'url' => 'exercise.php?'.api_get_cidreq(),
'name' => get_lang('Exercises'),
];
$interbreadcrumb[] = ["url" => "#", "name" => $objExercise->selectTitle(true)];

@ -128,7 +128,7 @@ function handle_forum_and_forumcategories($lp_id = null)
// Edit a forum category
if (($action_forum_cat == 'edit' && $get_content == 'forumcategory') ||
(isset($_POST['SubmitEditForumCategory'])) ? true : false
(isset($_POST['SubmitEditForumCategory'])) ? true : false
) {
$forum_category = get_forum_categories($get_id);
$content = show_edit_forumcategory_form($forum_category);
@ -614,6 +614,17 @@ function store_forumcategory($values, $courseInfo = [], $showMessage = true)
api_get_user_id()
);
$return_message = get_lang('ForumCategoryEdited');
// ## NSR - log
$logInfo = [
'tool' => TOOL_FORUM,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'update-forumcategory',
'action_details' => 'forumcategory',
'current_id' => $values['forum_category_id'],
'info' => $clean_cat_title,
];
Event::registerLog($logInfo);
} else {
$params = [
'c_id' => $course_id,
@ -645,6 +656,18 @@ function store_forumcategory($values, $courseInfo = [], $showMessage = true)
);
}
$return_message = get_lang('ForumCategoryAdded');
// ## NSR - log
$logInfo = [
'tool' => TOOL_FORUM,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'new-forumcategory',
'action_details' => 'forumcategory',
'current_id' => $last_id,
'info' => $clean_cat_title,
];
Event::registerLog($logInfo);
}
if ($showMessage) {
@ -839,6 +862,18 @@ function store_forum($values, $courseInfo = [], $returnId = false)
$return_message = get_lang('ForumEdited');
$forumId = $values['forum_id'];
// ## NSR - log
$logInfo = [
'tool' => TOOL_FORUM,
'tool_id' => $values['forum_id'],
'tool_id_detail' => 0,
'action' => 'update-forum',
'action_details' => 'forum',
'current_id' => $values['forum_id'],
'info' => $values['forum_title'],
];
Event::registerLog($logInfo);
} else {
if ($image_moved) {
$new_file_name = isset($new_file_name) ? $new_file_name : '';
@ -887,6 +922,18 @@ function store_forum($values, $courseInfo = [], $returnId = false)
$group_id,
$courseInfo
);
// ## NSR - log
$logInfo = [
'tool' => TOOL_FORUM,
'tool_id' => $forumId,
'tool_id_detail' => 0,
'action' => 'new-forum',
'action_details' => 'forum',
'current_id' => $forumId,
'info' => $values['forum_title'],
];
Event::registerLog($logInfo);
}
$return_message = get_lang('ForumAdded');
}
@ -2610,6 +2657,18 @@ function updateThread($values)
return '';
}
// ## NSR - log
$logInfo = [
'tool' => TOOL_FORUM,
'tool_id' => $values['forum_id'],
'tool_id_detail' => $values['thread_id'],
'action' => 'edit-thread',
'action_details' => 'thread',
'current_id' => $values['thread_id'],
'info' => $values['thread_title'],
];
Event::registerLog($logInfo);
$threadTable = Database::get_course_table(TABLE_FORUM_THREAD);
$courseId = api_get_course_int_id();
$courseCode = api_get_course_id();
@ -2854,6 +2913,18 @@ function store_thread(
);
$visible = 1;
}
// ## NSR - log
$logInfo = [
'tool' => TOOL_FORUM,
'tool_id' => $values['forum_id'],
'tool_id_detail' => $lastThread->getIid(),
'action' => 'new-thread',
'action_details' => '',
'current_id' => $lastThread->getIid(),
'info' => $clean_post_title,
];
Event::registerLog($logInfo);
}
// We now store the content in the table_post table.
@ -2884,6 +2955,18 @@ function store_thread(
$lastPostId = $lastPost->getIid();
// ## NSR - log
$logInfo = [
'tool' => TOOL_FORUM,
'tool_id' => $values['forum_id'],
'tool_id_detail' => $lastThread->getIid(),
'action' => 'new-post',
'action_details' => '',
'current_id' => $lastPostId,
'info' => $clean_post_title,
];
Event::registerLog($logInfo);
if ($lastPostId) {
$lastPost->setPostId($lastPostId);
$em->merge($lastPost);
@ -3014,11 +3097,11 @@ function show_add_post_form($current_forum, $forum_setting, $action, $id = '', $
$my_post = isset($_GET['post']) ? (int) $_GET['post'] : '';
$url = api_get_self().'?'.http_build_query([
'action' => $action,
'forum' => $forumId,
'thread' => $myThread,
'post' => $my_post,
]).'&'.api_get_cidreq();
'action' => $action,
'forum' => $forumId,
'thread' => $myThread,
'post' => $my_post,
]).'&'.api_get_cidreq();
$form = new FormValidator(
'thread',
@ -3182,9 +3265,9 @@ function show_add_post_form($current_forum, $forum_setting, $action, $id = '', $
$defaults['post_text'] = '<div>&nbsp;</div>
<div style="margin: 5px;">
<div style="font-size: 90%; font-style: italic;">'.
get_lang('Quoting').' '.$posterName.':</div>
get_lang('Quoting').' '.$posterName.':</div>
<div style="color: #006600; font-size: 90%; font-style: italic; background-color: #FAFAFA; border: #D1D7DC 1px solid; padding: 3px;">'.
prepare4display($values['post_text']).'
prepare4display($values['post_text']).'
</div>
</div>
<div>&nbsp;</div>
@ -3239,11 +3322,11 @@ function show_add_post_form($current_forum, $forum_setting, $action, $id = '', $
}
$url = api_get_path(WEB_CODE_PATH).'forum/viewthread.php?'.api_get_cidreq().'&'.http_build_query(
[
'forum' => $forumId,
'thread' => $myThread,
]
);
[
'forum' => $forumId,
'thread' => $myThread,
]
);
Security::clear_token();
header('Location: '.$url);
@ -3681,6 +3764,18 @@ function store_reply($current_forum, $values, $courseId = 0, $userId = 0)
$values
);
add_forum_attachment_file('', $new_post_id);
// ## NSR - log
$logInfo = [
'tool' => TOOL_FORUM,
'tool_id' => $values['forum_id'],
'tool_id_detail' => $values['thread_id'],
'action' => 'new-post',
'action_details' => $values['action'],
'current_id' => $new_post_id,
'info' => $values['post_title'],
];
Event::registerLog($logInfo);
}
Session::erase('formelements');
@ -3868,6 +3963,18 @@ function show_edit_post_form(
*/
function store_edit_post($forumInfo, $values)
{
// ## NSR - log
$logInfo = [
'tool' => TOOL_FORUM,
'tool_id' => $_GET['forum'],
'tool_id_detail' => $values['thread_id'],
'action' => 'edit-post',
'action_details' => 'post',
'current_id' => $values['post_id'],
'info' => $values['post_title'],
];
Event::registerLog($logInfo);
$threadTable = Database::get_course_table(TABLE_FORUM_THREAD);
$table_posts = Database::get_course_table(TABLE_FORUM_POST);
$course_id = api_get_course_int_id();
@ -5810,7 +5917,7 @@ function get_all_post_from_user($user_id, $course_code)
Display::return_icon('forum.gif', get_lang('Forum')).'&nbsp;'.Security::remove_XSS($forum['forum_title'], STUDENT).
'<div style="float:right;margin-top:-35px">
<a href="../forum/viewforum.php?'.api_get_cidreq_params($course_code).'&forum='.$forum['forum_id'].' " >'.
get_lang('SeeForum').'
get_lang('SeeForum').'
</a>
</div></div>';
$forum_results .= '<br / >';

@ -121,6 +121,19 @@ $whatsnew_post_info = Session::read('whatsnew_post_info');
/* TRACKING */
Event::event_access_tool(TOOL_FORUM);
// ## NSR - log
$logInfo = [
'tool' => TOOL_FORUM,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => !empty($actions) ? $actions : 'list-category',
'action_details' => $_GET['content'],
'current_id' => !empty($actions) ? (int) $_GET['id'] : 0,
'info' => '',
];
Event::registerLog($logInfo);
/*
RETRIEVING ALL THE FORUM CATEGORIES AND FORUMS
note: we do this here just after het handling of the actions to be

@ -44,6 +44,17 @@ $origin = api_get_origin();
$current_forum = get_forum_information($_GET['forum']);
$current_forum_category = get_forumcategory_information($current_forum['forum_category']);
// ## NSR - log
$logInfo = [
'tool' => TOOL_FORUM,
'tool_id' => (int) $_GET['forum'],
'tool_id_detail' => 0,
'action' => 'add-thread',
'action_details' => '',
'current_id' => 0,
];
Event::registerLog($logInfo);
if (api_is_in_gradebook()) {
$interbreadcrumb[] = [
'url' => Category::getUrl(),

@ -155,6 +155,17 @@ $my_action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : ''
$my_post = isset($_GET['post']) ? Security::remove_XSS($_GET['post']) : '';
$my_elements = isset($_SESSION['formelements']) ? $_SESSION['formelements'] : '';
// ## NSR - log
$logInfo = [
'tool' => TOOL_FORUM,
'tool_id' => $forumId,
'tool_id_detail' => $threadId,
'action' => !empty($my_action) ? $my_action : 'reply',
'action_details' => '',
'current_id' => $my_post,
];
Event::registerLog($logInfo);
$form = show_add_post_form(
$current_forum,
$forum_setting,

@ -103,6 +103,17 @@ if (!empty($groupId)) {
$my_search = isset($_GET['search']) ? $_GET['search'] : '';
$my_action = isset($_GET['action']) ? $_GET['action'] : '';
// ## NSR - log
$logInfo = [
'tool' => TOOL_FORUM,
'tool_id' => $my_forum,
'tool_id_detail' => 0,
'action' => !empty($my_action) ? $my_action : 'list-threads',
'action_details' => $_GET['content'],
'current_id' => !empty($my_action) ? (int) $_GET['id'] : 0,
];
Event::registerLog($logInfo);
if (api_is_in_gradebook()) {
$interbreadcrumb[] = [
'url' => Category::getUrl(),

@ -125,6 +125,16 @@ $html .= '</div>';
/* ACTIONS */
echo $html;
// ## NSR - log
$logInfo = [
'tool' => TOOL_FORUM,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => $action,
'info' => $_GET['content'],
];
Event::registerLog($logInfo);
if (api_is_allowed_to_edit(false, true)) {
handle_forum_and_forumcategories();
}

@ -125,6 +125,18 @@ if (!api_is_allowed_to_edit(false, true) &&
/* Actions */
$my_action = isset($_GET['action']) ? $_GET['action'] : '';
// ## NSR - log
$logInfo = [
'tool' => TOOL_FORUM,
'tool_id' => $_GET['forum'],
'tool_id_detail' => $_GET['thread'],
'action' => !empty($my_action) ? $my_action : 'view-thread',
'action_details' => $_GET['content'],
'current_id' => !empty($my_action) ? (int) $_GET['id'] : 0,
];
Event::registerLog($logInfo);
if ($my_action == 'delete' &&
isset($_GET['content']) &&
isset($_GET['id']) &&

@ -89,10 +89,34 @@ if ($form->validate()) {
}
$cat->set_visible($visible);
$result = $cat->add();
// ## NSR - log
$logInfo = [
'tool' => TOOL_GRADEBOOK,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'new-cat',
'action_details' => 'parent_id='.$cat->get_parent_id(),
'current_id' => $cat->get_id(),
'info' => '',
];
Event::registerLog($logInfo);
header('Location: '.Category::getUrl().'addcat=&selectcat='.$cat->get_parent_id());
exit;
}
$logInfo = [
'tool' => TOOL_GRADEBOOK,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'add-cat',
'action_details' => Category::getUrl().'selectcat='.$get_select_cat,
'current_id' => $current_id,
'info' => '',
];
Event::registerLog($logInfo);
if (!$_in_course) {
$interbreadcrumb[] = [
'url' => Category::getUrl().'selectcat='.$get_select_cat,

@ -64,6 +64,18 @@ if ($form->validate()) {
}
$eval->set_visible($visible);
$eval->add();
// ## NSR - log
$logInfo = [
'tool' => TOOL_GRADEBOOK,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'new-eval',
'action_details' => 'selectcat='.$eval->get_category_id(),
'current_id' => $eval->get_id(),
'info' => '',
];
Event::registerLog($logInfo);
if ($eval->get_course_code() == null) {
if ($values['adduser'] == 1) {
//Disabling code when course code is null see issue #2705
@ -85,6 +97,17 @@ if ($form->validate()) {
}
}
$logInfo = [
'tool' => TOOL_GRADEBOOK,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'add-eval',
'action_details' => 'selectcat='.$eval->get_category_id(),
'current_id' => $current_id,
'info' => '',
];
Event::registerLog($logInfo);
$interbreadcrumb[] = [
'url' => Category::getUrl().'selectcat='.$select_cat,
'name' => get_lang('Gradebook'), ]

@ -131,6 +131,19 @@ if (isset($typeSelected) && $typeSelected != '0') {
}
$link->add();
// ## NSR - log
$logInfo = [
'tool' => TOOL_GRADEBOOK,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'new-link',
'action_details' => 'selectcat='.$selectCat,
'current_id' => $link->get_id(),
'info' => '',
];
Event::registerLog($logInfo);
$addvalue_result = !empty($addvalues['addresult']) ? $addvalues['addresult'] : [];
if ($addvalue_result == 1) {
header('Location: gradebook_add_result.php?selecteval='.$link->get_ref_id().'&'.api_get_cidreq());
@ -142,6 +155,17 @@ if (isset($typeSelected) && $typeSelected != '0') {
}
}
$logInfo = [
'tool' => TOOL_GRADEBOOK,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'add-link',
'action_details' => 'selectcat='.$selectCat,
'current_id' => $current_id,
'info' => '',
];
Event::registerLog($logInfo);
$interbreadcrumb[] = [
'url' => Category::getUrl().'selectcat='.$selectCat,
'name' => get_lang('Gradebook'),

@ -71,6 +71,17 @@ $table_evaluated[LINK_SURVEY] = [
get_lang('Survey'),
];
$logInfo = [
'tool' => TOOL_GRADEBOOK,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'edit-weight',
'action_details' => $my_selectcat,
'current_id' => $current_id,
'info' => '',
];
Event::registerLog($logInfo);
$submitted = isset($_POST['submitted']) ? $_POST['submitted'] : '';
if ($submitted == 1) {
Display::addFlash(Display::return_message(get_lang('GradebookWeightUpdated')));

@ -10,7 +10,6 @@ require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();
GradebookUtils::block_students();
$edit_cat = isset($_REQUEST['editcat']) ? intval($_REQUEST['editcat']) : '';
$catedit = Category::load($edit_cat);
@ -85,6 +84,18 @@ if ($form->validate()) {
exit;
}
$selectcat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : '';
$logInfo = [
'tool' => TOOL_GRADEBOOK,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'edit-cat',
'action_details' => $selectcat,
'current_id' => $current_id,
'info' => '',
];
Event::registerLog($logInfo);
$interbreadcrumb[] = [
'url' => Category::getUrl().'selectcat='.$selectcat,
'name' => get_lang('Gradebook'),

@ -44,6 +44,18 @@ if ($form->validate()) {
}
$eval->set_visible($visible);
$eval->save();
$logInfo = [
'tool' => TOOL_GRADEBOOK,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'edit-eval',
'action_details' => '',
'current_id' => $eval->get_category_id(),
'info' => '',
];
Event::registerLog($logInfo);
header('Location: '.Category::getUrl().'editeval=&selectcat='.$eval->get_category_id());
exit;
}

@ -105,6 +105,17 @@ if ($form->validate()) {
'type' => LINK_STUDENTPUBLICATION,
]);
$logInfo = [
'tool' => TOOL_GRADEBOOK,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'edit-link',
'action_details' => '',
'current_id' => $_GET['editlink'],
'info' => '',
];
Event::registerLog($logInfo);
header('Location: '.Category::getUrl().'linkedited=&selectcat='.$link->get_category_id());
exit;
}

@ -66,6 +66,65 @@ $(document).ready(function() {
});
</script>';
// ## NSR - log
$list_actions = [];
$list_values = [];
if (isset($_GET['movecat'])) {
$list_actions[] = 'movecat';
$list_values[] = $_GET['movecat'];
}
if (isset($_GET['moveeval'])) {
$list_actions[] = 'moveeval';
$list_values[] = $_GET['moveeval'];
}
if (isset($_GET['movelink'])) {
$list_actions[] = 'movelink';
$list_values[] = $_GET['movelink'];
}
if (isset($_GET['visiblecat'])) {
$list_actions[] = 'visiblecat';
$list_values[] = $_GET['visiblecat'];
}
if (isset($_GET['deletecat'])) {
$list_actions[] = 'deletecat';
$list_values[] = $_GET['deletecat'];
}
if (isset($_GET['visibleeval'])) {
$list_actions[] = 'visibleeval';
$list_values[] = $_GET['visibleeval'];
}
if (isset($_GET['lockedeval'])) {
$list_actions[] = 'lockedeval';
$list_values[] = $_GET['lockedeval'];
}
if (isset($_GET['deleteeval'])) {
$list_actions[] = 'deleteeval';
$list_values[] = $_GET['deleteeval'];
}
if (isset($_GET['visiblelink'])) {
$list_actions[] = 'visiblelink';
$list_values[] = $_GET['visiblelink'];
}
if (isset($_GET['deletelink'])) {
$list_actions[] = 'deletelink';
$list_values[] = $_GET['deletelink'];
}
if (isset($_GET['action'])) {
$list_actions[] = $_GET['action'];
}
$my_actions = implode(';', $list_actions);
$my_actions_values = implode(';', $list_values);
$logInfo = [
'tool' => TOOL_GRADEBOOK,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => $my_actions,
'action_details' => $my_actions_values,
'current_id' => 0,
'info' => '',
];
Event::registerLog($logInfo);
$tbl_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD);
$tbl_attendance = Database::get_course_table(TABLE_ATTENDANCE);
$tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);

@ -12,6 +12,18 @@ $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
// ## NSR - log
$logInfo = [
'tool' => 'MyCertificates',
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => '',
'action_details' => '',
'current_id' => 0,
'info' => '',
];
Event::registerLog($logInfo);
if (api_is_anonymous()) {
api_not_allowed(true);
}

@ -19,6 +19,16 @@ if ($type == 'course') {
api_protect_course_script(true);
}
// ## NSR
$logInfo = [
'tool' => TOOL_CALENDAR_EVENT,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => $action,
'info' => '',
];
Event::registerLog($logInfo);
$agenda = new Agenda($type);
// get filtered type
$type = $agenda->getType();

@ -365,6 +365,17 @@ switch ($action) {
'sid' => api_get_session_id(),
];
$logInfo = [
'tool' => 'close-window',
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'exit',
'action_details' => '',
'current_id' => $_GET['last_id'],
'info' => '',
];
Event::registerLog($logInfo);
$result = (int) Event::courseLogout($logoutInfo);
echo $result;
break;

@ -18,6 +18,19 @@ $json = ['status' => false];
$courseChatUtils = new CourseChatUtils($courseId, $userId, $sessionId, $groupId);
switch ($_REQUEST['action']) {
case 'chat_logout':
// ## NSR - log
$logInfo = [
'tool' => TOOL_CHAT,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'exit',
'action_details' => 'exit-chat',
'current_id' => 0,
'info' => '',
];
Event::registerLog($logInfo);
break;
case 'track':
$courseChatUtils->keepUserAsConnected();
$courseChatUtils->disconnectInactiveUsers();

@ -2453,4 +2453,34 @@ class Event
// proper logic for this filter
return $res;
}
/**
* Register the logout of the course (usually when logging out of the platform)
* from the track_e_access_complete table.
*
* @param array $logInfo Information stored by local.inc.php
*
* @return bool
*/
public static function registerLog($logInfo)
{
if (!api_get_configuration_value('allow_track_complete')) {
return false;
}
$loginAs = (int) (Session::read('login_as') === true);
$logInfo['user_id'] = api_get_user_id();
$logInfo['c_id'] = api_get_course_int_id();
$logInfo['session_id'] = api_get_session_id();
$logInfo['url'] = $_SERVER['REQUEST_URI'];
$logInfo['ch_sid'] = session_id();
$logInfo['ip_user'] = api_get_real_ip();
$logInfo['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
$logInfo['login_as'] = $loginAs;
$id = Database::insert('track_e_access_complete', $logInfo);
Session::write('last_id', $id);
return true;
}
}

@ -132,6 +132,16 @@ function online_logout($user_id = null, $logout_redirect = false)
Database::query($sql);
}
// ## NSR - log
$logInfo = [
'tool' => 'logout',
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => '',
'info' => '',
];
Event::registerLog($logInfo);
UserManager::loginDelete($user_id);
//the following code enables the use of an external logout function.

@ -435,6 +435,16 @@ class Tracking
$lesson_status = $row['mystatus'];
$score = $row['myscore'];
$time_for_total = $row['mytime'];
// ## NSR sistema de tiempos nuevo
if (api_get_configuration_value('allow_track_complete')) {
$timeCourse = self::getCalculateTime($user_id, $session_id);
Session::write('trackTimeCourse', $timeCourse);
$lp_time = $timeCourse[TOOL_LEARNPATH];
$lpTime = (int) $lp_time[$lp_id];
$time_for_total = $lpTime;
}
$time = learnpathItem::getScormTimeFromParameter('js', $row['mytime']);
if ($score == 0) {
@ -1649,6 +1659,28 @@ class Tracking
$rs = Database::query($sql);
$row = Database::fetch_array($rs);
if (api_get_configuration_value('lp_minimum_time')) {
$courseInfo = api_get_course_info_by_id($courseId);
$course_code = $courseInfo['code'];
$sql = "SELECT * FROM c_lp WHERE c_id = $courseId";
$rs = Database::query($sql);
$dataLp = [];
while ($aux = Database::fetch_assoc($rs)) {
$dataLp[] = $aux['id'];
}
$lpTime = Tracking::get_time_spent_in_lp(
$user_id,
$course_code,
$dataLp, //array($_SESSION['oLP']->lp_id),
$session_id
);
if ($row['nb_seconds'] > $lpTime) {
return $row['nb_seconds'];
} else {
return $lpTime;
}
}
return $row['nb_seconds'];
}
@ -1791,29 +1823,54 @@ class Tracking
$session_id = 0,
$convert_date = true
) {
$student_id = intval($student_id);
$courseId = intval($courseId);
$session_id = intval($session_id);
$student_id = (int) $student_id;
$courseId = (int) $courseId;
$session_id = (int) $session_id;
$tbl_track_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$sql = 'SELECT login_course_date
FROM '.$tbl_track_login.'
WHERE
user_id = '.$student_id.' AND
c_id = '.$courseId.' AND
session_id = '.$session_id.'
ORDER BY login_course_date ASC
LIMIT 0,1';
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
if ($first_login_date = Database::result($rs, 0, 0)) {
if ($convert_date) {
return api_convert_and_format_date(
$first_login_date,
DATE_FORMAT_SHORT
);
} else {
return $first_login_date;
if (api_get_configuration_value('lp_minimum_time')) {
$tbl_track_e_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$sql = 'SELECT access_date
FROM '.$tbl_track_e_access.'
WHERE access_user_id = '.$student_id.' AND
c_id = "'.$courseId.'" AND
access_session_id = '.$session_id.'
ORDER BY access_date ASC
LIMIT 0,1';
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
if ($last_login_date = Database::result($rs, 0, 0)) {
if (empty($last_login_date)) {
return false;
}
if ($convert_date) {
return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT);
} else {
return $last_login_date;
}
}
}
} else {
$tbl_track_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$sql = 'SELECT login_course_date
FROM '.$tbl_track_login.'
WHERE
user_id = '.$student_id.' AND
c_id = '.$courseId.' AND
session_id = '.$session_id.'
ORDER BY login_course_date ASC
LIMIT 0,1';
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
if ($first_login_date = Database::result($rs, 0, 0)) {
if ($convert_date) {
return api_convert_and_format_date(
$first_login_date,
DATE_FORMAT_SHORT
);
} else {
return $first_login_date;
}
}
}
}
@ -1841,45 +1898,106 @@ class Tracking
$student_id = (int) $student_id;
$session_id = (int) $session_id;
$courseId = $courseInfo['real_id'];
$tbl_track_e_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$sql = 'SELECT access_date
if (api_get_configuration_value('lp_minimum_time')) {
// ## NSR - Muestra la última fecha que accedió a la sesión cuando estaba activa
$where_condition = '';
$userInfo = api_get_user_info($student_id);
if ($userInfo['status'] == 5 && $session_id > 0) {
// fin de acceso a la sesión
$sessionInfo = SessionManager::fetch($session_id);
$last_access = $sessionInfo['access_end_date'];
$where_condition = ' AND access_date < "'.$last_access.'" ';
}
$tbl_track_e_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$sql = 'SELECT access_date
FROM '.$tbl_track_e_access.'
WHERE access_user_id = '.$student_id.' AND
c_id = "'.$courseId.'" AND
access_session_id = '.$session_id.'
access_session_id = '.$session_id.$where_condition.'
ORDER BY access_date DESC
LIMIT 0,1';
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
if ($last_login_date = Database::result($rs, 0, 0)) {
if (empty($last_login_date)) {
return false;
}
//see #5736
$last_login_date_timestamp = api_strtotime($last_login_date);
$now = time();
//If the last connection is > than 7 days, the text is red
//345600 = 7 days in seconds
if ($now - $last_login_date_timestamp > 604800) {
if ($convert_date) {
$last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT);
$icon = api_is_allowed_to_edit() ?
'<a href="'.api_get_path(WEB_CODE_PATH).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'&cidReq='.$courseInfo['code'].'" title="'.get_lang('RemindInactiveUser').'">
'.Display::return_icon('messagebox_warning.gif').'
</a>'
: null;
return $icon.Display::label($last_login_date, 'warning');
} else {
return $last_login_date;
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
if ($last_login_date = Database::result($rs, 0, 0)) {
if (empty($last_login_date)) {
return false;
}
} else {
//see #5736
$last_login_date_timestamp = api_strtotime($last_login_date);
$now = time();
//If the last connection is > than 7 days, the text is red
//345600 = 7 days in seconds
/*
if ($now - $last_login_date_timestamp > 604800) {
if ($convert_date) {
$last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT);
$icon = api_is_allowed_to_edit() ?
'<a href="'.api_get_path(WEB_CODE_PATH).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'&cidReq='.$courseInfo['code'].'" title="'.get_lang('RemindInactiveUser').'">
'.Display::return_icon('messagebox_warning.gif').'
</a>'
: null;
return $icon.Display::label($last_login_date, 'warning');
} else {
return $last_login_date;
}
} else {
*/
if ($convert_date) {
return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT);
} else {
return $last_login_date;
}
//}
}
}
} else {
$tbl_track_e_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$sql = 'SELECT access_date
FROM '.$tbl_track_e_access.'
WHERE access_user_id = '.$student_id.' AND
c_id = "'.$courseId.'" AND
access_session_id = '.$session_id.'
ORDER BY access_date DESC
LIMIT 0,1';
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
if ($last_login_date = Database::result($rs, 0, 0)) {
if (empty($last_login_date)) {
return false;
}
//see #5736
$last_login_date_timestamp = api_strtotime($last_login_date);
$now = time();
//If the last connection is > than 7 days, the text is red
//345600 = 7 days in seconds
if ($now - $last_login_date_timestamp > 604800) {
if ($convert_date) {
$last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT);
$icon = api_is_allowed_to_edit() ?
'<a href="'.api_get_path(
WEB_CODE_PATH
).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'&cidReq='.$courseInfo['code'].'" title="'.get_lang(
'RemindInactiveUser'
).'">
'.Display::return_icon('messagebox_warning.gif').'
</a>'
: null;
return $icon.Display::label($last_login_date, 'warning');
} else {
return $last_login_date;
}
} else {
if ($convert_date) {
return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT);
} else {
return $last_login_date;
}
}
}
}
}
@ -6679,6 +6797,404 @@ class Tracking
return $html;
}
/**
* @param int $userId
* @param int $sessionId
* @param bool $debug
*
* @return array
*/
public static function getCalculateTime($userId, $sessionId, $debug = false)
{
/* $sql = "SELECT session_lifetime
FROM plugin_licences_course_session
WHERE session_id = $sessionId";
$res = Database::query($sql);
$lifeTime = intval(Database::fetch_assoc($res)['session_lifetime']);*/
//error_log("sessionId: $sessionId: $lifeTime");
/*if ($lifeTime > 0) {
$sessionLifetime = $lifeTime;
$sessionFixTime = $lifeTime;
} else {
$sessionLifetime = 28800; //intval(api_get_configuration_value('session_lifetime'));
$sessionFixTime = 2700;
}*/
$sessionLifetime = 28800; //intval(api_get_configuration_value('session_lifetime'));
$sessionFixTime = 2700;
$total_time = 0;
$course_time = 0;
$quiz_time = 0;
$chat_time = 0;
$agenda_time = 0;
$forum_time = 0;
$announcement_time = 0;
$description_time = 0;
$survey_time = 0;
$notebook_time = 0;
$gradebook_time = 0;
$dropbox_time = 0;
$report_time = 0;
$videoconference_time = 0;
$link_time = 0;
$lp_time = [];
$reg = [];
$regUse = [];
$count_login = 0;
$sql = 'SELECT date_reg
FROM track_e_access_complete
WHERE
user_id = '.$userId.' AND
session_id = '.$sessionId.' AND
login_as = 0
ORDER BY date_reg ASC
LIMIT 0,1';
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
if ($last_login_date = Database::result($rs, 0, 0)) {
if (empty($last_login_date)) {
$fistConection = '';
} else {
$fistConection = date("d/m/Y H:i:s", strtotime($last_login_date));
}
} else {
$fistConection = '';
}
} else {
$fistConection = '';
}
$sql = 'SELECT date_reg
FROM track_e_access_complete
WHERE
user_id = '.$userId.' AND
session_id = '.$sessionId.' AND
login_as = 0
ORDER BY date_reg DESC
LIMIT 0,1';
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
if ($last_login_date = Database::result($rs, 0, 0)) {
if (empty($last_login_date)) {
$lastConection = '';
} else {
$lastConection = date('d/m/Y H:i:s', strtotime($last_login_date));
}
} else {
$lastConection = '';
}
} else {
$lastConection = '';
}
$sql = "SELECT * FROM track_e_access_complete WHERE user_id = $userId"; //AND session_id = $sessionId";
$res = Database::query($sql);
while ($row = Database::fetch_assoc($res)) {
if ($row['login_as'] == 1 && !$debug) {
continue;
}
if ($row['session_id'] == $sessionId) {
if ($login) {
$count_login++;
$login = false;
}
if ($row['tool'] == 'close-window' && $row['current_id'] > 0) {
$id = $row['current_id'];
if (!in_array($id, $regUse)) {
$reg[$row['id']]['date_reg'] = strtotime($row['date_reg']);
$reg[$row['id']]['tool'] = $row['tool'];
$reg[$row['id']]['tool_id'] = $row['tool_id'];
$reg[$row['id']]['action'] = $row['action'];
$reg[$row['id']]['action_details'] = $row['action_details'];
$reg[$row['id']]['use'] = 1;
continue;
}
$partialTime = intval(strtotime($row['date_reg']) - $reg[$id]['date_reg']);
if ($partialTime > 0) {
$total_time += $partialTime;
}
$tool = $reg[$id]['tool'];
if ($tool == 'close-window') {
$tool = $last_tool_active;
} else {
$last_tool_active = $tool;
}
switch ($tool) {
case 'course-main':
$course_time += $partialTime;
break;
case TOOL_LEARNPATH:
$lp_time[$reg[$id]['tool_id']] += $partialTime;
break;
case TOOL_QUIZ:
if ($reg[$id]['action'] == 'learnpath_id') {
$lp_time[$reg[$id]['action_details']] += $partialTime;
} else {
$quiz_time += $partialTime;
}
break;
case TOOL_CHAT:
$chat_time += $partialTime;
break;
case TOOL_AGENDA:
$agenda_time += $partialTime;
break;
case TOOL_FORUM:
$forum_time += $partialTime;
break;
case TOOL_ANNOUNCEMENT:
$announcement_time += $partialTime;
break;
case TOOL_COURSE_DESCRIPTION:
$description_time += $partialTime;
break;
case TOOL_SURVEY:
$survey_time += $partialTime;
break;
case TOOL_NOTEBOOK:
$notebook_time += $partialTime;
break;
case TOOL_GRADEBOOK:
$gradebook_time += $partialTime;
break;
case TOOL_DROPBOX:
$dropbox_time += $partialTime;
break;
case 'Reports':
$report_time += $partialTime;
break;
case 'Videoconference':
$videoconference_time += $partialTime;
break;
case TOOL_LINK:
$link_time += $partialTime;
break;
}
$reg[$row['id']]['date_reg'] = strtotime($row['date_reg']);
$reg[$row['id']]['tool'] = $row['tool'];
$reg[$row['id']]['tool_id'] = $row['tool_id'];
$reg[$row['id']]['action'] = $row['action'];
$reg[$row['id']]['action_details'] = $row['action_details'];
$reg[$row['id']]['use'] = 1;
$reg[$id]['use'] = 1;
} else {
$reg[$row['id']]['date_reg'] = strtotime($row['date_reg']);
$reg[$row['id']]['tool'] = $row['tool'];
$reg[$row['id']]['tool_id'] = $row['tool_id'];
$reg[$row['id']]['action'] = $row['action'];
$reg[$row['id']]['action_details'] = $row['action_details'];
$reg[$row['id']]['use'] = 0;
$regUse[] = $row['id'];
}
} else {
if ($row['tool'] == 'close-window' && $row['current_id'] > 0) {
$id = $row['current_id'];
if (!in_array($id, $regUse)) {
$reg[$row['id']]['date_reg'] = strtotime($row['date_reg']);
$reg[$row['id']]['tool'] = $row['tool'];
$reg[$row['id']]['tool_id'] = $row['tool_id'];
$reg[$row['id']]['action'] = $row['action'];
$reg[$row['id']]['action_details'] = $row['action_details'];
$reg[$row['id']]['use'] = 1;
continue;
}
$partialTime = intval(strtotime($row['date_reg']) - $reg[$id]['date_reg']);
if ($partialTime > 0) {
$total_time += $partialTime;
}
$tool = $reg[$id]['tool'];
if ($tool == 'close-window') {
$tool = $last_tool_active;
} else {
$last_tool_active = $tool;
}
switch ($tool) {
case 'course-main':
$course_time += $partialTime;
break;
case TOOL_LEARNPATH:
$lp_time[$reg[$id]['tool_id']] += $partialTime;
break;
case TOOL_QUIZ:
if ($reg[$id]['action'] == 'learnpath_id') {
$lp_time[$reg[$id]['action_details']] += $partialTime;
} else {
$quiz_time += $partialTime;
}
break;
case TOOL_CHAT:
$chat_time += $partialTime;
break;
case TOOL_AGENDA:
$agenda_time += $partialTime;
break;
case TOOL_FORUM:
$forum_time += $partialTime;
break;
case TOOL_ANNOUNCEMENT:
$announcement_time += $partialTime;
break;
case TOOL_COURSE_DESCRIPTION:
$description_time += $partialTime;
break;
case TOOL_SURVEY:
$survey_time += $partialTime;
break;
case TOOL_NOTEBOOK:
$notebook_time += $partialTime;
break;
case TOOL_GRADEBOOK:
$gradebook_time += $partialTime;
break;
case TOOL_DROPBOX:
$dropbox_time += $partialTime;
break;
case 'Reports':
$report_time += $partialTime;
break;
case 'Videoconference':
$videoconference_time += $partialTime;
break;
case TOOL_LINK:
$link_time += $partialTime;
break;
}
$reg[$row['id']]['date_reg'] = strtotime($row['date_reg']);
$reg[$row['id']]['tool'] = $row['tool'];
$reg[$row['id']]['tool_id'] = $row['tool_id'];
$reg[$row['id']]['action'] = $row['action'];
$reg[$row['id']]['action_details'] = $row['action_details'];
$reg[$row['id']]['use'] = 1;
$reg[$id]['use'] = 1;
} else {
$reg[$row['id']]['date_reg'] = strtotime($row['date_reg']);
$reg[$row['id']]['tool'] = $row['tool'];
$reg[$row['id']]['tool_id'] = $row['tool_id'];
$reg[$row['id']]['action'] = $row['action'];
$reg[$row['id']]['action_details'] = $row['action_details'];
$reg[$row['id']]['use'] = 1;
if ($row['tool'] == 'login') {
$login = true;
}
}
}
}
$tmp_active = false;
foreach ($reg as $key => $value) {
if ($tmp_active) {
$partialTime = intval($value['date_reg'] - $aux_reg['date_reg']);
if ($partialTime >= 0 && $partialTime < $sessionLifetime) {
$total_time += $partialTime;
} else {
$partialTime = $sessionFixTime; // 1200 // Fix 20 min
$total_time += $partialTime;
}
$tool = $aux_reg['tool'];
switch ($tool) {
case 'course-main':
$course_time += $partialTime;
break;
case TOOL_LEARNPATH:
$lp_time[$aux_reg['tool_id']] += $partialTime;
break;
case TOOL_QUIZ:
if ($aux_reg['action'] == 'learnpath_id') {
$lp_time[$aux_reg['action_details']] += $partialTime;
} else {
$quiz_time += $partialTime;
}
break;
case TOOL_CHAT:
$chat_time += $partialTime;
break;
case TOOL_AGENDA:
$agenda_time += $partialTime;
break;
case TOOL_FORUM:
$forum_time += $partialTime;
break;
case TOOL_ANNOUNCEMENT:
$announcement_time += $partialTime;
break;
case TOOL_COURSE_DESCRIPTION:
$description_time += $partialTime;
break;
case TOOL_SURVEY:
$survey_time += $partialTime;
break;
case TOOL_NOTEBOOK:
$notebook_time += $partialTime;
break;
case TOOL_GRADEBOOK:
$gradebook_time += $partialTime;
break;
case TOOL_DROPBOX:
$dropbox_time += $partialTime;
break;
case 'Reports':
$report_time += $partialTime;
break;
case 'Videoconference':
$videoconference_time += $partialTime;
break;
case TOOL_LINK:
$link_time += $partialTime;
break;
}
$tmp_active = false;
}
if ($value['use'] == 0) {
if ($value['tool'] != 'chat' && $value['action'] != 'return_to_course_homepage') {
$aux_reg['id'] = $key;
$aux_reg['date_reg'] = $value['date_reg'];
$aux_reg['tool'] = $value['tool'];
$aux_reg['tool_id'] = $value['tool_id'];
$aux_reg['action'] = $value['action'];
$aux_reg['action_details'] = $value['action_details'];
$tmp_active = true;
}
}
}
$horas = intval($total_time / 3600);
$minutos = str_pad(intval(($total_time % 3600) / 60), 2, '0', STR_PAD_LEFT);
$segundos = str_pad(intval(($total_time % 3600) % 60), 2, '0', STR_PAD_LEFT);
$total_lp = 0;
foreach ($lp_time as $key => $value) {
if ($key != 0) {
$total_lp += $value;
}
}
//echo "Tiempo total en lecciones: $total_lp seg<br>";
$result = [
'course-main' => $course_time,
TOOL_LEARNPATH => $lp_time,
'total_learnpath' => $total_lp,
TOOL_QUIZ => $quiz_time,
TOOL_CHAT => $chat_time,
TOOL_AGENDA => $agenda_time,
TOOL_FORUM => $forum_time,
TOOL_ANNOUNCEMENT => $announcement_time,
TOOL_COURSE_DESCRIPTION => $description_time,
TOOL_SURVEY => $survey_time,
TOOL_NOTEBOOK => $notebook_time,
TOOL_GRADEBOOK => $gradebook_time,
TOOL_DROPBOX => $dropbox_time,
'Reports' => $report_time,
'Videoconference' => $videoconference_time,
TOOL_LINK => $link_time,
'total_time' => $total_time,
'num_conection' => $count_login,
'first' => $fistConection,
'last' => $lastConection,
];
return $result;
}
/**
* Gets the IP of a given user, using the last login before the given date.
*

@ -5970,6 +5970,16 @@ SQL;
}
if ($userId) {
// ## NSR - log
$logInfo = [
'tool' => 'logout',
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => '',
'info' => 'Cambia de usuario (login as)',
];
Event::registerLog($logInfo);
// Logout the current user
self::loginDelete(api_get_user_id());
@ -5996,6 +6006,15 @@ SQL;
// will be useful later to know if the user is actually an admin or not (example reporting)
Session::write('login_as', true);
$logInfo = [
'tool' => 'login',
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => '',
'info' => $userId,
];
Event::registerLog($logInfo);
return true;
}

@ -1045,6 +1045,17 @@ VALUES (2, 13, 'session_courses_read_only_mode', 'Lock Course In Session', 1, 1,
// Improve speed when rendering gradebook student reports using Doctrine APCU cache
// $_configuration['gradebook_use_apcu_cache'] = true;
// Add a minimum time limit to be in the learning path
// in order to get the last item completed
// Requires a DB change:
// ALTER TABLE c_lp ADD accumulate_work_time INT NOT NULL;
//$_configuration['lp_minimum_time'] = false;
// Allow detail user activity
// CREATE TABLE track_e_access_complete (id int(11) NOT NULL AUTO_INCREMENT, user_id int(11) NOT NULL, date_reg datetime NOT NULL, tool varchar(255) NOT NULL, tool_id int(11) NOT NULL, tool_id_detail int(11) NOT NULL, action varchar(255) NOT NULL, action_details varchar(255) NOT NULL, current_id int(11) NOT NULL, ip_user varchar(255) NOT NULL, user_agent varchar(255) NOT NULL, session_id int(11) NOT NULL, c_id int(11) NOT NULL, ch_sid varchar(255) NOT NULL, login_as int(11) NOT NULL, info longtext NOT NULL, url text NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB AUTO_INCREMENT=13989 DEFAULT CHARSET=utf8;
//$_configuration['allow_track_complete'] = false;
// Add collapsable option for user course categories
// ALTER TABLE user_course_category ADD collapsed TINYINT(1) DEFAULT NULL;
// $_configuration['allow_user_course_category_collapsable'] = false;

@ -61,6 +61,7 @@ class learnpath
public $theme; // The current theme of the learning path.
public $preview_image; // The current image of the learning path.
public $accumulateScormTime; // Flag to decide whether to accumulate SCORM time or not
public $accumulateWorkTime; // The min time of learnpath
// Tells if all the items of the learnpath can be tried again. Defaults to "no" (=1).
public $prevent_reinit = 1;
@ -164,6 +165,7 @@ class learnpath
$this->ref = $row['ref'];
$this->categoryId = $row['category_id'];
$this->accumulateScormTime = isset($row['accumulate_scorm_time']) ? $row['accumulate_scorm_time'] : 'true';
$this->accumulateWorkTime = isset($row['accumulate_work_time']) ? $row['accumulate_work_time'] : 0;
if (!empty($row['publicated_on'])) {
$this->publicated_on = $row['publicated_on'];
@ -2404,6 +2406,55 @@ class learnpath
if ($progress < 100) {
$isBlocked = true;
}
if (api_get_configuration_value('lp_minimum_time')) {
// ## NSR - bloquear si no supera tiempo minimo
// TL --- Tiempo minimo para superar la lección ( en minutos )
$accumulateWorkTime = self::getAccumulateWorkTimePrerequisite($prerequisite, $courseInfo['real_id']);
if ($accumulateWorkTime > 0) {
// TT --- Tiempo total del curso
$accumulateWorkTimeTotal = self::getAccumulateWorkTimeTotal($courseInfo['real_id']);
// P y TC --- Conectamos con la tabla plugin_licences_course_session en la que se indica que porcentaje del tiempo se aplica
$perc = 100;
$tc = $accumulateWorkTimeTotal;
if (!empty($sessionId) && $sessionId != 0) {
/*$sql = "SELECT hours, perc FROM plugin_licences_course_session WHERE session_id = $sessionId";
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
$aux = Database::fetch_assoc($res);
$perc = $aux['perc'];
$tc = $aux['hours'] * 60;
}*/
}
// PL --- Porcentaje lección (tiempo leccion / tiempo total curso)
$pl = $accumulateWorkTime / $accumulateWorkTimeTotal;
/*
* TL: Tiempo que pone en una lección
* TT : tiempo total que pone Teresa (suma tiempos lecciones curso)
* PL: Fracción que supone una lección sobre el tiempo total = TL/TT
* TC: Tiempo que dice el cliente que tiene el curso
* P: porcentaje mínimo conexión que indica el cliente
*
* el tiempo mínimo de cada lección sería: PL x TC x P /100
*/
$accumulateWorkTime = ($pl * $tc * $perc / 100);
// Tiempo empleado hasta el momento en la leccion ( en segundos )
$lpTime = Tracking::get_time_spent_in_lp(
$studentId,
$courseInfo['code'],
[$prerequisite],
$sessionId
);
if ($lpTime < ($accumulateWorkTime * 60)) {
$isBlocked = true;
}
}
}
}
return $isBlocked;
@ -13837,6 +13888,95 @@ EOD;
return true;
}
/**
* Get whether this is a learning path with the accumulated work time or not.
*
* @return int
*/
public function getAccumulateWorkTime()
{
return $this->accumulateWorkTime;
}
/**
* Get whether this is a learning path with the accumulated work time or not.
*
* @return int
*/
public function getAccumulateWorkTimeTotalCourse()
{
$table = Database::get_course_table(TABLE_LP_MAIN);
$sql = "SELECT SUM(accumulate_work_time) AS total
FROM $table
WHERE c_id = ".$this->course_int_id;
$result = Database::query($sql);
$row = Database::fetch_array($result);
return (int) $row['total'];
}
/**
* Set whether this is a learning path with the accumulated work time or not.
*
* @param int $value (0 = false, 1 = true)
*
* @return bool
*/
public function setAccumulateWorkTime($value)
{
if (!api_get_configuration_value('lp_minimum_time')) {
return false;
}
$this->accumulateWorkTime = (int) $value;
$table = Database::get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id();
$sql = "UPDATE $table SET accumulate_work_time = ".$this->accumulateWorkTime."
WHERE c_id = ".$this->course_int_id." AND id = $lp_id";
Database::query($sql);
return true;
}
/**
* @param int $lpId
* @param int $courseId
*
* @return mixed
*/
public static function getAccumulateWorkTimePrerequisite($lpId, $courseId)
{
$lpId = (int) $lpId;
$courseId = (int) $courseId;
$table = Database::get_course_table(TABLE_LP_MAIN);
$sql = "SELECT accumulate_work_time
FROM $table
WHERE c_id = $courseId AND id = $lpId";
$result = Database::query($sql);
$row = Database::fetch_array($result);
return $row['accumulate_work_time'];
}
/**
* @param int $courseId
*
* @return int
*/
public static function getAccumulateWorkTimeTotal($courseId)
{
$table = Database::get_course_table(TABLE_LP_MAIN);
$courseId = (int) $courseId;
$sql = "SELECT SUM(accumulate_work_time) AS total
FROM $table
WHERE c_id = $courseId";
$result = Database::query($sql);
$row = Database::fetch_array($result);
return (int) $row['total'];
}
/**
* Get the depth level of LP item.
*

@ -1889,14 +1889,64 @@ class learnpathItem
$sessionLifetime = 3600;
}
$fixedAddedMinute = 5 * 60; // Add only 5 minutes
if ($time > $sessionLifetime) {
error_log("fixAbusiveTime: Total time is too big: $time replaced with: $fixedAddedMinute");
error_log("item_id : ".$this->db_id." lp_item_view.iid: ".$this->db_item_view_id);
$time = $fixedAddedMinute;
}
if (!api_get_configuration_value('lp_minimum_time')) {
$fixedAddedMinute = 5 * 60; // Add only 5 minutes
if ($time > $sessionLifetime) {
error_log("fixAbusiveTime: Total time is too big: $time replaced with: $fixedAddedMinute");
error_log("item_id : ".$this->db_id." lp_item_view.iid: ".$this->db_item_view_id);
$time = $fixedAddedMinute;
}
return $time;
return $time;
} else {
/* ## NSR - calculo de tiempo minimo y acumulado */
$user_id = api_get_user_id();
$myLP = learnpath::getLpFromSession(api_get_course_id(), $this->lp_id, $user_id);
$timeLp = $myLP->getAccumulateWorkTime();
$timeTotalCourse = $myLP->getAccumulateWorkTimeTotalCourse();
/*
$timeLp = $_SESSION['oLP']->getAccumulateWorkTime();
$timeTotalCourse = $_SESSION['oLP']->getAccumulateWorkTimeTotalCourse();
*/
$perc = 100;
$tc = $timeTotalCourse;
/*if (!empty($sessionId) && $sessionId != 0) {
$sql = "SELECT hours, perc FROM plugin_licences_course_session WHERE session_id = $sessionId";
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
$aux = Database::fetch_assoc($res);
$perc = $aux['perc'];
$tc = $aux['hours'] * 60;
}
}*/
// PL --- Porcentaje lección (tiempo leccion / tiempo total curso)
$pl = $timeLp / $timeTotalCourse;
/*
* TL: Tiempo que pone en una lección
* TT : tiempo total que pone Teresa (suma tiempos lecciones curso)
* PL: Fracción que supone una lección sobre el tiempo total = TL/TT
* TC: Tiempo que dice el cliente que tiene el curso
* P: porcentaje mínimo conexión que indica el cliente
*
* el tiempo mínimo de cada lección sería: PL x TC x P /100
*/
// Aplicamos el porcentaje si no hubiese definido un porcentaje por defecto es 100%
$time_seg = intval(($pl * $tc * $perc / 100) * 60);
if ($time_seg < $sessionLifetime) {
$sessionLifetime = $time_seg;
}
if ($time > $sessionLifetime) {
$fixedAddedMinute = $time_seg + mt_rand(0, 300);
if (self::DEBUG > 2) {
error_log("Total time is too big: $time replaced with: $fixedAddedMinute");
}
$time = $fixedAddedMinute;
}
return $time;
}
}
/**

@ -217,10 +217,68 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
"olms.lms_item_core_exit = '".$mycore_exit."';".
"olms.asset_timer = 0;";
$return .= "update_toc('unhighlight','".$current_item."');".
$timeLp = $mylp->getAccumulateWorkTime();
$timeTotalCourse = $mylp->getAccumulateWorkTimeTotalCourse();
$updateMinTime = '';
if (api_get_configuration_value('lp_minimum_time')) {
$perc = 100;
$tc = $timeTotalCourse;
$sessionId = api_get_session_id();
if (!empty($sessionId) && $sessionId != 0) {
/*$sql = "SELECT hours, perc FROM plugin_licences_course_session WHERE session_id = $sessionId";
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
$aux = Database::fetch_assoc($res);
$perc = $aux['perc'];
$tc = $aux['hours'] * 60;
}*/
}
// PL --- Porcentaje lección (tiempo leccion / tiempo total curso)
$pl = $timeLp / $timeTotalCourse;
/*
* TL: Tiempo que pone en una lección
* TT : tiempo total que pone Teresa (suma tiempos lecciones curso)
* PL: Fracción que supone una lección sobre el tiempo total = TL/TT
* TC: Tiempo que dice el cliente que tiene el curso
* P: porcentaje mínimo conexión que indica el cliente
*
* el tiempo mínimo de cada lección sería: PL x TC x P /100
*/
// Aplicamos el porcentaje si no hubiese definido un porcentaje por defecto es 100%
$time_total = intval($pl * $tc * $perc / 100) * 60;
//$time_total = $mylp->getAccumulateWorkTime() * 60;
$lpTime = Tracking::get_time_spent_in_lp(
$user_id,
api_get_course_id(),
[$lp_id],
api_get_session_id()
);
if ($lpTime >= $time_total) {
$time_spent = $time_total;
} else {
$time_spent = $lpTime;
}
$hour = (intval($lpTime / 3600)) < 10 ? '0'.intval($lpTime / 3600) : intval($lpTime / 3600);
$minute = date('i', $lpTime);
$second = date('s', $lpTime);
$updateMinTime = "update_time_bar('$time_spent','$time_total','%');".
"update_cronometro('$hour','$minute','$second');";
}
$return .=
"update_toc('unhighlight','".$current_item."');".
"update_toc('highlight','".$new_item_id."');".
"update_toc('$mylesson_status','".$new_item_id."');".
"update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');";
"update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');".
$updateMinTime
;
$return .= 'updateGamificationValues(); ';
$mylp->set_error_msg('');

@ -369,6 +369,26 @@ if ($debug) {
error_log('Entered lp_controller.php -+- (action: '.$action.')');
}
// ## NSR - log
$lp_id = (!empty($_REQUEST['lp_id']) ? (int) $_REQUEST['lp_id'] : 0);
switch ($action) {
case 'view':
case 'content':
$lp_detail_id = $_SESSION['oLP']->get_current_item_id();
break;
default:
$lp_detail_id = (!empty($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0);
}
$logInfo = [
'tool' => TOOL_LEARNPATH,
'tool_id' => $lp_id,
'tool_id_detail' => $lp_detail_id,
'action' => !empty($action) ? $action : 'list',
'info' => '',
];
Event::registerLog($logInfo);
// format title to be displayed correctly if QUIZ
$post_title = '';
if (isset($_POST['title'])) {
@ -392,6 +412,78 @@ if ($debug > 0) {
}
switch ($action) {
// ## NSR
case 'send_notify_teacher':
// Enviar correo al profesor
$studentInfo = api_get_user_info();
$course_info = api_get_course_info();
global $_configuration;
$root_web = $_configuration['root_web'];
if (api_get_session_id() > 0) {
$session_info = api_get_session_info(api_get_session_id());
$course_name = $session_info['name'];
$course_url = $root_web.'courses/'.$course_info['code'].'/index.php?id_session='.api_get_session_id();
} else {
$course_name = $course_info['title'];
$course_url = $root_web.'courses/'.$course_info['code'].'/index.php?';
}
$url = '<a href="'.$course_url.'" title="Ir al curso">'.$course_name.'</a>';
/*$sql = "SELECT c.* FROM plugin_licences_customers c
INNER JOIN plugin_licences_student_rel_customer s
ON s.user_id = c.user_id
WHERE s.student_id = ".$studentInfo['user_id'];
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
$row = Database::fetch_assoc($res);
if (!empty($row['telefono'])) {
$telefono = htmlspecialchars($row['telefono']);
} else {
$telefono = '';
}
if (!empty($row['prefix'])) {
$prefix = htmlspecialchars($row['prefix']);
} else {
$prefix = '';
}
} else {
$telefono = '';
$prefix = '';
}*/
$coachList = CourseManager::get_coachs_from_course(api_get_session_id(), api_get_course_int_id());
foreach ($coachList as $coach_course) {
$recipient_name = $coach_course['full_name'];
$coachInfo = api_get_user_info($coach_course['user_id']);
$email = $coachInfo['email'];
$tplContent = new Template(null, false, false, false, false, false);
// variables for the default template
$tplContent->assign('name_teacher', $recipient_name);
$tplContent->assign('name_student', $studentInfo['firstname'].' '.$studentInfo['lastname']);
$tplContent->assign('course_name', $course_name);;
$tplContent->assign('course_url', $url);
$tplContent->assign('telefono', $telefono);
$tplContent->assign('prefix', $prefix);
$layoutContent = $tplContent->get_template('mail/content_ending_learnpath.tpl');
$emailBody = $tplContent->fetch($layoutContent);
api_mail_html(
$recipient_name,
$email,
'Alumno con lecciones finalizadas',
$emailBody,
$studentInfo['firstname'].' '.$studentInfo['lastname'],
$studentInfo['email'],
true
);
}
Display::addFlash(Display::return_message('Notificación enviada al profesor'));
require 'lp_list.php';
break;
case 'add_item':
if (!$is_allowed_to_edit) {
api_not_allowed(true);
@ -1029,12 +1121,9 @@ switch ($action) {
$hide_toc_frame = null;
}
$_SESSION['oLP']->set_hide_toc_frame($hide_toc_frame);
$_SESSION['oLP']->set_prerequisite(
isset($_POST['prerequisites']) ? (int) $_POST['prerequisites'] : 0
);
$_SESSION['oLP']->set_use_max_score(
isset($_POST['use_max_score']) ? 1 : 0
);
$_SESSION['oLP']->set_prerequisite(isset($_POST['prerequisites']) ? (int) $_POST['prerequisites'] : 0);
$_SESSION['oLP']->setAccumulateWorkTime(isset($_REQUEST['accumulate_work_time']) ? $_REQUEST['accumulate_work_time'] : 0);
$_SESSION['oLP']->set_use_max_score(isset($_POST['use_max_score']) ? 1 : 0);
$subscribeUsers = isset($_REQUEST['subscribe_users']) ? 1 : 0;
$_SESSION['oLP']->setSubscribeUsers($subscribeUsers);

@ -158,7 +158,15 @@ $form->addElement('html', '<div class="help-block">'.get_lang('LpPrerequisiteDes
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-2"></div>');
$form->addElement('html', '</div>');
//Start date
// Time Control
if (api_get_configuration_value('lp_minimum_time')) {
$accumulateTime = $_SESSION['oLP']->getAccumulateWorkTime();
$form->addText('accumulate_work_time', [get_lang('LpMinTime'), get_lang('LpMinTimeDescription')]);
$defaults['accumulate_work_time'] = $accumulateTime;
}
// Start date
$form->addElement(
'checkbox',
'activate_start_date_check',

@ -392,6 +392,88 @@ foreach ($categories as $item) {
}
}
// ## NSR
if ($progress < 100) {
$ending = false;
}
$dsp_time = '';
$linkMinTime = '';
if (api_get_configuration_value('lp_minimum_time')) {
// ## NSR
// Time info
// TL --- Tiempo minimo para superar la lección ( en minutos )
$accumulateWorkTime = learnpath::getAccumulateWorkTimePrerequisite($id, api_get_course_int_id());
if ($accumulateWorkTime > 0) {
// TT --- Tiempo total del curso
$accumulateWorkTimeTotal = learnpath::getAccumulateWorkTimeTotal(api_get_course_int_id());
// Tiempo empleado hasta el momento en la leccion ( en segundos )
$lpTime = Tracking::get_time_spent_in_lp(
$userId,
api_get_course_id(),
[$id],
api_get_session_id()
);
// Conectamos con la tabla plugin_licences_course_session en la que se indica que porcentaje del tiempo se aplica
$perc = 100;
$tc = $accumulateWorkTimeTotal;
/*if (!empty($current_session) && $current_session != 0) {
$sql = "SELECT hours, perc FROM plugin_licences_course_session WHERE session_id = $current_session";
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
$aux = Database::fetch_assoc($res);
$perc = $aux['perc'];
$tc = ($aux['hours'] * 60);
}
}*/
// PL --- Porcentaje lección (tiempo leccion / tiempo total curso)
$pl = $accumulateWorkTime / $accumulateWorkTimeTotal;
/*
* TL: Tiempo que pone en una lección
* TT : tiempo total que pone Teresa (suma tiempos lecciones curso)
* PL: Fracción que supone una lección sobre el tiempo total = TL/TT
* TC: Tiempo que dice el cliente que tiene el curso
* P: porcentaje mínimo conexión que indica el cliente
*
* el tiempo mínimo de cada lección sería: PL x TC x P /100
*/
// Aplicamos el porcentaje si no hubiese definido un porcentaje por defecto es 100%
$accumulateWorkTime = ($pl * $tc * $perc / 100);
// Si el tiempo empleado es menor que lo necesario mostramos un icono en la columna de acción indicando la advertencia
if ($lpTime < ($accumulateWorkTime * 60)) {
$linkMinTime = Display::return_icon(
'warning.png',
get_lang('LpMinTimeWarning').' - '.api_time_to_hms($lpTime).' / '.api_time_to_hms(
$accumulateWorkTime * 60
)
);
$linkMinTime .= '<b>'.api_time_to_hms($lpTime).' / '.api_time_to_hms($accumulateWorkTime * 60).'</b>';
} else {
$linkMinTime = sprintf(get_lang('YouHaveSpentXTime'), api_time_to_hms($lpTime));
}
// Calculamos el porcentaje superado del tiempo para la barra de "superacion de tiempo mínimo"
if ($lpTime >= ($accumulateWorkTime * 60)) {
$time_progress_perc = '100%';
$time_progress_value = 100;
} else {
$time_progress_value = intval(($lpTime * 100) / ($accumulateWorkTime * 60));
}
// ## NSR
if ($time_progress_value < 100) {
$ending = false;
}
$dsp_time = learnpath::get_progress_bar($time_progress_value, '%');
}
}
$token_parameter = "&sec_token=$token";
$dsp_edit_lp = null;
$dsp_publish = null;
@ -404,7 +486,7 @@ foreach ($categories as $item) {
$actionUpdateScormFile = '';
$actionExportToCourseBuild = '';
// Only for "Chamilo" packages
$allowExportCourseFormat = $allowLpChamiloExport && $details['lp_maker'] == 'Chamilo';
$allowExportCourseFormat = $allowLpChamiloExport && $details['lp_maker'] === 'Chamilo';
if ($is_allowed_to_edit) {
// EDIT LP
@ -893,6 +975,7 @@ foreach ($categories as $item) {
'action_subscribe_users' => $subscribeUsers,
'action_update_scorm' => $actionUpdateScormFile,
'action_export_to_course_build' => $actionExportToCourseBuild,
'info_time_prerequisite' => $linkMinTime,
];
$lpIsShown = true;
@ -933,6 +1016,7 @@ $template = new Template($nameTools);
$template->assign('subscription_settings', $subscriptionSettings);
$template->assign('is_allowed_to_edit', $is_allowed_to_edit);
$template->assign('is_invitee', api_is_invitee());
$template->assign('is_ending', $ending);
$template->assign('actions', $actions);
$template->assign('categories', $categories);
$template->assign('message', $message);

@ -557,6 +557,69 @@ if ($gamificationMode == 1) {
}
$template->assign('lp_author', $lp->get_author());
$lpMinTime = '';
if (api_get_configuration_value('lp_minimum_time')) {
/* ## NSR - calculo de tiempo minimo y acumulado */
$timeLp = $_SESSION['oLP']->getAccumulateWorkTime();
$timeTotalCourse = $_SESSION['oLP']->getAccumulateWorkTimeTotalCourse();
$perc = 100;
$tc = $timeTotalCourse;
if (!empty($sessionId) && $sessionId != 0) {
/*$sql = "SELECT hours, perc FROM plugin_licences_course_session WHERE session_id = $sessionId";
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
$aux = Database::fetch_assoc($res);
$perc = $aux['perc'];
$tc = $aux['hours'] * 60;
}*/
}
// PL --- Porcentaje lección (tiempo leccion / tiempo total curso)
$pl = $timeLp / $timeTotalCourse;
/*
* TL: Tiempo que pone en una lección
* TT : tiempo total que pone Teresa (suma tiempos lecciones curso)
* PL: Fracción que supone una lección sobre el tiempo total = TL/TT
* TC: Tiempo que dice el cliente que tiene el curso
* P: porcentaje mínimo conexión que indica el cliente
*
* el tiempo mínimo de cada lección sería: PL x TC x P /100
*/
// Aplicamos el porcentaje si no hubiese definido un porcentaje por defecto es 100%
$time_min = intval($pl * $tc * $perc / 100);
if ($_SESSION['oLP']->getAccumulateWorkTime() > 0) {
$lpMinTime = '('.$time_min.' min)';
}
$lpTime = Tracking::get_time_spent_in_lp(
$user_id,
$course_code,
[$_SESSION['oLP']->lp_id],
$sessionId
);
if ($lpTime >= ($time_min * 60)) {
$time_progress_perc = '100%';
$time_progress_value = 100;
} else {
$time_progress_value = intval(($lpTime * 100) / ($time_min * 60));
$time_progress_perc = $time_progress_value.'%';
}
$template->assign('time_progress_perc', $time_progress_perc);
$template->assign('time_progress_value', $time_progress_value);
// Cronometro
$hour = (intval($lpTime / 3600)) < 10 ? '0'.intval($lpTime / 3600) : intval($lpTime / 3600);
$template->assign('hour', $hour);
$template->assign('minute', date('i', $lpTime));
$template->assign('second', date('s', $lpTime));
/* ## NSR fin modificacion */
}
$template->assign('lp_accumulate_work_time', $lpMinTime);
$template->assign('lp_mode', $lp->mode);
$template->assign('lp_title_scorm', $lp->name);
if (api_get_configuration_value('lp_view_accordion') === true && $lpType == 1) {

@ -2383,3 +2383,96 @@ function attach_glossary_into_scorm(type) {
}
}
}
// ## NSR ##
/**
* Updates the time bar with the new status. Prevents the need of a page refresh and flickering
* @param integer Number of completed items
* @param integer Number of items in total
* @param string Display mode (absolute 'abs' or percentage '%').Defaults to %
*/
function update_time_bar(nbr_complete, nbr_total, mode)
{
logit_lms('update_progress_bar('+nbr_complete+', '+nbr_total+', '+mode+')',3);
logit_lms(
'update_progress_bar with params: lms_lp_id= ' + olms.lms_lp_id +
', lms_view_id= '+ olms.lms_view_id + ' lms_user_id= '+ olms.lms_user_id,
3
);
if (mode == '') {
mode='%';
}
if (nbr_total == 0) {
nbr_total=1;
}
var percentage = (nbr_complete/nbr_total)*100;
percentage = Math.round(percentage);
var progress_bar = $("#progress_bar_value2");
progress_bar.css('width', percentage + "%");
var mytext = '';
switch(mode){
case 'abs':
mytext = nbr_complete + '/' + nbr_total;
break;
case '%':
default:
mytext = percentage + '%';
break;
}
progress_bar.html(mytext);
return true;
}
/**
* Update cronometro
*/
function update_cronometro(text_hour, text_minute, text_second)
{
$("#hour").text(text_hour);
$("#minute").text(text_minute);
$("#second").text(text_second);
var tiempo = {
hora: parseInt($("#hour").text()),
minuto: parseInt($("#minute").text()),
segundo: parseInt($("#second").text())
};
/*
var tiempo = {
hora: text_hour,
minuto: text_minute,
segundo: text_second
};
*/
//window.tiempo_corriendo = null;
clearInterval(window.tiempo_corriendo);
window.tiempo_corriendo = setInterval(function(){
// Segundos
tiempo.segundo++;
if(tiempo.segundo >= 60) {
tiempo.segundo = 0;
tiempo.minuto++;
}
// Minutos
if(tiempo.minuto >= 60) {
tiempo.minuto = 0;
tiempo.hora++;
}
$("#hour").text(tiempo.hora < 10 ? '0' + tiempo.hora : tiempo.hora);
//$("#hour").text(tiempo.hora);
$("#minute").text(tiempo.minuto < 10 ? '0' + tiempo.minuto : tiempo.minuto);
//$("#minute").text(tiempo.minuto);
$("#second").text(tiempo.segundo < 10 ? '0' + tiempo.segundo : tiempo.segundo);
//$("#second").text(tiempo.segundo);
}, 1000);
return true;
}

@ -14,6 +14,18 @@ if (api_get_setting('allow_message_tool') != 'true') {
api_not_allowed(true);
}
// ## NSR - log
$logInfo = [
'tool' => 'Messages',
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => isset($_GET['action']) ? $_GET['action'] : 'inbox',
'action_details' => '',
'current_id' => isset($_GET['id']) ? (int) $_GET['id'] : 0,
'info' => '',
];
Event::registerLog($logInfo);
$allowSocial = api_get_setting('allow_social_tool') == 'true';
$allowMessage = api_get_setting('allow_message_tool') == 'true';

@ -22,6 +22,18 @@ if (api_get_setting('allow_message_tool') !== 'true') {
api_not_allowed(true);
}
// ## NSR - log
$logInfo = [
'tool' => 'Messages',
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'new_message',
'action_details' => isset($_GET['re_id']) ? 're_id' : '',
'current_id' => isset($_GET['re_id']) ? (int) $_GET['re_id'] : 0,
'info' => '',
];
Event::registerLog($logInfo);
$allowSocial = api_get_setting('allow_social_tool') == 'true';
$nameTools = api_xml_http_response_encode(get_lang('Messages'));

@ -13,6 +13,18 @@ if (api_get_setting('allow_message_tool') != 'true') {
api_not_allowed(true);
}
// ## NSR - log
$logInfo = [
'tool' => 'Messages',
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => isset($_GET['action']) ? $_GET['action'] : 'outbox',
'action_details' => '',
'current_id' => isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0,
'info' => '',
];
Event::registerLog($logInfo);
$allowSocial = api_get_setting('allow_social_tool') == 'true';
$allowMessage = api_get_setting('allow_message_tool') == 'true';

@ -47,6 +47,18 @@ if (empty($_GET['id'])) {
$message = '';
// ## NSR - log
$logInfo = [
'tool' => 'Messages',
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => $source,
'action_details' => 'view-message',
'current_id' => $messageId,
'info' => '',
];
Event::registerLog($logInfo);
// LEFT COLUMN
if (api_get_setting('allow_social_tool') === 'true') {
// Block Social Menu

@ -37,6 +37,18 @@ $skipData = api_get_configuration_value('tracking_skip_generic_data');
// Access control
api_block_anonymous_users();
// ## NSR - log
$logInfo = [
'tool' => SECTION_TRACKING,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => '',
'action_details' => '',
'current_id' => 0,
'info' => '',
];
Event::registerLog($logInfo);
$allowToTrack = api_is_platform_admin(true, true) || api_is_teacher();
if (!$allowToTrack) {

@ -37,6 +37,18 @@ $tool = TOOL_NOTEBOOK;
// Tracking
Event::event_access_tool(TOOL_NOTEBOOK);
// ## NSR - log
$logInfo = [
'tool' => TOOL_NOTEBOOK,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => $action,
'action_details' => '',
'current_id' => isset($_REQUEST['notebook_id']) ? (int) $_REQUEST['notebook_id'] : 0,
'info' => '',
];
Event::registerLog($logInfo);
$action = isset($_GET['action']) ? $_GET['action'] : '';
// Tool name

@ -160,6 +160,18 @@ if (!isset($_POST['finish_survey']) &&
api_not_allowed(true, get_lang('YouAlreadyFilledThisSurvey'));
}
// ## NSR - log
$logInfo = [
'tool' => TOOL_SURVEY,
'tool_id' => $survey_invitation['survey_invitation_id'],
'tool_id_detail' => 0,
'action' => 'invitationcode',
'action_details' => $invitationcode,
'current_id' => 0,
'info' => '',
];
Event::registerLog($logInfo);
// Checking if there is another survey with this code.
// If this is the case there will be a language choice
$sql = "SELECT * FROM $table_survey

@ -28,6 +28,18 @@ $action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null;
// Tracking
Event::event_access_tool(TOOL_SURVEY);
// ## NSR - log
$logInfo = [
'tool' => TOOL_SURVEY,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => '',
'action_details' => '',
'current_id' => 0,
'info' => '',
];
Event::registerLog($logInfo);
/** @todo
* This has to be moved to a more appropriate place (after the display_header
* of the code)

@ -103,7 +103,9 @@
<table class="table table-hover table-striped">
<thead>
<tr>
<th>{{ "Title"|get_lang }}</th>
<th>
{{ "Title"|get_lang }}
</th>
{% if is_allowed_to_edit %}
<th>{{ "PublicationDate"|get_lang }}</th>
<th>{{ "ExpirationDate"|get_lang }}</th>
@ -148,6 +150,9 @@
{% endif %}
{% endif %}
<td>
{% if row.info_time_prerequisite %}
{{ row.info_time_prerequisite }}
{% endif %}
{{ row.action_build }}
{{ row.action_edit }}
{{ row.action_visible }}
@ -485,6 +490,21 @@
{% endif %}
{% endfor %}
</div>
{% if not is_invitee %}
<div class="controls text-center">
{% if not is_ending %}
<a href="{{ web_self ~ "?" ~ _p.web_cid_query ~ "&action=send_notify_teacher" }}" class="btn btn-primary disabled">
He finalizado las lecciones, notificar al profesor
</a>
{% else %}
<a href="{{ web_self ~ "?" ~ _p.web_cid_query ~ "&action=send_notify_teacher" }}" class="btn btn-primary">
He finalizado las lecciones, notificar al profesor
</a>
{% endif %}
</div>
{% endif %}
{% if is_allowed_to_edit and not lp_is_shown %}
<div id="no-data-view">
<h2>{{ "LearningPaths"|get_lang }}</h2>

@ -25,6 +25,88 @@
{{ media_player }}
</div>
{% endif %}
{% if lp_accumulate_work_time != '' %}
{% set lp_progress %}
<style>
#timer .container{display:table;background:#777;color:#eee;font-weight:bold;width:100%;text-align:center;text-shadow:1px 1px 4px #999;}
#timer .container div{display:table-cell;font-size:24px;padding:0px;width:20px;}
#timer .container .divider{width:10px;color:#ddd;}
#btn-comenzar{box-sizing:border-box;background:#eee;border:none;margin:0 auto;padding:20px;width:100%;font-size:30px;color:#777;}
#btn-comenzar:hover{background:#fff;}
</style>
<script>
$(document).ready(function() {
var tiempo = {
hora: parseInt($("#hour").text()),
minuto: parseInt($("#minute").text()),
segundo: parseInt($("#second").text())
};
//window.tiempo_corriendo = null;
clearInterval(window.tiempo_corriendo);
window.tiempo_corriendo = setInterval(function(){
// Segundos
tiempo.segundo++;
if(tiempo.segundo >= 60) {
tiempo.segundo = 0;
tiempo.minuto++;
}
if (tiempo.segundo%10 == 0) {
//console.log({{lp_current_item_id}});
/*time_save({{lp_current_item_id}});*/
}
// Minutos
if(tiempo.minuto >= 60)
{
tiempo.minuto = 0;
tiempo.hora++;
}
$("#hour").text(tiempo.hora < 10 ? '0' + tiempo.hora : tiempo.hora);
//$("#hour").text(tiempo.hora);
$("#minute").text(tiempo.minuto < 10 ? '0' + tiempo.minuto : tiempo.minuto);
//$("#minute").text(tiempo.minuto);
$("#second").text(tiempo.segundo < 10 ? '0' + tiempo.segundo : tiempo.segundo);
//$("#second").text(tiempo.segundo);
}, 1000);
})
</script>
<b>
{{ "TimeSpentInLp"|get_lang|format(lp_accumulate_work_time) }}
</b>
<div id="progress_bar">
<div class="progress">
<div id="progress_bar_value2"
class="progress-bar progress-bar-success"
role="progressbar" aria-valuenow="50"
aria-valuemin="0"
aria-valuemax="{{ time_progress_value }}"
style="width: {{ time_progress_perc }};"
>
{{ time_progress_perc }}
</div>
</div>
</div>
<div id="timer">
<div class="container">
<div id="hour">{{ hour }}</div>
<div class="divider">:</div>
<div id="minute">{{ minute }}</div>
<div class="divider">:</div>
<div id="second">{{ second }}</div>
</div>
</div>
{% endset %}
{% else %}
{% set lp_progress %}
<div id="progress_bar">
{{ progress_bar }}
</div>
{% endset %}
{% endif %}
{% if gamification_mode == 1 %}
<!--- gamification -->
<div id="scorm-gamification">
@ -48,18 +130,15 @@
</div>
<div class="row">
<div class="col-xs-12 navegation-bar">
<div id="progress_bar">
{{ progress_bar }}
</div>
{{ lp_progress }}
</div>
</div>
</div>
<!--- end gamification -->
{% else %}
<div id="progress_bar">
{{ progress_bar }}
</div>
{{ lp_progress }}
{% endif %}
{{ teacher_toc_buttons }}
</div>
</div>

@ -0,0 +1,7 @@
<p>{{ 'Dear'|get_lang }} {{ name_teacher }},</p>
<p>El estudiante <b>{{ name_student }}</b> ha finalizado las lecciones del grupo <b>{{ course_name }}</p>
<p>{{ course_url }} </p>
<p>{{ 'SignatureFormula'|get_lang }}</p>
<p> {{ prefix ? prefix }}<br>
{{ telefono ? 'Tlfno. ' ~ telefono }}
</p>

@ -120,6 +120,18 @@ if (!empty($groupId)) {
// Stats
Event::event_access_tool(TOOL_STUDENTPUBLICATION);
// ## NSR - log
$logInfo = [
'tool' => TOOL_STUDENTPUBLICATION,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => $action,
'action_details' => '',
'current_id' => isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0,
'info' => '',
];
Event::registerLog($logInfo);
$groupId = api_get_group_id();
$isTutor = false;
if (!empty($groupId)) {

@ -11,6 +11,18 @@ require_once __DIR__.'/../../vendor/autoload.php';
$course_plugin = 'bbb'; //needed in order to load the plugin lang variables
require_once __DIR__.'/config.php';
// ## NSR - log
$logInfo = [
'tool' => 'Videoconference',
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => '',
'action_details' => '',
'current_id' => 0,
'info' => '',
];
Event::registerLog($logInfo);
$tool_name = get_lang('Videoconference');
$tpl = new Template($tool_name);

@ -34,6 +34,16 @@ $this_section = SECTION_COURSES;
api_block_anonymous_users(); // Only users who are logged in can proceed.
// ## NSR - log
$logInfo = [
'tool' => SECTION_COURSES,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => '',
'info' => '',
];
Event::registerLog($logInfo);
$userId = api_get_user_id();
$collapsable = api_get_configuration_value('allow_user_session_collapsable');

Loading…
Cancel
Save