Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 3566 Rev 3567
Line 195... Line 195...
195
					$champsEtendusObs[$idNouvelleObs] = $fullObs['obs_etendue'];
195
					$champsEtendusObs[$idNouvelleObs] = $fullObs['obs_etendue'];
Line 196... Line 196...
196
 
196
 
197
					$imgAAjouter = null;
197
					$imgAAjouter = null;
198
					if (isset($fullObs['image_nom'])) {
198
					if (isset($fullObs['image_nom'])) {
199
						$imgAAjouter = $this->traiterImagesALierAObs($idNouvelleObs, $fullObs);
-
 
200
						if ($imgAAjouter != null) {
199
						$imgAAjouter = $this->traiterImagesALierAObs($idNouvelleObs, $fullObs);
201
							foreach ($imgAAjouter as $uneImgAAjouter) {
200
						foreach ($imgAAjouter as $uneImgAAjouter) {
202
								$nomsOriginauxImagesTemp[] = $uneImgAAjouter['nom'];
-
 
203
							}
201
							$nomsOriginauxImagesTemp[] = $uneImgAAjouter['nom'];
204
						}
202
						}
Line 205... Line 203...
205
					}
203
					}
206
 
204
 
207
					// si le formulaire contient une image on la traite
205
					// si le formulaire contient une image on la traite
208
					if ($imgAAjouter != null) {
206
					if (!empty($imgAAjouter)) {
209
						$this->nettoyerImagesUploades();
207
						$this->nettoyerImagesUploades();
210
						$img_a_taguer_ids_noms = $this->stockerImagesEtLierAObs($idNouvelleObs, $imgAAjouter);
208
						$img_a_taguer_ids_noms = $this->stockerImagesEtLierAObs($idNouvelleObs, $imgAAjouter);
211
						if (empty($img_a_taguer_ids_noms)) {
209
						if (empty($img_a_taguer_ids_noms)) {
Line 489... Line 487...
489
 
487
 
490
		return $gestionChampsEtendus->ajouterParLots($champs_etendus_obs, $this->projet);
488
		return $gestionChampsEtendus->ajouterParLots($champs_etendus_obs, $this->projet);
Line 491... Line 489...
491
	}
489
	}
492
 
490
 
493
	private function traiterImagesALierAObs($idObs, $obs) {
491
	private function traiterImagesALierAObs($idObs, $obs) {
494
		$imgAAjouter = null;
-
 
495
		if (is_array($obs['image_nom'])) {
492
		$imgAAjouter = array();
496
			$imgAAjouter = array();
493
		if (is_array($obs['image_nom'])) {
497
			foreach ($obs['image_nom'] as $index => $nom_image) {
494
			foreach ($obs['image_nom'] as $index => $nom_image) {
498
				$image = array();
495
				$image = array();
499
				$image['id_utilisateur'] = $this->userId;
496
				$image['id_utilisateur'] = $this->userId;
Line 504... Line 501...
504
				$image['b64'] = (is_array($obs['image_b64']) && isset($obs['image_b64'][$index])) ? $obs['image_b64'][$index] : null;
501
				$image['b64'] = (is_array($obs['image_b64']) && isset($obs['image_b64'][$index])) ? $obs['image_b64'][$index] : null;
505
				$this->debug[] = 'Contient B64 : '.(isset($obs['image_b64']) ? 'oui' : 'non');
502
				$this->debug[] = 'Contient B64 : '.(isset($obs['image_b64']) ? 'oui' : 'non');
506
				$imgAAjouter[] = $image;
503
				$imgAAjouter[] = $image;
507
			}
504
			}
508
		} else {
505
		} else {
509
			$imgAAjouter = array();
-
 
510
			$imgAAjouter['id_utilisateur'] = $this->userId;
506
			$imgAAjouter['id_utilisateur'] = $this->userId;
511
			$imgAAjouter['id_obs'] = $idObs;
507
			$imgAAjouter['id_obs'] = $idObs;
512
			$imgAAjouter['nom'] = $obs['image_nom'];
508
			$imgAAjouter['nom'] = $obs['image_nom'];
513
			$imgAAjouter['b64'] = $obs['image_b64'] ?? null;
509
			$imgAAjouter['b64'] = $obs['image_b64'] ?? null;
514
			$this->debug[] = 'Contient B64 : '.(isset($obs['image_b64']) ? 'oui' : 'non');
510
			$this->debug[] = 'Contient B64 : '.(isset($obs['image_b64']) ? 'oui' : 'non');
Line 823... Line 819...
823
	}
819
	}
Line 824... Line 820...
824
 
820
 
825
	private function construireRequeteInsertionImage($informations) {
821
	private function construireRequeteInsertionImage($informations) {
826
		$champs = array();
822
		$champs = array();
827
		$valeurs = array();
-
 
828
		$url = $informations['url'];
823
		$valeurs = array();
829
		foreach ($informations as $champ => $valeur) {
824
		foreach ($informations as $champ => $valeur) {
830
			$champs[] = $champ;
825
			$champs[] = $champ;
831
			if (is_null($valeur)) {
826
			if (is_null($valeur)) {
832
				$valeurs[$champ] = 'NULL';
827
				$valeurs[$champ] = 'NULL';