581,18 → 581,38 |
*/ |
private function ajouterContrainteTagDel() { |
if (isset($this->parametres['masque.tag_del'])) { |
$tagsMotif = $this->construireTagsMotif(); |
if (is_null($tagsMotif) === false) { |
$nbTags = $this->getNombreDeTags(); |
if($nbTags > 1) { |
$tagsMotif = $this->construireTagsMotif(); |
if (is_null($tagsMotif) === false) { |
$sousRequete = 'SELECT ce_image '. |
'FROM del_image_tag '. |
'WHERE actif = 1 '. |
'GROUP BY ce_image '. |
"HAVING GROUP_CONCAT(DISTINCT tag_normalise ORDER BY tag_normalise) REGEXP $tagsMotif "; |
} |
} else { |
// Si un seul tag est demandé il se trouve dans le OR |
$tag = $this->parametres['masque.tag_del']['OR'][0]; |
$sousRequete = 'SELECT ce_image '. |
'FROM del_image_tag '. |
'WHERE actif = 1 '. |
'GROUP BY ce_image '. |
"HAVING GROUP_CONCAT(DISTINCT tag_normalise ORDER BY tag_normalise) REGEXP $tagsMotif "; |
|
$this->addWhere('masque.tag_del', "di.id_image IN ($sousRequete)"); |
'FROM del_image_tag '. |
'WHERE actif = 1 '. |
'AND tag_normalise LIKE '.$this->bdd->proteger($tag.'%'); |
} |
|
$this->addWhere('masque.tag_del', "di.id_image IN ($sousRequete)"); |
} |
} |
|
private function getNombreDeTags() { |
$somme = 0; |
if (isset($this->parametres['masque.tag_del']['AND'])) { |
$somme = count($this->parametres['masque.tag_del']['AND']); |
} else { |
$somme = count($this->parametres['masque.tag_del']['OR']); |
} |
return $somme; |
} |
|
private function construireTagsMotif() { |
$tagsMotif = null; |