diff --git a/main/course_progress/index.php b/main/course_progress/index.php index cff739d53d..ca98339131 100755 --- a/main/course_progress/index.php +++ b/main/course_progress/index.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 = $(\'
\').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; + }); }); diff --git a/main/course_progress/layout_headerless.php b/main/course_progress/layout_no_header.php similarity index 100% rename from main/course_progress/layout_headerless.php rename to main/course_progress/layout_no_header.php diff --git a/main/course_progress/thematic.php b/main/course_progress/thematic.php index 70b3cf0beb..7b71487436 100755 --- a/main/course_progress/thematic.php +++ b/main/course_progress/thematic.php @@ -74,7 +74,6 @@ if ($action == 'thematic_list') { echo ''.get_lang('Thematic').' | '.get_lang('ThematicPlan').' | '.get_lang('ThematicAdvance').' | '; + // Display 2nd column - thematic plan data + + echo ' | ';
+
//if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) {
if (api_is_allowed_to_edit(null, true)) {
echo ' '; - } - - echo $thematic_plan_div[$thematic['id']]; + Display::return_icon('edit.png', get_lang('EditThematicPlan'), array('style'=>'vertical-align:middle'),32).' '; + } + if (empty($thematic_plan_div[$thematic['id']])) { + echo Display::div('', array('id' => "thematic_plan_".$thematic['id'])); + } else { + echo $thematic_plan_div[$thematic['id']]; + } + echo ' | ';
- // display thematic advance data
- echo ''; + // Display 3rd column - thematic advance data + echo ' | ';
+
//if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) {
if (api_is_allowed_to_edit(null, true)) {
- echo ' '; - } + //echo ' '; + echo ''; + } //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { if (!empty($thematic_advance_data[$thematic['id']])) { echo '
'.get_lang('ThereIsNoAThematicSection').' ';
@@ -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','');
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
diff --git a/main/course_progress/thematic_advance.php b/main/course_progress/thematic_advance.php
index 99cfcf8b70..d44bfd000e 100755
--- a/main/course_progress/thematic_advance.php
+++ b/main/course_progress/thematic_advance.php
@@ -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','');
- $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 '';
- echo ''.Display::return_icon('add_calendar_event.png',get_lang('NewThematicAdvance'),'','32').'';
- echo ' ';
- }
+
// thematic advance list
$table = new SortableTable('thematic_advance_list', array('Thematic', 'get_number_of_thematic_advances'), array('Thematic', 'get_thematic_advance_data'));
diff --git a/main/course_progress/thematic_controller.php b/main/course_progress/thematic_controller.php
index be4d509d0e..45044d8394 100755
--- a/main/course_progress/thematic_controller.php
+++ b/main/course_progress/thematic_controller.php
@@ -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();
}
diff --git a/main/course_progress/thematic_plan.php b/main/course_progress/thematic_plan.php
index 868a5fa2b6..bb38f153d9 100755
--- a/main/course_progress/thematic_plan.php
+++ b/main/course_progress/thematic_plan.php
@@ -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','');
-
+ $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','');
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','');
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
diff --git a/main/css/base.css b/main/css/base.css
index 843b4aee90..68c136f218 100644
--- a/main/css/base.css
+++ b/main/css/base.css
@@ -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;
}
\ No newline at end of file
diff --git a/main/img/icons/32/add.png b/main/img/icons/32/add.png
new file mode 100644
index 0000000000..e4fe053a5b
Binary files /dev/null and b/main/img/icons/32/add.png differ
diff --git a/main/inc/ajax/thematic.ajax.php b/main/inc/ajax/thematic.ajax.php
index d4d42cc46d..92617e0bf9 100755
--- a/main/inc/ajax/thematic.ajax.php
+++ b/main/inc/ajax/thematic.ajax.php
@@ -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'.$thematic_advance['start_date'].$session_star.' ';
+// $thematic_advance_item .= ''.get_lang('DurationInHours').' : '.$thematic_advance['duration'].' ';
+ $thematic_advance_item .= ''.$thematic_advance['duration'].' '.get_lang('HourShort').' ';
+ $thematic_advance_item .= ''.Security::remove_XSS($thematic_advance['content'], STUDENT).' ';
+ $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) {
|
---|