Adding jquery effects in the Course progress for fast edit

skala
Julio Montoya 14 years ago
parent 85bd3ae6b2
commit a34af59464
  1. 98
      main/course_progress/index.php
  2. 0
      main/course_progress/layout_no_header.php
  3. 73
      main/course_progress/thematic.php
  4. 11
      main/course_progress/thematic_advance.php
  5. 77
      main/course_progress/thematic_controller.php
  6. 26
      main/course_progress/thematic_plan.php
  7. 8
      main/css/base.css
  8. BIN
      main/img/icons/32/add.png
  9. 57
      main/inc/ajax/thematic.ajax.php
  10. 27
      main/inc/lib/thematic.lib.php

@ -98,6 +98,32 @@ function datetime_by_attendance(selected_value) {
}
$(document).ready(function() {
$(".thematic_advance_actions, .thematic_tools ").hide();
$(".thematic_content").mouseover(function() {
var id = parseInt(this.id.split("_")[3]);
$("#thematic_id_content_"+id ).show();
});
$(".thematic_content").mouseleave(function() {
var id = parseInt(this.id.split("_")[3]);
$("#thematic_id_content_"+id ).hide();
});
$(".thematic_advance_content").mouseover(function() {
var id = parseInt(this.id.split("_")[4]);
$("#thematic_advance_tools_"+id ).show();
});
$(".thematic_advance_content").mouseleave(function() {
var id = parseInt(this.id.split("_")[4]);
$("#thematic_advance_tools_"+id ).hide();
});
//Second col
$(".thematic_plan_opener").live("click", function() {
var url = this.href;
@ -118,14 +144,29 @@ $(document).ready(function() {
modal: true,
buttons: {
'.addslashes(get_lang('Save')).' : function() {
var serialize_form_content = $("#thematic_plan_add").serialize();
var serialize_form_content = $("#thematic_plan_add").serialize();
//Getting FCK content
var oEditor = FCKeditorAPI.GetInstance("description[1]");
content_1= oEditor.GetXHTML(true) ;
var oEditor = FCKeditorAPI.GetInstance("description[2]");
content_2= oEditor.GetXHTML(true) ;
var oEditor = FCKeditorAPI.GetInstance("description[3]");
content_3= oEditor.GetXHTML(true) ;
var oEditor = FCKeditorAPI.GetInstance("description[4]");
content_4= oEditor.GetXHTML(true) ;
var oEditor = FCKeditorAPI.GetInstance("description[5]");
content_5= oEditor.GetXHTML(true) ;
var oEditor = FCKeditorAPI.GetInstance("description[6]");
content_6= oEditor.GetXHTML(true) ;
$.ajax({
type: "POST",
url: "'.api_get_path(WEB_AJAX_PATH).'thematic.ajax.php?a=save_thematic_plan",
data: serialize_form_content,
data: "desc[1]="+content_1+"&"+"desc[2]="+content_2+"&"+"desc[3]="+content_3+"&"+"desc[4]="+content_4+"&"+"desc[5]="+content_5+"&"+"desc[6]="+content_6+"&"+serialize_form_content,
success: function(data) {
var thematic_id = $("input[name=\"thematic_id\"]").val();
$("#thematic_plan_"+thematic_id ).html(data);
$("#thematic_plan_"+thematic_id).html(data);
}
});
dialog.dialog("close");
@ -137,6 +178,57 @@ $(document).ready(function() {
//prevent the browser to follow the link
return false;
});
// Third col
$(".thematic_advanced_opener, .thematic_advanced_add_opener").live("click", function() {
var url = this.href;
var my_class = this.className;
var dialog = $("#dialog");
if ($("#dialog").length == 0) {
dialog = $(\'<div id="dialog" style="display:hidden"></div> \').appendTo(\'body\');
}
// load remote content
dialog.load(
url,
{},
function(responseText, textStatus, XMLHttpRequest) {
dialog.dialog({
width: 720,
height: 550,
modal: true,
buttons: {
'.addslashes(get_lang('Save')).' : function() {
var serialize_form_content = $("#thematic_advance").serialize();
//Getting FCK content
var oEditor = FCKeditorAPI.GetInstance("content");
content = oEditor.GetXHTML(true) ;
$.ajax({
type: "POST",
url: "'.api_get_path(WEB_AJAX_PATH).'thematic.ajax.php?a=save_thematic_advance",
data: "real_content=" + content + "&" +serialize_form_content,
success: function(data) {
var thematic_advance_id = $("input[name=\"thematic_advance_id\"]").val();
$("#thematic_advance_"+thematic_advance_id).html(data);
//Only refresh if the parent is to add
if (my_class == "thematic_advanced_add_opener") {
location.reload(true);
}
}
});
dialog.dialog("close");
}
}
});
}
);
//prevent the browser to follow the link
return false;
});
});

@ -74,7 +74,6 @@ if ($action == 'thematic_list') {
echo '<table width="100%" class="data_table">';
echo '<tr><th width="33%">'.get_lang('Thematic').'</th><th>'.get_lang('ThematicPlan').'</th><th width="33%">'.get_lang('ThematicAdvance').'</th></tr>';
foreach ($thematic_data as $thematic) {
$my_thematic_id = $thematic['id'];
@ -116,54 +115,67 @@ if ($action == 'thematic_list') {
$actions_first_col .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$my_thematic_id.$param_gradebook.$url_token.'">'.Display::return_icon('delete.png',get_lang('Delete'),'',22).'</a>';
}
}
$actions_first_col = Display::div($actions_first_col, array('id'=>'thematic_id_content_'.$thematic['id'], 'class'=>'thematic_tools'));
$actions_first_col = Display::div($actions_first_col, array('style'=>'height:20px'));
echo Display::tag('td', Display::tag('h2', Security::remove_XSS($thematic['title'], STUDENT).$session_star).Security::remove_XSS($thematic['content'], STUDENT).$actions_first_col);
echo Display::tag('td', Display::tag('h2', Security::remove_XSS($thematic['title'], STUDENT).$session_star).Security::remove_XSS($thematic['content'], STUDENT).$actions_first_col, array('id'=>'thematic_td_content_'.$thematic['id'], 'class'=>'thematic_content'));
// display thematic plan data
echo '<td>';
// Display 2nd column - thematic plan data
echo '<td>';
//if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) {
if (api_is_allowed_to_edit(null, true)) {
echo '<div style="text-align:right"><a class="thematic_plan_opener" href="index.php?'.api_get_cidreq().'&origin=thematic_details&action=thematic_plan_list&thematic_id='.$thematic['id'].'">'.
Display::return_icon('edit.png', get_lang('EditThematicPlan'), array('style'=>'vertical-align:middle'),22).'</a></div><br />';
}
echo $thematic_plan_div[$thematic['id']];
Display::return_icon('edit.png', get_lang('EditThematicPlan'), array('style'=>'vertical-align:middle'),32).'</a></div><br />';
}
if (empty($thematic_plan_div[$thematic['id']])) {
echo Display::div('', array('id' => "thematic_plan_".$thematic['id']));
} else {
echo $thematic_plan_div[$thematic['id']];
}
echo '</td>';
// display thematic advance data
echo '<td>';
// Display 3rd column - thematic advance data
echo '<td style="vertical-align:top">';
//if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) {
if (api_is_allowed_to_edit(null, true)) {
echo '<div style="text-align:right"><a href="index.php?'.api_get_cidreq().'&origin=thematic_details&action=thematic_advance_list&thematic_id='.$thematic['id'].'">'.Display::return_icon('edit.png',get_lang('EditThematicAdvance'),array('style'=>'vertical-align:middle'),22).'</a></div><br />';
}
//echo '<div style="text-align:right"><a href="index.php?'.api_get_cidreq().'&origin=thematic_details&action=thematic_advance_list&thematic_id='.$thematic['id'].'">'.Display::return_icon('edit.png',get_lang('EditThematicAdvance'),array('style'=>'vertical-align:middle'),22).'</a></div><br />';
echo '<div style="text-align:right"><a class="thematic_advanced_add_opener" href="index.php?'.api_get_cidreq().'&action=thematic_advance_add&thematic_id='.$thematic['id'].'">'.Display::return_icon('add.png',get_lang('NewThematicAdvance'),'','32').'</a></div>';
}
//if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) {
if (!empty($thematic_advance_data[$thematic['id']])) {
echo '<table width="100%">';
foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) {
$thematic_advance['start_date'] = api_get_local_time($thematic_advance['start_date']);
$thematic_advance['start_date'] = api_format_date($thematic_advance['start_date'], DATE_TIME_FORMAT_LONG);
echo '<tr>';
echo '<td width="90%">';
echo '<td width="90%" class="thematic_advance_content" id="thematic_advance_content_id_'.$thematic_advance['id'].'">';
$edit_link = '<a class="thematic_advanced_opener" href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic['id'].'&thematic_advance_id='.$thematic_advance['id'].'" >'.Display::return_icon('edit.png',get_lang('EditThematicAdvance'),array(),22).'</a>';
$edit_link .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic['id'].'&thematic_advance_id='.$thematic_advance['id'].'">'.Display::return_icon('delete.png',get_lang('Delete'),'',22).'</a></center>';
$thematic_advance_item = isset($thematic_advance_div[$thematic['id']][$thematic_advance['id']]) ? $thematic_advance_div[$thematic['id']][$thematic_advance['id']] : null;
echo Display::div($thematic_advance_item, array('id'=>'thematic_advance_'.$thematic_advance['id']));
//Links
echo Display::div(Display::div($edit_link , array('id'=>'thematic_advance_tools_'.$thematic_advance['id'], 'class'=>'thematic_advance_actions')), array('style'=>'height:20px;'));
$session_star = '';
if (api_is_allowed_to_edit(null, true)) {
if ($thematic_advance['session_id'] !=0) {
$session_star = api_get_session_image(api_get_session_id(), $user_info['status']);
}
}
echo '<div><strong>'.$thematic_advance['start_date'].$session_star.'</strong></div>';
echo '<div>'.Security::remove_XSS($thematic_advance['content'], STUDENT).'</div>';
echo '<div>'.get_lang('DurationInHours').' : '.$thematic_advance['duration'].'</div>';
echo '</td>';
//if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) {
if (api_is_allowed_to_edit(null, true)) {
if (api_is_allowed_to_edit(null, true)) {
if (empty($thematic_id)) {
$checked = '';
$checked = '';
if ($last_done_thematic_advance == $thematic_advance['id']) {
$checked = 'checked';
}
@ -176,8 +188,7 @@ if ($action == 'thematic_list') {
echo '<td id="td_done_thematic_'.$thematic_advance['id'].'" '.$style.'><center>';
echo '<input type="radio" class="done_thematic" id="done_thematic_'.$thematic_advance['id'].'" name="done_thematic" value="'.$thematic_advance['id'].'" '.$checked.' onclick="update_done_thematic_advance(this.value)">';
echo '</center></td>';
} else {
} else {
if ($thematic_advance['done_advance'] == 1) {
echo '<td><center>'.get_lang('Done').'</center></td>';
} else {
@ -192,10 +203,8 @@ if ($action == 'thematic_list') {
echo '<div><em>'.get_lang('ThereIsNoAThematicAdvance').'</em></div>';
}
echo '</td>';
echo '</tr>';
echo '</tr>';
} //End for
echo '</table>';
} else {
echo '<div><em>'.get_lang('ThereIsNoAThematicSection').'</em></div>';
@ -217,7 +226,7 @@ if ($action == 'thematic_list') {
}
$form->add_textfield('title', get_lang('Title'), true, array('size'=>'50'));
$form->add_html_editor('content', get_lang('Content'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '250'));
$form->add_html_editor('content', get_lang('Content'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '80%', 'Height' => '150'));
$form->addElement('html','<div class="clear" style="margin-top:50px;"></div>');
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');

@ -72,11 +72,11 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
$form->add_textfield('duration_in_hours', get_lang('DurationInHours'), false, array('size'=>'3'));
$form->add_html_editor('content', get_lang('Content'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '150'));
$form->add_html_editor('content', get_lang('Content'), false, false, array('ToolbarStartExpanded'=>'false', 'ToolbarSet' => 'TrainingDescription', 'Width' => '80%', 'Height' => '150'));
//$form->addElement('textarea', 'content', get_lang('Content'));
$form->addElement('html','<div class="clear" style="margin-top:50px;"></div>');
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
//$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
$default['start_date_type'] = 1;
$default['custom_start_date'] = date('d-F-Y H:i',api_strtotime(api_get_local_time()));
@ -115,12 +115,7 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
$form->display();
} else if ($action == 'thematic_advance_list') {
if (api_is_allowed_to_edit(null, true)) {
echo '<div class="actions" style="margin-bottom:30px">';
echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_add&thematic_id='.$thematic_id.'">'.Display::return_icon('add_calendar_event.png',get_lang('NewThematicAdvance'),'','32').'</a>';
echo '</div>';
}
// thematic advance list
$table = new SortableTable('thematic_advance_list', array('Thematic', 'get_number_of_thematic_advances'), array('Thematic', 'get_thematic_advance_data'));

@ -150,6 +150,8 @@ class ThematicController
$data['thematic_plan_div'] = $thematic->get_thematic_plan_div($thematic_plan_data);
$data['thematic_advance_div'] = $thematic->get_thematic_advance_div($thematic_advance_data);
$data['thematic_plan_data'] = $thematic_plan_data;
$data['thematic_advance_data'] = $thematic_advance_data;
@ -213,12 +215,8 @@ class ThematicController
$this->view->set_template('thematic_plan');
$this->view->render();
}
} else if($_POST['action'] == 'thematic_plan_list') {
}
}
}
}
if ($action == 'thematic_plan_list') {
@ -255,7 +253,7 @@ class ThematicController
//render to the view
$this->view->set_data($data);
$this->view->set_layout('layout_headerless');
$this->view->set_layout('layout_no_header');
$this->view->set_template('thematic_plan');
$this->view->render();
exit;
@ -279,64 +277,7 @@ class ThematicController
foreach ($attendance_list as $attendance_id => $attendance_data) {
$attendance_select[$attendance_id] = $attendance_data['name'];
}
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (isset($_POST['action']) && ($_POST['action'] == 'thematic_advance_add' || $_POST['action'] == 'thematic_advance_edit')) {
if (($_POST['start_date_type'] == 1 && empty($_POST['start_date_by_attendance'])) || (!empty($_POST['duration_in_hours']) && !is_numeric($_POST['duration_in_hours'])) ) {
if ($_POST['start_date_type'] == 1 && empty($_POST['start_date_by_attendance'])) {
$start_date_error = true;
$data['start_date_error'] = $start_date_error;
}
if (!empty($_POST['duration_in_hours']) && !is_numeric($_POST['duration_in_hours'])) {
$duration_error = true;
$data['duration_error'] = $duration_error;
}
$data['action'] = $_POST['action'];
$data['thematic_id'] = $_POST['thematic_id'];
$data['attendance_select'] = $attendance_select;
if (isset($_POST['thematic_advance_id'])) {
$data['thematic_advance_id'] = $_POST['thematic_advance_id'];
$thematic_advance_data = $thematic->get_thematic_advance_list($_POST['thematic_advance_id']);
$data['thematic_advance_data'] = $thematic_advance_data;
}
// render to the view
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('thematic_advance');
$this->view->render();
} else {
if ($_POST['thematic_advance_token'] == $_SESSION['thematic_advance_token'] && api_is_allowed_to_edit(null, true)) {
$thematic_advance_id = $_POST['thematic_advance_id'];
$thematic_id = $_POST['thematic_id'];
$content = $_POST['content'];
$duration = $_POST['duration_in_hours'];
if (isset($_POST['start_date_type']) && $_POST['start_date_type'] == 2) {
$start_date = $thematic->build_datetime_from_array($_POST['custom_start_date']);
$attendance_id = 0;
} else {
$start_date = $_POST['start_date_by_attendance'];
$attendance_id = $_POST['attendance_select'];
}
$thematic->set_thematic_advance_attributes($thematic_advance_id, $thematic_id, $attendance_id, $content, $start_date, $duration);
$affected_rows = $thematic->thematic_advance_save();
if ($affected_rows) {
// get last done thematic advance before move thematic list
$last_done_thematic_advance = $thematic->get_last_done_thematic_advance();
// update done advances with de current thematic list
if (!empty($last_done_thematic_advance)) {
$update_done_advances = $thematic->update_done_thematic_advances($last_done_thematic_advance);
}
}
unset($_SESSION['thematic_advance_token']);
$action = 'thematic_advance_list';
}
}
}
}
$thematic_id = intval($_GET['thematic_id']);
$thematic_advance_id = intval($_GET['thematic_advance_id']);
$thematic_advance_data = array();
@ -345,7 +286,9 @@ class ThematicController
if (api_is_allowed_to_edit(null, true)) {
$affected_rows = $thematic->thematic_advance_destroy($thematic_advance_id);
}
$action = 'thematic_advance_list';
$action = 'thematic_list';
header('Location: index.php');
exit;
} else {
$thematic_advance_data = $thematic->get_thematic_advance_list($thematic_advance_id);
}
@ -373,7 +316,7 @@ class ThematicController
// render to the view
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_layout('layout_no_header');
$this->view->set_template('thematic_advance');
$this->view->render();
}

@ -48,40 +48,28 @@ if ($action == 'thematic_plan_list') {
$form->addElement('hidden', 'action', $action);
$form->addElement('hidden', 'thematic_plan_token', $token);
$form->addElement('hidden', 'thematic_id', $thematic_id);
//var_dump($default_thematic_plan_title);
//var_dump($thematic_simple_list);
foreach ($default_thematic_plan_title as $id => $title) {
//foreach ($thematic_simple_list as $id) {
//$title = $default_thematic_plan_title[$id];
$form->addElement('hidden', 'description_type['.$id.']', $id);
$form->add_textfield('title['.$id.']', get_lang('Title'), true, array('size'=>'50'));
//$form->add_html_editor('description['.$id.']', get_lang('Description'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '200'));
$form->addElement('textarea', 'description['.$id.']', get_lang('Description'));
$form->addElement('html','<div class="clear" style="margin-top:50px;"></div>');
$form->add_html_editor('description['.$id.']', get_lang('Description'), false, false, array('ToolbarStartExpanded'=>'false', 'ToolbarSet' => 'TrainingDescription', 'Width' => '80%', 'Height' => '150'));
//$form->addElement('textarea', 'description['.$id.']', get_lang('Description'));
$form->addElement('html','<div class="clear" style="margin-top:50px;"></div>');
if (!empty($thematic_simple_list) && in_array($id, $thematic_simple_list)) {
$thematic_plan = $new_thematic_plan_data[$id];
$thematic_plan = $new_thematic_plan_data[$id];
// set default values
$default['title['.$id.']'] = $thematic_plan['title'];
$default['description['.$id.']'] = $thematic_plan['description'];
$thematic_plan = null;
} else {
$thematic_plan = null;
$default['title['.$id.']'] = $title;
$default['description['.$id.']']= '';
}
}
$form->setDefaults($default);
}
//$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
$form->display();
$form->display();
} else if ($action == 'thematic_plan_add' || $action == 'thematic_plan_edit') {
if ($description_type >= ADD_THEMATIC_PLAN) {
@ -108,7 +96,7 @@ if ($action == 'thematic_plan_list') {
}
$form->add_textfield('title', get_lang('Title'), true, array('size'=>'50'));
$form->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '200'));
$form->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '80%', 'Height' => '150'));
$form->addElement('html','<div class="clear" style="margin-top:50px;"></div>');
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');

@ -2238,4 +2238,12 @@ div.admin_section h4 {
.question-list-description-block {
margin-bottom:10px !important;
margin-top: -6px !important;
}
.thematic_advance_content {
padding:10px;
}
.thematic_advance_actions {
width:100px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

@ -12,11 +12,12 @@ api_protect_course_script(true);
$action = $_GET['a'];
switch ($action) {
switch ($action) {
case 'save_thematic_plan':
$thematic = new Thematic();
$title_list = $_REQUEST['title'];
$description_list = $_REQUEST['description'];
$description_list = $_REQUEST['desc'];
//$description_list = $_REQUEST['description'];
$description_type = $_REQUEST['description_type'];
if (api_is_allowed_to_edit(null, true)) {
for($i=1;$i<count($title_list)+1; $i++) {
@ -29,6 +30,58 @@ switch ($action) {
echo $return[$_REQUEST['thematic_id']];
break;
case 'save_thematic_advance':
$thematic = new Thematic();
if (($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) || (!empty($_REQUEST['duration_in_hours']) && !is_numeric($_REQUEST['duration_in_hours'])) ) {
if ($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) {
$start_date_error = true;
$data['start_date_error'] = $start_date_error;
}
if (!empty($_REQUEST['duration_in_hours']) && !is_numeric($_REQUEST['duration_in_hours'])) {
$duration_error = true;
$data['duration_error'] = $duration_error;
}
$data['action'] = $_REQUEST['action'];
$data['thematic_id'] = $_REQUEST['thematic_id'];
$data['attendance_select'] = $attendance_select;
if (isset($_REQUEST['thematic_advance_id'])) {
$data['thematic_advance_id'] = $_REQUEST['thematic_advance_id'];
$thematic_advance_data = $thematic->get_thematic_advance_list($_REQUEST['thematic_advance_id']);
$data['thematic_advance_data'] = $thematic_advance_data;
}
} else {
if ($_REQUEST['thematic_advance_token'] == $_SESSION['thematic_advance_token'] && api_is_allowed_to_edit(null, true)) {
$thematic_advance_id = $_REQUEST['thematic_advance_id'];
$thematic_id = $_REQUEST['thematic_id'];
$content = $_REQUEST['real_content'];
$duration = $_REQUEST['duration_in_hours'];
if (isset($_REQUEST['start_date_type']) && $_REQUEST['start_date_type'] == 2) {
$start_date = $thematic->build_datetime_from_array($_REQUEST['custom_start_date']);
$attendance_id = 0;
} else {
$start_date = $_REQUEST['start_date_by_attendance'];
$attendance_id = $_REQUEST['attendance_select'];
}
$thematic->set_thematic_advance_attributes($thematic_advance_id, $thematic_id, $attendance_id, $content, $start_date, $duration);
$affected_rows = $thematic->thematic_advance_save();
if ($affected_rows) {
// get last done thematic advance before move thematic list
$last_done_thematic_advance = $thematic->get_last_done_thematic_advance();
// update done advances with de current thematic list
if (!empty($last_done_thematic_advance)) {
$update_done_advances = $thematic->update_done_thematic_advances($last_done_thematic_advance);
}
}
}
}
$thematic_advance_data = $thematic->get_thematic_advance_list(null, null, true);
$return = $thematic->get_thematic_advance_div($thematic_advance_data);
echo $return[$_REQUEST['thematic_id']][$_REQUEST['thematic_advance_id']];
break;
case 'get_datetime_by_attendance':
$attendance_id = intval($_POST['attendance_id']);

@ -466,9 +466,32 @@ class Thematic
}
return $data;
}
public function get_thematic_advance_div($data) {
$return_array = array();
foreach ($data as $thematic_id => $thematic_advance_data) {
foreach ($thematic_advance_data as $key => $thematic_advance) {
$session_star = '';
if (api_is_allowed_to_edit(null, true)) {
if ($thematic_advance['session_id'] !=0) {
$session_star = api_get_session_image(api_get_session_id(), $user_info['status']);
}
}
$thematic_advance_item = '<div><strong>'.$thematic_advance['start_date'].$session_star.'</strong></div>';
// $thematic_advance_item .= '<div>'.get_lang('DurationInHours').' : '.$thematic_advance['duration'].'</div>';
$thematic_advance_item .= '<div>'.$thematic_advance['duration'].' '.get_lang('HourShort').'</div>';
$thematic_advance_item .= '<div>'.Security::remove_XSS($thematic_advance['content'], STUDENT).'</div>';
$return_array[$thematic_id][$thematic_advance['id']] = $thematic_advance_item;
}
}
return $return_array;
}
public function get_thematic_plan_div($data, $id = false) {
public function get_thematic_plan_div($data) {
$final_return = array();
foreach ($data as $thematic_id => $thematic_plan_data) {

Loading…
Cancel
Save