Source for file class.texts.php
Documentation is available at class.texts.php
* Logique des textes lodel
* LODEL - Logiciel d'Edition ELectronique.
* Home page: http://www.lodel.org
* E-Mail: lodel@lodel.org
* 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.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* @author Ghislain Picard
* @copyright 2001-2002, Ghislain Picard, Marin Dacos
* @copyright 2003, Ghislain Picard, Marin Dacos, Luc Santeramo, Nicolas Nutten, Anne Gentil-Beccot
* @copyright 2004, Ghislain Picard, Marin Dacos, Luc Santeramo, Anne Gentil-Beccot, Bruno Cénou
* @copyright 2005, Ghislain Picard, Marin Dacos, Luc Santeramo, Gautier Poupeau, Jean Lamy, Bruno Cénou
* @copyright 2006, Marin Dacos, Luc Santeramo, Bruno Cénou, Jean Lamy, Mikaël Cixous, Sophie Malafosse
* @copyright 2007, Marin Dacos, Bruno Cénou, Sophie Malafosse, Pierre-Alain Mignot
* @licence http://www.gnu.org/copyleft/gpl.html
* @since Fichier ajouté depuis la version 0.8
* @version CVS:$Id: class.texts.php 4006 2007-10-05 11:53:41Z malafosse $
require_once("translationfunc.php");
* Classe de logique des textes lodel
* @author Ghislain Picard
* @copyright 2001-2002, Ghislain Picard, Marin Dacos
* @copyright 2003, Ghislain Picard, Marin Dacos, Luc Santeramo, Nicolas Nutten, Anne Gentil-Beccot
* @copyright 2004, Ghislain Picard, Marin Dacos, Luc Santeramo, Anne Gentil-Beccot, Bruno Cénou
* @copyright 2005, Ghislain Picard, Marin Dacos, Luc Santeramo, Gautier Poupeau, Jean Lamy, Bruno Cénou
* @copyright 2006, Marin Dacos, Luc Santeramo, Bruno Cénou, Jean Lamy, Mikaël Cixous, Sophie Malafosse
* @copyright 2007, Marin Dacos, Bruno Cénou, Sophie Malafosse, Pierre-Alain Mignot
* @licence http://www.gnu.org/copyleft/gpl.html
* @since Classe ajouté depuis la version 0.8
function editAction(&$context, &$error, $clean = false)
//if ($GLOBALS['lodeluser']['translationmode'] != 'site') {
if($context['textgroup'] != 'site') {
foreach ($context['contents'] as $id=> $contents) {
$dao->instantiateObject($vo);
$vo->contents = preg_replace("/(\r\n\s*){2,}/", "<br />", $contents);
$status = intval($context['status'][$id]);
//if ($GLOBALS['lodeluser']['translationmode']!="site") {
if($context['textgroup'] != 'site') {
require_once 'cachefunc.php';
* Function to create the text entry for all the languages
$criteria = "#_TP_texts.id='". $name. "'";
$criteria = "name='". $name. "' AND textgroup='". $textgroup. "'";
if ($textgroup != 'site') {
$result = $db->execute(lq("SELECT #_TP_translations.lang FROM #_TP_translations LEFT JOIN #_TP_texts ON #_TP_translations.lang=#_TP_texts.lang AND ". $criteria. " WHERE #_TP_texts.lang is NULL")) or dberror();
$dao->instantiateObject($vo);
$vo->textgroup = $textgroup;
$vo->lang = $result->fields['lang'];
if ($textgroup != 'site') {
/*---------------------------------------------------------------*/
//! Private or protected from this point
* Sauve des données dans des tables liées éventuellement
* Appelé par editAction pour effectuer des opérations supplémentaires de sauvegarde.
* @param object $vo l'objet qui a été créé
* @param array $context le contexte
// reinitialise le cache surement.
// begin{publicfields} automatic generation //
* Retourne la liste des champs publics
return array('contents' => array('longtext', ''),
'lang' => array('lang', '+'),
'textgroup' => array('text', '+'));
// end{publicfields} automatic generation //
|