31 |
aurelien |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
class GestionTriple extends JRestService {
|
67 |
aurelien |
4 |
|
31 |
aurelien |
5 |
protected function obtenirValeursListeParId($id_liste) {
|
|
|
6 |
|
|
|
7 |
$requete = 'SELECT * FROM ods_triple WHERE ot_ce_parent ='.$this->proteger($id_liste);
|
|
|
8 |
$resultat = $this->executerRequete($requete);
|
|
|
9 |
|
|
|
10 |
return $resultat;
|
|
|
11 |
|
|
|
12 |
}
|
|
|
13 |
|
|
|
14 |
protected function obtenirValeursListeParAbreviation($abreviation_triple) {
|
|
|
15 |
|
33 |
aurelien |
16 |
$requete = 'SELECT * FROM ods_triples WHERE ot_ce_parent = (SELECT ot_id_triple FROM ods_triples WHERE ot_cle ='.$this->proteger($abreviation_triple).')';
|
31 |
aurelien |
17 |
$resultat = $this->executerRequete($requete);
|
|
|
18 |
|
33 |
aurelien |
19 |
return $this->grouperResultat($resultat);
|
31 |
aurelien |
20 |
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
protected function obtenirValeurTripleParId($id_triple) {
|
|
|
24 |
|
|
|
25 |
$requete = 'SELECT * FROM ods_triple WHERE ot_id_triple = '.$this->proteger($id_triple);
|
|
|
26 |
$resultat = $this->executerRequete($requete);
|
|
|
27 |
|
|
|
28 |
return $resultat['ot_valeur'];
|
|
|
29 |
|
|
|
30 |
}
|
|
|
31 |
|
|
|
32 |
protected function obtenirValeurTripleParAbreviation($abreviation_triple) {
|
|
|
33 |
|
|
|
34 |
$requete = 'SELECT * FROM ods_triple WHERE ot_cle = '.$this->proteger($abreviation_triple);
|
|
|
35 |
$resultat = $this->executerRequete($requete);
|
|
|
36 |
|
|
|
37 |
return $resultat['ot_valeur'];
|
|
|
38 |
|
|
|
39 |
}
|
|
|
40 |
|
33 |
aurelien |
41 |
private function grouperResultat($tableau_resultat_requete_triple) {
|
|
|
42 |
|
|
|
43 |
$tableau_resultat_requete_triple_ordonne = array();
|
|
|
44 |
|
|
|
45 |
foreach($tableau_resultat_requete_triple as $valeur_triple) {
|
|
|
46 |
$tableau_resultat_requete_triple_ordonne[$valeur_triple['ot_id_triple']] = $valeur_triple;
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
return $tableau_resultat_requete_triple_ordonne;
|
|
|
50 |
}
|
|
|
51 |
|
46 |
aurelien |
52 |
protected function renvoyerInformationStadeAPartirChaineTriple($stade_observation_complet) {
|
|
|
53 |
|
|
|
54 |
$infos_stades = split('_',$stade_observation_complet);
|
|
|
55 |
$titre_numero_stade = array('nom','abreviation','numero');
|
|
|
56 |
|
|
|
57 |
if($this->estUnEvenementAvecDesSousStades($stade_observation_complet)) {
|
|
|
58 |
$titre_numero_stade['nom'] = $infos_stades[1];
|
|
|
59 |
$titre_numero_stade['numero'] = $infos_stades[3];
|
|
|
60 |
$titre_numero_stade['abreviation'] = $infos_stades[1];
|
|
|
61 |
} else {
|
|
|
62 |
$titre_numero_stade['nom'] = $infos_stades[1].' '.$infos_stades[2];
|
|
|
63 |
$titre_numero_stade['abreviation'] = $infos_stades[1].'_'.$infos_stades[2];
|
|
|
64 |
$titre_numero_stade['numero'] = '';
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
return $titre_numero_stade;
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
protected function estUnEvenementAvecDesSousStades($evenement) {
|
|
|
71 |
|
|
|
72 |
$infos_stades = split('_',$evenement);
|
|
|
73 |
|
|
|
74 |
if(count($infos_stades) <= 3) {
|
|
|
75 |
return false;
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
return true;
|
|
|
79 |
}
|
|
|
80 |
|
31 |
aurelien |
81 |
}
|
|
|
82 |
|
|
|
83 |
?>
|