Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 3123 → Rev 3124

/trunk/jrest/bibliotheque/GestionChampsEtendus.php
258,13 → 258,15
/**
* Renvoie la liste des groupes de champs étendus
*/
public function consulterGroupesChampsEtendusPredefinis() {
public function consulterGroupesChampsEtendusPredefinis($groupe = "", $langue = 'fr') {
$groupes = array();
$requete = "SELECT cc.cle as cle_groupe, cc.label as nom_groupe, ccc.cle as cle_champ, ccc.label as label_champ, ccc.invisible, ccc.prive ".
$requete = "SELECT cc.cle as cle_groupe, cc.label as nom_groupe, ccc.cle as cle_champ, ccc.label as label_champ, ccc.type as type_champ, ccc.valeur as valeur_champ, ccc.invisible, ccc.prive ".
"FROM `cel_catalogue_champs_etendus` cc ".
"INNER JOIN cel_catalogue_champs_etendus_liaison cl ON cc.cle = cl.groupe ".
"INNER JOIN cel_catalogue_champs_etendus ccc ON ccc.cle = cl.champ ".
' -- '.__FILE__.':'.__LINE__;
"INNER JOIN cel_catalogue_champs_etendus ccc ON ccc.cle = cl.champ ".
"WHERE cc.langue = '".$langue."' ";
if ($groupe !== "") $requete .= " AND cl.groupe = '".$groupe."'";
$requete .= ' -- '.__FILE__.':'.__LINE__;
$groupes_champs = Cel::db()->executerRequete($requete);
 
$cle_groupe = '';
293,6 → 295,8
$infos_groupe['champs'][] = array(
'cle' => $groupe_champ['cle_champ'],
'label' => $groupe_champ['label_champ'],
'type' => $groupe_champ['type_champ'],
'valeur' => $groupe_champ['valeur_champ'],
'options' => array(
'invisible' => $groupe_champ['invisible'],
'prive' => $groupe_champ['prive'])
312,25 → 316,28
/**
* Renvoie le catalogue des champs étendus
*/
public function consulterCatalogueChampsEtendusPredefinis($ordonner_par_cle = false) {
public function consulterCatalogueChampsEtendusPredefinis($ordonner_par_cle = false, $groupe = "") {
$requete = 'SELECT cle, label, invisible, prive '.
'FROM cel_catalogue_champs_etendus AS cc '.
' -- '.__FILE__.':'.__LINE__;
'FROM cel_catalogue_champs_etendus AS cc ';
if ($groupe !== "") $requete .= " WHERE groupe = ".$groupe;
$requete .= ' -- '.__FILE__.':'.__LINE__;
$catalogue = Cel::db()->executerRequete($requete);
 
$infos_champs = array();
foreach ($catalogue as $champ) {
$champ_fmt = array(
'cle' => $champ['cle'],
'label' => $champ['label'],
'options' => array(
'invisible' => $champ['invisible'],
'prive' => $champ['prive'])
);
if ($ordonner_par_cle) {
$infos_champs[$champ_fmt['cle']] = $champ_fmt;
} else {
$infos_champs[] = $champ_fmt;
if ($catalogue != false) {
foreach ($catalogue as $champ) {
$champ_fmt = array(
'cle' => $champ['cle'],
'label' => $champ['label'],
'options' => array(
'invisible' => $champ['invisible'],
'prive' => $champ['prive'])
);
if ($ordonner_par_cle) {
$infos_champs[$champ_fmt['cle']] = $champ_fmt;
} else {
$infos_champs[] = $champ_fmt;
}
}
}
return $infos_champs;