diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css
index a61f6b6b43..5d2e5a9fca 100644
--- a/app/Resources/public/css/base.css
+++ b/app/Resources/public/css/base.css
@@ -6055,6 +6055,11 @@ ul#toolnavbox-two li a.btn{
margin-right: 10px;
vertical-align: middle;
}
+.exercise-btn{
+ padding-top: 10px;
+ padding-bottom: 10px;
+ margin-bottom: 10px;
+}
/* CSS NEW TOP ******************************************************************************/
/* CSS Responsive */
@media (min-width: 1025px) and (max-width: 1200px) {
diff --git a/main/exercise/overview.php b/main/exercise/overview.php
index 679591be09..28783c4d64 100755
--- a/main/exercise/overview.php
+++ b/main/exercise/overview.php
@@ -56,7 +56,7 @@ if ($time_control) {
$htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');
$htmlHeadXtra[] = $objExercise->show_time_control_js($time_left);
}
-
+/*
if ($origin != 'learnpath') {
Display::display_header();
} else {
@@ -66,36 +66,29 @@ if ($origin != 'learnpath') {
";
Display::display_reduced_header();
-}
+}*/
$tpl = new Template('Overview');
$list = array();
$html = '';
$message = '';
-$html .= '
';
-$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
-$edit_link = '';
-if ($is_allowed_to_edit && $objExercise->sessionId == $sessionId) {
- $edit_link = Display::url(
- Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
- api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&exerciseId='.$objExercise->id
- );
-}
-$iconExercise = Display::return_icon('test-quiz.png', null, array(), ICON_SIZE_MEDIUM);
+
+$isAllowedToEdit = api_is_allowed_to_edit(null, true);
+
+$list['id'] = $objExercise->id;
+$list['session_id'] = $objExercise->sessionId;
+$list['edit'] = $isAllowedToEdit;
+
// Exercise name.
if (api_get_configuration_value('save_titles_as_html')) {
- $html .= Display::div(
- $objExercise->get_formated_title().PHP_EOL.$edit_link
- );
+ $list['title'] = $objExercise->get_formated_title().PHP_EOL;
} else {
- $html .= Display::page_header(
- $iconExercise.PHP_EOL.$objExercise->selectTitle().PHP_EOL.$edit_link
- );
+ $list['title'] = $objExercise->selectTitle().PHP_EOL;
}
//Exercise description
if (!empty($objExercise->description)) {
- $html .= Display::div($objExercise->description, array('class'=>'exercise_description'));
+ $list['description'] = $objExercise->description;
}
$extra_params = '';
@@ -103,35 +96,25 @@ if (isset($_GET['preview'])) {
$extra_params = '&preview=1';
}
-$exercise_stat_info = $objExercise->get_stat_track_exercise_info(
+$exerciseStatus = $objExercise->get_stat_track_exercise_info(
$learnpath_id,
$learnpath_item_id,
0
);
-/*$attempt_list = null;
-if (isset($exercise_stat_info['exe_id'])) {
- $attempt_list = Event::getAllExerciseEventByExeId($exercise_stat_info['exe_id']);
-}*/
-
//1. Check if this is a new attempt or a previous
$label = get_lang('StartTest');
-if ($time_control && !empty($clock_expired_time) || isset($exercise_stat_info['exe_id'])) {
+if ($time_control && !empty($clock_expired_time) || isset($exerciseStatus['exe_id'])) {
$label = get_lang('ContinueTest');
}
-if (isset($exercise_stat_info['exe_id'])) {
- $message = Display::return_message(get_lang('YouTriedToResolveThisExerciseEarlier'));
+if (isset($exerciseStatus['exe_id'])) {
+ $msgStatus = get_lang('YouTriedToResolveThisExerciseEarlier');
}
// 2. Exercise button
// Notice we not add there the lp_item_view_id because is not already generated
-$exercise_url = api_get_path(WEB_CODE_PATH).'exercise/exercise_submit.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&origin='.$origin.'&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&learnpath_item_view_id='.$learnpathItemViewId.$extra_params;
-$exercise_url_button = Display::url(
- $label,
- $exercise_url,
- array('class' => 'btn btn-success btn-large')
-);
+$list['url'] = api_get_path(WEB_CODE_PATH).'exercise/exercise_submit.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&origin='.$origin.'&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&learnpath_item_view_id='.$learnpathItemViewId.$extra_params;
//3. Checking visibility of the exercise (overwrites the exercise button)
$visible_return = $objExercise->is_visible(
@@ -147,7 +130,7 @@ if ($visible_return['value'] == false) {
$message = Display::return_message(get_lang('ThisItemIsInvisibleForStudentsButYouHaveAccessAsTeacher'), 'warning');
} else {
$message = $visible_return['message'];
- $exercise_url_button = null;
+ //$exercise_url_button = null;
}
}
@@ -163,7 +146,7 @@ $attempts = Event::getExerciseResultsByUser(
$counter = count($attempts);
$my_attempt_array = array();
-$table_content = '';
+$table_content = null;
/* Make a special case for IE, which doesn't seem to be able to handle the
* results popup -> send it to the full results page */
@@ -183,7 +166,7 @@ if ($objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANS
$blockShowAnswers = true;
}
}
-
+$tableContent = null;
if (!empty($attempts)) {
$i = $counter;
foreach ($attempts as $attempt_result) {
@@ -298,48 +281,23 @@ if (!empty($attempts)) {
$row++;
}
}
- $table_content = $table->toHtml();
+ $tableContent = $table->toHtml();
}
-if ($objExercise->selectAttempts()) {
- $attempt_message = get_lang('Attempts').' '.$counter.' / '.$objExercise->selectAttempts();
-
- if ($counter == $objExercise->selectAttempts()) {
- $attempt_message = Display::return_message($attempt_message, 'error');
- } else {
- $attempt_message = Display::return_message($attempt_message, 'info');
- }
- if ($visible_return['value'] == true) {
- $message .= $attempt_message;
- }
+if ($objExercise->selectAttempts() && $visible_return['value'] == true) {
+ $list['attempts'] = $objExercise->selectAttempts();
}
if ($time_control) {
- $html .= $objExercise->return_time_left_div();
-}
-
-$html .= $message;
-
-if (!empty($exercise_url_button)) {
- $html .= Display::div(
- Display::div(
- $exercise_url_button,
- array('class' => 'exercise_overview_options col-md-12')
- ),
- array('class' => ' row')
- );
+ $tpl->assign('time_control',$objExercise->return_time_left_div());
}
-$html .= Display::tag(
- 'div',
- $table_content,
- ['class' => 'table-responsive']
-);
-$html .= '
';
-echo $html;
-
-$tpl->assign('data',$list);
+$tpl->assign('data', $list);
+$tpl->assign('label', $label);
+$tpl->assign('message', $message);
+$tpl->assign('count', $counter);
+$tpl->assign('status', $msgStatus);
+$tpl->assign('table_result', $tableContent);
$layout = $tpl->get_template('exercise/overview.tpl');
-$tpl->display($layout);
-
-Display::display_footer();
+$tpl->assign('content', $tpl->fetch($layout));
+$tpl->display_one_col_template();
diff --git a/main/template/rainbow/exercise/overview.tpl b/main/template/rainbow/exercise/overview.tpl
index 3df23ea610..e99c3fdd89 100644
--- a/main/template/rainbow/exercise/overview.tpl
+++ b/main/template/rainbow/exercise/overview.tpl
@@ -1,4 +1,44 @@
-
- {{ dump(data) }}
-
\ No newline at end of file
+
+ {{ time_control }}
+ {% if status is not empty %}
+
+ {{ status }}
+
+ {% endif %}
+ {% if data.edit and data.session_id == api_get_session_id %}
+
+ {% endif %}
+
+
+ {{ data.description }}
+
+ {% if count == data.attempts %}
+
+ {{ "Attempts" |get_lang }} {{ count }} / {{ data.attempts }}
+
+ {% else %}
+
+ {{ "Attempts" |get_lang }} {{ count }} / {{ data.attempts }}
+
+ {% endif %}
+ {% if data.url is not empty %}
+
+ {% endif %}
+
+ {% if table_result is not empty %}
+
+ {{ table_result }}
+
+ {% endif %}
+