[svn r20086] translation variable fixed

translation variable SaveIntroText moved from course_description.inc.php to trad4all.inc.php (partial fix for FS#4055) by fcedillo
skala
Yannick Warnier 16 years ago
parent ccb065fa55
commit c475631b42
  1. 126
      main/inc/introductionSection.inc.php

@ -1,26 +1,5 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2005 Dokeos S.A.
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 address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /dokeos_license.txt */
/**
==============================================================================
* The INTRODUCTION MICRO MODULE is used to insert and edit
@ -45,7 +24,6 @@
==============================================================================
*/
include_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
/*
@ -53,6 +31,7 @@ include_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php')
Constants and variables
-----------------------------------------------------------
*/
$TBL_INTRODUCTION = Database::get_course_table(TABLE_TOOL_INTRO);
$intro_editAllowed = $is_allowed_to_edit;
@ -62,60 +41,51 @@ $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']);
if (!empty ($GLOBALS["_cid"]))
{
if (!empty ($GLOBALS["_cid"])) {
$form = new FormValidator('introduction_text', 'post', api_get_self()."?".api_get_cidreq());
}
else
{
} else {
$form = new FormValidator('introduction_text');
}
$renderer =& $form->defaultRenderer();
$renderer->setElementTemplate('<div style="width: 80%; margin: 0px auto; padding-bottom: 10px; ">{element}</div>');
$form->add_html_editor('intro_content',null,null,false);
$form->addElement('style_submit_button', 'intro_cmdUpdate', get_lang('Save'), 'class="save"');
$form->addElement('style_submit_button', 'intro_cmdUpdate', get_lang('SaveIntroText'), 'class="save"');
/*=========================================================
INTRODUCTION MICRO MODULE - COMMANDS SECTION (IF ALLOWED)
========================================================*/
if ($intro_editAllowed)
{
if ($intro_editAllowed) {
/* Replace command */
if( $intro_cmdUpdate )
{
if( $form->validate())
{
if ( $intro_cmdUpdate ) {
if ( $form->validate()) {
$form_values = $form->exportValues();
$intro_content = $form_values['intro_content'];
if ( ! empty($intro_content) )
{
if ( ! empty($intro_content) ) {
$sql = "REPLACE $TBL_INTRODUCTION SET id='$moduleId',intro_text='".Database::escape_string($intro_content)."'";
api_sql_query($sql,__FILE__,__LINE__);
Display::display_confirmation_message(get_lang('IntroductionTextUpdated'),false);
}
else
{
} else {
$intro_cmdDel = true; // got to the delete command
}
}
else
{
$intro_cmdEdit = true;
} else {
$intro_cmdEdit = true;
}
}
/* Delete Command */
if($intro_cmdDel)
{
if ($intro_cmdDel) {
api_sql_query("DELETE FROM $TBL_INTRODUCTION WHERE id='".$moduleId."'",__FILE__,__LINE__);
Display::display_confirmation_message(get_lang('IntroductionTextDeleted'));
}
}
@ -132,32 +102,26 @@ $intro_content = $intro_dbResult['intro_text'];
/* Determines the correct display */
if ($intro_cmdEdit || $intro_cmdAdd)
{
if ($intro_cmdEdit || $intro_cmdAdd) {
$intro_dispDefault = false;
$intro_dispForm = true;
$intro_dispCommand = false;
}
else
{
} else {
$intro_dispDefault = true;
$intro_dispForm = false;
if ($intro_editAllowed)
{
if ($intro_editAllowed) {
$intro_dispCommand = true;
}
else
{
} else {
$intro_dispCommand = false;
}
}
/* Executes the display */
if ($intro_dispForm)
{
if ($intro_dispForm) {
$default['intro_content'] = $intro_content;
$form->setDefaults($default);
//echo '<div id="courseintro">';
@ -166,45 +130,41 @@ if ($intro_dispForm)
echo '</div>';
}
if ($intro_dispDefault)
{
if ($intro_dispDefault) {
//$intro_content = make_clickable($intro_content); // make url in text clickable
$intro_content = text_filter($intro_content); // parse [tex] codes
if (!empty($intro_content))
{
if (!empty($intro_content)) {
echo "<table align='center' style='width: 80%;'><tr><td>$intro_content</td></tr></table>";
}
}
if ($intro_dispCommand)
{
if( empty($intro_content) ) // displays "Add intro" Commands
{
if ($intro_dispCommand) {
if ( empty($intro_content) ) {
//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
{
} else {
echo "<a href=\"".api_get_self()."?intro_cmdAdd=1\">\n".get_lang('AddIntro')."</a>\n";
}
echo "</p>\n</div>";
}
else // displays "edit intro && delete intro" Commands
{
} else {
// 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(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
{
} else {
echo "<a href=\"".api_get_self()."?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()."?intro_cmdDel=1\" onclick=\"javascript:if(!confirm('".addslashes(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";
}
echo "</p>\n</div>";
}
}
?>
?>
Loading…
Cancel
Save