Feature #272 - Revision and cleaning of all the include files.

skala
Ivan Tcholakov 16 years ago
parent 05a14efe4c
commit 8aae1a67e3
  1. 61
      main/inc/banner.inc.php
  2. 252
      main/inc/course_document.inc.php
  3. 29
      main/inc/footer.inc.php
  4. 52
      main/inc/global.inc.php
  5. 11
      main/inc/global_error_message.inc.php
  6. 108
      main/inc/header.inc.php
  7. 91
      main/inc/introductionSection.inc.php
  8. 52
      main/inc/latex.php
  9. 10
      main/inc/local.inc.php
  10. 101
      main/inc/reduced_header.inc.php
  11. 101
      main/inc/tool_navigation_menu.inc.php

@ -1,14 +1,14 @@
<?php
/* For licensing terms, see /chamilo_license.txt */
/* For licensing terms, see /license.txt */
/**
* This script contains the actual html code to display the "header"
* or "banner" on top of every Dokeos page.
* or "banner" on top of every Chamilo page.
*
* @package chamilo.include
*/
require_once api_get_path(SYS_CODE_PATH).'/inc/lib/banner.lib.php';
require_once api_get_path(LIBRARY_PATH).'banner.lib.php';
$session_id = api_get_session_id();
$session_name = api_get_session_name($my_session_id);
@ -29,9 +29,9 @@ $session_name = api_get_session_name($my_session_id);
?>
</div>
<?php
/*
Course title section
*/
/* Course title section */
if (!empty($_cid) and $_cid != -1 and isset($_course)) {
//Put the name of the course in the header
?>
@ -63,18 +63,16 @@ if (!empty($_cid) and $_cid != -1 and isset($_course)) {
} else {
echo '<div id="my_courses"></div>';
}
//not to let the header disappear if there's nothing on the left
//Don't let the header disappear if there's nothing on the left
echo '<div class="clear">&nbsp;</div>';
/*
Plugins for banner section
*/
/* Plugins for banner section */
api_plugin('header');
$web_course_path = api_get_path(WEB_COURSE_PATH);
/*
External link section
*/
/* External link section */
if (isset($_course['extLink']) && $_course['extLink']['name'] != '') {
echo '<span class="extLinkSeparator"> / </span>';
if ($_course['extLink']['url'] != '') {
@ -106,7 +104,6 @@ if ((api_get_setting('showonline', 'world') == 'true' AND !$_user['user_id']) OR
echo '<li>';
// Display the who's online of the platform
if ((api_get_setting('showonline', 'world') == 'true' AND !$_user['user_id']) OR (api_get_setting('showonline', 'users') == 'true' AND $_user['user_id'])) {
//echo '<a href="'.api_get_path(WEB_PATH).'whoisonline.php" target="_top">'.$number.'</a>';
echo '<a href="'.api_get_path(WEB_PATH).'whoisonline.php" target="_top">'.get_lang('UsersOnline').': '.$number.'</a>';
}
@ -129,8 +126,8 @@ if (api_is_allowed_to_edit()) {
// Show help
?>
<li>|
<a href="#" onclick="MyWindow=window.open('<?php echo api_get_path(WEB_CODE_PATH).'help/help.php'; ?>?open=<?php echo $help; ?>','MyWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=620,height=600,left=200,top=20'); return false;">
<img src="<?php echo api_get_path(WEB_CODE_PATH); ?>img/khelpcenter.gif" style="vertical-align: middle;" alt="<?php echo get_lang('Help'); ?>"/>&nbsp;<?php echo get_lang('Help'); ?></li></a>
<a href="#" onclick="javascript: MyWindow=window.open('<?php echo api_get_path(WEB_CODE_PATH).'help/help.php'; ?>?open=<?php echo $help; ?>','MyWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=620,height=600,left=200,top=20'); return false;">
<img src="<?php echo api_get_path(WEB_IMG_PATH); ?>khelpcenter.gif" style="vertical-align: middle;" alt="<?php echo get_lang('Help'); ?>"/>&nbsp;<?php echo get_lang('Help'); ?></li></a>
<?php
}
@ -143,12 +140,12 @@ if (api_is_allowed_to_edit()) {
<div id="header3">
<?php
/*
User section
*/
/* User section */
if ($_user['user_id']) {
$login = '';
if(api_is_anonymous()) {
if (api_is_anonymous()) {
$login = '('.get_lang('Anonymous').')';
} else {
$uinfo = api_get_user_info(api_get_user_id());
@ -180,7 +177,7 @@ if ($_user['user_id'] && !api_is_anonymous()) {
// My Courses
if (api_get_setting('show_tabs', 'my_courses') == 'true') {
$navigation['mycourses'] = $possible_tabs['mycourses'];
} else{
} else {
$menu_navigation['mycourses'] = $possible_tabs['mycourses'];
}
@ -209,13 +206,13 @@ if ($_user['user_id'] && !api_is_anonymous()) {
// Reporting
if (api_get_setting('show_tabs', 'reporting') == 'true') {
if(api_is_allowed_to_create_course() || $_user['status'] == DRH) {
if (api_is_allowed_to_create_course() || $_user['status'] == DRH) {
$navigation['session_my_space'] = $possible_tabs['session_my_space'];
} else {
$navigation['session_my_space'] = $possible_tabs['session_my_progress'];
}
} else {
if(api_is_allowed_to_create_course() || $_user['status'] == DRH) {
if (api_is_allowed_to_create_course() || $_user['status'] == DRH) {
$menu_navigation['session_my_space'] = $possible_tabs['session_my_space'];
} else {
$menu_navigation['session_my_space'] = $possible_tabs['session_my_progress'];
@ -331,8 +328,8 @@ if (api_get_self() != '/main/admin/configure_homepage.php') {
$enreg = trim($enreg);
if (!empty($enreg)) {
$edit_link = '<a href="'.api_get_self().'?action=edit_tabs&amp;link_index='.$key.'" ><span>'.Display::return_icon('edit.gif', get_lang('Edit')).'</span></a>';
$delete_link = '<a href="'.api_get_self().'?action=delete_tabs&amp;link_index='.$key.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;"><span>'.Display::return_icon('delete.gif', get_lang('Delete')).'</span></a>';
$tab_string = str_replace(array('href="'.api_get_path(WEB_PATH).'index.php?include=','</li>'),array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename(api_get_self()).'?action=open_link&link=',''.$edit_link.$delete_link.'</li>'),$enreg);
$delete_link = '<a href="'.api_get_self().'?action=delete_tabs&amp;link_index='.$key.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;"><span>'.Display::return_icon('delete.gif', get_lang('Delete')).'</span></a>';
$tab_string = str_replace(array('href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'), array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename(api_get_self()).'?action=open_link&link=', $edit_link.$delete_link.'</li>'), $enreg);
echo $tab_string;
}
}
@ -352,7 +349,7 @@ $navigation = array();
// part 1: Course Homepage. If we are in a course then the first breadcrumb is a link to the course homepage
// hide_course_breadcrumb the parameter has been added to hide the name of the course, that appeared in the default $interbreadcrumb
$my_session_name = is_null($session_name) ? '' : '&nbsp;('.$session_name.')';
if (isset ($_cid) and $_cid != -1 and isset($_course) and !isset($_GET['hide_course_breadcrumb'])) {
if (isset($_cid) and $_cid != -1 and isset($_course) and !isset($_GET['hide_course_breadcrumb'])) {
$navigation_item['url'] = $web_course_path . $_course['path'].'/index.php'.(!empty($session_id) ? '?id_session='.$session_id : '');
switch (api_get_setting('breadcrumbs_course_homepage')) {
case 'get_lang':
@ -409,7 +406,7 @@ if (api_get_setting('show_toolshortcuts') == 'true') {
echo '</div>';
}
if (isset ($dokeos_database_connection)) {
if (isset($dokeos_database_connection)) {
// connect to the main database.
// if single database, don't pefix table names with the main database name in SQL queries
// (ex. SELECT * FROM `table`)
@ -433,9 +430,8 @@ if (!empty($header_hide_main_div) && $header_hide_main_div === true) {
<?php
}
/*
"call for chat" module section
*/
/* "call for chat" module section */
$chat = strpos(api_get_self(), 'chat_banner.php');
if (!$chat) {
include_once api_get_path(LIBRARY_PATH).'online.inc.php';
@ -446,9 +442,8 @@ if (!$chat) {
}
}
/*
Navigation menu section
*/
/* Navigation menu section */
if (api_get_setting('show_navigation_menu') != 'false' && api_get_setting('show_navigation_menu') != 'icons') {
Display::show_course_navigation_menu($_GET['isHidden']);
$course_id = api_get_course_id();

@ -1,88 +1,76 @@
<?php
/* For licensing terms, see /license.txt */
/* INIT SECTION */
$language_file = array('create_course', 'document');
include_once('global.inc.php');
require_once(api_get_path(SYS_CODE_PATH).'inc/lib/course_document.lib.php');
/*
==============================================================================
INIT SECTION
==============================================================================
*/
// name of the language file that needs to be included
require 'global.inc.php';
require_once api_get_path(INCLUDE_PATH).'lib/fckeditor/repository.php';
/* Libraries */
include(api_get_path(SYS_CODE_PATH).'document/document.inc.php');
require_once api_get_path(LIBRARY_PATH).'course_document.lib.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/repository.php';
require_once api_get_path(SYS_CODE_PATH).'document/document.inc.php';
require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php';
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
require_once api_get_path(LIBRARY_PATH).'tablesort.lib.php';
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
//if(!$is_in_admin){
if(!api_is_platform_admin()){
if (!api_is_platform_admin()){
api_protect_course_script();
}
//session
if(isset($_GET['id_session']))
if(isset($_GET['id_session'])) {
$_SESSION['id_session'] = intval($_GET['id_session']);
}
$htmlHeadXtra[] =
"<script type=\"text/javascript\">
function confirmation (name)
{
if (confirm(\" ". api_convert_encoding(get_lang('AreYouSureToDelete'), 'UTF-8', $charset) ." \"+ name + \" ?\"))
if (confirm(\" ". api_utf8_encode(get_lang('AreYouSureToDelete')) ." \"+ name + \" ?\"))
{return true;}
else
{return false;}
}
</script>";
/*
-----------------------------------------------------------
Variables
- some need defining before inclusion of libraries
-----------------------------------------------------------
*/
/* Variables
- some need defining before inclusion of libraries */
$sType = isset($sType) ? $sType : '';
if($sType=="MP3") $sType="audio";
if ($sType=="MP3") $sType="audio";
// Resource type
$sType = strtolower($sType);
// Choosing the repository to be used.
if (api_is_in_course())
{
if (!api_is_in_group())
{
if (api_is_in_course()) {
if (!api_is_in_group()) {
// 1. We are inside a course and not in a group.
if (api_is_allowed_to_edit())
{
if (api_is_allowed_to_edit()) {
// 1.1. Teacher
$base_work_dir = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document/';
$http_www = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/';
}
else
{
} else {
// 1.2. Student
$base_work_dir = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document/shared_folder/'.api_get_user_id().'/';
$http_www = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/shared_folder/'.api_get_user_id().'/';
}
}
else
{
} else {
// 2. Inside a course and inside a group.
$base_work_dir = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/';
$http_www = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/';
}
}
else
{
if (api_is_platform_admin() && $_SESSION['this_section'] == 'platform_admin')
{
} else {
if (api_is_platform_admin() && $_SESSION['this_section'] == 'platform_admin') {
// 3. Platform administration activities.
$base_work_dir = $_configuration['root_sys'].'home/default_platform_document/';
$http_www = $_configuration['root_web'].'home/default_platform_document/';
}
else
{
} else {
// 4. The user is outside courses.
$base_work_dir = $_configuration['root_sys'].'main/upload/users/'.api_get_user_id().'/my_files/';
$http_www = $_configuration['root_web'].'main/upload/users/'.api_get_user_id().'/my_files/';
@ -90,36 +78,27 @@ else
}
// Set the upload path according to the resource type.
if ($sType == 'audio')
{
if ($sType == 'audio') {
check_and_create_resource_directory($base_work_dir, '/audio', get_lang('Audio'));
$base_work_dir = $base_work_dir.'audio/';
$http_www = $http_www.'audio/';
$path = "/audio/";
}
elseif ($sType == 'flash')
{
} elseif ($sType == 'flash') {
check_and_create_resource_directory($base_work_dir, '/flash', get_lang('Flash'));
$base_work_dir = $base_work_dir.'flash/';
$http_www = $http_www.'flash/';
$path = "/flash/";
}
elseif ($sType == 'images')
{
} elseif ($sType == 'images') {
check_and_create_resource_directory($base_work_dir, '/images', get_lang('Images'));
$base_work_dir = $base_work_dir.'images/';
$http_www = $http_www.'images/';
$path = "/images/";
}
elseif ($sType == 'video')
{
} elseif ($sType == 'video') {
check_and_create_resource_directory($base_work_dir, '/video', get_lang('Video'));
$base_work_dir = $base_work_dir.'video/';
$http_www = $http_www.'video/';
$path = "/video/";
}
elseif ($sType == 'video/flv')
{
} elseif ($sType == 'video/flv') {
check_and_create_resource_directory($base_work_dir, '/video', get_lang('Video'));
check_and_create_resource_directory($base_work_dir, '/video/flv', 'flv');
$base_work_dir = $base_work_dir.'video/flv/';
@ -127,7 +106,7 @@ elseif ($sType == 'video/flv')
$path = "/video/flv/";
}
$course_dir = $_course['path']."/document/".$sType;
$course_dir = $_course['path'].'/document/'.$sType;
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$dbl_click_id = 0; // used to avoid double-click
@ -135,44 +114,20 @@ $is_allowed_to_edit = api_is_allowed_to_edit();
$req_gid = '';
/*
-----------------------------------------------------------
Libraries
-----------------------------------------------------------
*/
//libraries are included by default
include_once(api_get_path(LIBRARY_PATH) . 'fileDisplay.lib.php');
include_once(api_get_path(LIBRARY_PATH) . 'document.lib.php');
include_once(api_get_path(LIBRARY_PATH) . 'tablesort.lib.php');
/*
-----------------------------------------------------------
Constants and variables
-----------------------------------------------------------
*/
/* Constants and variables */
$course_quota = DocumentManager::get_course_quota();
/*
==============================================================================
MAIN SECTION
==============================================================================
*/
/* MAIN SECTION */
/*
-----------------------------------------------------------
Header
-----------------------------------------------------------
*/
/* Header */
$tool_name = get_lang("Doc"); // title of the page (should come from the language file)
$tool_name = get_lang('Doc'); // Title of the page (should come from the language file)
?>
<style type="text/css" media="screen, projection">
/*<![CDATA[*/
@import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/public_admin/default.css";
@import "<?php echo api_get_path(WEB_CSS_PATH); ?>public_admin/default.css";
/*]]>*/
</style>
@ -182,7 +137,7 @@ if(api_get_setting('stylesheets')<>'')
?>
<style type="text/css" media="screen, projection">
/*<![CDATA[*/
@import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/<?php echo api_get_setting('stylesheets');?>/default.css";
@import "<?php echo api_get_path(WEB_CSS_PATH), api_get_setting('stylesheets'); ?>/default.css";
/*]]>*/
</style>
@ -191,99 +146,70 @@ if(api_get_setting('stylesheets')<>'')
$is_allowed_to_edit = api_is_allowed_to_edit();
if($is_allowed_to_edit) // TEACHER ONLY
{
if ($is_allowed_to_edit) { // TEACHER ONLY
/*======================================
DELETE FILE OR DIRECTORY
======================================*/
/* DELETE FILE OR DIRECTORY */
if ( isset($_GET['delete']) )
{
include_once(api_get_path(LIBRARY_PATH) . 'fileManage.lib.php');
if(DocumentManager::delete_document($_course,$_GET['delete'],$base_work_dir))
{
Display::display_normal_message(api_convert_encoding(get_lang('DocDeleted'), 'UTF-8', $charset));
}
else
{
Display::display_normal_message(api_convert_encoding(get_lang('DocDeleteError'), 'UTF-8', $charset));
if (isset($_GET['delete'])) {
if (DocumentManager::delete_document($_course,$_GET['delete'], $base_work_dir)) {
Display::display_normal_message(api_utf8_encode(get_lang('DocDeleted')));
} else {
Display::display_normal_message(api_utf8_encode(get_lang('DocDeleteError')));
}
}
if( isset($_POST['action']))
{
switch($_POST['action'])
{
if (isset($_POST['action'])) {
switch ($_POST['action']) {
case 'delete':
foreach($_POST['path'] as $index => $path)
{
DocumentManager::delete_document($_course,$path,$base_work_dir);
foreach ($_POST['path'] as $index => $path) {
DocumentManager::delete_document($_course, $path, $base_work_dir);
}
Display::display_normal_message(api_convert_encoding(get_lang('DocDeleted'), 'UTF-8', $charset));
Display::display_normal_message(api_utf8_encode(get_lang('DocDeleted')));
break;
}
}
}
/*
-----------------------------------------------------------
GET ALL DOCUMENT DATA FOR CURDIRPATH
-----------------------------------------------------------
*/
/* GET ALL DOCUMENT DATA FOR CURDIRPATH */
$docs_and_folders = getlist ($base_work_dir.'/');
?>
<?php
if($docs_and_folders)
{
//echo('<pre>');
//print_r($docs_and_folders);
//echo('</pre>');
//*************************************************************************************************
if ($docs_and_folders) {
//do we need the title field for the document name or not?
//we get the setting here, so we only have to do it once
$use_document_title = api_get_setting('use_document_title');
//create a sortable table with our data
$sortable_data = array();
while (list ($key, $id) = each($docs_and_folders))
{
while (list ($key, $id) = each($docs_and_folders)) {
// Skip directories.
if ($id['filetype'] != 'file')
{
if ($id['filetype'] != 'file') {
continue;
}
$row = array ();
//if the item is invisible, wrap it in a span with class invisible
$invisibility_span_open = ($id['visibility']==0)?'<span class="invisible">':'';
$invisibility_span_close = ($id['visibility']==0)?'</span>':'';
$invisibility_span_open = ($id['visibility'] == 0) ? '<span class="invisible">' : '';
$invisibility_span_close = ($id['visibility'] == 0) ? '</span>' : '';
//size (or total size of a directory)
$size = $id['filetype']=='folder' ? get_total_folder_size($id['path'],$is_allowed_to_edit) : $id[size];
$size = $id['filetype'] == 'folder' ? get_total_folder_size($id['path'], $is_allowed_to_edit) : $id[size];
//get the title or the basename depending on what we're using
if ($use_document_title=='true' AND $id['title']<>'')
{
if ($use_document_title == 'true' AND $id['title'] != '') {
$document_name=$id['title'];
}
else
{
$document_name=basename($id['path']);
} else {
$document_name = basename($id['path']);
}
//$row[] = $key; //testing
//data for checkbox
/*
if ($is_allowed_to_edit AND count($docs_and_folders)>1)
{
if ($is_allowed_to_edit AND count($docs_and_folders) > 1) {
$row[] = $id['path'];
}
*/
// icons with hyperlinks
$row[]= '<a href="#" onclick="javascript:OpenFile(\''.$http_www.'/'.$id['title'].'\', \''.$sType.'\');return false;">'.build_document_icon_tag($id['filetype'],$id['path']).'</a>';
$row[]= '<a href="#" onclick="javascript: OpenFile(\''.$http_www.'/'.$id['title'].'\', \''.$sType.'\');return false;">'.build_document_icon_tag($id['filetype'],$id['path']).'</a>';
//document title with hyperlink
$row[] = '<a href="#" onclick="javascript:OpenFile(\''.$http_www.'/'.$id['title'].'\', \''.$sType.'\');return false;">'.$id['title'].'</a>';
$row[] = '<a href="#" onclick="javascript: OpenFile(\''.$http_www.'/'.$id['title'].'\', \''.$sType.'\');return false;">'.$id['title'].'</a>';
//comments => display comment under the document name
//$row[] = $invisibility_span_open.nl2br(htmlspecialchars($id['comment'])).$invisibility_span_close;
$display_size = format_file_size($size);
@ -294,66 +220,56 @@ if($docs_and_folders)
$sortable_data[] = $row;
}
//*******************************************************************************************
}
else
{
$sortable_data=array();
} else {
$sortable_data = array();
//$table_footer='<div style="text-align:center;"><strong>'.get_lang('NoDocsInFolder').'</strong></div>';
}
$table = new SortableTableFromArray($sortable_data,4,10);
$table = new SortableTableFromArray($sortable_data, 4, 10);
$query_vars['curdirpath'] = $curdirpath;
if(isset($_SESSION['_gid']))
{
if (isset($_SESSION['_gid'])) {
$query_vars['gidReq'] = $_SESSION['_gid'];
}
$table->set_additional_parameters($query_vars);
$column = 0;
/*
if ($is_allowed_to_edit AND count($docs_and_folders)>1)
{
$table->set_header($column++,'',false);
if ($is_allowed_to_edit AND count($docs_and_folders) > 1) {
$table->set_header($column++, '', false);
}
*/
$table->set_header($column++, api_htmlentities(get_lang('Type'), ENT_QUOTES, $charset));
$table->set_header($column++, api_htmlentities(get_lang('Title'), ENT_QUOTES, $charset));
$table->set_header($column++, api_htmlentities(get_lang('Type'), ENT_QUOTES));
$table->set_header($column++, api_htmlentities(get_lang('Title'), ENT_QUOTES));
//$column_header[] = array(get_lang('Comment'),true); => display comment under the document name
$table->set_header($column++, api_htmlentities(get_lang('Size'), ENT_QUOTES, $charset));
$table->set_header($column++, api_htmlentities(get_lang('Date'), ENT_QUOTES, $charset));
$table->set_header($column++, api_htmlentities(get_lang('Size'), ENT_QUOTES));
$table->set_header($column++, api_htmlentities(get_lang('Date'), ENT_QUOTES));
//currently only delete action -> take only DELETE right into account
/*
if (count($docs_and_folders)>1)
{
if ($is_allowed_to_edit)
{
if (count($docs_and_folders) > 1) {
if ($is_allowed_to_edit) {
$form_actions = array();
$form_action['delete'] = get_lang('Delete');
$table->set_form_actions($form_action,'path');
$table->set_form_actions($form_action, 'path');
}
}
*/
echo api_convert_encoding($table->get_table_html(), 'UTF-8', $charset);
echo api_convert_encoding($table_footer, 'UTF-8', $charset);
////////// functions ////////////
echo api_utf8_encode($table->get_table_html());
echo api_utf8_encode($table_footer);
// Functions
?>
<script type="text/javascript">
<!--
function OpenFile( fileUrl, type )
{
if(type=="audio")
if (type=="audio")
{
ret = confirm('<?php echo api_convert_encoding(get_lang('AutostartMp3'), 'UTF-8', $charset); ?>');
if(ret==true)
ret = confirm('<?php echo api_utf8_encode(get_lang('AutostartMp3')); ?>');
if (ret==true)
{
GetE('autostart').checked = true;
}

@ -1,13 +1,12 @@
<?php
/* For licensing terms, see /chamilo_license.txt */
/* For licensing terms, see /license.txt */
/**
==============================================================================
* This script displays the footer that is below (almost)
* every Chamilo web page.
*
* @package chamilo.include
==============================================================================
*/
* This script displays the footer that is below (almost)
* every Chamilo web page.
*
* @package chamilo.include
*/
// Display of tool_navigation_menu according to admin setting.
require_once api_get_path(LIBRARY_PATH).'course.lib.php';
@ -35,12 +34,14 @@ if (api_get_setting('show_navigation_menu') != 'false') {
<div class="copyright">
<?php
global $_configuration;
if (api_get_setting('show_administrator_data') == 'true') {
// Platform manager
echo '<div align="right">', get_lang('Manager'), ' : ', Display::encrypted_mailto_link(api_get_setting('emailAdministrator'), api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))).'</div>';
}
echo get_lang("Platform"), ' <a href="', $_configuration['software_url'], '" target="_blank">', $_configuration['software_name'], ' ', $_configuration['system_version'], '</a> &copy; ', date('Y');
echo get_lang('Platform'), ' <a href="', $_configuration['software_url'], '" target="_blank">', $_configuration['software_name'], ' ', $_configuration['system_version'], '</a> &copy; ', date('Y');
// Server mode indicator.
if (api_is_platform_admin()) {
if (api_get_setting('server_type') == 'test') {
@ -52,17 +53,15 @@ if (api_is_platform_admin()) {
</div>
<?php
/*
-----------------------------------------------------------------------------
Plugins for footer section
-----------------------------------------------------------------------------
*/
/* Plugins for footer section */
api_plugin('footer');
echo '<div class="footer_emails">';
if (api_get_setting('show_tutor_data') == 'true') {
// course manager
// Course manager
$id_course = api_get_course_id();
$id_session = api_get_session_id();
if (isset($id_course) && $id_course != -1) {

@ -1,23 +1,25 @@
<?php
/* For licensing terms, see /license.txt */
/**
* It is recommended that ALL Chamilo scripts include this important file.
* This script manages
* - http get, post, post_files, session, server-vars extraction into global namespace;
* (which doesn't occur anymore when servertype config setting is set to test,
* and which will disappear completely in Dokeos 1.6.1)
* - include of /conf/configuration.php;
* - include of several libraries: main_api, database, display, text, security;
* - selecting the main database;
* - include of language files.
*
* @package dokeos.include
* @todo isn't configuration.php renamed to configuration.inc.php yet?
* @todo use the $_configuration array for all the needed variables
* @todo remove the code that displays the button that links to the install page
* but use a redirect immediately. By doing so the $already_installed variable can be removed.
* @todo make it possible to enable / disable the tracking through the Dokeos config page.
*
*/
* It is recommended that ALL Chamilo scripts include this important file.
* This script manages
* - http get, post, post_files, session, server-vars extraction into global namespace;
* (which doesn't occur anymore when servertype config setting is set to test,
* and which will disappear completely in Dokeos 1.6.1)
* - include of /conf/configuration.php;
* - include of several libraries: main_api, database, display, text, security;
* - selecting the main database;
* - include of language files.
*
* @package chamilo.include
* @todo isn't configuration.php renamed to configuration.inc.php yet?
* @todo use the $_configuration array for all the needed variables
* @todo remove the code that displays the button that links to the install page
* but use a redirect immediately. By doing so the $already_installed variable can be removed.
* @todo make it possible to enable / disable the tracking through the Chamilo config page.
*
*/
// Showing/hiding error codes in global error messages.
define('SHOW_ERROR_CODES', false);
@ -38,7 +40,7 @@ if (!function_exists('version_compare') || version_compare(phpversion(), REQUIRE
}
// @todo Isn't this file renamed to configuration.inc.php yet?
// Include the main Dokeos platform configuration file.
// Include the main Chamilo platform configuration file.
$main_configuration_file_path = $includePath.'/conf/configuration.php';
$already_installed = false;
@ -74,7 +76,7 @@ if (empty($_configuration['system_version'])) {
$_configuration['dokeos_version'] = $_configuration['system_version'];
$_configuration['dokeos_stable'] = $_configuration['system_stable'];
// Include the main Dokeos platform library file.
// Include the main Chamilo platform library file.
require_once $includePath.'/lib/main_api.lib.php';
// Do not over-use this variable. It is only for this script's local use.
@ -104,7 +106,7 @@ if (empty($_configuration['statistics_database']) && $already_installed) {
$_configuration['statistics_database'] = $_configuration['main_database'];
}
// Connect to the server database and select the main dokeos database.
// Connect to the server database and select the main chamilo database.
if (!($dokeos_database_connection = @Database::connect(
array(
'server' => $_configuration['db_host'],
@ -128,7 +130,7 @@ if (!$_configuration['db_host']) {
if (!empty($_configuration['multiple_access_urls'])) {
$_configuration['access_url'] = 1;
$access_urls = api_get_access_urls();
$protocol = ((!empty($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) != 'OFF') ? 'https' : 'http').'://';
$request_url1 = $protocol.$_SERVER['SERVER_NAME'].'/';
$request_url2 = $protocol.$_SERVER['HTTP_HOST'].'/';
@ -142,7 +144,7 @@ if (!empty($_configuration['multiple_access_urls'])) {
$_configuration['access_url'] = 1;
}
// This function is moved here after the database connections was made since api_session_start will call the api_get_path() function and this function will call a Database function
// This function is moved here after the database connections was made since api_session_start will call the api_get_path() function and this function will call a Database function
// Start session.
api_session_start($already_installed);
@ -151,7 +153,7 @@ Database::query("set session sql_mode='';");
if (!Database::select_db($_configuration['main_database'], $dokeos_database_connection)) {
$global_error_code = 5;
// Connection to the main Dokeos database is impossible, it might be missing or restricted or its configuration option might be incorrect.
// Connection to the main Chamilo database is impossible, it might be missing or restricted or its configuration option might be incorrect.
require $includePath.'/global_error_message.inc.php';
die();
}
@ -179,7 +181,7 @@ Database::query("SET SESSION character_set_server='utf8';");
Database::query("SET SESSION collation_server='utf8_general_ci';");
Database::query("SET CHARACTER SET '" . Database::to_db_encoding($charset) . "';");
// access_url == 1 is the default dokeos location
// access_url == 1 is the default chamilo location
if ($_configuration['access_url'] != 1) {
$url_info = api_get_access_url($_configuration['access_url']);
if ($url_info['active'] == 1) {

@ -1,14 +1,11 @@
<?php
/* For licensing terms, see /chamilo_license.txt */
/* For licensing terms, see /license.txt */
/**
*==============================================================================
* This script displays error messages on fatal errors
* during initialization.
* This script displays error messages on fatal errors during initialization.
*
* @package dokeos.include
* @author Ivan Tcholakov, 2009
*==============================================================================
* @package chamilo.include
* @author Ivan Tcholakov, 2009-2010
*/
$Organisation = '<a href="http://www.chamilo.org" target="_blank">Chamilo Homepage</a>';

@ -1,17 +1,13 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /license.txt */
/**
==============================================================================
* This script displays the Dokeos header.
*
* @package dokeos.include
==============================================================================
*/
* This script displays the Chamilo header.
*
* @package chamilo.include
*/
/*----------------------------------------
HEADERS SECTION
--------------------------------------*/
/* HEADERS SECTION */
/*
* HTTP HEADER
@ -21,14 +17,12 @@ header('Content-Type: text/html; charset='.api_get_system_encoding());
$navigator_info = api_get_navigator();
//ie6 fix
if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') {
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/iepngfix/iepngfix_tilebg.js" type="text/javascript" language="javascript"></script>'; //jQuery
if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/iepngfix/iepngfix_tilebg.js" type="text/javascript" language="javascript"></script>';
}
if ( isset($httpHeadXtra) && $httpHeadXtra )
{
foreach($httpHeadXtra as $thisHttpHead)
{
if (isset($httpHeadXtra) && $httpHeadXtra) {
foreach ($httpHeadXtra as & $thisHttpHead) {
header($thisHttpHead);
}
}
@ -48,11 +42,11 @@ $document_language = api_get_language_isocode();
<head>
<title>
<?php
if(!empty($nameTools)) {
if (!empty($nameTools)) {
echo $nameTools.' - ';
}
if(!empty($_course['official_code'])) {
if (!empty($_course['official_code'])) {
echo $_course['official_code'].' - ';
}
@ -64,46 +58,37 @@ echo api_get_setting('siteName');
/*<![CDATA[*/
<?php
$platform_theme= api_get_setting('stylesheets'); // plataform's css
$my_style=$platform_theme;
$platform_theme = api_get_setting('stylesheets'); // plataform's css
$my_style = $platform_theme;
if(api_get_setting('user_selected_theme') == 'true')
{
if (api_get_setting('user_selected_theme') == 'true') {
$useri = api_get_user_info();
$user_theme = $useri['theme'];
if(!empty($user_theme) && $user_theme != $my_style)
{
if (!empty($user_theme) && $user_theme != $my_style) {
$my_style = $user_theme; // user's css
}
}
$mycourseid = api_get_course_id();
if (!empty($mycourseid) && $mycourseid != -1) {
if (api_get_setting('allow_course_theme') == 'true')
{
if (api_get_setting('allow_course_theme') == 'true') {
$mycoursetheme=api_get_course_setting('course_theme');
if (!empty($mycoursetheme) && $mycoursetheme!=-1)
{
if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
{
if (!empty($mycoursetheme) && $mycoursetheme != -1) {
if (!empty($mycoursetheme) && $mycoursetheme != $my_style) {
$my_style = $mycoursetheme; // course's css
}
}
$mycourselptheme=api_get_course_setting('allow_learning_path_theme');
if (!empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1)
{
$mycourselptheme = api_get_course_setting('allow_learning_path_theme');
if (!empty($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
global $lp_theme_css; // it comes from the lp_controller.php
global $lp_theme_config; // it comes from the lp_controller.php
if (!$lp_theme_config)
{
if ($lp_theme_css!='')
{
$theme=$lp_theme_css;
if(!empty($theme) && $theme != $my_style)
{
if (!$lp_theme_config) {
if ($lp_theme_css != '') {
$theme = $lp_theme_css;
if (!empty($theme) && $theme != $my_style) {
$my_style = $theme; // LP's css
}
}
@ -115,17 +100,16 @@ if (!empty($mycourseid) && $mycourseid != -1) {
global $show_learn_path;
if ($show_learn_path) {
$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_CODE_PATH).'css/'.$my_style.'/learnpath.css"/>';
$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_CSS_PATH).$my_style.'/learnpath.css"/>';
$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="dtree.css" />'; //will be moved
$htmlHeadXtra[] = '<script src="dtree.js" type="text/javascript"></script>'; //will be moved
}
$my_code_path = api_get_path(WEB_CODE_PATH);
if(empty($my_style)) {
if (empty($my_style)) {
$my_style = 'dokeos_classic';
}
echo '@import "'.$my_code_path.'css/'.$my_style.'/default.css";'."\n";
echo '@import "'.$my_code_path.'css/'.$my_style.'/course.css";'."\n";
echo '@import "'.api_get_path(WEB_CSS_PATH).$my_style.'/default.css";'."\n";
echo '@import "'.api_get_path(WEB_CSS_PATH).$my_style.'/course.css";'."\n";
if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') {
echo 'img, div { behavior: url('.api_get_path(WEB_LIBRARY_PATH).'javascript/iepngfix/iepngfix.htc) } ';
@ -137,15 +121,15 @@ if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=
<style type="text/css" media="print">
/*<![CDATA[*/
<?php
echo '@import "'.$my_code_path.'css/'.$my_style.'/print.css";'."\n";
echo '@import "'.api_get_path(WEB_CSS_PATH).$my_style.'/print.css";'."\n";
?>
/*]]>*/
</style>
<link rel="top" href="<?php echo api_get_path(WEB_PATH); ?>index.php" title="" />
<link rel="courses" href="<?php echo api_get_path(WEB_CODE_PATH) ?>auth/courses.php" title="<?php echo api_htmlentities(get_lang('OtherCourses'),ENT_QUOTES,$charset); ?>" />
<link rel="profil" href="<?php echo api_get_path(WEB_CODE_PATH) ?>auth/profile.php" title="<?php echo api_htmlentities(get_lang('ModifyProfile'),ENT_QUOTES,$charset); ?>" />
<link rel="courses" href="<?php echo api_get_path(WEB_CODE_PATH); ?>auth/courses.php" title="<?php echo api_htmlentities(get_lang('OtherCourses'), ENT_QUOTES); ?>" />
<link rel="profil" href="<?php echo api_get_path(WEB_CODE_PATH); ?>auth/profile.php" title="<?php echo api_htmlentities(get_lang('ModifyProfile'), ENT_QUOTES); ?>" />
<link href="http://www.chamilo.org/documentation.php" rel="Help" />
<link href="http://www.chamilo.org/team.php" rel="Author" />
<link href="http://www.chamilo.org" rel="Copyright" />
@ -180,35 +164,31 @@ if ( ( navigator.userAgent.toLowerCase().indexOf('msie') != -1 ) && ( navigator.
</script>
<?php
if ( isset($htmlHeadXtra) && $htmlHeadXtra )
{
foreach($htmlHeadXtra as $this_html_head)
{
echo($this_html_head);
if (isset($htmlHeadXtra) && $htmlHeadXtra) {
foreach ($htmlHeadXtra as & $this_html_head) {
echo $this_html_head;
}
}
if ( isset($htmlIncHeadXtra) && $htmlIncHeadXtra )
{
foreach($htmlIncHeadXtra as $this_html_head)
{
if (isset($htmlIncHeadXtra) && $htmlIncHeadXtra) {
foreach ($htmlIncHeadXtra as & $this_html_head) {
include($this_html_head);
}
}
//the following include might be subject to a setting proper to the course or platform
include(api_get_path(LIBRARY_PATH).'/javascript/email_links.lib.js.php');
// The following include might be subject to a setting proper to the course or platform.
include api_get_path(LIBRARY_PATH).'javascript/email_links.lib.js.php';
?>
</head>
<body dir="<?php echo api_get_text_direction(); ?>" <?php
if(defined('DOKEOS_HOMEPAGE') && DOKEOS_HOMEPAGE)
echo 'onload="javascript:if(document.formLogin) { document.formLogin.login.focus(); }"'; ?>>
if (defined('DOKEOS_HOMEPAGE') && DOKEOS_HOMEPAGE)
echo 'onload="javascript: if(document.formLogin) { document.formLogin.login.focus(); }"'; ?>>
<div class="skip">
<ul>
<li><a href="#menu"><?php echo ( get_lang('WCAGGoMenu') )?></a></li>
<li><a href="#content" accesskey="2"><?php echo ( get_lang('WCAGGoContent') )?></a></li>
<li><a href="#menu"><?php echo get_lang('WCAGGoMenu'); ?></a></li>
<li><a href="#content" accesskey="2"><?php echo get_lang('WCAGGoContent'); ?></a></li>
</ul>
</div>
<?php
// Banner
// Banner
require_once api_get_path(INCLUDE_PATH).'banner.inc.php';

@ -1,10 +1,10 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /license.txt */
/**
==============================================================================
* The INTRODUCTION MICRO MODULE is used to insert and edit
* an introduction section on a Dokeos Module. It can be inserted on any
* Dokeos Module, provided a connection to a course Database is already active.
* an introduction section on a Chamilo Module. It can be inserted on any
* Chamilo Module, provided a connection to a course Database is already active.
*
* The introduction content are stored on a table called "introduction"
* in the course Database. Each module introduction has an Id stored on
@ -19,30 +19,26 @@
*
* $moduleId = XX // specifying the module Id
* include(moduleIntro.inc.php);
*
* @package dokeos.include
==============================================================================
*/
*
* @package chamilo.include
*/
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once api_get_path(LIBRARY_PATH).'course_description.lib.php';
/*
-----------------------------------------------------------
Constants and variables
-----------------------------------------------------------
*/
/* Constants and variables */
$TBL_INTRODUCTION = Database::get_course_table(TABLE_TOOL_INTRO);
$intro_editAllowed = $is_allowed_to_edit;
global $charset;
$intro_cmdEdit = (empty($_GET['intro_cmdEdit'])?'':$_GET['intro_cmdEdit']);
$intro_cmdUpdate = isset($_POST['intro_cmdUpdate'])?true:false;
$intro_cmdDel= (empty($_GET['intro_cmdDel'])?'':$_GET['intro_cmdDel']);
$intro_cmdAdd= (empty($_GET['intro_cmdAdd'])?'':$_GET['intro_cmdAdd']);
$intro_cmdEdit = empty($_GET['intro_cmdEdit']) ? '' : $_GET['intro_cmdEdit'];
$intro_cmdUpdate = isset($_POST['intro_cmdUpdate']);
$intro_cmdDel = empty($_GET['intro_cmdDel']) ? '' : $_GET['intro_cmdDel'];
$intro_cmdAdd = empty($_GET['intro_cmdAdd']) ? '' : $_GET['intro_cmdAdd'];
if (!empty ($GLOBALS["_cid"])) {
$form = new FormValidator('introduction_text', 'post', api_get_self()."?".api_get_cidreq());
if (!empty ($GLOBALS['_cid'])) {
$form = new FormValidator('introduction_text', 'post', api_get_self().'?'.api_get_cidreq());
} else {
$form = new FormValidator('introduction_text');
}
@ -84,28 +80,25 @@ if (is_array($editor_config)) {
$form->add_html_editor('intro_content', null, null, false, $editor_config);
$form->addElement('style_submit_button', 'intro_cmdUpdate', get_lang('SaveIntroText'), 'class="save"');
/*=========================================================
INTRODUCTION MICRO MODULE - COMMANDS SECTION (IF ALLOWED)
========================================================*/
/* INTRODUCTION MICRO MODULE - COMMANDS SECTION (IF ALLOWED) */
if ($intro_editAllowed) {
/* Replace command */
if ( $intro_cmdUpdate ) {
if ( $form->validate()) {
if ($intro_cmdUpdate) {
if ($form->validate()) {
$form_values = $form->exportValues();
$intro_content = Security::remove_XSS(stripslashes(api_html_entity_decode($form_values['intro_content'])), COURSEMANAGERLOWSECURITY);
if ( ! empty($intro_content) ) {
if (!empty($intro_content)) {
$sql = "REPLACE $TBL_INTRODUCTION SET id='$moduleId',intro_text='".Database::escape_string($intro_content)."'";
Database::query($sql);
Display::display_confirmation_message(get_lang('IntroductionTextUpdated'),false);
Display::display_confirmation_message(get_lang('IntroductionTextUpdated'), false);
} else {
$intro_cmdDel = true; // got to the delete command
}
} else {
$intro_cmdEdit = true;
}
@ -117,13 +110,10 @@ if ($intro_editAllowed) {
Database::query("DELETE FROM $TBL_INTRODUCTION WHERE id='".$moduleId."'");
Display::display_confirmation_message(get_lang('IntroductionTextDeleted'));
}
}
/*===========================================
INTRODUCTION MICRO MODULE - DISPLAY SECTION
===========================================*/
/* INTRODUCTION MICRO MODULE - DISPLAY SECTION */
/* Retrieves the module introduction text, if exist */
@ -135,9 +125,11 @@ $intro_content = $intro_dbResult['intro_text'];
/* Determines the correct display */
if ($intro_cmdEdit || $intro_cmdAdd) {
$intro_dispDefault = false;
$intro_dispForm = true;
$intro_dispCommand = false;
} else {
$intro_dispDefault = true;
@ -148,7 +140,6 @@ if ($intro_cmdEdit || $intro_cmdAdd) {
} else {
$intro_dispCommand = false;
}
}
/* Executes the display */
@ -156,7 +147,6 @@ if ($intro_cmdEdit || $intro_cmdAdd) {
if ($intro_dispForm) {
$default['intro_content'] = $intro_content;
$form->setDefaults($default);
//echo '<div id="courseintro">';
echo '<div id="courseintro" style="width: 100%">';
$form->display();
echo '</div>';
@ -164,21 +154,21 @@ if ($intro_dispForm) {
$style_introduction_section = 'style="margin-left:10%;margin-right:10%;"';
$thematic_description_html = '';
if ($tool==TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
$course_description = new CourseDescription();
$course_description->set_session_id(api_get_session_id());
$thematic_description = $course_description->get_data_by_description_type(8);
if (!empty($thematic_description)) {
$style_introduction_section = 'style="width:65%;float:left;margin-left:10%;"';
$thematic_advance = get_lang('ThematicAdvance').'&nbsp;'.$course_description->get_progress_porcent(false,8);
if (api_is_allowed_to_edit(null,true)) {
$thematic_advance = '<a href="'.api_get_path(WEB_CODE_PATH).'course_description/index.php?action=edit&'.api_get_cidreq().'&description_type=8'.'">'.get_lang('ThematicAdvance').'&nbsp;'.$course_description->get_progress_porcent(false,8).'</a>';
$thematic_advance = get_lang('ThematicAdvance').'&nbsp;'.$course_description->get_progress_porcent(false, 8);
if (api_is_allowed_to_edit(null, true)) {
$thematic_advance = '<a href="'.api_get_path(WEB_CODE_PATH).'course_description/index.php?action=edit&'.api_get_cidreq().'&description_type=8'.'">'.get_lang('ThematicAdvance').'&nbsp;'.$course_description->get_progress_porcent(false, 8).'</a>';
}
$thematic_description_html = '<div style="width:20%;float:left;font-size:10pt;"><div class="thematic-postit">
<div class="thematic-postit-top"><a class="thematic-postit-head" style="" href="#">'.Display::return_icon('postit_top.png').'</a></div>
<div class="thematic-postit-center">
@ -188,8 +178,7 @@ if ($tool==TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
</div>
<div class="thematic-postit-bottom">'.Display::return_icon('postit_bottom.png').'</div>
</div></div>';
}
}
}
echo '<div '.$style_introduction_section.'>';
@ -203,11 +192,11 @@ if ($intro_dispDefault) {
if ($intro_dispCommand) {
if ( empty($intro_content) ) {
if (empty($intro_content)) {
//displays "Add intro" Commands
// Displays "Add intro" commands
echo "<div id=\"courseintro\"><p>\n";
if (!empty ($GLOBALS["_cid"])) {
if (!empty ($GLOBALS['_cid'])) {
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&amp;intro_cmdAdd=1\">\n".get_lang('AddIntro')."</a>\n";
} else {
echo "<a href=\"".api_get_self()."?intro_cmdAdd=1\">\n".get_lang('AddIntro')."</a>\n";
@ -216,9 +205,9 @@ if ($intro_dispCommand) {
} else {
// displays "edit intro && delete intro" Commands
// Displays "edit intro && delete intro" commands
echo "<div id=\"courseintro_icons\"><p>\n";
if (!empty ($GLOBALS["_cid"])) {
if (!empty ($GLOBALS['_cid'])) {
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&amp;intro_cmdEdit=1\"><img src=\"".api_get_path(WEB_CODE_PATH)."img/edit.gif\" alt=\"".get_lang('Modify')."\" border=\"0\" /></a>\n";
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&amp;intro_cmdDel=1\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset))."')) return false;\"><img src=\"".api_get_path(WEB_CODE_PATH)."img/delete.gif\" alt=\"".get_lang('Delete')."\" border=\"0\" /></a>\n";
} else {
@ -235,5 +224,3 @@ echo '</div>';
echo $thematic_description_html;
echo '<div class="clear"></div>';
?>

@ -6,53 +6,20 @@
<body>
<?php // $Id: latex.php,v 1.1 2006/04/05 07:18:46 pcool Exp $
/*
==============================================================================
Dokeos - elearning and course management software
/* For licensing terms, see /license.txt */
Copyright (c) 2004-2006 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) Patrick Cool <patrick.cool@UGent.be>, Ghent University
/* INIT SECTION */
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
include '../inc/global.inc.php';
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 address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/*
==============================================================================
INIT SECTION
==============================================================================
*/
include("../inc/global.inc.php");
/*
==============================================================================
FUNCTIONS
==============================================================================
*/
/* FUNCTIONS */
// put your functions here
// if the list gets large, divide them into different sections:
// display functions, tool logic functions, database functions
// try to place your functions into an API library or separate functions file - it helps reuse
/*
==============================================================================
MAIN CODE
==============================================================================
*/
/* MAIN CODE */
$code = Security::remove_XSS($_GET['code']);
@ -61,16 +28,13 @@ echo '<h3>'.get_lang('LatexCode').'</h3>';
echo stripslashes($code);
echo '</div>';
echo '<div id="latex_image">';
echo '<h3>'.get_lang('LatexFormula').'</h3>';
echo '<img src="'.api_get_path(WEB_COURSE_PATH).$_course['path'].'/temp/'.$code.'" alt="'.get_lang('LatexCode').'"/>';
echo '</div>';
/*
==============================================================================
FOOTER
==============================================================================
*/
/* FOOTER */
?>
</body>
</html>

@ -4,7 +4,7 @@
*
* SCRIPT PURPOSE
*
* This script initializes and manages Dokeos session information. It
* This script initializes and manages Chamilo session information. It
* keeps available session information up to date.
*
* You can request a course id. It will check if the course Id requested is the
@ -232,7 +232,7 @@ if (api_get_setting('allow_terms_conditions')=='true') {
$uData = Database::fetch_array($result);
if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE) {
//the authentification of this user is managed by Dokeos itself
//the authentification of this user is managed by Chamilo itself
$password = trim(stripslashes($password));
// determine if the password needs to be encrypted before checking
// $userPasswordCrypted is set in an external configuration file
@ -343,10 +343,10 @@ if (api_get_setting('allow_terms_conditions')=='true') {
// see configuration.php to define these
include_once($extAuthSource[$key]['login']);
/* >>>>>>>> External authentication modules <<<<<<<<< */
} else // no standard Dokeos login - try external authentification
} else // no standard Chamilo login - try external authentification
{
//huh... nothing to do... we shouldn't get here
error_log('Dokeos Authentication file '. $extAuthSource[$uData['auth_source']]['login']. ' could not be found - this might prevent your system from doing the corresponding authentication process',0);
error_log('Chamilo Authentication file '. $extAuthSource[$uData['auth_source']]['login']. ' could not be found - this might prevent your system from doing the corresponding authentication process',0);
}
if (!empty($_SESSION['request_uri'])) {
@ -403,7 +403,7 @@ if (api_get_setting('allow_terms_conditions')=='true') {
* - Implement user interface for api_get_setting('sso_authentication')
* } elseif (api_get_setting('sso_authentication')=='true') {
* - Work on a better validation for webservices paths. Current is very poor and exit
* - $master variable should be recovered from dokeos settings.
* - $master variable should be recovered from chamilo settings.
*/
$master = array(
'domain' => api_get_setting('sso_authentication_domain'), // 'localhost/project/drupal5',

@ -1,17 +1,15 @@
<?php
/* For licensing terms, see /license.txt */
/**
==============================================================================
* This script displays the Dokeos header up to the </head> tag
* IT IS A COPY OF header.inc.php EXCEPT that it doesn't start the body
* output.
*
* @package dokeos.include
==============================================================================
*/
/*----------------------------------------
HEADERS SECTION
--------------------------------------*/
* This script displays the Dokeos header up to the </head> tag
* IT IS A COPY OF header.inc.php EXCEPT that it doesn't start the body
* output.
*
* @package chamilo.include
*/
/* HEADERS SECTION */
/*
* HTTP HEADER
@ -19,10 +17,8 @@
header('Content-Type: text/html; charset='.api_get_system_encoding());
if ( isset($httpHeadXtra) && $httpHeadXtra )
{
foreach($httpHeadXtra as $thisHttpHead)
{
if (isset($httpHeadXtra) && $httpHeadXtra) {
foreach ($httpHeadXtra as & $thisHttpHead) {
header($thisHttpHead);
}
}
@ -33,18 +29,17 @@ $document_language = api_get_language_isocode();
/*
* HTML HEADER
*/
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $document_language; ?>" lang="<?php echo $document_language; ?>">
<head>
<title>
<?php
if(!empty($nameTools))
{
if (!empty($nameTools)) {
echo $nameTools.' - ';
}
if(!empty($_course['official_code']))
{
if (!empty($_course['official_code'])) {
echo $_course['official_code'].' - ';
}
@ -60,40 +55,32 @@ echo api_get_setting('siteName');
$platform_theme = api_get_setting('stylesheets'); // plataform's css
$my_style = $platform_theme;
if (api_get_setting('user_selected_theme') == 'true')
{
if (api_get_setting('user_selected_theme') == 'true') {
$useri = api_get_user_info();
$user_theme = $useri['theme'];
if(!empty($user_theme) && $user_theme != $my_style)
{
if (!empty($user_theme) && $user_theme != $my_style) {
$my_style = $user_theme; // user's css
}
}
$mycourseid = api_get_course_id();
if (!empty($mycourseid) && $mycourseid != -1)
{
if (api_get_setting('allow_course_theme') == 'true')
{
if (!empty($mycourseid) && $mycourseid != -1) {
if (api_get_setting('allow_course_theme') == 'true') {
$mycoursetheme=api_get_course_setting('course_theme');
if (!empty($mycoursetheme) && $mycoursetheme!=-1)
{
if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
{
if (!empty($mycoursetheme) && $mycoursetheme != -1) {
if (!empty($mycoursetheme) && $mycoursetheme != $my_style) {
$my_style = $mycoursetheme; // course's css
}
}
$mycourselptheme=api_get_course_setting('allow_learning_path_theme');
if (!empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1)
{
if (!empty($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
global $lp_theme_css; // it comes from the lp_controller.php
global $lp_theme_config; // it comes from the lp_controller.php
if (!empty($lp_theme_css))
{
$theme=$lp_theme_css;
if(!empty($theme) && $theme != $my_style)
{
if (!empty($theme) && $theme != $my_style) {
$my_style = $theme; // LP's css
}
}
@ -102,34 +89,27 @@ if (!empty($mycourseid) && $mycourseid != -1)
}
}
if (!empty($lp_theme_log)){
$my_style=$platform_theme;
if (!empty($lp_theme_log)) {
$my_style = $platform_theme;
}
// Sets the css reference it is call from lp_nav.php, lp_toc.php, lp_message, lp_log.php
if (!empty($scorm_css_header))
{
if (!empty($my_style))
{
$scorm_css=api_get_path(WEB_CODE_PATH).'css/'.$my_style.'/scorm.css';
$scormfs_css=api_get_path(WEB_CODE_PATH).'css/'.$my_style.'/scormfs.css';
}
else
{
$scorm_css='scorm.css';
$scormfs_css='scormfs.css';
if (!empty($scorm_css_header)) {
if (!empty($my_style)) {
$scorm_css = api_get_path(WEB_CSS_PATH).$my_style.'/scorm.css';
$scormfs_css = api_get_path(WEB_CSS_PATH).$my_style.'/scormfs.css';
} else {
$scorm_css = 'scorm.css';
$scormfs_css = 'scormfs.css';
}
if(!empty($display_mode) && $display_mode == 'fullscreen')
{
if (!empty($display_mode) && $display_mode == 'fullscreen') {
$htmlHeadXtra[] = '<style type="text/css" media="screen, projection">
/*<![CDATA[*/
@import "'.$scormfs_css.'";
/*]]>*/
</style>';
}
else
{
} else {
$htmlHeadXtra[] = '<style type="text/css" media="screen, projection">
/*<![CDATA[*/
@import "'.$scorm_css.'";
@ -139,12 +119,11 @@ if (!empty($scorm_css_header))
}
if($my_style!='')
{
if ($my_style != '') {
?>
<style type="text/css" media="screen, projection">
/*<![CDATA[*/
@import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/<?php echo $my_style;?>/default.css";
@import "<?php echo api_get_path(WEB_CSS_PATH), $my_style; ?>/default.css";
/*]]>*/
</style>
<?php
@ -188,11 +167,9 @@ if ( ( navigator.userAgent.toLowerCase().indexOf('msie') != -1 ) && ( navigator.
</script>
<?php
if ( isset($htmlHeadXtra) && $htmlHeadXtra )
{
foreach($htmlHeadXtra as $this_html_head)
{
echo($this_html_head);
if (isset($htmlHeadXtra) && $htmlHeadXtra) {
foreach ($htmlHeadXtra as & $this_html_head) {
echo $this_html_head;
}
}
?>

@ -1,82 +1,66 @@
<?php
// $Id: tool_navigation_menu.inc.php 22072 2009-07-14 15:14:42Z jhp1411 $
/* For licensing terms, see /chamilo_license.txt */
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Navigation menu display code
*
* @package dokeos.include
==============================================================================
*/
define('SHORTCUTS_HORIZONTAL',0);
define('SHORTCUTS_VERTICAL',1);
* Navigation menu display code
*
* @package dokeos.include
*/
define('SHORTCUTS_HORIZONTAL', 0);
define('SHORTCUTS_VERTICAL', 1);
/**
* Build the navigation items to show in a course menu
* @param boolean $include_admin_tools
*/
function get_navigation_items($include_admin_tools = false)
{
function get_navigation_items($include_admin_tools = false) {
global $is_courseMember;
global $_user;
global $_course;
if (!empty($_course['db_name']))
{
if (!empty($_course['db_name'])) {
$database = $_course['db_name'];
}
$navigation_items = array ();
$course_id = api_get_course_id();
if (!empty ($course_id) && ($course_id != -1))
{
if (!empty($course_id) && $course_id != -1) {
$user_id = api_get_user_id();
$course_tools_table = Database :: get_course_table(TABLE_TOOL_LIST,$database);
/*
--------------------------------------------------------------
Link to the Course homepage
--------------------------------------------------------------
*/
/* Link to the Course homepage */
$navigation_items['home']['image'] = 'home.gif';
$navigation_items['home']['link'] = api_get_path(REL_COURSE_PATH).Security::remove_XSS($_SESSION['_course']['path']).'/index.php';
$navigation_items['home']['name'] = get_lang('CourseHomepageLink');
/*
--------------------------------------------------------------
Link to the different tools
--------------------------------------------------------------
*/
/* Link to the different tools */
$sql_menu_query = "SELECT * FROM $course_tools_table WHERE visibility='1' and admin='0' ORDER BY id ASC";
$sql_result = Database::query($sql_menu_query);
while ($row = Database::fetch_array($sql_result))
{
while ($row = Database::fetch_array($sql_result)) {
$navigation_items[$row['id']] = $row;
/*
if (!stristr($row['link'], 'http://'))
*/
if (stripos($row['link'], 'http://') === false && stripos($row['link'], 'https://') === false)
{
if (stripos($row['link'], 'http://') === false && stripos($row['link'], 'https://') === false) {
$navigation_items[$row['id']]['link'] = api_get_path(REL_CODE_PATH).$row['link'];
/*
$navigation_items[$row['id']]['name'] = $row['image'] == 'scormbuilder.gif' ? $navigation_items[$row['id']]['name'] : get_lang(ucfirst($navigation_items[$row['id']]['name']));
*/
if ($row['image'] != 'scormbuilder.gif' && $row['image'] != 'blog.gif')
{
if ($row['image'] != 'scormbuilder.gif' && $row['image'] != 'blog.gif') {
$navigation_items[$row['id']]['name'] = get_lang(ucfirst($navigation_items[$row['id']]['name']));
}
}
}
/*
--------------------------------------------------------------
Admin (edit rights) only links
/* Admin (edit rights) only links
- Course settings (course admin only)
- Course rights (roles & rights overview)
--------------------------------------------------------------
*/
- Course rights (roles & rights overview) */
if ($include_admin_tools) {
$course_settings_sql = "SELECT name,image FROM $course_tools_table
@ -84,7 +68,7 @@ function get_navigation_items($include_admin_tools = false)
$sql_result = Database::query($course_settings_sql);
$course_setting_info = Database::fetch_array($sql_result);
$course_setting_visual_name = get_lang(api_ucfirst($course_setting_info['name']));
if (api_get_session_id()==0) {
if (api_get_session_id() == 0) {
// course settings item
$navigation_items['course_settings']['image'] = $course_setting_info['image'];
$navigation_items['course_settings']['link'] = api_get_path(REL_CODE_PATH).'course_info/infocours.php';
@ -92,7 +76,7 @@ function get_navigation_items($include_admin_tools = false)
}
}
}
foreach($navigation_items as $key => $navigation_item) {
foreach ($navigation_items as $key => $navigation_item) {
if (strstr($navigation_item['link'], '?')) {
//link already contains a parameter, add course id parameter with &
$parameter_separator = '&amp;';
@ -108,11 +92,10 @@ function get_navigation_items($include_admin_tools = false)
/**
* Show a navigation menu
*/
function show_navigation_menu()
{
function show_navigation_menu() {
$navigation_items = get_navigation_items(true);
$course_id = api_get_course_id();
if(api_get_setting('show_navigation_menu') == 'icons') {
if (api_get_setting('show_navigation_menu') == 'icons') {
echo '<div style="float:right;width: 40px;position:absolute;right:10px;top:10px;">';
show_navigation_tool_shortcuts($orientation = SHORTCUTS_VERTICAL);
echo '</div>';
@ -121,7 +104,7 @@ function show_navigation_menu()
?>
<script type="text/javascript">
/* <![CDATA[ */
function createCookie(name,value,days)
function createCookie(name, value, days)
{
if (days)
{
@ -136,7 +119,7 @@ function show_navigation_menu()
{
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++)
for (var i = 0; i < ca.length; i++)
{
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
@ -150,7 +133,7 @@ function show_navigation_menu()
center_el = document.getElementById('center');
swap_menu_link_el = document.getElementById('swap_menu_link');
if(toolnavlist_el.style.display == 'none')
if (toolnavlist_el.style.display == 'none')
{
toolnavlist_el.style.display = '';
if (center_el)
@ -186,26 +169,22 @@ function show_navigation_menu()
$url_item = parse_url($navigation_item['link']);
$url_current = parse_url($_SERVER['REQUEST_URI']);
if (strpos($navigation_item['link'],'chat')!==false && api_get_course_setting('allow_open_chat_window',$course_id)==true) {
echo '<a href="javascript: void(0);" onclick="window.open(\''.$navigation_item['link'].'\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $navigation_item['target'] . '"';
if (strpos($navigation_item['link'], 'chat') !== false && api_get_course_setting('allow_open_chat_window', $course_id)) {
echo '<a href="javascript: void(0);" onclick="javascript: window.open(\''.$navigation_item['link'].'\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $navigation_item['target'] . '"';
} else {
echo '<a href="'.$navigation_item['link'].'" target="_top" ';
}
if (stristr($url_item['path'],$url_current['path']))
{
if(! isset($_GET['learnpath_id']) || strpos($url_item['query'],'learnpath_id='.$_GET['learnpath_id']) === 0)
{
if (stristr($url_item['path'], $url_current['path'])) {
if (!isset($_GET['learnpath_id']) || strpos($url_item['query'],'learnpath_id='.$_GET['learnpath_id']) === 0) {
echo ' id="here"';
}
}
echo ' title="'.$navigation_item['name'].'">';
if (api_get_setting('show_navigation_menu') != 'text')
{
if (api_get_setting('show_navigation_menu') != 'text') {
echo '<div align="left"><img src="'.api_get_path(WEB_IMG_PATH).$navigation_item['image'].'" alt="'.$navigation_item['name'].'"/></div>';
}
if (api_get_setting('show_navigation_menu') != 'icons')
{
if (api_get_setting('show_navigation_menu') != 'icons') {
echo $navigation_item['name'];
}
echo '</a>';
@ -217,7 +196,7 @@ function show_navigation_menu()
?>
<script type="text/javascript">
/* <![CDATA[ */
if(readCookie('dokeos_menu_state') == 0)
if (readCookie('dokeos_menu_state') == 0)
swap_menu();
}
/* ]]> */
@ -229,11 +208,10 @@ function show_navigation_menu()
/**
* Show a toolbar with shortcuts to the course tool
*/
function show_navigation_tool_shortcuts($orientation = SHORTCUTS_HORIZONTAL)
{
function show_navigation_tool_shortcuts($orientation = SHORTCUTS_HORIZONTAL) {
$navigation_items = get_navigation_items(false);
foreach ($navigation_items as $key => $navigation_item) {
if (strpos($navigation_item['link'],'chat')!==false && api_get_course_setting('allow_open_chat_window')==true) {
if (strpos($navigation_item['link'],'chat') !== false && api_get_course_setting('allow_open_chat_window')) {
/*
echo '<a href="#" onclick="window.open(\''.$navigation_item['link'].'\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $navigation_item['target'] . '"';
*/
@ -248,9 +226,8 @@ function show_navigation_tool_shortcuts($orientation = SHORTCUTS_HORIZONTAL)
echo ' target="_top" title="'.$navigation_item['name'].'">';
echo '<img src="'.api_get_path(WEB_IMG_PATH).$navigation_item['image'].'" alt="'.$navigation_item['name'].'"/>';
echo '</a>';
if($orientation == SHORTCUTS_VERTICAL){
if ($orientation == SHORTCUTS_VERTICAL) {
echo '<br />';
}
}
}
?>
Loading…
Cancel
Save