You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Menu.php 763B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace Blog\Model;
  3. use \Blog\Model\Link;
  4. use \Blog\DB\Menu as DB_Menu;
  5. class Menu
  6. {
  7. protected $links = [];
  8. public function __construct($type)
  9. {
  10. $this->_loadMenu($type);
  11. }
  12. protected function _loadMenu($type)
  13. {
  14. $db = new DB_Menu();
  15. $res = $db->getMenu($type);
  16. while ($result = $res->fetchArray(SQLITE3_ASSOC)) {
  17. $link = new Link();
  18. $link->setID($result['id']);
  19. $link->setName($result['name']);
  20. $link->setUrl($result['url']);
  21. $link->setType($result['type']);
  22. $link->setParent($result['parent']);
  23. $this->links[] = $link;
  24. }
  25. }
  26. public function getLinks()
  27. {
  28. return $this->links;
  29. }
  30. }