Source for file class.useroptiongroups.php
Documentation is available at class.useroptiongroups.php
* Logique des groupes d'options utilisateur
* 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.useroptiongroups.php 4006 2007-10-05 11:53:41Z malafosse $
return $GLOBALS['fieldtypes'][$text];
* Classe de logique des groupes d'options utilisateurs
* @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
$this->Logic("optiongroups"); // UserOptionGroups use the same table as OptionGroups but restrein permitted operations to change the option values.
* @param array &$context le contexte passé par référence
* @param array &$error le tableau des erreurs éventuelles passé par référence
function loop_useroptions($context,$funcname)
$result= $db->execute(lq("SELECT * FROM #_TP_options WHERE status > 0 AND idgroup='". $context['id']. "' ORDER BY rank,name ")) or dberror();
$name= $result->fields['name'];
if ($context[$name]) $localcontext['value']= $context[$name];
// get the dao for working with the object
$options= $dao->findMany("idgroup='". $context['id']. "'","","id,name,type,defaultvalue,userrights");
require_once("validfunc.php");
foreach ($options as $option) {
if ($option->type== "passwd" && !trim($context['data'][$option->name])) continue; // empty password means we keep the previous one.
$valid= validfield($context['data'][$option->name],$option->type,"",$option->name);
if ($valid=== false) die("ERROR: \"". $option->type. "\" can not be validated in UserOptionGroups::editAction.php");
if ( ($option->type== "file" || $option->type== "image") && preg_match("/\/tmpdir-\d+\/[^\/]+$/",$context['data'][$option->name]) ) {
$dir= dirname($context['data'][$option->name]);
if (is_string($valid)) $error[$option->name]= $valid;
if ($error) return "_error";
foreach ($options as $option) {
if ($lodeluser['rights'] < $option->userrights) continue; // the user has not the right to do that.
if ($option->type== "passwd" && !trim($context['data'][$option->name])) continue; // empty password means we keep the previous one.
if ($option->type!= "boolean" && trim($context['data'][$option->name])=== "") $context['data'][$option->name]= $option->defaultvalue; // default value
$option->value= $context['data'][$option->name];
if (!$dao->save($option)) die("You don't have the rights to modify this option");
* Changement du rang d'un objet
* @param array &$context le contexte passé par référence
* @param array &$error le tableau des erreurs éventuelles passé par référence
* Construction des balises select HTML pour cet objet
* @param array &$context le contexte, tableau passé par référence
* @param string $var le nom de la variable du select
/*---------------------------------------------------------------*/
//! Private or protected from this point
/*-----------------------------------*/
|