Subversion Repositories eFlore/Applications.cel

Rev

Rev 1951 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
416 aurelien 1
<?php
1867 raphael 2
/*
1951 aurelien 3
 * @author    Aurélien Peronnet <aurelien@tela-botanica.org>
1867 raphael 4
 * @author    David Delon <david.delon@clapas.net>
5
 * @copyright 2010, 2013 Tela-Botanica
6
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
7
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
8
 */
416 aurelien 9
 
762 aurelien 10
class InventoryTransmit extends Cel  {
1867 raphael 11
	function updateElement($uid, $pairs) {
762 aurelien 12
		// Controle detournement utilisateur
13
 	    $this->controleUtilisateur($uid[0]);
1867 raphael 14
		if (!isset($uid[1])) return false;
1301 aurelien 15
 
1860 raphael 16
		$transmission = intval($pairs['transmission']);
17
		if($transmission != 0 && $transmission != 1) return false;
416 aurelien 18
 
1867 raphael 19
		$ids = array_filter(array_map(create_function('$v','return intval($v);'),
20
									  explode(',', $uid[1])));
1949 aurelien 21
 
22
		$date = ($transmission == 1) ? 'now()' : 'NULL';
23
		//TODO: modification pour passer ceci dans la classe gestion observation
24
		$requete_transmission = 'UPDATE cel_obs '.
25
		           	'SET transmission = '.$pairs['transmission'].', '.
26
					'date_modification = now(), date_transmission = '.$date.' '.
27
		        	'WHERE ce_utilisateur = '.Cel::db()->proteger($uid[0]).' AND ordre in ('.implode(',', $ids).')';
28
 
29
		$resultat_transmission = Cel::db()->executer($requete_transmission);
30
 
1867 raphael 31
		return ($resultat_transmission != 0);
416 aurelien 32
	}
33
}
1951 aurelien 34
?>