1,24 → 1,20 |
<?php |
// ATTENTION ! Classe compatible uniquement avec nouveau format de bdd du cel // |
// declare(encoding='UTF-8'); |
/** |
* PHP Version 5 |
* Classe de recherche d'images à partir de divers critères. |
* |
* @category PHP |
* @package jrest |
* @author Aurélien Peronnet <aurelien@tela-botania.org> |
* @copyright 2010 Tela-Botanica |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL |
* @version SVN: <svn_id> |
* @link /doc/jrest/ |
* @internal Mininum PHP version : 5.2 |
* @category CEL |
* @package Services |
* @subpackage Bibliothèques |
* @version 0.1 |
* @author Mathias CHOUET <mathias@tela-botanica.org> |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
* @author Aurelien PERONNET <aurelien@tela-botanica.org> |
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt> |
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt> |
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org> |
*/ |
|
/** |
* in : utf8 |
* out : utf8 |
* |
* Librairie recherche d'images a partir de divers critères |
* |
*/ |
class RechercheImage extends Cel { |
|
function rechercherImagesEtObservationAssociees($id_utilisateur = null, $criteres = array(), $debut = 0, $limite = 50) { |
85,7 → 81,6 |
if ($resultat_requete_nombre_images && is_array($resultat_requete_nombre_images) && count($resultat_requete_nombre_images) > 0) { |
$nb_images = $resultat_requete_nombre_images[0]['nb_images']; |
} |
|
return $nb_images; |
} |
|
219,10 → 214,8 |
if (trim($chaine_recherche) == '') { |
return ''; |
} |
|
$chaine_recherche = strtolower($chaine_recherche); |
$chaine_recherche = str_replace(' ','_',$chaine_recherche); |
|
$requete = ' ('. |
'ci.nom_original LIKE '.Cel::db()->proteger($chaine_recherche.'%').' OR '. |
'co.nom_ret LIKE '.Cel::db()->proteger($chaine_recherche.'%').' OR '. |
236,7 → 229,6 |
'ci.nom_utilisateur LIKE '.Cel::db()->proteger($chaine_recherche.'%').' OR '. |
'ci.prenom_utilisateur LIKE '.Cel::db()->proteger($chaine_recherche.'%').' '. |
') '; |
|
return $requete; |
} |
|
286,13 → 278,15 |
$mots_cles_chaine = rtrim($mots_cles_chaine,','); |
$image['mots_cles'] = $mots_cles_chaine; |
} |
|
return $tableau_images; |
} |
|
public function obtenirCourrielUtilisateurPourIdImage($id_image) { |
$requete = 'SELECT courriel_utilisateur FROM cel_images WHERE id_image = '.Cel::db()->proteger($id_image); |
|
$idImageP = Cel::db()->proteger($id_image); |
$requete = 'SELECT courriel_utilisateur '. |
'FROM cel_images '. |
"WHERE id_image = $idImageP ". |
' -- '.__FILE__.':'.__LINE__; |
$utilisateur_courriel = Cel::db()->requeter($requete); |
|
$retour = false; |
305,18 → 299,8 |
private function getIdsMotsClesImage($id_image) { |
$requete = 'SELECT DISTINCT id_mot_cle '. |
'FROM cel_mots_cles_images_liaison '. |
"WHERE id_element_lie = $id_image "; |
|
"WHERE id_element_lie = $id_image ". |
' -- '.__FILE__.':'.__LINE__; |
return Cel::db()->requeter($requete); |
} |
|
// TODO: fonction temporaire |
private function formaterDateSqlVersDateAvecSlash($date_sql) { |
$date_formatee = ''; |
$date = explode('-', $date_sql) ; |
if (count($date) > 2) { |
$date_formatee = $date[2].'/'.$date[1].'/'.$date[0] ; |
} |
return $date_formatee; |
} |
} |