, Beeznest Team
* @version Chamilo 1.9.6
*/
- function display_tracking_access_overview($sessionId = 0, $courseId = 0, $studentId = '', $profile = '', $date_to, $date_from) {
+ static function display_tracking_access_overview($sessionId = 0, $courseId = 0, $studentId = '', $profile = '', $date_from, $date_to) {
//The order is important you need to check the the $column variable in the model.ajax.php file
$columns = array(
get_lang('LoginDate'),
- get_lang('Username'),
- get_lang('Firstname'),
- get_lang('Lastname'),
+ get_lang('UserName'),
+ get_lang('LastName'),
+ get_lang('FirstName'),
get_lang('Clicks'),
get_lang('IP'),
get_lang('TimeLoggedIn'),
+ get_lang('Section'),
);
$column_model = array(
@@ -634,6 +792,7 @@ class MySpace {
array('name'=>'clicks', 'index'=>'clicks', 'align'=>'left', 'search' => 'true'),
array('name'=>'ip', 'index'=>'ip', 'align'=>'left', 'search' => 'true'),
array('name'=>'timeloggedin', 'index'=>'timeLoggedIn', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'session', 'index'=>'session', 'align'=>'left')
);
$action_links = '';
diff --git a/main/newscorm/learnpathList.class.php b/main/newscorm/learnpathList.class.php
index e53fafd592..0e1c5023ed 100644
--- a/main/newscorm/learnpathList.class.php
+++ b/main/newscorm/learnpathList.class.php
@@ -170,7 +170,7 @@ class learnpathList {
* @param int Id of session
* @return array List of lessons with lessons id as keys
*/
- function get_course_lessons($course_code, $session_id) {
+ static function get_course_lessons($course_code, $session_id) {
$tbl_course_lp = Database::get_course_table(TABLE_LP_MAIN);
$course = api_get_course_info($course_code);
diff --git a/main/newscorm/lp_ajax_save_item.php b/main/newscorm/lp_ajax_save_item.php
index 4c6947a0b1..d86d760e8d 100644
--- a/main/newscorm/lp_ajax_save_item.php
+++ b/main/newscorm/lp_ajax_save_item.php
@@ -44,7 +44,7 @@ require_once 'aiccItem.class.php';
* @param array Interactions array
* @param string Core exit SCORM string
*/
-function save_item($lp_id, $user_id, $view_id, $item_id, $score = -1, $max = -1, $min = -1, $status = '', $time = 0, $suspend = '', $location = '', $interactions = array(), $core_exit = 'none')
+function save_item($lp_id, $user_id, $view_id, $item_id, $score = -1, $max = -1, $min = -1, $status = '', $time = 0, $suspend = '', $location = '', $interactions = array(), $core_exit = 'none', $sessionId = null, $courseId = null)
{
global $debug;
$return = null;
@@ -58,6 +58,9 @@ function save_item($lp_id, $user_id, $view_id, $item_id, $score = -1, $max = -1,
$mylp = null;
$lpobject = Session::read('lpobject');
+ if (!is_object($lpobject) && isset($sessionId) && isset($courseId)) {
+ $lpobject = new learnpathItem($lp_id, $user_id, $courseId);
+ }
if (isset($lpobject)) {
$oLP = unserialize($lpobject);
if ($debug) error_log("lpobject was set");
@@ -305,5 +308,8 @@ echo save_item(
(!empty($_REQUEST['suspend'])?$_REQUEST['suspend']:null),
(!empty($_REQUEST['loc'])?$_REQUEST['loc']:null),
$interactions,
- (!empty($_REQUEST['core_exit'])?$_REQUEST['core_exit']:'')
+ (!empty($_REQUEST['core_exit'])?$_REQUEST['core_exit']:''),
+ '',
+ (!empty($_REQUEST['session_id'])?$_REQUEST['session_id']:''),
+ (!empty($_REQUEST['course_id'])?$_REQUEST['course_id']:'')
);
diff --git a/main/newscorm/lp_controller.php b/main/newscorm/lp_controller.php
index cf147003ae..2e67962e3f 100644
--- a/main/newscorm/lp_controller.php
+++ b/main/newscorm/lp_controller.php
@@ -864,6 +864,12 @@ switch ($action) {
$_SESSION['oLP']->delete_lp_image();
}
+ $extraFieldValue = new ExtraFieldValue('lp');
+ $params = array(
+ 'lp_id' => $_SESSION['oLP']->id
+ );
+ $extraFieldValue->save_field_values($_REQUEST);
+
if ($_FILES['lp_preview_image']['size'] > 0)
$_SESSION['oLP']->upload_image($_FILES['lp_preview_image']);
diff --git a/main/newscorm/lp_edit.php b/main/newscorm/lp_edit.php
index fd7d8a2115..a3d8552d57 100644
--- a/main/newscorm/lp_edit.php
+++ b/main/newscorm/lp_edit.php
@@ -23,9 +23,9 @@ if (isset($_SESSION['gradebook'])) {
if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array (
- 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
- 'name' => get_lang('ToolGradebook')
- );
+ 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
+ 'name' => get_lang('ToolGradebook')
+ );
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
$interbreadcrumb[] = array('url' => api_get_self()."?action=build&lp_id=".$_SESSION['oLP']->get_id(), 'name' => $_SESSION['oLP']->get_name());
@@ -50,11 +50,6 @@ function activate_end_date() {
';
-
-Display::display_header(get_lang('CourseSettings'), 'Path');
-
-echo $_SESSION['oLP']->build_action_menu();
-
$gradebook = isset($_GET['gradebook']) ? Security::remove_XSS($_GET['gradebook']) : null;
$defaults=array();
@@ -198,6 +193,9 @@ if (api_is_platform_admin()) {
$defaults['use_max_score'] = $_SESSION['oLP']->use_max_score;
}
+$extraField = new ExtraField('lp');
+$extra = $extraField->addElements($form, $_SESSION['oLP']->get_id());
+
//Submit button
$form->addElement('style_submit_button', 'Submit',get_lang('SaveLPSettings'),'class="save"');
@@ -205,12 +203,24 @@ $form->addElement('style_submit_button', 'Submit',get_lang('SaveLPSettings'),'cl
$form->addElement('hidden', 'action', 'update_lp');
$form->addElement('hidden', 'lp_id', $_SESSION['oLP']->get_id());
+$htmlHeadXtra[] = '';
+$htmlHeadXtra[] = '';
+$htmlHeadXtra[] ='';
+
$defaults['publicated_on'] = ($publicated_on!='0000-00-00 00:00:00' && !empty($publicated_on))? api_get_local_time($publicated_on) : date('Y-m-d 12:00:00');
$defaults['expired_on'] = ($expired_on !='0000-00-00 00:00:00' && !empty($expired_on) )? api_get_local_time($expired_on): date('Y-m-d 12:00:00',time()+84600);
$form->setDefaults($defaults);
+Display::display_header(get_lang('CourseSettings'), 'Path');
+
+echo $_SESSION['oLP']->build_action_menu();
+
echo '';
if ($_SESSION['oLP']->get_hide_toc_frame() == 1) {
diff --git a/main/newscorm/lp_stats.php b/main/newscorm/lp_stats.php
index 9c89bac5c3..c5823e4418 100644
--- a/main/newscorm/lp_stats.php
+++ b/main/newscorm/lp_stats.php
@@ -48,7 +48,7 @@ $course_id = $course_info['real_id'];
if (isset($_GET['student_id'])) {
$student_id = intval($_GET['student_id']);
}
-$session_id = api_get_session_id();
+$session_id = ($_GET['id_session'])? intval($_GET['id_session']) : api_get_session_id();
$session_condition = api_get_session_condition($session_id);
//When origin is not set that means that the lp_stats are viewed from the "man running" icon
@@ -859,10 +859,10 @@ if (!empty($a_my_id)) {
//var_dump($my_studen_id, $my_course_id,$a_my_id);
if (isset($_GET['extend_attempt'])) {
//"Right green cross" extended
- $total_score = Tracking::get_avg_student_score($my_studen_id, $my_course_id, $a_my_id, api_get_session_id(), false, false);
+ $total_score = Tracking::get_avg_student_score($my_studen_id, $my_course_id, $a_my_id, $session_id, false, false);
} else {
//"Left green cross" extended
- $total_score = Tracking::get_avg_student_score($my_studen_id, $my_course_id, $a_my_id, api_get_session_id(), false, true);
+ $total_score = Tracking::get_avg_student_score($my_studen_id, $my_course_id, $a_my_id, $session_id, false, true);
}
} else {
// Extend all "left green cross"
@@ -870,12 +870,12 @@ if (!empty($a_my_id)) {
$my_course_id = Database::escape_string($_GET['course']);
// var_dump($student_id, $my_course_id );
if (!empty($student_id) && !empty($my_course_id)) {
- $total_score = Tracking::get_avg_student_score($student_id, $my_course_id, array(intval($_GET['lp_id'])), api_get_session_id(), false, false);
+ $total_score = Tracking::get_avg_student_score($student_id, $my_course_id, array(intval($_GET['lp_id'])), $session_id, false, false);
} else {
$total_score = 0;
}
} else {
- $total_score = Tracking::get_avg_student_score(api_get_user_id(), api_get_course_id(), array(intval($_GET['lp_id'])), api_get_session_id(), false, false);
+ $total_score = Tracking::get_avg_student_score(api_get_user_id(), api_get_course_id(), array(intval($_GET['lp_id'])), $session_id, false, false);
}
}
diff --git a/main/newscorm/scorm_api.php b/main/newscorm/scorm_api.php
index de39555b2b..3c86785096 100644
--- a/main/newscorm/scorm_api.php
+++ b/main/newscorm/scorm_api.php
@@ -183,8 +183,8 @@ olms.lms_item_lesson_mode = 'get_lesson_mode();?>';
olms.lms_item_launch_data = 'get_launch_data());?>';
olms.lms_item_core_exit = 'get_core_exit();?>';
olms.lms_course_id = 'get_course_int_id(); ?>';
+olms.lms_session_id = '';
olms.lms_course_code = 'getCourseCode(); ?>';
-
get_items_details_as_js('olms.lms_item_types');?>
olms.asset_timer = 0;
@@ -1498,13 +1498,31 @@ function switch_item(current_item, next_item){
* @return void
* @uses lp_ajax_save_item.php through an AJAX call
*/
-function xajax_save_item(lms_lp_id, lms_user_id, lms_view_id, lms_item_id, score, max, min, lesson_status, session_time, suspend_data, lesson_location, interactions, lms_item_core_exit, item_type) {
+function xajax_save_item(
+ lms_lp_id,
+ lms_user_id,
+ lms_view_id,
+ lms_item_id,
+ score,
+ max,
+ min,
+ lesson_status,
+ session_time,
+ suspend_data,
+ lesson_location,
+ interactions,
+ lms_item_core_exit,
+ item_type,
+ session_id,
+ course_id) {
var params = '';
params += 'lid='+lms_lp_id+'&uid='+lms_user_id+'&vid='+lms_view_id;
params += '&iid='+lms_item_id+'&s='+score+'&max='+max+'&min='+min;
params += '&status='+lesson_status+'&t='+session_time;
params += '&suspend='+suspend_data+'&loc='+lesson_location;
params += '&core_exit='+lms_item_core_exit;
+ params += '&session_id='+session_id;
+ params += '&course_id='+course_id;
//console.info(session_time);
if (olms.lms_lp_type == 1 || item_type == 'document') {
logit_lms('xajax_save_item with params:' + params,3);
diff --git a/main/session/index.php b/main/session/index.php
index f6cac273c1..8cbf5d45fb 100644
--- a/main/session/index.php
+++ b/main/session/index.php
@@ -119,7 +119,16 @@ if (!empty($course_list)) {
true
);
$lp_list = $list->get_flat_list();
- $lp_count = count($lp_list);
+
+ $lp_count = 0;
+
+ if(!empty($lp_list)) {
+ foreach ($lp_list as $valLp) {
+ if($valLp['lp_visibility']) {
+ $lp_count++;
+ }
+ }
+ }
$course_info = api_get_course_info($course_data['code']);
$exercise_count = count(get_all_exercises($course_info, $session_id, true));