Subversion Repositories eFlore/Applications.cel

Rev

Rev 1951 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
/*
 * @author    Aurélien Peronnet <aurelien@tela-botanica.org>
 * @author    David Delon <david.delon@clapas.net>
 * @copyright 2010, 2013 Tela-Botanica
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
 */

class InventoryTransmit extends Cel  {
        function updateElement($uid, $pairs) {
                // Controle detournement utilisateur 
            $this->controleUtilisateur($uid[0]);
                if (!isset($uid[1])) return false;

                $transmission = intval($pairs['transmission']);
                if($transmission != 0 && $transmission != 1) return false;

                $ids = array_filter(array_map(create_function('$v','return intval($v);'),
                                                                          explode(',', $uid[1])));
                
                $date = ($transmission == 1) ? 'now()' : 'NULL';
                //TODO: modification pour passer ceci dans la classe gestion observation
                $requete_transmission = 'UPDATE cel_obs '.
                                'SET transmission = '.$pairs['transmission'].', '.
                                        'date_modification = now(), date_transmission = '.$date.' '. 
                                'WHERE ce_utilisateur = '.Cel::db()->proteger($uid[0]).' AND ordre in ('.implode(',', $ids).')';
                
                $resultat_transmission = Cel::db()->executer($requete_transmission);
                
                return ($resultat_transmission != 0);
        }
}
?>