16/07/2013, 17:37:42
Merci pour le compliment je dois encore passer dessus pour 'nettoyer' un peu...
Ma balise user est (comme celle du tuto de l'aide)
C
Ma balise user est (comme celle du tuto de l'aide)
Code :
[== Indéfini ==]
/**
* Load wanted ListItExtended instance, where you wan't to save items.
* If instance can't be loaded, it will silently return.
*/
$mod = cmsms()->GetModuleInstance('ListIt2ad');
if(!is_object($mod))
return;
/**
* Intitate item with identifier 'alias', $params['email'] comes from FormBuilder.
* Do duplication check with 'item_id', silently return, if item already in database.
*/
$alias = munge_string_to_url($params['email'], true);
$obj = $mod->LoadItemByIdentifier('alias', $alias);
if($obj->item_id > 0)
return;
/**
* Fill previously initiated ListIt2Item object with values from form submission.
* NOTICE: All params that are not known by ListIt2Item object are going to ignored.
*/
$obj->title = $params['email'];
$obj->alias = $alias;
foreach($params as $key => $value) {
if(isset($obj->fielddefs[$key]))
$obj->$key = $value;
}
/**
* Save this object to database by using ListItExtended API.
*/
$mod->SaveItem($obj);
C