Minor - cleaning code

skala
Julio Montoya 16 years ago
parent c043d97a71
commit 0af4e27d52
  1. 121
      main/course_info/infocours.php
  2. 51
      main/course_info/maintenance.php

@ -1,32 +1,6 @@
<?php // $Id: infocours.php 21873 2009-07-08 08:35:57Z herodoto $ <?php
/* For licensing terms, see /license.txt */
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2009 Dokeos SPRL
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) Hugues Peeters
Copyright (c) Roan Embrechts (Vrije Universiteit Brussel)
Copyright (c) Olivier Brouckaert
Copyright (c) Bart Mollet, Hogeschool Gent
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/** /**
==============================================================================
* Code to display the course settings form (for the course admin) * Code to display the course settings form (for the course admin)
* and activate the changes. * and activate the changes.
* *
@ -36,35 +10,22 @@
* @author Patrick Cool <patrick.cool@UGent.be> * @author Patrick Cool <patrick.cool@UGent.be>
* @author Roan Embrechts, refactoring * @author Roan Embrechts, refactoring
* and improved course visibility|subscribe|unsubscribe options * and improved course visibility|subscribe|unsubscribe options
* @package dokeos.course_info * @package chamilo.course_info
==============================================================================
*/
/*
==============================================================================
INIT SECTION
==============================================================================
*/ */
/* INIT SECTION */
// name of the language file that needs to be included // name of the language file that needs to be included
$language_file = array ('create_course', 'course_info'); $language_file = array ('create_course', 'course_info');
include ('../inc/global.inc.php'); require_once '../inc/global.inc.php';
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
$nameTools = get_lang("ModifInfo"); $nameTools = get_lang("ModifInfo");
/* /* Libraries */
----------------------------------------------------------- require_once api_get_path(LIBRARY_PATH).'course.lib.php';
Libraries require_once api_get_path(INCLUDE_PATH)."conf/course_info.conf.php";
----------------------------------------------------------- require_once api_get_path(INCLUDE_PATH)."lib/debug.lib.inc.php";
*/ require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once (api_get_path(LIBRARY_PATH).'course.lib.php'); /* Constants and variables */
require_once (api_get_path(INCLUDE_PATH)."conf/course_info.conf.php");
require_once (api_get_path(INCLUDE_PATH)."lib/debug.lib.inc.php");
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
/*
-----------------------------------------------------------
Constants and variables
-----------------------------------------------------------
*/
define("MODULE_HELP_NAME", "Settings"); define("MODULE_HELP_NAME", "Settings");
define("COURSE_CHANGE_PROPERTIES", "COURSE_CHANGE_PROPERTIES"); define("COURSE_CHANGE_PROPERTIES", "COURSE_CHANGE_PROPERTIES");
$TABLECOURSE = Database :: get_main_table(TABLE_MAIN_COURSE); $TABLECOURSE = Database :: get_main_table(TABLE_MAIN_COURSE);
@ -76,11 +37,8 @@ $currentCourseID = $_course['sysCode'];
$currentCourseRepository = $_course["path"]; $currentCourseRepository = $_course["path"];
$is_allowedToEdit = $is_courseAdmin || $is_platformAdmin; $is_allowedToEdit = $is_courseAdmin || $is_platformAdmin;
$course_setting_table = Database::get_course_table(TABLE_COURSE_SETTING); $course_setting_table = Database::get_course_table(TABLE_COURSE_SETTING);
/*
============================================================================== /* LOGIC FUNCTIONS */
LOGIC FUNCTIONS
==============================================================================
*/
function is_settings_editable() function is_settings_editable()
{ {
return $GLOBALS["course_info_is_editable"]; return $GLOBALS["course_info_is_editable"];
@ -89,9 +47,7 @@ $course_code = $_course["sysCode"];
$course_access_settings = CourseManager :: get_access_settings($course_code); $course_access_settings = CourseManager :: get_access_settings($course_code);
/* /*
==============================================================================
MAIN CODE MAIN CODE
==============================================================================
*/ */
if (!$is_allowedToEdit) if (!$is_allowedToEdit)
@ -254,8 +210,7 @@ $form->addElement('radio', 'allow_open_chat_window', null, get_lang('AllowOpenCh
$form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"'); $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
// COURSE THEME PICKER // COURSE THEME PICKER
if (api_get_setting('allow_course_theme') == 'true') if (api_get_setting('allow_course_theme') == 'true') {
{
$form->addElement('html','<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif',get_lang('Top')).'</a><a name="theme" id="theme"></a>'.Display::return_icon('theme.gif',get_lang('Theming')).' '.get_lang('Theming').'</div><div style="clear:both;"></div>'); $form->addElement('html','<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif',get_lang('Top')).'</a><a name="theme" id="theme"></a>'.Display::return_icon('theme.gif',get_lang('Theming')).' '.get_lang('Theming').'</div><div style="clear:both;"></div>');
//Allow Learning path //Allow Learning path
@ -268,17 +223,14 @@ if (api_get_setting('allow_course_theme') == 'true')
$form -> addElement('html',$linebreak); $form -> addElement('html',$linebreak);
} }
if (is_settings_editable()) if (is_settings_editable()) {
{
$form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"'); $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
} } else {
else
{
// is it allowed to edit the course settings? // is it allowed to edit the course settings?
if (!is_settings_editable()) if (!is_settings_editable())
$disabled_output = "disabled"; $disabled_output = "disabled";
$form->freeze(); $form->freeze();
} }
// get all the course information // get all the course information
$all_course_information = CourseManager::get_course_information($_course['sysCode']); $all_course_information = CourseManager::get_course_information($_course['sysCode']);
@ -328,18 +280,19 @@ if ($form->validate() && is_settings_editable()) {
$update_values[$index] = Database::escape_string($value); $update_values[$index] = Database::escape_string($value);
} }
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE); $table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$sql = "UPDATE $table_course SET title = '".Security::remove_XSS($update_values['title'])."', $sql = "UPDATE $table_course SET
visual_code = '".$update_values['visual_code']."', title = '".Security::remove_XSS($update_values['title'])."',
course_language = '".$update_values['course_language']."', visual_code = '".$update_values['visual_code']."',
category_code = '".$update_values['category_code']."', course_language = '".$update_values['course_language']."',
department_name = '".Security::remove_XSS($update_values['department_name'])."', category_code = '".$update_values['category_code']."',
department_url = '".Security::remove_XSS($update_values['department_url'])."', department_name = '".Security::remove_XSS($update_values['department_name'])."',
visibility = '".$update_values['visibility']."', department_url = '".Security::remove_XSS($update_values['department_url'])."',
subscribe = '".$update_values['subscribe']."', visibility = '".$update_values['visibility']."',
unsubscribe = '".$update_values['unsubscribe']."', subscribe = '".$update_values['subscribe']."',
tutor_name = '".$update_values['tutor_name']."', unsubscribe = '".$update_values['unsubscribe']."',
registration_code = '".$update_values['course_registration_password']."' tutor_name = '".$update_values['tutor_name']."',
WHERE code = '".$course_code."'"; registration_code = '".$update_values['course_registration_password']."'
WHERE code = '".$course_code."'";
Database::query($sql); Database::query($sql);
//update course_settings table - this assumes those records exist, otherwise triggers an error //update course_settings table - this assumes those records exist, otherwise triggers an error
@ -425,8 +378,11 @@ echo '</div>';
// Display the form // Display the form
$form->display(); $form->display();
if ($showDiskQuota && $currentCourseDiskQuota != "")
{ //@todo this code is out dated should
if ($showDiskQuota && $currentCourseDiskQuota != "") {
?> ?>
<table> <table>
<tr> <tr>
@ -511,11 +467,6 @@ $form->display();
} }
/* /* FOOTER */
==============================================================================
FOOTER
==============================================================================
*/
Display::display_footer(); Display::display_footer();
?> ?>

