Minor - format code.

1.9.x
Julio Montoya 11 years ago
parent 4396246858
commit 8c3eb89c3d
  1. 22
      main/admin/course_create_content.php
  2. 5
      main/admin/course_information.php
  3. 49
      main/admin/course_intro_pdf_import.php
  4. 10
      main/admin/course_list.php
  5. 17
      main/admin/course_request_accepted.php
  6. 10
      main/admin/course_request_edit.php
  7. 47
      main/admin/course_request_rejected.php
  8. 39
      main/admin/course_request_review.php
  9. 16
      main/admin/course_user_import.php
  10. 1
      main/admin/course_virtual.php

@ -6,10 +6,6 @@
* @author Bart Mollet <bart.mollet@hogent.be>
* @package chamilo.admin
*/
/**
* INIT SECTION
*/
// name of the language file that needs to be included
$language_file = 'admin';
include ('../inc/global.inc.php');
@ -20,26 +16,16 @@ $tool_name = get_lang('DummyCourseCreator');
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
Display::display_header($tool_name);
//api_display_tool_title($tool_name);
if(api_get_setting('server_type') != 'test')
{
if (api_get_setting('server_type') != 'test') {
echo get_lang('DummyCourseOnlyOnTestServer');
}
elseif( isset($_POST['action']))
{
} elseif( isset($_POST['action'])) {
require_once('../coursecopy/classes/DummyCourseCreator.class.php');
$dcc = new DummyCourseCreator();
$dcc->create_dummy_course($_POST['course_code']);
echo get_lang('Done');
}
else
{
} else {
echo get_lang('DummyCourseDescription');
echo '<form method="post"><input type="hidden" name="course_code" value="'.Security::remove_XSS($_GET['course_code']).'"/><input type="submit" name="action" value="'.get_lang('Ok').'"/></form>';
}
/*
==============================================================================
FOOTER
==============================================================================
*/
Display::display_footer();
?>

@ -5,9 +5,6 @@
* @author Bart Mollet
* @package chamilo.admin
*/
/**
* INIT SECTION
*/
// name of the language file that needs to be included
$language_file = 'admin';
@ -110,7 +107,7 @@ $table->display();
echo Display::page_header(get_lang('Users'));
$table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
$sql = "SELECT *,cu.status as course_status
$sql = "SELECT *,cu.status as course_status
FROM $table_course_user cu, $table_user u";
if (api_is_multiple_url_enabled()) {
$sql .= " INNER JOIN ".Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER)." url_rel_user

@ -5,15 +5,14 @@
* uploaded in each course
* @package chamilo.admin
*/
/**
* Initialization
*/
$language_file = array('admin', 'document');
$cidReset = true;
require '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
// temporary configuration of in which folder to upload the file in each course. Should default to '', and start with a '/' and end without it, if defined
// temporary configuration of in which folder to upload the file in each course.
// Should default to '', and start with a '/' and end without it, if defined
$subDir = '';
//require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
@ -41,7 +40,7 @@ if ($_POST['formSent']) {
} else {
$errors = import_pdfs($courses, $subDir);
if (count($errors) == 0) {
error_log('Course intros imported successfully in '.__FILE__.', line '.__LINE__);
error_log('Course intros imported successfully in '.__FILE__.', line '.__LINE__);
}
}
}
@ -58,25 +57,25 @@ if (count($errors) != 0) {
Display :: display_confirmation_message('CourseIntroductionsAllImportesSuccessfully', false);
}
?>
<form method="post" action="<?php echo api_get_self(); ?>" enctype="multipart/form-data" style="margin: 0px;">
<legend><?php echo $tool_name; ?></legend>
<div class="control-group">
<label><?php echo get_lang('ImportZipFileLocation'); ?></label>
<div class="control">
<input type="file" name="import_file"/>
</div>
</div>
<div class="control-group">
<div class="control">
<button type="submit" class="save" value="<?php echo get_lang('Import'); ?>"><?php echo get_lang('Import'); ?></button>
</div>
</div>
<input type="hidden" name="formSent" value="1"/>
</form>
<div style="clear: both;"></div>
<p><?php echo get_lang('PDFsMustLookLike'); ?></p>
<form method="post" action="<?php echo api_get_self(); ?>" enctype="multipart/form-data" style="margin: 0px;">
<legend><?php echo $tool_name; ?></legend>
<div class="control-group">
<label><?php echo get_lang('ImportZipFileLocation'); ?></label>
<div class="control">
<input type="file" name="import_file"/>
</div>
</div>
<div class="control-group">
<div class="control">
<button type="submit" class="save" value="<?php echo get_lang('Import'); ?>"><?php echo get_lang('Import'); ?></button>
</div>
</div>
<input type="hidden" name="formSent" value="1"/>
</form>
<div style="clear: both;"></div>
<p><?php echo get_lang('PDFsMustLookLike'); ?></p>
<blockquote>
<blockquote>
<pre>
<strong>CourseCode</strong>_<strong>NameOfDocument</strong>_<strong>CourseName</strong>.pdf
e.g.
@ -84,7 +83,7 @@ MAT101_Introduction_Mathematics-101.pdf
MAT102_Introduction_Mathematics-102.pdf
ENG101_Introduction_English-101.pdf
</pre>
</blockquote>
</blockquote>
<?php
Display :: display_footer();
@ -99,7 +98,7 @@ function import_pdfs($file, $subDir = '/') {
$baseDir = api_get_path(SYS_ARCHIVE_PATH);
$uploadPath = 'pdfimport/';
$errors = array ();
if (!is_dir($baseDir.$uploadPath)) {
if (!is_dir($baseDir.$uploadPath)) {
@mkdir($baseDir.$uploadPath);
}
if (!unzip_uploaded_file($_FILES['import_file'], $uploadPath, $baseDir, 1024*1024*1024)) {

@ -7,8 +7,6 @@
* @package chamilo.admin
*/
/* INIT SECTION */
// Language files that need to be included.
$language_file = array('admin', 'courses');
$cidReset = true;
@ -48,7 +46,7 @@ function get_number_of_courses() {
$sql .= " WHERE (code LIKE '%".$keyword_code."%' OR visual_code LIKE '%".$keyword_code."%') AND title LIKE '%".$keyword_title."%' AND category_code LIKE '%".$keyword_category."%' AND course_language LIKE '%".$keyword_language."%' AND visibility LIKE '%".$keyword_visibility."%' AND subscribe LIKE '".$keyword_subscribe."'AND unsubscribe LIKE '".$keyword_unsubscribe."'";
}
// adding the filter to see the user's only of the current access_url
// adding the filter to see the user's only of the current access_url
if ((api_is_platform_admin() || api_is_session_admin()) && api_is_multiple_url_enabled() && api_get_current_access_url_id() != -1) {
$sql.= " AND url_rel_course.access_url_id=".api_get_current_access_url_id();
}
@ -178,8 +176,8 @@ function get_course_data_by_session($from, $number_of_items, $column, $direction
*/
function modify_filter($code)
{
$icourse = api_get_course_info($code);
return
$icourse = api_get_course_info($code);
return
'<a href="course_information.php?code='.$code.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a>&nbsp;'.
//'<a href="../course_home/course_home.php?cidReq='.$code.'">'.Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>&nbsp;'. // This is not the preferable way to go to the homepage.
'<a href="'.api_get_path(WEB_COURSE_PATH).$icourse['path'].'/index.php">'.Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>&nbsp;'.
@ -386,4 +384,4 @@ $tpl = new Template($tool_name);
$tpl->assign('actions', $actions);
$tpl->assign('message', $message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
$tpl->display_one_col_template();

@ -11,8 +11,6 @@
* @author Ivan Tcholakov <ivantcholakov@gmail.com> (technical adaptation for Chamilo 1.8.8), 2010
*/
/* INIT SECTION */
// Language files that need to be included.
$language_file = array('admin', 'create_course');
@ -78,13 +76,10 @@ if ($course_validation_feature) {
break;
}
}
} else {
$link_to_setting = api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Platform#course_validation';
$message = sprintf(get_lang('PleaseActivateCourseValidationFeature'), sprintf('<strong><a href="%s">%s</a></strong>', $link_to_setting, get_lang('EnableCourseValidation')));
$is_error_message = true;
$link_to_setting = api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Platform#course_validation';
$message = sprintf(get_lang('PleaseActivateCourseValidationFeature'), sprintf('<strong><a href="%s">%s</a></strong>', $link_to_setting, get_lang('EnableCourseValidation')));
$is_error_message = true;
}
/**
@ -129,10 +124,12 @@ function get_request_data($from, $number_of_items, $column, $direction) {
/**
* Actions in the list: edit, accept, delete.
*/
function modify_filter($id) {
function modify_filter($id)
{
$code = CourseRequestManager::get_course_request_code($id);
$result = '<a href="course_request_edit.php?id='.$id.'&caller=1">'.Display::return_icon('edit.gif', get_lang('Edit'), array('style' => 'vertical-align: middle;')).'</a>'.
'&nbsp;<a href="?delete_course_request='.$id.'">'.Display::return_icon('delete.gif', get_lang('DeleteThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeDeleted'), $code), ENT_QUOTES)).'\')) return false;')).'</a>';
return $result;
}
@ -174,7 +171,7 @@ echo '</div>';
// Create a sortable table with the course data.
$table = new SortableTable('course_requests_accepted', 'get_number_of_requests', 'get_request_data', 5, 20, 'DESC');
$table->set_additional_parameters($parameters);
//$table->set_additional_parameters($parameters);
$table->set_header(0, '', false);
$table->set_header(1, get_lang('Code'));
$table->set_header(2, get_lang('Title'));

@ -7,8 +7,6 @@
* @author Ivan Tcholakov <ivantcholakov@gmail.com>, 2010
*/
// Initialization section.
// Language files that need to be included.
$language_file = array('admin', 'create_course');
@ -161,9 +159,9 @@ if ($course_validation_feature) {
// Detection which submit button has been pressed.
$submit_button = isset($_POST['save_button']) ? 'save_button'
: (isset($_POST['accept_button']) ? 'accept_button'
: (isset($_POST['reject_button']) ? 'reject_button'
: (isset($_POST['ask_info_button']) ? 'ask_info_button'
: 'submit_button')));
: (isset($_POST['reject_button']) ? 'reject_button'
: (isset($_POST['ask_info_button']) ? 'ask_info_button'
: 'submit_button')));
// Check the course code for avoiding duplication.
$course_code_ok = $course_request_values['wanted_code'] == $course_request_info['code']
@ -226,7 +224,6 @@ if ($course_validation_feature) {
}
$message = implode(' ', $message);
$back_url = get_caller_name($caller);
if ($message != '') {
$back_url = api_add_url_param($back_url, 'message='.urlencode(Security::remove_XSS($message)), false);
@ -259,6 +256,7 @@ function get_caller_name($caller_id) {
case 2:
return 'course_request_rejected.php';
}
return 'course_request_review.php';
}

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */
/**
* A list containig the rejected course requests
* A list containing the rejected course requests
* @package chamilo.admin
* @author José Manuel Abuin Mosquera <chema@cesga.es>, 2010
* @author Bruno Rubio Gayo <brubio@cesga.es>, 2010
@ -11,8 +11,6 @@
* @author Ivan Tcholakov <ivantcholakov@gmail.com> (technical adaptation for Chamilo 1.8.8), 2010
*/
/* INIT SECTION */
// Language files that need to be included.
$language_file = array('admin', 'create_course');
@ -62,12 +60,10 @@ if ($course_validation_feature) {
$message = sprintf(get_lang('CourseRequestAcceptanceFailed'), $course_request_code);
$is_error_message = true;
}
}
/**
* Sending to the teacher a request for additional information about the proposed course.
*/
elseif (!empty($request_info)) {
} elseif (!empty($request_info)) {
/**
* Sending to the teacher a request for additional information about the proposed course.
*/
$course_request_code = CourseRequestManager::get_course_request_code($request_info);
$result = CourseRequestManager::ask_for_additional_info($request_info);
if ($result) {
@ -77,12 +73,10 @@ if ($course_validation_feature) {
$message = sprintf(get_lang('CourseRequestInfoFailed'), $course_request_code);
$is_error_message = true;
}
}
/**
* Deletion of a course request.
*/
elseif (!empty($delete_course_request)) {
} elseif (!empty($delete_course_request)) {
/**
* Deletion of a course request.
*/
$course_request_code = CourseRequestManager::get_course_request_code($delete_course_request);
$result = CourseRequestManager::delete_course_request($delete_course_request);
if ($result) {
@ -92,12 +86,10 @@ if ($course_validation_feature) {
$message = sprintf(get_lang('CourseRequestDeletionFailed'), $course_request_code);
$is_error_message = true;
}
}
/**
* Form actions: delete.
*/
elseif (isset($_POST['action'])) {
} elseif (isset($_POST['action'])) {
/**
* Form actions: delete.
*/
switch ($_POST['action']) {
// Delete selected courses
case 'delete_course_requests' :
@ -113,13 +105,10 @@ if ($course_validation_feature) {
break;
}
}
} else {
$link_to_setting = api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Platform#course_validation';
$message = sprintf(get_lang('PleaseActivateCourseValidationFeature'), sprintf('<strong><a href="%s">%s</a></strong>', $link_to_setting, get_lang('EnableCourseValidation')));
$is_error_message = true;
$link_to_setting = api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Platform#course_validation';
$message = sprintf(get_lang('PleaseActivateCourseValidationFeature'), sprintf('<strong><a href="%s">%s</a></strong>', $link_to_setting, get_lang('EnableCourseValidation')));
$is_error_message = true;
}
/**
@ -136,8 +125,6 @@ function get_request_data($from, $number_of_items, $column, $direction) {
global $keyword;
$course_request_table = Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST);
$users_table = Database :: get_main_table(TABLE_MAIN_USER);
$course_users_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$sql = "SELECT id AS col0,
code AS col1,
@ -219,7 +206,7 @@ echo '</div>';
// Create a sortable table with the course data.
$table = new SortableTable('course_requests_rejected', 'get_number_of_requests', 'get_request_data', 5, 20, 'DESC');
$table->set_additional_parameters($parameters);
//$table->set_additional_parameters($parameters);
$table->set_header(0, '', false);
$table->set_header(1, get_lang('Code'));
$table->set_header(2, get_lang('Title'));

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */
/**
* A list containig the pending course requests
* A list containing the pending course requests
* @package chamilo.admin
* @author José Manuel Abuin Mosquera <chema@cesga.es>, 2010
* Centro de Supercomputacion de Galicia (CESGA)
@ -10,8 +10,6 @@
* @author Ivan Tcholakov <ivantcholakov@gmail.com> (technical adaptation for Chamilo 1.8.8), 2010
*/
/* INIT SECTION */
// Language files that need to be included.
$language_file = array('admin', 'create_course');
@ -34,7 +32,7 @@ require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
// The delete action should be deactivated in this page.
// Better reject the target request, after that you can delete it.
define(DELETE_ACTION_ENABLED, false);
// see DELETE_ACTION_ENABLED constant in main_api.lib.php
// A check whether the course validation feature is enabled.
$course_validation_feature = api_get_setting('course_validation') == 'true';
@ -82,7 +80,6 @@ if ($course_validation_feature) {
/**
* Sending to the teacher a request for additional information about the proposed course.
*/
$course_request_code = CourseRequestManager::get_course_request_code($request_info);
$result = CourseRequestManager::ask_for_additional_info($request_info);
if ($result) {
@ -124,26 +121,25 @@ if ($course_validation_feature) {
break;
}
}
} else {
$link_to_setting = api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Platform#course_validation';
$message = sprintf(get_lang('PleaseActivateCourseValidationFeature'), sprintf('<strong><a href="%s">%s</a></strong>', $link_to_setting, get_lang('EnableCourseValidation')));
$is_error_message = true;
$link_to_setting = api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Platform#course_validation';
$message = sprintf(get_lang('PleaseActivateCourseValidationFeature'), sprintf('<strong><a href="%s">%s</a></strong>', $link_to_setting, get_lang('EnableCourseValidation')));
$is_error_message = true;
}
/**
* Get the number of courses which will be displayed.
*/
function get_number_of_requests() {
function get_number_of_requests()
{
return CourseRequestManager::count_course_requests(COURSE_REQUEST_PENDING);
}
/**
* Get course data to display
*/
function get_request_data($from, $number_of_items, $column, $direction) {
function get_request_data($from, $number_of_items, $column, $direction)
{
global $keyword;
$course_request_table = Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST);
@ -155,7 +151,8 @@ function get_request_data($from, $number_of_items, $column, $direction) {
tutor_name AS col4,
request_date AS col5,
id AS col6
FROM $course_request_table WHERE status = ".COURSE_REQUEST_PENDING;
FROM $course_request_table
WHERE status = ".COURSE_REQUEST_PENDING;
} else {
$sql = "SELECT
code AS col0,
@ -164,7 +161,8 @@ function get_request_data($from, $number_of_items, $column, $direction) {
tutor_name AS col3,
request_date AS col4,
id AS col5
FROM $course_request_table WHERE status = ".COURSE_REQUEST_PENDING;
FROM $course_request_table
WHERE status = ".COURSE_REQUEST_PENDING;
}
if ($keyword != '') {
@ -190,7 +188,8 @@ function get_request_data($from, $number_of_items, $column, $direction) {
/**
* Enlace a la ficha del profesor
*/
function email_filter($teacher) {
function email_filter($teacher)
{
$sql = "SELECT user_id FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." WHERE tutor_name LIKE '".$teacher."'";
$res = Database::query($sql);
$info = Database::fetch_array($res);
@ -200,7 +199,8 @@ function email_filter($teacher) {
/**
* Actions in the list: edit, accept, reject, request additional information.
*/
function modify_filter($id) {
function modify_filter($id)
{
$code = CourseRequestManager::get_course_request_code($id);
$result = '<a href="course_request_edit.php?id='.$id.'&caller=0">'.Display::return_icon('edit.gif', get_lang('Edit'), array('style' => 'vertical-align: middle;')).'</a>'.
'&nbsp;<a href="?accept_course_request='.$id.'">'.Display::return_icon('accept.png', get_lang('AcceptThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ANewCourseWillBeCreated'), $code), ENT_QUOTES)).'\')) return false;'),16).'</a>'.
@ -211,6 +211,7 @@ function modify_filter($id) {
if (DELETE_ACTION_ENABLED) {
$result .= '&nbsp;<a href="?delete_course_request='.$id.'">'.Display::return_icon('delete.gif', get_lang('DeleteThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeDeleted'), $code), ENT_QUOTES)).'\')) return false;')).'</a>';
}
return $result;
}
@ -254,7 +255,7 @@ echo '</div>';
// Create a sortable table with the course data.
$offet = DELETE_ACTION_ENABLED ? 1 : 0;
$table = new SortableTable('course_requests_review', 'get_number_of_requests', 'get_request_data', 4 + $offet, 20, 'DESC');
$table->set_additional_parameters($parameters);
//$table->set_additional_parameters($parameters);
if (DELETE_ACTION_ENABLED) {
$table->set_header(0, '', false);
}
@ -271,6 +272,4 @@ if (DELETE_ACTION_ENABLED) {
}
$table->display();
/* FOOTER */
Display :: display_footer();

@ -211,19 +211,19 @@ if (count($errors) != 0) {
// Displaying the form.
$form->display();
?>
<p><?php echo get_lang('CSVMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p>
<blockquote>
<p><?php echo get_lang('CSVMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p>
<blockquote>
<pre>
<b>UserName</b>;<b>CourseCode</b>;<b>Status</b>
jdoe;course01;<?php echo COURSEMANAGER; ?>
adam;course01;<?php echo STUDENT; ?>
adam;course01;<?php echo STUDENT; ?>
</pre>
<?php
echo COURSEMANAGER.': '.get_lang('Teacher').'<br />';
echo STUDENT.': '.get_lang('Student').'<br />';
?>
</blockquote>
<?php
echo COURSEMANAGER.': '.get_lang('Teacher').'<br />';
echo STUDENT.': '.get_lang('Student').'<br />';
?>
</blockquote>
<?php
Display :: display_footer();

@ -3,6 +3,7 @@
/**
* @author Roan Embrechts - initial admin interface
* @package chamilo.admin
* @deprecated
*/
/**
* INIT SECTION

Loading…
Cancel
Save