Adding thematic.lib.php in autoloader, fixes double declaration error.

1.9.x
Julio Montoya 12 years ago
parent 37db718c5b
commit f0f3cf9224
  1. 7
      main/course_home/course_home.php
  2. 117
      main/course_progress/index.php
  3. 122
      main/inc/ajax/thematic.ajax.php
  4. 4
      main/inc/introductionSection.inc.php
  5. 1
      main/inc/lib/autoload.class.php
  6. 1
      main/inc/lib/course_home.lib.php
  7. 1
      main/mySpace/course.php
  8. 6
      plugin/dashboard/block_course/block_course.class.php
  9. 1
      plugin/dashboard/block_daily/block_daily.class.php

@ -38,7 +38,7 @@ $language_file = array('course_home','courses');
$use_anonymous = true;
// Inlcuding the global initialization file.
require dirname(__FILE__).'/../inc/global.inc.php';
require_once dirname(__FILE__).'/../inc/global.inc.php';
// Delete LP sessions - commented out after seeing that normal
// users in their first learnpath step (1st SCO of a SCORM)
@ -233,7 +233,6 @@ $reqdate = "&reqdate=$temps";
/* MAIN CODE */
/* Introduction section (editable by course admins) */
$content = Display::return_introduction_section(TOOL_COURSE_HOMEPAGE, array(
'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
'CreateDocumentDir' => 'document/',
@ -245,7 +244,7 @@ $content = Display::return_introduction_section(TOOL_COURSE_HOMEPAGE, array(
the setting homepage_view is adjustable through
the platform administration section */
require_once api_get_path(LIBRARY_PATH).'course_home.lib.php';
//require_once api_get_path(LIBRARY_PATH).'course_home.lib.php';
if ($show_autolunch_lp_warning) {
$show_message .= Display::return_message(get_lang('TheLPAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificLP'),'warning');
@ -268,4 +267,4 @@ $tpl->assign('content', $content);
$tpl->assign('course_code', $course_code);
$tpl->display_one_col_template();
Session::erase('_gid');
Session::erase('_gid');

@ -15,7 +15,6 @@ $language_file = array ('course_description', 'userInfo', 'admin');
// including files
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
require_once api_get_path(LIBRARY_PATH).'thematic.lib.php';
require_once api_get_path(LIBRARY_PATH).'app_view.php';
require_once 'thematic_controller.php';
@ -80,19 +79,19 @@ if (!empty($thematic_id)) {
// get default thematic plan title
$default_thematic_plan_title = $thematic->get_default_thematic_plan_title();
// Only when I see the 3 columns. Avoids double or triple click binding for onclick event
// Only when I see the 3 columns. Avoids double or triple click binding for onclick event
$htmlHeadXtra[] = '<script type="text/javascript">
$(document).ready(function() {
//Second col
//Second col
/*
$("#thematic_plan_add").live("submit", function() {
var serialize_form_content = $(this).serialize();
//Getting FCK content
//Getting FCK content
var oEditor = FCKeditorAPI.GetInstance("description[1]");
content_1= oEditor.GetXHTML(true) ;
var oEditor = FCKeditorAPI.GetInstance("description[2]");
@ -104,93 +103,93 @@ $(document).ready(function() {
var oEditor = FCKeditorAPI.GetInstance("description[5]");
content_5= oEditor.GetXHTML(true) ;
var oEditor = FCKeditorAPI.GetInstance("description[6]");
content_6= oEditor.GetXHTML(true) ;
content_6= oEditor.GetXHTML(true) ;
$.ajax({
type: "POST",
url: "'.api_get_path(WEB_AJAX_PATH).'thematic.ajax.php?a=save_thematic_plan",
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) {
success: function(data) {
var thematic_id = $("input[name=\"thematic_id\"]").val();
$("#thematic_plan_"+thematic_id).html(data);
$("#thematic_plan_add").html("<div class=\"confirmation-message\">'.addslashes(get_lang('Saved')).'</div>");
//location.reload(true);
$("#thematic_plan_"+thematic_id).html(data);
$("#thematic_plan_add").html("<div class=\"confirmation-message\">'.addslashes(get_lang('Saved')).'</div>");
//location.reload(true);
}
});
//prevent the browser to follow the link
return false;
return false;
});*/
// Third col
/*
$("#thematic_advance").live("submit", function() {
var url = this.href;
var url = this.href;
var my_id = this.id;
var serialize_form_content = $(this).serialize();
//Getting FCK content
//Getting FCK content
var oEditor = FCKeditorAPI.GetInstance("content");
content = oEditor.GetXHTML(true) ;
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) {
success: function(data) {
var thematic_advance_id = $("input[name=\"thematic_advance_id\"]").val();
$("#thematic_advance_"+thematic_advance_id).html(data);
$("#thematic_advance").html("<div class=\"confirmation-message\">'.addslashes(get_lang('Saved')).'</div>");
$("#thematic_advance_"+thematic_advance_id).html(data);
$("#thematic_advance").html("<div class=\"confirmation-message\">'.addslashes(get_lang('Saved')).'</div>");
//Only refresh if the parent is to add
if (my_id == "add_button") {
//location.reload(true);
}
}
});
});
//prevent the browser to follow the link
return false;
return false;
});*/
$(".thematic_advance_actions, .thematic_tools ").hide();
$(".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();
});
});
/*
$("#custom_date").live("click", function() {
$("#custom_date").live("click", function() {
$("#div_custom_datetime").css("display", "none");
$("#div_datetime_by_attendance").hide();
$("#div_datetime_by_attendance").hide();
});
$("#from_attendance").live("click", function() {
$("#from_attendance").live("click", function() {
$("#div_custom_datetime").css("display", "block");
$("#div_custom_datetime").show();
$("#div_datetime_by_attendance").show();
$("#div_datetime_by_attendance").show();
});*/
});
});
</script>';
$htmlHeadXtra[] = '<script type="text/javascript">
function datetime_by_attendance(attendance_id, thematic_advance_id) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {},
@ -198,10 +197,10 @@ function datetime_by_attendance(attendance_id, thematic_advance_id) {
url: "'.api_get_path(WEB_AJAX_PATH).'thematic.ajax.php?a=get_datetime_by_attendance",
data: "attendance_id="+attendance_id+"&thematic_advance_id="+thematic_advance_id,
success: function(data) {
$("#div_datetime_attendance").html(data);
$("#div_datetime_attendance").html(data);
if (thematic_advance_id == 0) {
$("#start_date_select_calendar").val($("#start_date_select_calendar option:first").val());
}
}
}
});
}
@ -219,9 +218,9 @@ function update_done_thematic_advance(selected_value) {
});
// clean all radios
for (var i=0; i< $(".done_thematic").length;i++) {
var id_radio_thematic = $(".done_thematic").get(i).id;
var id_radio_thematic = $(".done_thematic").get(i).id;
$("#td_"+id_radio_thematic).css({"background-color":"#FFF"});
}
@ -237,21 +236,21 @@ function update_done_thematic_advance(selected_value) {
function check_per_attendance(obj) {
if (obj.checked) {
$("#div_datetime_by_attendance").show();
$("#div_datetime_by_attendance").show();
$("#div_custom_datetime").hide();
} else {
$("#div_datetime_by_attendance").hide();
$("#div_custom_datetime").show();
$("#div_custom_datetime").show();
}
}
function check_per_custom_date(obj) {
if (obj.checked) {
$("#div_custom_datetime").show();
$("#div_datetime_by_attendance").hide();
$("#div_datetime_by_attendance").hide();
} else {
$("#div_custom_datetime").hide();
$("#div_datetime_by_attendance").show();
$("#div_datetime_by_attendance").show();
}
}
@ -273,7 +272,7 @@ if ($action == 'thematic_details') {
}
if ($action == 'thematic_plan_list' || $action == 'thematic_plan_delete') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicPlan').' ('.$thematic_data['title'].') ');
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicPlan').' ('.$thematic_data['title'].') ');
}
if ($action == 'thematic_plan_add' || $action == 'thematic_plan_edit') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
@ -287,7 +286,7 @@ if ($action == 'thematic_plan_add' || $action == 'thematic_plan_edit') {
if ($action == 'thematic_advance_list' || $action == 'thematic_advance_delete') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')');
}
if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
@ -305,32 +304,32 @@ switch ($action) {
case 'thematic_import_select' :
case 'thematic_import' :
case 'moveup' :
case 'movedown' :
case 'movedown' :
if (!api_is_allowed_to_edit(null,true)) {
api_not_allowed();
}
case 'thematic_list' :
case 'thematic_export' :
case 'thematic_export_pdf' :
case 'thematic_details' :
case 'thematic_details' :
$thematic_controller->thematic($action);
break;
break;
case 'thematic_plan_add' :
case 'thematic_plan_edit' :
case 'thematic_plan_delete' :
case 'thematic_plan_delete' :
if (!api_is_allowed_to_edit(null,true)) {
api_not_allowed();
}
}
case 'thematic_plan_list' :
$thematic_controller->thematic_plan($action);
break;
break;
case 'thematic_advance_add' :
case 'thematic_advance_edit' :
case 'thematic_advance_delete' :
if (!api_is_allowed_to_edit(null,true)) {
api_not_allowed();
api_not_allowed();
}
case 'thematic_advance_list' :
case 'thematic_advance_list' :
$thematic_controller->thematic_advance($action);
break;
}

