Subversion Repositories eFlore/Applications.del

Rev

Rev 819 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 819 Rev 841
Line 439... Line 439...
439
	private function chargerDeterminations($observations) {
439
	private function chargerDeterminations($observations) {
440
		foreach ($observations as $id => $observation) {
440
		foreach ($observations as $id => $observation) {
441
			$requetePropositions = 'SELECT * FROM '.$this->gestionBdd->formaterTable('del_commentaire', 'dc').
441
			$requetePropositions = 'SELECT * FROM '.$this->gestionBdd->formaterTable('del_commentaire', 'dc').
442
									   'WHERE dc.nom_sel IS NOT NULL AND ce_observation = '.$observation['id_observation'];
442
									   'WHERE dc.nom_sel IS NOT NULL AND ce_observation = '.$observation['id_observation'];
443
			$propositions = $this->bdd->recupererTous($requetePropositions);
443
			$propositions = $this->bdd->recupererTous($requetePropositions);
444
			$observations[$id]['propositions'] = $this->formaterDeterminations($propositions);
444
			$observations[$id]['commentaires'] = $this->formaterDeterminations($propositions);
445
		}
445
		}
446
		return $observations;
446
		return $observations;
447
	}
447
	}
Line 448... Line 448...
448
	
448
	
Line 467... Line 467...
467
			$this->gestionBdd->formaterTable('del_commentaire_vote').
467
			$this->gestionBdd->formaterTable('del_commentaire_vote').
468
			'WHERE ce_proposition IN ('.implode(', ', $ids_proposition).')';
468
			'WHERE ce_proposition IN ('.implode(', ', $ids_proposition).')';
Line 469... Line 469...
469
			
469
			
470
		$resultatsVotes = $this->bdd->recupererTous($requeteVotes);
470
		$resultatsVotes = $this->bdd->recupererTous($requeteVotes);
471
		foreach ($resultatsVotes as $vote) {
471
		foreach ($resultatsVotes as $vote) {
472
			$propositions[$vote['ce_proposition']]['votes'][] = $this->formaterVotes($vote);
472
			$propositions[$vote['ce_proposition']]['votes'][$vote['id_vote']] = $this->formaterVotes($vote);
473
		}
473
		}
474
		return $propositions;
474
		return $propositions;
Line 475... Line 475...
475
	}
475
	}
Line 481... Line 481...
481
	private function chargerNombreCommentaire($ids_proposition, $propositions) {
481
	private function chargerNombreCommentaire($ids_proposition, $propositions) {
482
		$requeteNbCommentaires = 'SELECT ce_proposition, COUNT('.$this->proteger('id_commentaire').') as nb '.
482
		$requeteNbCommentaires = 'SELECT ce_proposition, COUNT('.$this->proteger('id_commentaire').') as nb '.
483
									'FROM '.$this->gestionBdd->formaterTable('del_commentaire').
483
									'FROM '.$this->gestionBdd->formaterTable('del_commentaire').
484
									'WHERE ce_proposition IN ('.implode(', ', $ids_proposition).')';
484
									'WHERE ce_proposition IN ('.implode(', ', $ids_proposition).')';
485
		$nbCommentaires = $this->bdd->recuperer($requeteNbCommentaires);
485
		$nbCommentaires = $this->bdd->recuperer($requeteNbCommentaires);
486
		foreach ($nbCommentaires as $vote) {
486
		foreach ($nbCommentaires as $nbCommentaire) {
487
			$propositions[$vote['ce_proposition']]['commentaires']= $vote;
487
			$propositions[$nbCommentaire['ce_proposition']]['nb_commentaires']= $nbCommentaire;
488
		}
488
		}
489
		return $propositions;
489
		return $propositions;
490
	}
490
	}
Line 491... Line 491...
491
	
491
	
Line 546... Line 546...
546
	*  @param $votes array()
546
	*  @param $votes array()
547
	* */
547
	* */
548
	private function formaterVotes($vote) {
548
	private function formaterVotes($vote) {
549
		$retour = array();
549
		$retour = array();
550
		foreach ($vote as $param=>$valeur) {
550
		foreach ($vote as $param=>$valeur) {
551
			$retour[$vote['id_vote']][$this->mappingVotes[$param]] = $valeur;
551
			$retour[$this->mappingVotes[$param]] = $valeur;
552
		}
552
		}
553
		return $retour;
553
		return $retour;
554
	}
554
	}
Line 555... Line 555...
555
	
555