@ -1,31 +1,5 @@
<?php // $Id: infocours.php 14956 2008-04-20 14:21:32Z yannoo $ <?php // $Id: infocours.php 14956 2008-04-20 14:21:32Z yannoo $
/* For licensing terms, see /license.txt */
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) Hugues Peeters
Copyright (c) Roan Embrechts (Vrije Universiteit Brussel)
Copyright (c) Olivier Brouckaert
Copyright (c) Bart Mollet, Hogeschool Gent
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/* /*
* Created on 18 October 2006 by Elixir Interactive http://www.elixir-interactive.com * Created on 18 October 2006 by Elixir Interactive http://www.elixir-interactive.com
@ -33,30 +7,25 @@
// name of the language file that needs to be included // name of the language file that needs to be included
$language_file = array ('admin','create_course', 'course_info', 'coursebackup'); $language_file = array ('admin','create_course', 'course_info', 'coursebackup');
require ('../inc/global.inc.php'); require_once '../inc/global.inc.php';
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
$nameTools= get_lang('Maintenance'); $nameTools= get_lang('Maintenance');
api_block_anonymous_users(); api_block_anonymous_users();
Display :: display_header($nameTools); Display :: display_header($nameTools);
api_display_tool_title($nameTools); api_display_tool_title($nameTools);
?> ?>
<div class="sectiontitle"><?php Display::display_icon('save_import.gif', get_lang("backup")); ?>&nbsp;&nbsp;<a href="../coursecopy/backup.php?<?php echo api_get_cidreq();?>"><?php echo get_lang("backup");?></a></div> <div class="sectiontitle"><?php Display::display_icon('save_import.gif', get_lang("backup")); ?>&nbsp;&nbsp;<a href="../coursecopy/backup.php?<?php echo api_get_cidreq();?>"><?php echo get_lang("backup");?></a></div>
<div class="sectioncomment"> <div class="sectioncomment">
<ul> <ul>
<li><a href="../coursecopy/create_backup.php?<?php echo api_get_cidreq();?>"><?php echo get_lang('CreateBackup') ?></a><br/> <li><a href="../coursecopy/create_backup.php?<?php echo api_get_cidreq();?>"><?php echo get_lang('CreateBackup') ?></a><br/>
<?php echo get_lang('CreateBackupInfo') ?> <?php echo get_lang('CreateBackupInfo') ?>
</li> </li>
<li><a href="../coursecopy/import_backup.php?<?php echo api_get_cidreq();?>"><?php echo get_lang('ImportBackup') ?></a><br/> <li><a href="../coursecopy/import_backup.php?<?php echo api_get_cidreq();?>"><?php echo get_lang('ImportBackup') ?></a><br/>
<?php echo get_lang('ImportBackupInfo') ?> <?php echo get_lang('ImportBackupInfo') ?>
</li> </li>
</ul> </ul>
</div> </div>
<div class="sectiontitle"><?php Display::display_icon('copy.gif', get_lang("CopyCourse")); ?>&nbsp;&nbsp;<a href="../coursecopy/copy_course.php?<?php echo api_get_cidreq();?>"><?php echo get_lang("CopyCourse");?></a></div> <div class="sectiontitle"><?php Display::display_icon('copy.gif', get_lang("CopyCourse")); ?>&nbsp;&nbsp;<a href="../coursecopy/copy_course.php?<?php echo api_get_cidreq();?>"><?php echo get_lang("CopyCourse");?></a></div>

Loading…
Cancel
Save