@ -1,19 +1,17 @@
<?php
/* For licensing terms, see /chamilo_license.txt */
/**
* Responses to AJAX calls for thematic
* Responses to AJAX calls for thematic
*/
require_once '../global.inc.php';
require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
require_once api_get_path(LIBRARY_PATH).'thematic.lib.php';
api_protect_course_script(true);
$action = $_GET['a'];
$thematic = new Thematic();
switch ($action) {
switch ($action) {
case 'save_thematic_plan':
/*$title_list = $_REQUEST['title'];
$description_list = $_REQUEST['desc'];
@ -24,51 +22,51 @@ switch ($action) {
$thematic->set_thematic_plan_attributes($_REQUEST['thematic_id'], $title_list[$i], $description_list[$i], $description_type[$i]);
$affected_rows = $thematic->thematic_plan_save();
}
}
}
$thematic_plan_data = $thematic->get_thematic_plan_data();
$return = $thematic->get_thematic_plan_div($thematic_plan_data);
echo $return[$_REQUEST['thematic_id']];*/
break;
case 'save_thematic_advance':
break;
case 'save_thematic_advance':
if (!api_is_allowed_to_edit(null, true)) {
echo '';
exit;
}
/*
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'])) || (!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;
}
$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['duration_error'] = $duration_error;
}
$data['action'] = $_REQUEST['action'];
$data['thematic_id'] = $_REQUEST['thematic_id'];
$data['attendance_select'] = $attendance_select;
$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)) {
$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'];
$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;
$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();
}
$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();
@ -79,53 +77,53 @@ switch ($action) {
}
}
}
$thematic_advance_data = $thematic->get_thematic_advance_list(null, null, true);
$return = $thematic->get_thematic_advance_div($thematic_advance_data);
$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($_REQUEST['attendance_id']);
break;
case 'get_datetime_by_attendance':
$attendance_id = intval($_REQUEST['attendance_id']);
$thematic_advance_id = intval($_REQUEST['thematic_advance_id']);
$label = '';
$input_select = '';
$input_select = '';
if (!empty($attendance_id)) {
$attendance = new Attendance();
$thematic = new Thematic();
$attendance = new Attendance();
$thematic = new Thematic();
$thematic_list = $thematic->get_thematic_list();
$my_list = $thematic_list_temp = array();
foreach ($thematic_list as $item) {
$my_list = $thematic->get_thematic_advance_by_thematic_id($item['id']);
foreach ($thematic_list as $item) {
$my_list = $thematic->get_thematic_advance_by_thematic_id($item['id']);
$thematic_list_temp = array_merge($my_list, $thematic_list_temp);
}
}
$new_thematic_list = array();
foreach($thematic_list_temp as $item) {
if (!empty($item['attendance_id']) ) {
$new_thematic_list[$item['id']] = array('attendance_id' =>$item['attendance_id'], 'start_date'=>$item['start_date']);
}
}
$attendance_calendar = $attendance->get_attendance_calendar($attendance_id);
}
$attendance_calendar = $attendance->get_attendance_calendar($attendance_id);
$label = get_lang('StartDate');
if (!empty($attendance_calendar)) {
$input_select .= '<select id="start_date_select_calendar" name="start_date_by_attendance" UNIQUE size="5">';
$input_select .= '<select id="start_date_select_calendar" name="start_date_by_attendance" UNIQUE size="5">';
foreach ($attendance_calendar as $calendar) {
$selected = null;
$insert = true;
//checking if was already taken
//checking if was already taken
foreach ($new_thematic_list as $key => $thematic_item) {
//if ($calendar['db_date_time'] == $thematic_item['start_date'] && $calendar['attendance_id'] == $thematic_item['attendance_id'] ) {
if ($calendar['db_date_time'] == $thematic_item['start_date'] ) {
$insert = false;
$insert = false;
if ($thematic_advance_id == $key) {
$insert = true;
$insert = true;
$selected = 'selected';
}
break;
}
break;
}
}
if ($insert == true) {
$input_select .= '<option '.$selected.' value="'.$calendar['date_time'].'">'.$calendar['date_time'].'</option>';
@ -135,27 +133,27 @@ switch ($action) {
} else {
$input_select .= '<em>'.get_lang('ThereAreNoRegisteredDatetimeYet').'</em>';
}
}
?>
}
?>
<div class="control-group">
<label class="control-label"><?php echo $label ?></label>
<div class="controls"><?php echo $input_select ?></div>
</div>
<?php
break;
case 'update_done_thematic_advance':
</div>
<?php
break;
case 'update_done_thematic_advance':
$thematic_advance_id = intval($_GET['thematic_advance_id']);
$total_average = 0;
if (!empty($thematic_advance_id)) {
$thematic = new Thematic();
$affected_rows = $thematic->update_done_thematic_advances($thematic_advance_id);
$total_average = 0;
if (!empty($thematic_advance_id)) {
$thematic = new Thematic();
$affected_rows = $thematic->update_done_thematic_advances($thematic_advance_id);
//if ($affected_rows) {
$total_average = $thematic->get_total_average_of_thematic_advances(api_get_course_id(), api_get_session_id());
//}
//}
}
echo $total_average;
break;
default:
echo '';
}
exit;
exit;

@ -22,8 +22,6 @@
* @package chamilo.include
*/
require_once api_get_path(LIBRARY_PATH).'thematic.lib.php';
/* Constants and variables */
$TBL_INTRODUCTION = Database::get_course_table(TABLE_TOOL_INTRO);
@ -237,7 +235,7 @@ $introduction_section .= '</div>';
$introduction_section .= '<div class="home-course-intro span12"><div class="page-course">';
if ($intro_dispDefault) {
$intro_content = $intro_content;
if (!empty($intro_content)) {

@ -97,6 +97,7 @@ class Autoload
$result['AssetWikiRenderer'] = '/main/inc/lib/system/media/renderer/lab/asset_wiki_renderer.class.php';
$result['AttendanceLink'] = '/main/gradebook/lib/be/attendancelink.class.php';
$result['Auth'] = '/main/inc/lib/auth.lib.php';
$result['Thematic'] = '/main/inc/lib/thematic.lib.php';
$result['Block'] = '/main/dashboard/block.class.php';
$result['Blog'] = '/main/inc/lib/blog.lib.php';
$result['Cache'] = '/main/inc/lib/cache.class.php';

@ -6,7 +6,6 @@ define('SHORTCUTS_VERTICAL', 1);
class CourseHome
{
/**
* Gets the html content to show in the 3 column view
*/

@ -15,7 +15,6 @@ $cidReset = true;
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'thematic.lib.php';
$this_section = SECTION_TRACKING;

@ -5,12 +5,6 @@
* @package chamilo.dashboard
* @author Christian Fasanando
*/
/**
* required files for getting data
*/
require_once api_get_path(LIBRARY_PATH) . 'thematic.lib.php';
/**
* This class is used like controller for this course block plugin,
* the class name must be registered inside path.info file (e.g: controller = "BlockCourse"), so dashboard controller will be instantiate it

@ -11,7 +11,6 @@
* required files for getting data
*/
require_once api_get_path(LIBRARY_PATH) . 'thematic.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'attendance.lib.php';
require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/be.inc.php';

Loading…
Cancel
Save