[1] | 1 | <?php |
---|
| 2 | |
---|
| 3 | class dc_menus extends data |
---|
| 4 | { |
---|
| 5 | |
---|
| 6 | # ---------------------------------------------------------------------------------------- |
---|
| 7 | # categories |
---|
| 8 | # |
---|
| 9 | |
---|
| 10 | function menus_categories($path) |
---|
| 11 | { return $this->categories($path); |
---|
| 12 | } |
---|
| 13 | |
---|
| 14 | function all_menus($path = array()) |
---|
| 15 | { $_path = array("root", "menus"); |
---|
| 16 | foreach($path as $__path) $_path[] = $__path; |
---|
| 17 | if(($id = $this->id_categorie($_path)) !== false) |
---|
| 18 | { return $this->sub_categories($id, null); |
---|
| 19 | } |
---|
| 20 | return false; |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | function menus_categorie($id) |
---|
| 24 | { return $this->categorie($id); |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | function add_menus_categorie($titre, $url = null, $parent = null) |
---|
| 28 | { return $this->add_categorie |
---|
| 29 | ( null, |
---|
| 30 | $titre, |
---|
| 31 | null, |
---|
| 32 | null, |
---|
| 33 | $url, |
---|
| 34 | isset($parent) ? $parent : $this->id_categorie(array("root", "menus")) |
---|
| 35 | ); |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | function set_menus_categorie($id, $titre, $url, $ordre = null) |
---|
| 39 | { if(($categorie = $this->categorie($id)) !== false) |
---|
| 40 | { return $this->set_categorie($id, $categorie["nom"], $titre, null, null, $url, $ordre); |
---|
| 41 | } |
---|
| 42 | else return false; |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | function del_menus_categorie($id) |
---|
| 46 | { return $this->del_categorie($id, true); |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | # ---------------------------------------------------------------------------------------- |
---|
| 50 | # liens |
---|
| 51 | # |
---|
| 52 | |
---|
| 53 | function menus($path, $start = 0, $depth = 0, $public = false) |
---|
| 54 | { return $this->contenus($path, $start, null, $public ? " AND public=1 AND date_publication <= NOW()" : "", $depth); |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | function add_menu($categorie, $nom, $titre, $description, $url, $auteur, $date_publication, $public) |
---|
| 58 | { return $this->add_contenu($nom, $categorie, $titre, $description, $url, $auteur, $date_publication, $public); |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | function set_menu($id, $categorie, $nom, $titre, $description, $url, $auteur, $date_publication, $public) |
---|
| 62 | { return $this->set_contenu($id, $nom, $categorie, $titre, $description, $url, $auteur, $date_publication, $public); |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | function del_menu($id) |
---|
| 66 | { return $this->del_contenu($id); |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | ?> |
---|