Minor - format code.

1.9.x
Julio Montoya 11 years ago
parent 9995a2c1aa
commit a4c4fb6253
  1. 14
      main/admin/dashboard_add_courses_to_user.php
  2. 3
      main/announcements/announcements.php
  3. 106
      main/course_progress/index.php
  4. 50
      main/course_progress/thematic_controller.php
  5. 889
      main/inc/lib/glossary.lib.php
  6. 13
      main/inc/lib/main_api.lib.php
  7. 2127
      main/inc/lib/thematic.lib.php

@ -214,7 +214,7 @@ if (api_is_multiple_url_enabled()) {
$result = Database::query($sql);
?>
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?user=<?php echo $user_id ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?user=<?php echo $user_id ?>" style="margin:0px;">
<input type="hidden" name="formSent" value="1" />
<?php
if(!empty($msg)) {
@ -268,21 +268,9 @@ if(!empty($msg)) {
</td>
<td width="10%" valign="middle" align="center">
<?php
if ($ajax_search) {
?>
<button class="arrowl" type="button" onclick="remove_item(document.getElementById('destination'))"></button>
<?php
}
else
{
?>
<button class="arrowr" type="button" onclick="moveItem(document.getElementById('origin'), document.getElementById('destination'))" onclick="moveItem(document.getElementById('origin'), document.getElementById('destination'))"></button>
<br /><br />
<button class="arrowl" type="button" onclick="moveItem(document.getElementById('destination'), document.getElementById('origin'))" onclick="moveItem(document.getElementById('destination'), document.getElementById('origin'))"></button>
<?php
}
?>
<br /><br /><br /><br /><br /><br />
<?php
echo '<button class="save" type="button" value="" onclick="valide()" >'.$tool_name.'</button>';

@ -270,9 +270,10 @@ if (api_is_allowed_to_edit(false,true) OR
$rs = Database::query($sql);
$myrow = Database::fetch_array($rs);
$last_id = $id;
$userUpload = isset($_FILES['user_upload']) ? $_FILES['user_upload'] : null;
$edit_attachment = AnnouncementManager::edit_announcement_attachment_file(
$last_id,
$_FILES['user_upload'],
$userUpload,
$file_comment
);

@ -1,16 +1,14 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Template (front controller in MVC pattern) used for distpaching to the controllers depend on the current action
* @author Christian Fasanando <christian1827@gmail.com>
* @author Julio Montoya <gugli100@gmail.com> Bugfixes session support
* @package chamilo.course_progress
*/
/**
* Code
* Template (front controller in MVC pattern) used for distpaching to the controllers depend on the current action
* @author Christian Fasanando <christian1827@gmail.com>
* @author Julio Montoya <gugli100@gmail.com> Bugfixes session support
* @package chamilo.course_progress
*/
// name of the language file that needs to be included
$language_file = array ('course_description', 'userInfo', 'admin');
$language_file = array('course_description', 'userInfo', 'admin');
// including files
require_once '../inc/global.inc.php';
@ -33,36 +31,54 @@ api_protect_course_script(true);
define('ADD_THEMATIC_PLAN', 6);
// get actions
$actions = array('thematic_details', 'thematic_list', 'thematic_add', 'thematic_edit', 'thematic_copy', 'thematic_delete', 'moveup', 'movedown',
'thematic_import_select', 'thematic_import', 'thematic_export', 'thematic_export_pdf',
'thematic_plan_list', 'thematic_plan_add', 'thematic_plan_edit', 'thematic_plan_delete',
'thematic_advance_list', 'thematic_advance_add', 'thematic_advance_edit', 'thematic_advance_delete');
$actions = array(
'thematic_details',
'thematic_list',
'thematic_add',
'thematic_edit',
'thematic_copy',
'thematic_delete',
'moveup',
'movedown',
'thematic_import_select',
'thematic_import',
'thematic_export',
'thematic_export_pdf',
'thematic_plan_list',
'thematic_plan_add',
'thematic_plan_edit',
'thematic_plan_delete',
'thematic_advance_list',
'thematic_advance_add',
'thematic_advance_edit',
'thematic_advance_delete'
);
$action = 'thematic_details';
if (isset($_GET['action']) && in_array($_GET['action'],$actions)) {
$action = $_GET['action'];
$action = $_GET['action'];
}
if (isset($_POST['action']) && $_POST['action'] == 'thematic_delete_select') {
$action = 'thematic_delete_select';
$action = 'thematic_delete_select';
}
if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'true') {
$action = 'thematic_details';
$action = 'thematic_details';
}
if ($action == 'thematic_details' || $action == 'thematic_list') {
$_SESSION['thematic_control'] = $action;
$_SESSION['thematic_control'] = $action;
}
// get thematic id
if (isset($_GET['thematic_id'])) {
$thematic_id = intval($_GET['thematic_id']);
$thematic_id = intval($_GET['thematic_id']);
}
// get thematic plan description type
if (isset($_GET['description_type'])) {
$description_type = intval($_GET['description_type']);
$description_type = intval($_GET['description_type']);
}
// instance thematic object for using like library here
@ -72,8 +88,8 @@ $thematic = new Thematic();
$thematic_controller = new ThematicController();
if (!empty($thematic_id)) {
// thematic data by id
$thematic_data = $thematic->get_thematic_list($thematic_id);
// thematic data by id
$thematic_data = $thematic->get_thematic_list($thematic_id);
}
// get default thematic plan title
@ -82,9 +98,7 @@ $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
$htmlHeadXtra[] = '<script type="text/javascript">
$(document).ready(function() {
//Second col
/*
$("#thematic_plan_add").live("submit", function() {
@ -149,7 +163,6 @@ $(document).ready(function() {
return false;
});*/
$(".thematic_advance_actions, .thematic_tools ").hide();
$(".thematic_content").mouseover(function() {
@ -185,11 +198,9 @@ $(document).ready(function() {
});
</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) {},
@ -218,7 +229,6 @@ 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;
$("#td_"+id_radio_thematic).css({"background-color":"#FFF"});
@ -253,45 +263,43 @@ function check_per_custom_date(obj) {
$("#div_datetime_by_attendance").show();
}
}
</script>';
if ($action == 'thematic_list') {
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl'));
}
if ($action == 'thematic_add') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicSection'));
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicSection'));
}
if ($action == 'thematic_edit') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('EditThematicSection'));
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('EditThematicSection'));
}
if ($action == 'thematic_details') {
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl'));
}
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' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
$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'));
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicPlan').' ('.$thematic_data['title'].')');
if ($description_type >= ADD_THEMATIC_PLAN) {
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewBloc'));
} else {
$interbreadcrumb[] = array ('url' => '#', 'name' => $default_thematic_plan_title[$description_type]);
}
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicPlan').' ('.$thematic_data['title'].')');
if ($description_type >= ADD_THEMATIC_PLAN) {
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewBloc'));
} else {
$interbreadcrumb[] = array ('url' => '#', 'name' => $default_thematic_plan_title[$description_type]);
}
}
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'].')');
$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'));
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')');
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicAdvance'));
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')');
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicAdvance'));
}
// Distpacher actions to controller
@ -306,7 +314,7 @@ switch ($action) {
case 'moveup':
case 'movedown':
if (!api_is_allowed_to_edit(null,true)) {
api_not_allowed();
api_not_allowed();
}
case 'thematic_list':
case 'thematic_export':

@ -4,9 +4,9 @@
/**
* This file contains class used like controller for thematic, it should be included inside a dispatcher file (e.g: index.php)
*
*
* !!! WARNING !!! : ALL DATES IN THIS MODULE ARE STORED IN UTC ! DO NOT CONVERT DURING THE TRANSITION FROM CHAMILO 1.8.x TO 2.0
*
*
* @author Christian Fasanando <christian1827@gmail.com>
* @author Julio Montoya <gugli100@gmail.com> token support improving UI
* @package chamilo.course_progress
@ -15,7 +15,7 @@
/**
* Thematic Controller script. Prepares the common background variables to give to the scripts corresponding to
* the requested action
* @package chamilo.course_progress
* @package chamilo.course_progress
*/
class ThematicController
{
@ -34,7 +34,7 @@ class ThematicController
* @param string Action
* render to thematic.php
*/
public function thematic($action)
public function thematic($action)
{
$thematic = new Thematic();
$data = array();
@ -44,12 +44,12 @@ class ThematicController
$check = Security::check_token('request');
$thematic_id = isset($_REQUEST['thematic_id']) ? intval($_REQUEST['thematic_id']) : null;
$displayHeader = (!empty($_REQUEST['display']) && $_REQUEST['display'] === 'no_header') ? false : true;
if ($check) {
switch ($action) {
case 'thematic_add':
case 'thematic_edit':
// insert or update a thematic
// insert or update a thematic
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (trim($_POST['title']) !== '') {
if (api_is_allowed_to_edit(null, true)) {
@ -250,7 +250,7 @@ class ThematicController
$data['action'] = $action;
$layoutName = $displayHeader ? 'layout' : 'layout_no_header';
// render to the view
$this->view->set_data($data);
$this->view->set_layout($layoutName);
@ -286,7 +286,7 @@ class ThematicController
}
unset($_SESSION['thematic_plan_token']);
$data['message'] = 'ok';
$saveRedirect = api_get_path(WEB_PATH) . 'main/course_progress/index.php?';
$saveRedirect.= api_get_cidreq() . '&';
$saveRedirect.= 'thematic_plan_save_message=ok';
@ -360,7 +360,7 @@ class ThematicController
/**
* This method is used for thematic advance control (update, insert or listing)
* @param string Action
* @param string $action
* render to thematic_advance.php
*/
public function thematic_advance($action)
@ -368,20 +368,19 @@ class ThematicController
$thematic = new Thematic();
$attendance = new Attendance();
$data = array();
$displayHeader = (!empty($_REQUEST['display']) && $_REQUEST['display'] === 'no_header') ? false : true;
// get data for attendance input select
// get data for attendance input select
$attendance_list = $attendance->get_attendances_list();
$attendance_select = array();
$attendance_select[0] = get_lang('SelectAnAttendance');
foreach ($attendance_list as $attendance_id => $attendance_data) {
$attendance_select[$attendance_id] = $attendance_data['name'];
}
$thematic_id = intval($_REQUEST['thematic_id']);
$thematic_advance_id = intval($_REQUEST['thematic_advance_id']);
$thematic_advance_data = array();
switch ($action) {
@ -421,8 +420,9 @@ class ThematicController
$data['thematic_advance_data'] = $thematic_advance_data;
}
} else {
if ($_REQUEST['thematic_advance_token'] == $_SESSION['thematic_advance_token'] && api_is_allowed_to_edit(null, true)) {
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['content'];
@ -434,14 +434,23 @@ class ThematicController
$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);
$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->update_done_thematic_advances($last_done_thematic_advance);
}
}
}
@ -452,7 +461,6 @@ class ThematicController
break;
}
// get calendar select by attendance id
$calendar_select = array();
if (!empty($thematic_advance_data)) {
@ -473,7 +481,7 @@ class ThematicController
$data['thematic_advance_data'] = $thematic_advance_data;
$data['calendar_select'] = $calendar_select;
$layoutName = $displayHeader ? 'layout' : 'layout_no_header';
// render to the view
$this->view->set_data($data);
$this->view->set_layout($layoutName);
@ -481,4 +489,4 @@ class ThematicController
$this->view->render();
}
}
}

File diff suppressed because it is too large Load Diff

@ -1417,19 +1417,24 @@ function api_get_anonymous_id() {
/**
* Returns the cidreq parameter name + current course id taken from
* $GLOBALS['_cid'] and returns a string like 'cidReq=ABC&id_session=123
*
* @param bool $addSessionId
* @param bool $addGroupId
* @return string Course & session references to add to a URL
*
* @see Uri.course_params
*/
function api_get_cidreq($add_session_id = true, $add_group_id = true) {
function api_get_cidreq($addSessionId = true, $addGroupId = true)
{
$url = empty($GLOBALS['_cid']) ? '' : 'cidReq='.htmlspecialchars($GLOBALS['_cid']);
$origin = api_get_origin();
if ($add_session_id) {
if ($addSessionId) {
if (!empty($url)) {
$url .= api_get_session_id() == 0 ? '&id_session=0' : '&id_session='.api_get_session_id();
}
}
if ($add_group_id) {
if ($addGroupId) {
if (!empty($url)) {
$url .= api_get_group_id() == 0 ? '&gidReq=0' : '&gidReq='.api_get_group_id();
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save