Condition pour Page->enfants()

This commit is contained in:
Georges Dupéron 2010-10-13 16:54:49 +02:00
parent 52a5eea2ff
commit a53de8845b
2 changed files with 9 additions and 5 deletions

View File

@ -181,13 +181,16 @@ class Page {
public function enfants($condition = true, $ordre = "-date_creation", $limit = 0, $offset = 0) {
// Renvoie un objet de la classe CollectionPages.
// Si $condition === true, il n'y a pas de condition
// sinon, par ex: $condition = "@apercu = true"
// sinon, par ex: $condition = "apercu = 'true'"
// ordre = null => ordre = "date_creation desc"
// limit = null || limit = 0 => pas de limite
// offset = null => offset = 0
niy("enfants");
// TODO : condition
// TODO : nettoyer la condition
if ($condition !== true)
$condition = " and ($condition)";
else
$condition = "";
$select_order = "";
$first = true;
@ -207,9 +210,10 @@ class Page {
// TODO : "natural join"
$select = "select uid_page_vers from "
. BDD::table("liens")
. " join " . BDD::table("pages") . " on uid_page = uid_page_vers "
. " join " . BDD::table("pages") . " on uid_page = uid_page_vers"
. " natural join " . BDD::table($this->type_liens("enfants"))
. " where groupe = 'enfants' and uid_page_de = " . $this->uid()
. $condition
. $select_order
. $select_limit
. $select_offset

View File

@ -29,7 +29,7 @@ class mAdminListeUtilisateurs extends Page {
public function res_h_liste_mots_de_passe($d) {
$d->w_titre("Liste de mots de passe.");
$l = $d->article()->w_liste($this->enfants("u_groupe = 'utilisateurs'", "+nom +prenom"), function($e, $li) {
$l = $d->article()->w_liste($this->enfants("groupe_permissions = 'utilisateurs'", "+nom +prenom"), function($e, $li) {
$e->rendu("h_admin_mdp", $li);
});
return $d;