Subversion Repositories eFlore/Applications.cel

Rev

Rev 1903 | Rev 2083 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1903 Rev 2056
Line 12... Line 12...
12
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
12
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
13
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
13
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
14
 * @version $Id$
14
 * @version $Id$
15
 * @copyright © 2011, Jean-Pascal MILCENT
15
 * @copyright © 2011, Jean-Pascal MILCENT
16
 */
16
 */
17
class CelWidgetSaisie extends CelMotCle {
17
class CelWidgetSaisie extends Cel {
Line 18... Line 18...
18
 
18
 
19
	private $projet = null;
19
	private $projet = null;
20
	private $projetTags = array();
20
	private $projetTags = array();
21
	private $tagsObs = null;
21
	private $tagsObs = null;
Line 24... Line 24...
24
	private $utilisateur_id = null;
24
	private $utilisateur_id = null;
25
	const DUREE_DE_VIE_IMG = 86400;// 3600 * 24 * 2 = 172 800
25
	const DUREE_DE_VIE_IMG = 86400;// 3600 * 24 * 2 = 172 800
26
	const ARRET_SERVICE = false;// Permet de bloquer le service en cas de problème sur le serveur
26
	const ARRET_SERVICE = false;// Permet de bloquer le service en cas de problème sur le serveur
Line 27... Line 27...
27
 
27
 
-
 
28
	private $correspondanceIdImgTags = array();
-
 
29
	private $gestionMotsClesObs = null;
Line 28... Line 30...
28
	private $correspondanceIdImgTags = array();
30
	private $gestionMotsClesImages = null;
29
 
31
 
30
	public function createElement($requeteDonnees) {
32
	public function createElement($requeteDonnees) {
31
		if (self::ARRET_SERVICE) {
33
		if (self::ARRET_SERVICE) {
Line 145... Line 147...
145
							if ($img != null) {
147
							if ($img != null) {
146
								$this->nettoyerImagesUploades();
148
								$this->nettoyerImagesUploades();
147
								$img_a_taguer_ids = $this->stockerImagesEtLierAObs($img, $id_utilisateur, $utilisateur);
149
								$img_a_taguer_ids = $this->stockerImagesEtLierAObs($img, $id_utilisateur, $utilisateur);
148
							}
150
							}
149
						}
151
						}
-
 
152
						
-
 
153
						$this->gestionMotsClesObs = new GestionMotsClesChemin($this->config,'obs');
-
 
154
						$this->gestionMotsClesImages = new GestionMotsClesChemin($this->config,'images');
Line 150... Line 155...
150
 
155
 
151
						$obs_a_taguer_ids = $this->obtenirIdsObsPourTableauOrdres($this->utilisateur_id, $obs_a_taguer_ordres);
156
						$obs_a_taguer_ids = $this->obtenirIdsObsPourTableauOrdres($this->utilisateur_id, $obs_a_taguer_ordres);
152
						$this->taguerObs($obs_a_taguer_ids);
157
						$this->taguerObs($obs_a_taguer_ids);
Line 373... Line 378...
373
			}
378
			}
374
		}
379
		}
375
	}
380
	}
Line 376... Line 381...
376
 
381
 
377
	private function lierObsAMotsCles($observations_ids, $tags) {
382
	private function lierObsAMotsCles($observations_ids, $tags) {
378
		$idTagParent = self::OBS_RACINE_ID;
383
		$chemin_parent = "/";
379
		$listeIdsTags = array();
384
		$listeIdsTags = array();
380
		foreach ($tags as $tag) {
385
		foreach ($tags as $tag) {
381
			$tag = $this->nettoyerTag($tag);
386
			$tag = $this->nettoyerTag($tag);
382
			if ($tag != '') {
387
			if ($tag != '') {
383
				$id_mot_cle = $this->ajouterMotCleObs($this->utilisateur_id, $tag, $idTagParent);
388
				$id_mot_cle = $this->gestionMotsClesObs->insererParCheminSiInexistant($tag, $chemin_parent, $this->utilisateur_id);
384
				if ($id_mot_cle !== false) {
389
				if ($id_mot_cle !== false) {
385
					$listeIdsTags[] = $id_mot_cle;
390
					$listeIdsTags[] = $id_mot_cle;
386
					$idTagParent = $id_mot_cle;
391
					$chemin_parent .= $tag."/";
387
				}
392
				}
388
			}
393
			}
Line 389... Line 394...
389
		}
394
		}
390
 
395
 
391
		$liaison_ok = $this->lierMotCleObs($this->utilisateur_id, $listeIdsTags, $observations_ids);
396
		$liaison_ok = $this->gestionMotsClesObs->lierParTableaux($listeIdsTags, $observations_ids, $this->utilisateur_id);
Line 392... Line 397...
392
		return $liaison_ok;
397
		return $liaison_ok;
393
	}
398
	}
Line 413... Line 418...
413
			}
418
			}
414
		}
419
		}
415
	}
420
	}
Line 416... Line 421...
416
 
421
 
417
	private function lierImgAMotsCles($images_ids, $tags) {
422
	private function lierImgAMotsCles($images_ids, $tags) {
418
		$idTagParent = self::IMG_RACINE_ID;
423
		$chemin_parent = "/";
419
		$listeIdsTags = array();
424
		$listeIdsTags = array();
420
		foreach ($tags as $tag) {
425
		foreach ($tags as $tag) {
421
			$tag = $this->nettoyerTag($tag);
426
			$tag = $this->nettoyerTag($tag);
422
			if ($tag != '') {
427
			if ($tag != '') {				
423
				$id_mot_cle = $this->ajouterMotCleImg($this->utilisateur_id, $tag, $idTagParent);
428
				$id_mot_cle = $this->gestionMotsClesImages->insererParCheminSiInexistant($tag, $chemin_parent, $this->utilisateur_id);
424
				if ($id_mot_cle !== false) {
429
				if ($id_mot_cle !== false) {
425
					$listeIdsTags[] = $id_mot_cle;
430
					$listeIdsTags[] = $id_mot_cle;
426
					$idTagParent = $id_mot_cle;
431
					$chemin_parent .= $tag."/";
427
				}
432
				}
428
			}
433
			}
429
		}
434
		}
430
		$liaison_ok = $this->lierMotCleImg($this->utilisateur_id, $listeIdsTags, $images_ids);
435
		$liaison_ok = $this->gestionMotsClesObs->lierParTableaux($listeIdsTags, $images_ids, $this->utilisateur_id);
431
		return $liaison_ok;
436
		return $liaison_ok;
Line 432... Line 437...
432
	}
437
	}
433
 
438