12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
-
- namespace Blog\Model;
-
-
- use \Blog\Model\Link;
- use \Blog\DB\Menu as DB_Menu;
-
- class Menu
- {
- protected $links = [];
-
- public function __construct($type)
- {
- $this->_loadMenu($type);
- }
-
- protected function _loadMenu($type)
- {
- $db = new DB_Menu();
- $res = $db->getMenu($type);
- while ($result = $res->fetchArray(SQLITE3_ASSOC)) {
- $link = new Link();
- $link->setID($result['id']);
- $link->setName($result['name']);
- $link->setUrl($result['url']);
- $link->setType($result['type']);
- $link->setParent($result['parent']);
- $this->links[] = $link;
- }
- }
-
- public function getLinks()
- {
- return $this->links;
- }
- }
|