Source for file introductionSection.inc.php
Documentation is available at introductionSection.inc.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
==============================================================================
==============================================================================
* 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.
* The introduction content are stored on a table called "introduction"
* in the course Database. Each module introduction has an Id stored on
* the table. It is this id that can make correspondance to a specific module.
* 'introduction' table description
* $moduleId = XX // specifying the module Id
* include(moduleIntro.inc.php);
* @package dokeos.include
==============================================================================
include_once(api_get_path(LIBRARY_PATH). 'formvalidator/FormValidator.class.php');
-----------------------------------------------------------
-----------------------------------------------------------
$intro_editAllowed = $is_allowed_to_edit;
$intro_cmdEdit = (empty($_GET['intro_cmdEdit'])? '': $_GET['intro_cmdEdit']);
$intro_cmdUpdate = (empty($_POST['intro_cmdUpdate'])? '': $_POST['intro_cmdUpdate']);
$intro_cmdDel= (empty($_GET['intro_cmdDel'])? '': $_GET['intro_cmdDel']);
$intro_cmdAdd= (empty($_GET['intro_cmdAdd'])? '': $_GET['intro_cmdAdd']);
$renderer = & $form->defaultRenderer();
$renderer->setElementTemplate('<div style="width: 80%; margin: 0px auto;">{element}</div>');
$form->add_html_editor('intro_content',null,null,false);
$form->addElement('submit','intro_cmdUpdate',get_lang('Ok'));
/*=========================================================
INTRODUCTION MICRO MODULE - COMMANDS SECTION (IF ALLOWED)
========================================================*/
$form_values = $form->exportValues();
$intro_content = $form_values['intro_content'];
if ( ! empty($intro_content) )
$intro_cmdDel = true; // got to the delete command
api_sql_query("DELETE FROM $TBL_INTRODUCTION WHERE id='". $moduleId. "'",__FILE__ ,__LINE__ );
/*===========================================
INTRODUCTION MICRO MODULE - DISPLAY SECTION
===========================================*/
/* Retrieves the module introduction text, if exist */
$sql = "SELECT intro_text FROM $TBL_INTRODUCTION WHERE id='". $moduleId. "'";
$intro_content = $intro_dbResult['intro_text'];
/* Determines the correct display */
if ($intro_cmdEdit || $intro_cmdAdd)
$intro_dispDefault = false;
$intro_dispCommand = false;
$intro_dispDefault = true;
$intro_dispCommand = true;
$intro_dispCommand = false;
/* Executes the display */
$default['intro_content'] = $intro_content;
$form->setDefaults($default);
echo '<div id="courseintro">';
//$intro_content = make_clickable($intro_content); // make url in text clickable
$intro_content = text_filter($intro_content); // parse [tex] codes
if (!empty($intro_content))
echo "<table align='center' style='width: 80%;'><tr><td>$intro_content</td></tr></table>";
if( empty($intro_content) ) // displays "Add intro" Commands
echo "<div id=\"courseintro\"><p>\n",
else // displays "edit intro && delete intro" Commands
echo "<div id=\"courseintro_icons\"><p>\n",
|