**/
public function set_seriousgame_mode()
@@ -5473,7 +5472,10 @@ class learnpath
// We need to close the form when we are updating the mp3 files.
if ($update_audio == 'true') {
- $return .= '' . get_lang('SaveAudioAndOrganization') . '
'; // TODO: What kind of language variable is this?
+ $return .= '';
+ //$return .= '' . get_lang('SaveAudioAndOrganization') . '
'; // TODO: What kind of language variable is this?
}
}
@@ -5565,7 +5567,7 @@ class learnpath
}
// The audio column.
- $return_audio .= '';
+ $return_audio .= ' ';
$audio = '';
@@ -10139,6 +10141,8 @@ EOD;
}
/**
+ * Get whether this is a learning path with the possibility to subscribe
+ * users or not
* @return int
*/
public function getSubscribeUsers()
@@ -10147,7 +10151,9 @@ EOD;
}
/**
- * @param int $subscribeUsers
+ * Set whether this is a learning path with the possibility to subscribe
+ * users or not
+ * @param int $subscribeUsers (0 = false, 1 = true)
*/
public function setSubscribeUsers($value)
{
@@ -10157,12 +10163,192 @@ EOD;
$this->subscribeUsers = intval($value);;
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id();
- $sql = "UPDATE $lp_table SET subscribe_users = '".$this->subscribeUsers."'
- WHERE c_id = ".$this->course_int_id." AND id = '$lp_id'";
+ $sql = "UPDATE $lp_table SET subscribe_users = ".$this->subscribeUsers."
+ WHERE c_id = ".$this->course_int_id." AND id = $lp_id";
Database::query($sql);
return true;
}
+ /**
+ * Calculate the count of stars for a user
+ * @param int $lpId The learn path ID
+ * @param int $userId The user ID
+ * @param int $courseId The course ID
+ * @param int $sessionId Optional. The session ID
+ * @return int The count of stars
+ */
+ public function getCalculateStars()
+ {
+ $stars = 0;
+
+ $progress = self::getProgress($this->lp_id, $this->user_id, $this->course_int_id, $this->lp_session_id);
+
+ if ($progress > 50) {
+ $stars++;
+ }
+
+ // Calculate stars chapters evaluation
+ $exercisesItems = $this->getExercisesItems();
+
+ if ($exercisesItems === false) {
+ return $stars;
+ }
+
+ $totalResult = 0;
+
+ foreach ($exercisesItems as $exerciseItem) {
+ $exerciseResultInfo = Event::getExerciseResultsByUser(
+ $this->user_id,
+ $exerciseItem->ref,
+ $this->course_int_id,
+ $this->lp_session_id,
+ $this->lp_id,
+ $exerciseItem->db_id
+ );
+
+ $exerciseResult = 0;
+
+ foreach ($exerciseResultInfo as $result) {
+ $exerciseResult += $result['exe_result'] * 100 / $result['exe_weighting'];
+ }
+
+ $exerciseAverage = $exerciseResult / (count($exerciseResultInfo) > 0 ? count($exerciseResultInfo) : 1);
+
+ $totalResult += $exerciseAverage;
+ }
+
+ $totalExerciseAverage = $totalResult / (count($exercisesItems) > 0 ? count($exercisesItems) : 1);
+
+ if ($totalExerciseAverage >= 50) {
+ $stars++;
+ }
+
+ if ($totalExerciseAverage >= 80) {
+ $stars++;
+ }
+
+ // Calculate star for final evaluation
+ $finalEvaluationItem = $this->getFinalEvaluationItem();
+
+ if ($finalEvaluationItem === false) {
+ return $stars;
+ }
+
+ $evaluationResultInfo = Event::getExerciseResultsByUser(
+ $this->user_id,
+ $finalEvaluationItem->ref,
+ $this->course_int_id,
+ $this->lp_session_id,
+ $this->lp_id,
+ $finalEvaluationItem->db_id
+ );
+
+ $evaluationResult = 0;
+
+ foreach ($evaluationResultInfo as $result) {
+ $evaluationResult += $result['exe_result'] * 100 / $result['exe_weighting'];
+ }
+
+ $evaluationAverage = $evaluationResult / (count($evaluationResultInfo) > 0 ? count($evaluationResultInfo) : 1);
+
+ if ($evaluationAverage >= 80) {
+ $stars++;
+ }
+
+ return $stars;
+ }
+
+ /**
+ * Get the items of exercise type
+ * @return array The items. Otherwise return false
+ */
+ public function getExercisesItems()
+ {
+ $exercises = [];
+
+ foreach ($this->items as $item) {
+ if ($item->type != 'quiz') {
+ continue;
+ }
+
+ $exercises[] = $item;
+ }
+
+ array_pop($exercises);
+
+ return $exercises;
+ }
+
+ /**
+ * Get the item of exercise type (evaluation type)
+ * @return array The final evaluation. Otherwise return false
+ */
+ public function getFinalEvaluationItem()
+ {
+ $exercises = [];
+
+ foreach ($this->items as $item) {
+ if ($item->type != 'quiz') {
+ continue;
+ }
+
+ $exercises[] = $item;
+ }
+
+ return array_pop($exercises);
+ }
+
+ /**
+ * Calculate the total points achieved for the current user in this learning path
+ * @return int
+ */
+ public function getCalculateScore()
+ {
+ // Calculate stars chapters evaluation
+ $exercisesItems = $this->getExercisesItems();
+ $finalEvaluationItem = $this->getFinalEvaluationItem();
+
+ $totalExercisesResult = 0;
+ $totalEvaluationResult = 0;
+
+ if ($exercisesItems !== false) {
+ foreach ($exercisesItems as $exerciseItem) {
+ $exerciseResultInfo = Event::getExerciseResultsByUser(
+ $this->user_id,
+ $exerciseItem->ref,
+ $this->course_int_id,
+ $this->lp_session_id,
+ $this->lp_id,
+ $exerciseItem->db_id
+ );
+
+ $exerciseResult = 0;
+
+ foreach ($exerciseResultInfo as $result) {
+ $exerciseResult += $result['exe_result'];
+ }
+
+ $totalExercisesResult += $exerciseResult;
+ }
+ }
+
+ if ($finalEvaluationItem !== false) {
+ $evaluationResultInfo = Event::getExerciseResultsByUser(
+ $this->user_id,
+ $finalEvaluationItem->ref,
+ $this->course_int_id,
+ $this->lp_session_id,
+ $this->lp_id,
+ $finalEvaluationItem->db_id
+ );
+
+ foreach ($evaluationResultInfo as $result) {
+ $totalEvaluationResult += $result['exe_result'];
+ }
+ }
+
+ return $totalExercisesResult + $totalEvaluationResult;
+ }
}
if (!function_exists('trim_value')) {
diff --git a/main/newscorm/lp_add.php b/main/newscorm/lp_add.php
index c936964360..8eaa301976 100755
--- a/main/newscorm/lp_add.php
+++ b/main/newscorm/lp_add.php
@@ -115,10 +115,7 @@ $form->addElement('hidden', 'action', 'add_lp');
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html', '');
-$items = learnpath::getCategoryFromCourseIntoSelect(api_get_course_int_id());
-if (!empty($items)) {
- $items = array_merge(array(get_lang('SelectACategory')), $items);
-}
+$items = learnpath::getCategoryFromCourseIntoSelect(api_get_course_int_id(), true);
$form->addElement('select', 'category_id', get_lang('Category'), $items);
// Start date
diff --git a/main/newscorm/lp_controller.php b/main/newscorm/lp_controller.php
index a24c9b8401..9b564757a3 100755
--- a/main/newscorm/lp_controller.php
+++ b/main/newscorm/lp_controller.php
@@ -1247,6 +1247,25 @@ switch ($action) {
$url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id)."&message=ItemUpdated";
header('Location: '.$url);
break;
+ case 'toggle_seriousgame': //activate/deactive seriousgame_mode
+ if (!$is_allowed_to_edit) {
+ api_not_allowed(true);
+ }
+
+ if ($debug > 0) {
+ error_log('New LP - seriousgame_mode action triggered');
+ }
+
+ if (!$lp_found) {
+ error_log('New LP - No learnpath given for visibility');
+
+ require 'lp_list.php';
+ }
+
+ $_SESSION['refresh'] = 1;
+ $_SESSION['oLP']->set_seriousgame_mode();
+ require 'lp_list.php';
+ break;
default:
if ($debug > 0) error_log('New LP - default action triggered', 0);
require 'lp_list.php';
diff --git a/main/newscorm/lp_list.php b/main/newscorm/lp_list.php
index 402d267fc7..6597372bc1 100755
--- a/main/newscorm/lp_list.php
+++ b/main/newscorm/lp_list.php
@@ -48,12 +48,11 @@ if (api_get_setting('search_enabled') == 'true') {
require api_get_path(LIBRARY_PATH).'search/search_widget.php';
search_widget_prepare($htmlHeadXtra);
}
-Display::display_header($nameTools, 'Path');
$current_session = api_get_session_id();
/* Introduction section (editable by course admins) */
-Display::display_introduction_section(TOOL_LEARNPATH, array(
+$introductionSection = Display::return_introduction_section(TOOL_LEARNPATH, array(
'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
'CreateDocumentDir' => '../../courses/'.api_get_course_path().'/document/',
'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/'
@@ -61,40 +60,49 @@ Display::display_introduction_section(TOOL_LEARNPATH, array(
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
+$message = '';
+$actions = '';
+
if ($is_allowed_to_edit) {
if (!empty($dialog_box)) {
switch ($_GET['dialogtype']) {
case 'confirmation':
- Display::display_confirmation_message($dialog_box);
+ $message = Display::return_message($dialog_box, 'success');
break;
case 'error':
- Display::display_error_message($dialog_box);
+ $message = Display::return_message($dialog_box, 'danger');
break;
case 'warning':
- Display::display_warning_message($dialog_box);
+ $message = Display::return_message($dialog_box, 'warning');
break;
default:
- Display::display_normal_message($dialog_box);
+ $message = Display::return_message($dialog_box);
break;
}
}
if (api_failure::get_last_failure()) {
- Display::display_normal_message(api_failure::get_last_failure());
+ $message = Display::return_message(api_failure::get_last_failure());
}
- echo '
';
- echo Display::url(
+ $actions .= Display::url(
Display::return_icon('new_folder.png', get_lang('AddCategory'), array(), ICON_SIZE_MEDIUM),
api_get_self().'?'.api_get_cidreq().'&action=add_lp_category'
);
- echo '
'.Display::return_icon('new_learnpath.png', get_lang('LearnpathAddLearnpath'), '', ICON_SIZE_MEDIUM).' '.
- str_repeat(' ', 3).
- '
'.Display::return_icon('import_scorm.png', get_lang('UploadScorm'), '', ICON_SIZE_MEDIUM).' ';
+ $actions .= Display::url(
+ Display::return_icon('new_learnpath.png', get_lang('LearnpathAddLearnpath'), '', ICON_SIZE_MEDIUM),
+ api_get_self().'?'.api_get_cidreq().'&action=add_lp'
+ );
+ $actions .= Display::url(
+ Display::return_icon('import_scorm.png', get_lang('UploadScorm'), '', ICON_SIZE_MEDIUM),
+ '../upload/index.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH
+ );
+
if (api_get_setting('service_ppt2lp', 'active') == 'true') {
- echo str_repeat(' ', 3).'
- '.Display::return_icon('import_powerpoint.png', get_lang('PowerPointConvert'), '', ICON_SIZE_MEDIUM).' ';
+ $actions .= Display::url(
+ Display::return_icon('import_powerpoint.png', get_lang('PowerPointConvert'), '', ICON_SIZE_MEDIUM),
+ '../upload/upload_ppt.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH
+ );
}
- echo '
';
}
$token = Security::get_token();
@@ -118,12 +126,12 @@ if (!empty($categoriesTempList)) {
$userId = api_get_user_id();
$userInfo = api_get_user_info();
-$lp_showed = false;
-$total = count($categories);
-$counterCategories = 1;
+$lpIsShown = false;
$test_mode = api_get_setting('server_type');
+$data = [];
+
foreach ($categories as $item) {
$categoryId = $item->getId();
@@ -143,59 +151,14 @@ foreach ($categories as $item) {
continue;
}
- $edit_link = null;
- $delete_link = null;
- $moveUpLink = null;
- $moveDownLink = null;
-
- if ($item->getId() > 0 && api_is_allowed_to_edit()) {
- $url = 'lp_controller.php?'.api_get_cidreq().'&action=add_lp_category&id='.$item->getId();
-
- $edit_link = Display::url(Display::return_icon('edit.png', get_lang('Edit')), $url);
- $delete_url = 'lp_controller.php?'.api_get_cidreq().'&action=delete_lp_category&id='.$item->getId();
- $moveUpUrl = 'lp_controller.php?'.api_get_cidreq().'&action=move_up_category&id='.$item->getId();
- $moveDownUrl = 'lp_controller.php?'.api_get_cidreq().'&action=move_down_category&id='.$item->getId();
-
- if ($counterCategories == 1) {
- $moveUpLink = Display::url(Display::return_icon('up_na.png', get_lang('Move')), '#');
- } else {
- $moveUpLink = Display::url(Display::return_icon('up.png', get_lang('Move')), $moveUpUrl);
- }
-
- if (($total -1) == $counterCategories) {
- $moveDownLink = Display::url(Display::return_icon('down_na.png', get_lang('Move')), '#');
- } else {
- $moveDownLink = Display::url(Display::return_icon('down.png', get_lang('Move')), $moveDownUrl);
- }
- $delete_link = Display::url(Display::return_icon('delete.png', get_lang('Delete')), $delete_url);
- $counterCategories++;
- }
-
- echo Display::page_subheader2($item->getName().$edit_link.$moveUpLink.$moveDownLink.$delete_link);
+ $listData = [];
if (!empty($flat_list)) {
- echo '
';
- echo '';
-
- if ($is_allowed_to_edit) {
- echo ''.get_lang('Title').' ';
- echo ''.get_lang('PublicationDate').' ';
- echo ''.get_lang('ExpirationDate').' ';
- echo ''.get_lang('Progress')." ";
- echo ''.get_lang('AuthoringOptions')." ";
- } else {
- echo ''.get_lang('Title').' ';
- if (!api_is_invitee()) {
- echo ''.get_lang('Progress')." ";
- }
- echo ''.get_lang('Actions')." ";
- }
- echo ' ';
-
$max = count($flat_list);
$counter = 0;
$current = 0;
$autolaunch_exists = false;
+
foreach ($flat_list as $id => $details) {
// Validation when belongs to a session.
@@ -318,10 +281,6 @@ foreach ($categories as $item) {
);
}
- $dsp_line = ''.
- ''.$icon_learnpath.'
- '.$my_title.' '.$session_img.$extra." ";
-
$dsp_desc = '';
$dsp_export = '';
$dsp_build = '';
@@ -343,21 +302,15 @@ foreach ($categories as $item) {
}
if ($is_allowed_to_edit) {
- $dsp_progress = ''.$progress.' ';
+ $dsp_progress = ''.$progress.' ';
} else {
$dsp_progress = "";
if (!api_is_invitee()) {
- $dsp_progress = ''.learnpath::get_progress_bar(
- $progress,
- '%'
- ).' ';
+ $dsp_progress = learnpath::get_progress_bar($progress, '%');
}
}
- $dsp_edit = '';
- $dsp_edit_close = ' ';
-
$token_parameter = "&sec_token=$token";
$dsp_edit_lp = null;
$dsp_publish = null;
@@ -366,19 +319,16 @@ foreach ($categories as $item) {
$dsp_disk = null;
$copy = null;
$lp_auto_launch_icon = null;
+ $actionSeriousGame = null;
if ($is_allowed_to_edit) {
// EDIT LP
if ($current_session == $details['lp_session']) {
- $dsp_edit_lp = ''.
- Display::return_icon(
- 'settings.png',
- get_lang('CourseSettings'),
- '',
- ICON_SIZE_SMALL
- ).' ';
+ $dsp_edit_lp = Display::url(
+ Display::return_icon('settings.png', get_lang('CourseSettings'), '', ICON_SIZE_SMALL),
+ "lp_controller.php?" . api_get_cidreq() . "&action=edit&lp_id=$id"
+ );
} else {
$dsp_edit_lp = Display::return_icon(
'settings_na.png',
@@ -391,13 +341,15 @@ foreach ($categories as $item) {
// BUILD
if ($current_session == $details['lp_session']) {
if ($details['lp_type'] == 1 || $details['lp_type'] == 2) {
- $dsp_build = ''.
- Display::return_icon(
- 'edit.png',
- get_lang('LearnpathEditLearnpath'),
- '',
- ICON_SIZE_SMALL
- ).' ';
+ $dsp_build = Display::url(
+ Display::return_icon('edit.png', get_lang('LearnpathEditLearnpath'), '', ICON_SIZE_SMALL),
+ 'lp_controller.php?' . api_get_cidreq() . '&' . http_build_query([
+ 'action' => 'add_item',
+ 'type' => 'step',
+ 'lp_id' => $id,
+ 'isStudentView' => 'false'
+ ])
+ );
} else {
$dsp_build = Display::return_icon(
'edit_na.png',
@@ -423,26 +375,30 @@ foreach ($categories as $item) {
*/
if (!isset($details['subscribe_users']) || $details['subscribe_users'] != 1) {
if ($details['lp_visibility'] == 0) {
- $dsp_visible = "".
- Display::return_icon('invisible.png', get_lang('Show'), '', ICON_SIZE_SMALL )." ";
+ $dsp_visible = Display::url(
+ Display::return_icon('invisible.png', get_lang('Show'), '', ICON_SIZE_SMALL),
+ api_get_self() . '?' . api_get_cidreq() . "&lp_id=$id&action=toggle_visible&new_status=1"
+ );
} else {
- $dsp_visible = "".
- Display::return_icon('visible.png', get_lang('Hide'), '', ICON_SIZE_SMALL )." ";
+ $dsp_visible = Display::url(
+ Display::return_icon('visible.png', get_lang('Hide'), '', ICON_SIZE_SMALL),
+ api_get_self() . '?' . api_get_cidreq() . "&lp_id=$id&action=toggle_visible&new_status=0"
+ );
}
}
/* PUBLISH COMMAND */
if ($current_session == $details['lp_session']) {
if ($details['lp_published'] == "i") {
- $dsp_publish = "".
+ $dsp_publish = Display::url(
Display::return_icon(
'lp_publish_na.png',
get_lang('LearnpathPublish'),
'',
ICON_SIZE_SMALL
- )." ";
+ ),
+ api_get_self() . '?' . api_get_cidreq() . "&lp_id=$id&action=toggle_publish&new_status=v"
+ );
} else {
$dsp_publish = "";
+ $dsp_publish = Display::url(
+ Display::return_icon(
+ 'lp_publish.png',
+ get_lang('LearnpathDoNotPublish'),
+ '',
+ ICON_SIZE_SMALL
+ ),
+ api_get_self() . '?' . api_get_cidreq() . "&lp_id=$id&action=toggle_publish&new_status=i"
+ );
}
} else {
$dsp_publish = Display::return_icon(
@@ -471,36 +436,37 @@ foreach ($categories as $item) {
*/
if ($current_session == $details['lp_session']) {
if ($details['seriousgame_mode'] == 1 && $details['lp_prevent_reinit'] == 1) { //seriousgame mode | next = single
- $dsp_reinit = ' '.
+ $dsp_reinit = Display::url(
Display::return_icon(
'reload.png',
get_lang('PreventMultipleAttempts'),
'',
ICON_SIZE_SMALL
- ).
- ' ';
+ ),
+ "lp_controller.php?" . api_get_cidreq() . "&action=switch_attempt_mode&lp_id=$id"
+ );
}
if ($details['seriousgame_mode'] == 0 && $details['lp_prevent_reinit'] == 1) { //single mode | next = multiple
- $dsp_reinit = ''.
+ $dsp_reinit = Display::url(
Display::return_icon(
'reload_na.png',
get_lang('AllowMultipleAttempts'),
'',
ICON_SIZE_SMALL
- ).
- ' ';
+ ),
+ "lp_controller.php?" . api_get_cidreq() . "&action=switch_attempt_mode&lp_id=$id"
+ );
}
if ($details['seriousgame_mode'] == 0 && $details['lp_prevent_reinit'] == 0) { //multiple mode | next = seriousgame
- $dsp_reinit = ''.Display::return_icon(
+ $dsp_reinit = Display::url(
+ Display::return_icon(
'reload.png',
get_lang('AllowMultipleAttempts'),
'',
ICON_SIZE_SMALL
- ).
- ' ';
+ ),
+ "lp_controller.php?" . api_get_cidreq() . "&action=switch_attempt_mode&lp_id=$id"
+ );
}
} else {
$dsp_reinit = Display::return_icon(
@@ -516,44 +482,52 @@ foreach ($categories as $item) {
switch ($details['lp_view_mode']) {
case 'fullscreen':
- $dsp_default_view = ''.
+ $dsp_default_view = Display::url(
Display::return_icon(
'view_fullscreen.png',
get_lang('ViewModeFullScreen'),
'',
ICON_SIZE_SMALL
- ).' ';
+ ),
+ 'lp_controller.php?' . api_get_cidreq()
+ . '&action=switch_view_mode&lp_id=' . $id . $token_parameter
+ );
break;
case 'embedded':
- $dsp_default_view = ''.
+ $dsp_default_view = Display::url(
Display::return_icon(
'view_left_right.png',
get_lang('ViewModeEmbedded'),
'',
ICON_SIZE_SMALL
- ).' ';
+ ),
+ 'lp_controller.php?' . api_get_cidreq()
+ . '&action=switch_view_mode&lp_id=' . $id . $token_parameter
+ );
break;
case 'embedframe':
- $dsp_default_view = ''.
+ $dsp_default_view = Display::url(
Display::return_icon(
'view_nofullscreen.png',
get_lang('ViewModeEmbedFrame'),
'',
ICON_SIZE_SMALL
- ).' ';
+ ),
+ 'lp_controller.php?' . api_get_cidreq()
+ . '&action=switch_view_mode&lp_id=' . $id . $token_parameter
+ );
break;
case 'impress':
- $dsp_default_view = ''.
+ $dsp_default_view = Display::url(
Display::return_icon(
'window_list_slide.png',
get_lang('ViewModeImpress'),
'',
ICON_SIZE_SMALL
- ).' ';
+ ),
+ 'lp_controller.php?' . api_get_cidreq()
+ . '&action=switch_view_mode&lp_id=' . $id . $token_parameter
+ );
break;
}
} else {
@@ -577,23 +551,25 @@ foreach ($categories as $item) {
/* DEBUG */
if ($test_mode == 'test' or api_is_platform_admin()) {
if ($details['lp_scorm_debug'] == 1) {
- $dsp_debug = ''.
+ $dsp_debug = Display::url(
Display::return_icon(
'bug.png',
get_lang('HideDebug'),
'',
ICON_SIZE_SMALL
- ).' ';
+ ),
+ "lp_controller.php?" . api_get_cidreq() . "&action=switch_scorm_debug&lp_id=$id"
+ );
} else {
- $dsp_debug = ''.
+ $dsp_debug = Display::url(
Display::return_icon(
'bug_na.png',
get_lang('ShowDebug'),
'',
ICON_SIZE_SMALL
- ).' ';
+ ),
+ "lp_controller.php?" . api_get_cidreq() . "&action=switch_scorm_debug&lp_id=$id"
+ );
}
}
@@ -657,45 +633,41 @@ foreach ($categories as $item) {
if (api_get_course_setting('enable_lp_auto_launch') == 1) {
if ($details['autolaunch'] == 1 && $autolaunch_exists == false) {
$autolaunch_exists = true;
- $lp_auto_launch_icon = '
- ';
+ $lp_auto_launch_icon = Display::url(
+ Display::return_icon('launch.png', get_lang('DisableLPAutoLaunch')),
+ api_get_self() . '?' . api_get_cidreq() . "&action=auto_launch&status=0&lp_id=$id"
+ );
} else {
- $lp_auto_launch_icon = '
- ';
+ $lp_auto_launch_icon = Display::url(
+ Display::return_icon('launch_na.png', get_lang('EnableLPAutoLaunch')),
+ api_get_self() . '?' . api_get_cidreq() . "&action=auto_launch&status=1&lp_id=$id"
+ );
}
}
// Export to PDF
- $export_icon = '
- '.Display::return_icon(
+ $export_icon = Display::url(
+ Display::return_icon(
'pdf.png',
get_lang('ExportToPDFOnlyHTMLAndImages'),
'',
ICON_SIZE_SMALL
- ).' ';
+ ),
+ api_get_self() . '?' . api_get_cidreq() . "&action=export_to_pdf&lp_id=$id"
+ );
/* Delete */
if ($current_session == $details['lp_session']) {
- $dsp_delete = "".
+ $dsp_delete = Display::url(
Display::return_icon(
'delete.png',
get_lang('LearnpathDeleteLearnpath'),
'',
ICON_SIZE_SMALL
- ).' ';
+ ),
+ 'lp_controller.php?' . api_get_cidreq() . "&action=delete&lp_id=$id",
+ ['onclick' => "javascript: return confirmation('" . addslashes($name) . "');"]
+ );
} else {
$dsp_delete = Display::return_icon(
'delete_na.png',
@@ -709,66 +681,66 @@ foreach ($categories as $item) {
// Only active while session mode is not active
if ($current_session == 0) {
if ($details['lp_display_order'] == 1 && $max != 1) {
- $dsp_order .= '
- '.Display::return_icon(
- 'down.png',
- get_lang('MoveDown'),
- '',
- ICON_SIZE_SMALL
- ).' ';
+ $dsp_order .= Display::url(
+ Display::return_icon('down.png', get_lang('MoveDown'), '', ICON_SIZE_SMALL),
+ "lp_controller.php?" . api_get_cidreq() . "&action=move_lp_down&lp_id=$id"
+ );
} elseif ($current == $max - 1 && $max != 1) {
- $dsp_order .= '
- '.Display::return_icon(
- 'up.png',
- get_lang('MoveUp'),
- '',
- ICON_SIZE_SMALL
- ).' ';
+ $dsp_order .= Display::url(
+ Display::return_icon('up.png', get_lang('MoveUp'), '', ICON_SIZE_SMALL),
+ "lp_controller.php?" . api_get_cidreq() . "&action=move_lp_up&lp_id=$id"
+ );
} elseif ($max == 1) {
$dsp_order = '';
} else {
- $dsp_order .= ''.
- Display::return_icon(
- 'down.png',
- get_lang('MoveDown'),
- '',
- ICON_SIZE_SMALL
- ).' ';
- $dsp_order .= ''.
- Display::return_icon(
- 'up.png',
- get_lang('MoveUp'),
- '',
- ICON_SIZE_SMALL
- ).' ';
+ $dsp_order .= Display::url(
+ Display::return_icon('down.png', get_lang('MoveDown'), '', ICON_SIZE_SMALL),
+ "lp_controller.php?" . api_get_cidreq() . "&action=move_lp_down&lp_id=$id"
+ );
+ $dsp_order .= Display::url(
+ Display::return_icon('up.png', get_lang('MoveUp'), '', ICON_SIZE_SMALL),
+ "lp_controller.php?" . api_get_cidreq() . "&action=move_lp_up&lp_id=$id"
+ );
}
}
if ($is_allowed_to_edit) {
- $start_time = Display::tag(
- 'td',
- Display::div($start_time, array('class' => 'small'))
- );
- $end_time = Display::tag(
- 'td',
- Display::div($end_time, array('class' => 'small'))
- );
+ $start_time = $start_time;
+ $end_time = $end_time;
} else {
$start_time = $end_time = '';
}
+
+ if (api_get_setting('gamification_mode') != 0) {
+ if ($details['seriousgame_mode'] == 0) {
+ $actionSeriousGame = Display::toolbarButton(
+ null,
+ api_get_self() . '?' . api_get_cidreq() . "&lp_id=$id&action=toggle_seriousgame",
+ 'trophy',
+ 'default',
+ [
+ 'class' => 'btn-xs',
+ 'title' => get_lang('ActivateSeriousGame')
+ ]
+ );
+ } else {
+ $actionSeriousGame = Display::toolbarButton(
+ null,
+ api_get_self() . '?' . api_get_cidreq() . "&lp_id=$id&action=toggle_seriousgame",
+ 'trophy',
+ 'warning',
+ [
+ 'class' => 'btn-xs active',
+ 'title' => get_lang('DeactivateSeriousGame')
+ ]
+ );
+ }
+ }
} else {
// Student
- $export_icon = ' '.
- Display::return_icon(
- 'pdf.png',
- get_lang('ExportToPDF'),
- '',
- ICON_SIZE_SMALL
- ).' ';
+ $export_icon = Display::url(
+ Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL),
+ api_get_self() . '?' . api_get_cidreq() . "&action=export_to_pdf&lp_id=$id"
+ );
}
$hideScormExportLink = api_get_setting('hide_scorm_export_link');
@@ -786,50 +758,60 @@ foreach ($categories as $item) {
$export_icon = null;
}
- echo
- $dsp_line.
- $start_time.
- $end_time.
- $dsp_progress.
- $dsp_desc.
- $dsp_export.
- $dsp_edit.
- $dsp_build.
- $dsp_edit_lp.
- $dsp_visible.
- $dsp_publish.
- $subscribeUsers.
- $dsp_reinit.
- $dsp_default_view.
- $dsp_debug.
- $dsp_disk.
- $copy.
- $lp_auto_launch_icon.
- $export_icon.
- $dsp_delete.
- $dsp_order.
- $dsp_edit_close;
-
- $lp_showed = true;
-
- echo " ";
+ $listData[] = [
+ 'learnpath_icon' => $icon_learnpath,
+ 'url_start' => $url_start_lp,
+ 'title' => $my_title,
+ 'session_image' => $session_img,
+ 'extra' => $extra,
+ 'start_time' => $start_time,
+ 'end_time' => $end_time,
+ 'dsp_progress' => $dsp_progress,
+ 'action_build' => $dsp_build,
+ 'action_edit' => $dsp_edit_lp,
+ 'action_visible' => $dsp_visible,
+ 'action_publish' => $dsp_publish,
+ 'action_reinit' => $dsp_reinit,
+ 'action_default_view' => $dsp_default_view,
+ 'action_debug' => $dsp_debug,
+ 'action_export' => $dsp_disk,
+ 'action_copy' => $copy,
+ 'action_auto_launch' => $lp_auto_launch_icon,
+ 'action_pdf' => $export_icon,
+ 'action_delete' => $dsp_delete,
+ 'action_order' => $dsp_order,
+ 'action_seriousgame' => $actionSeriousGame,
+ 'action_subscribe_users' => $subscribeUsers
+ ];
+
+ $lpIsShown = true;
//counter for number of elements treated
$current++;
} // end foreach ($flat_list)
- echo "
";
}
-}
-if ($is_allowed_to_edit && $lp_showed == false) {
- echo '
';
- echo '
'.get_lang('LearningPaths').' ';
- echo Display::return_icon('scorms.png', '', array(), 64);
- echo '
';
- echo Display::url(get_lang('LearnpathAddLearnpath'), api_get_self().'?'.api_get_cidreq().'&action=add_lp', array('class' => 'btn'));
- echo '
';
- echo '
';
+ $data[] = [
+ 'category' => $item,
+ 'lp_list' => $listData
+ ];
}
+
+$template = new Template($nameTools);
+$template->assign('is_allowed_to_edit', $is_allowed_to_edit);
+$template->assign('is_invitee', api_is_invitee());
+$template->assign('actions', $actions);
+$template->assign('message', $message);
+$template->assign('introduction_section', $introductionSection);
+
+$template->assign('data', $data);
+$template->assign('lp_is_shown', $lpIsShown);
+
+$content = $template->fetch('default/learnpath/list.tpl');
+
+$template->assign('content', $content);
+$template->display_one_col_template();
+
$course_info = api_get_course_info();
learnpath::generate_learning_path_folder($course_info);
@@ -837,4 +819,3 @@ learnpath::generate_learning_path_folder($course_info);
Session::erase('oLP');
Session::erase('lpobject');
DocumentManager::removeGeneratedAudioTempFile();
-Display::display_footer();
diff --git a/main/newscorm/lp_view.php b/main/newscorm/lp_view.php
index a372d465e9..74f1fc0d7b 100755
--- a/main/newscorm/lp_view.php
+++ b/main/newscorm/lp_view.php
@@ -2,17 +2,16 @@
/* For licensing terms, see /license.txt */
/**
-* This file was originally the copy of document.php, but many modifications happened since then ;
-* the direct file view is not needed anymore, if the user uploads a scorm zip file, a directory
-* will be automatically created for it, and the files will be uncompressed there for example ;
-*
-* @package chamilo.learnpath
-* @author Yannick Warnier
- redesign
-* @author Denes Nagy, principal author
-* @author Isthvan Mandak, several new features
-* @author Roan Embrechts, code improvements and refactoring
-*/
-
+ * This file was originally the copy of document.php, but many modifications happened since then ;
+ * the direct file view is not needed anymore, if the user uploads a scorm zip file, a directory
+ * will be automatically created for it, and the files will be uncompressed there for example ;
+ *
+ * @package chamilo.learnpath
+ * @author Yannick Warnier - redesign
+ * @author Denes Nagy, principal author
+ * @author Isthvan Mandak, several new features
+ * @author Roan Embrechts, code improvements and refactoring
+ */
use \ChamiloSession as Session;
$use_anonymous = true;
@@ -21,7 +20,7 @@ $_SESSION['whereami'] = 'lp/view';
$this_section = SECTION_COURSES;
if ($lp_controller_touched != 1) {
- header('location: lp_controller.php?action=view&item_id='.intval($_REQUEST['item_id']));
+ header('location: lp_controller.php?action=view&item_id=' . intval($_REQUEST['item_id']));
exit;
}
@@ -37,7 +36,8 @@ $lp_id = intval($_GET['lp_id']);
// Check if the learning path is visible for student - (LP requisites)
if (!api_is_platform_admin()) {
- if (!api_is_allowed_to_edit(null, true) &&
+ if (
+ !api_is_allowed_to_edit(null, true) &&
!learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())
) {
api_not_allowed(true);
@@ -77,25 +77,25 @@ $user_id = api_get_user_id();
$platform_theme = api_get_setting('stylesheets'); // Platform's css.
$my_style = $platform_theme;
-$htmlHeadXtra[] = '';
+$htmlHeadXtra[] = '';
$htmlHeadXtra[] = '';
-
-if ($_SESSION['oLP']->mode == 'embedframe' || $_SESSION['oLP']->get_hide_toc_frame()==1 ) {
+if ($_SESSION['oLP']->mode == 'embedframe' || $_SESSION['oLP']->get_hide_toc_frame() == 1) {
$htmlHeadXtra[] = 'hello';
}
//Impress js
if ($_SESSION['oLP']->mode == 'impress') {
$lp_id = $_SESSION['oLP']->get_id();
- $url = api_get_path(WEB_CODE_PATH)."newscorm/lp_impress.php?lp_id=$lp_id&".api_get_cidreq();
+ $url = api_get_path(WEB_CODE_PATH) . "newscorm/lp_impress.php?lp_id=$lp_id&" . api_get_cidreq();
header("Location: $url");
exit;
}
@@ -113,22 +113,21 @@ if (isset($exerciseResult) || isset($_SESSION['exerciseResult'])) {
// additional APIs
$htmlHeadXtra[] = '';
// Document API
$htmlHeadXtra[] = '';
// Storage API
$htmlHeadXtra[] = ''; // FIXME fetch sco and userid from a more reliable source directly in sotrageapi.js
$htmlHeadXtra[] = '';
/**
* Get a link to the corresponding document.
*/
-
if ($debug) {
error_log(" src: $src ");
error_log(" lp_type: $lp_type ");
@@ -155,10 +154,13 @@ if (!isset($src)) {
// Prevents FF 3.6 + Adobe Reader 9 bug see BT#794 when calling a pdf file in a LP.
$file_info = parse_url($src);
$file_info = pathinfo($file_info['path']);
- if (isset($file_info['extension']) &&
+ if (
+ isset($file_info['extension']) &&
api_strtolower(substr($file_info['extension'], 0, 3) == 'pdf')
) {
- $src = api_get_path(WEB_CODE_PATH).'newscorm/lp_view_item.php?lp_item_id='.$lp_item_id.'&'.api_get_cidreq();
+ $src = api_get_path(WEB_CODE_PATH)
+ . 'newscorm/lp_view_item.php?lp_item_id=' . $lp_item_id
+ . '&' . api_get_cidreq();
}
$_SESSION['oLP']->start_current_item(); // starts time counter manually if asset
} else {
@@ -180,7 +182,8 @@ if (!isset($src)) {
case 3:
// aicc
$_SESSION['oLP']->stop_previous_item(); // save status manually if asset
- $htmlHeadXtra[] = '';
+ $htmlHeadXtra[] = '';
$prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
if ($prereq_check === true) {
$src = $_SESSION['oLP']->get_link('http', $lp_item_id, $get_toc_list);
@@ -198,13 +201,14 @@ $autostart = 'true';
// Update status, total_time from lp_item_view table when you finish the exercises in learning path.
if ($debug) {
- error_log('$type_quiz: '.$type_quiz);
- error_log('$_REQUEST[exeId]: '.intval($_REQUEST['exeId']));
- error_log('$lp_id: '.$lp_id);
- error_log('$_GET[lp_item_id]: '.intval($_GET['lp_item_id']));
+ error_log('$type_quiz: ' . $type_quiz);
+ error_log('$_REQUEST[exeId]: ' . intval($_REQUEST['exeId']));
+ error_log('$lp_id: ' . $lp_id);
+ error_log('$_GET[lp_item_id]: ' . intval($_GET['lp_item_id']));
}
-if (!empty($_REQUEST['exeId']) &&
+if (
+ !empty($_REQUEST['exeId']) &&
isset($lp_id) &&
isset($_GET['lp_item_id'])
) {
@@ -218,60 +222,66 @@ if (!empty($_REQUEST['exeId']) &&
$safe_id = $lp_id;
$safe_exe_id = intval($_REQUEST['exeId']);
- if ($safe_id == strval(intval($safe_id)) &&
+ if (
+ $safe_id == strval(intval($safe_id)) &&
$safe_item_id == strval(intval($safe_item_id))
) {
$sql = 'SELECT start_date, exe_date, exe_result, exe_weighting
FROM ' . $TBL_TRACK_EXERCICES . '
- WHERE exe_id = '.$safe_exe_id;
+ WHERE exe_id = ' . $safe_exe_id;
$res = Database::query($sql);
$row_dates = Database::fetch_array($res);
- $time_start_date = api_strtotime($row_dates['start_date'],'UTC');
- $time_exe_date = api_strtotime($row_dates['exe_date'],'UTC');
+ $time_start_date = api_strtotime($row_dates['start_date'], 'UTC');
+ $time_exe_date = api_strtotime($row_dates['exe_date'], 'UTC');
- $mytime = ((int)$time_exe_date-(int)$time_start_date);
- $score = (float)$row_dates['exe_result'];
- $max_score = (float)$row_dates['exe_weighting'];
+ $mytime = ((int) $time_exe_date - (int) $time_start_date);
+ $score = (float) $row_dates['exe_result'];
+ $max_score = (float) $row_dates['exe_weighting'];
$sql = "UPDATE $TBL_LP_ITEM SET
max_score = '$max_score'
- WHERE c_id = $course_id AND id = '".$safe_item_id."'";
+ WHERE c_id = $course_id AND id = '" . $safe_item_id . "'";
Database::query($sql);
$sql = "SELECT id FROM $TBL_LP_ITEM_VIEW
WHERE
c_id = $course_id AND
lp_item_id = '$safe_item_id' AND
- lp_view_id = '".$_SESSION['oLP']->lp_view_id."'
+ lp_view_id = '" . $_SESSION['oLP']->lp_view_id . "'
ORDER BY id DESC
LIMIT 1";
$res_last_attempt = Database::query($sql);
if (Database::num_rows($res_last_attempt) && !api_is_invitee()) {
- $row_last_attempt = Database::fetch_row($res_last_attempt);
- $lp_item_view_id = $row_last_attempt[0];
+ $row_last_attempt = Database::fetch_row($res_last_attempt);
+ $lp_item_view_id = $row_last_attempt[0];
$sql = "UPDATE $TBL_LP_ITEM_VIEW SET
status = 'completed' ,
score = $score,
total_time = $mytime
- WHERE id='".$lp_item_view_id."' AND c_id = $course_id ";
+ WHERE id='" . $lp_item_view_id . "' AND c_id = $course_id ";
+
+ if ($debug) {
+ error_log($sql);
+ }
- if ($debug) error_log($sql);
Database::query($sql);
$sql = "UPDATE $TBL_TRACK_EXERCICES SET
orig_lp_item_view_id = $lp_item_view_id
- WHERE exe_id = ".$safe_exe_id;
+ WHERE exe_id = " . $safe_exe_id;
Database::query($sql);
}
}
if (intval($_GET['fb_type']) > 0) {
$src = 'blank.php?msg=exerciseFinished';
} else {
- $src = api_get_path(WEB_CODE_PATH).'exercice/result.php?origin=learnpath&id='.$safe_exe_id;
+ $src = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?origin=learnpath&id=' . $safe_exe_id;
- if ($debug) error_log('Calling URL: '.$src);
+ if ($debug) {
+ error_log('Calling URL: ' . $src);
+ }
}
$autostart = 'false';
}
@@ -290,13 +300,11 @@ if ($_SESSION['oLP']->mode == 'fullscreen') {
}
// Not in fullscreen mode.
-Display::display_reduced_header($nameTools);
-
// Check if audio recorder needs to be in studentview.
if (isset($_SESSION['status']) && $_SESSION['status'][$course_code] == 5) {
- $audio_recorder_studentview = true;
+ $audio_recorder_studentview = true;
} else {
- $audio_recorder_studentview = false;
+ $audio_recorder_studentview = false;
}
// Set flag to ensure lp_header.php is loaded by this script (flag is unset in lp_header.php).
@@ -312,26 +320,26 @@ $scorm_css_header = true;
$lp_theme_css = $_SESSION['oLP']->get_theme();
// Setting up the CSS theme if exists.
-if (!empty ($lp_theme_css) && !empty ($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
+if (!empty($lp_theme_css) && !empty($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
global $lp_theme_css;
} else {
$lp_theme_css = $my_style;
}
-$progress_bar = "";
+$progress_bar = "";
if (!api_is_invitee()) {
- $progress_bar = $_SESSION['oLP']->getProgressBar();
+ $progress_bar = $_SESSION['oLP']->getProgressBar();
}
$navigation_bar = $_SESSION['oLP']->get_navigation_bar();
-$navigation_bar_bottom = $_SESSION['oLP']->get_navigation_bar("control-bottom","display:none");
-$mediaplayer = $_SESSION['oLP']->get_mediaplayer($autostart);
+$navigation_bar_bottom = $_SESSION['oLP']->get_navigation_bar("control-bottom", "display:none");
+$mediaplayer = $_SESSION['oLP']->get_mediaplayer($autostart);
-$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
+$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$show_audioplayer = false;
// Getting all the information about the item.
$sql = "SELECT audio FROM " . $tbl_lp_item . "
- WHERE c_id = $course_id AND lp_id = '" . $_SESSION['oLP']->lp_id."'";
-$res_media= Database::query($sql);
+ WHERE c_id = $course_id AND lp_id = '" . $_SESSION['oLP']->lp_id . "'";
+$res_media = Database::query($sql);
if (Database::num_rows($res_media) > 0) {
while ($row_media = Database::fetch_array($res_media)) {
@@ -342,226 +350,77 @@ if (Database::num_rows($res_media) > 0) {
}
}
-echo '';
$is_allowed_to_edit = api_is_allowed_to_edit(false, true, true, false);
+$breadcrumb = null;
+
if ($is_allowed_to_edit) {
- echo '
';
- echo '
';
global $interbreadcrumb;
- $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list&isStudentView=false', 'name' => get_lang('LearningPaths'));
- $interbreadcrumb[] = array('url' => api_get_self()."?action=add_item&type=step&lp_id=".$_SESSION['oLP']->lp_id."&isStudentView=false", 'name' => $_SESSION['oLP']->get_name());
- $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Preview'));
- echo return_breadcrumb($interbreadcrumb, null, null);
- echo '
';
- echo '
';
+ $interbreadcrumb[] = array(
+ 'url' => 'lp_controller.php?action=list&isStudentView=false',
+ 'name' => get_lang('LearningPaths')
+ );
+ $interbreadcrumb[] = array(
+ 'url' => api_get_self() . "?action=add_item&type=step&lp_id={$_SESSION['oLP']->lp_id}&isStudentView=false",
+ 'name' => $_SESSION['oLP']->get_name()
+ );
+ $interbreadcrumb[] = array(
+ 'url' => '#',
+ 'name' => get_lang('Preview')
+ );
+ $breadcrumb = return_breadcrumb($interbreadcrumb, null, null);
}
- /* button hiden left zone */
- echo '
';
- /* Fin left zone */
- echo '
';
- echo '
-
-
-
-
-
- get_html_toc($get_toc_list); ?>
-
-
-
-
-
-
-
-
- mode == 'fullscreen') {
- echo '';
- } else {
- echo '';
- }
- ?>
-
-
-
-
-
-
-
-
+ function confirmation(name) {
+ if (confirm(" {{ "AreYouSureToDelete"|get_lang }} name ?")) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+
+{{ introduction_section }}
+
+{% for lp_data in data %}
+
+
+ {% if lp_data.lp_list %}
+
+
+
+
+ {{ "Title"|get_lang }}
+ {% if is_allowed_to_edit %}
+ {{ "PublicationDate"|get_lang }}
+ {{ "ExpirationDate"|get_lang }}
+ {{ "Progress"|get_lang }}
+ {{ "AuthoringOptions"|get_lang }}
+ {% else %}
+ {% if not is_invitee %}
+ {{ "Progress"|get_lang }}
+ {% endif %}
+
+ {{ "Actions"|get_lang }}
+ {% endif %}
+
+
+
+ {% for row in lp_data.lp_list %}
+
+
+ {{ row.learnpath_icon }}
+
+ {{ row.title }}
+ {{ row.session_image }}
+ {{ row.extra }}
+
+
+ {% if is_allowed_to_edit %}
+
+ {% if row.start_time %}
+ {{ row.start_time }}
+ {% endif %}
+
+
+ {{ row.end_time }}
+
+
+ {{ row.dsp_progress }}
+
+ {% else %}
+ {% if not is_invitee %}
+
+ {{ row.dsp_progress }}
+
+ {% endif %}
+ {% endif %}
+
+
+ {{ row.action_build }}
+ {{ row.action_edit }}
+ {{ row.action_visible }}
+ {{ row.action_publish }}
+ {{ row.action_seriousgame }}
+ {{ row.action_reinit }}
+ {{ row.action_default_view }}
+ {{ row.action_debug }}
+ {{ row.action_export }}
+ {{ row.action_copy }}
+ {{ row.action_auto_launch }}
+ {{ row.action_pdf }}
+ {{ row.action_delete }}
+ {{ row.action_order }}
+
+
+ {% endfor %}
+
+
+
+ {% endif %}
+{% endfor %}
+
+{% if is_allowed_to_edit and not lp_is_shown %}
+
+
{{ "LearningPaths"|get_lang }}
+
+
+
+{% endif %}
\ No newline at end of file
diff --git a/main/template/default/learnpath/view.tpl b/main/template/default/learnpath/view.tpl
new file mode 100644
index 0000000000..6eb19b7562
--- /dev/null
+++ b/main/template/default/learnpath/view.tpl
@@ -0,0 +1,201 @@
+
+ {% if is_allowed_to_edit %}
+
+ {% endif %}
+
+
+
+
+ {# end left zone #}
+
+ {#
#}
+
+ {# right zone #}
+
+ {% if oLP.mode == 'fullscreen' %}
+
+ {% else %}
+
+ {% endif %}
+
+ {# end right Zone #}
+
+ {{ navigation_bar_bottom }}
+
+
+
+
+
diff --git a/src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150527101600.php b/src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150527101600.php
new file mode 100644
index 0000000000..2b00da2494
--- /dev/null
+++ b/src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150527101600.php
@@ -0,0 +1,55 @@
+ autolaunch
+ * @package Chamilo\CoreBundle\Migrations\Schema\V110
+ */
+class Version20150527101600 extends AbstractMigrationChamilo
+{
+ /**
+ * @param Schema $schema
+ */
+ public function up(Schema $schema)
+ {
+ $this->addSettingCurrent(
+ 'gamification_mode',
+ '',
+ 'radio',
+ 'Platform',
+ 0,
+ 'GamificationModeTitle',
+ 'GamificationModeComment',
+ null,
+ '',
+ 1,
+ true,
+ false,
+ [
+ [
+ 'value' => 1,
+ 'text' => 'Yes'
+ ],
+ [
+ 'value' => 0,
+ 'text' => 'No'
+ ]
+ ]
+ );
+ }
+
+ /**
+ * @param Schema $schema
+ */
+ public function down(Schema $schema)
+ {
+ $this->addSql("DELETE FROM settings_options WHERE variable = 'gamification_mode'");
+ $this->addSql("DELETE FROM settings_current WHERE variable = 'gamification_mode'");
+ }
+
+}