@@ -8,13 +8,21 @@ use \Blog\DB\Menu as DB_Menu; | |||
class Menu | |||
{ | |||
protected $links; | |||
protected $links = []; | |||
public function loadMenu($type) | |||
{ | |||
$db = new DB_Menu(); | |||
$res = $db->getMenu($type); | |||
$results = $res->fetchArray(SQLITE3_ASSOC); | |||
$this->links = $results; | |||
foreach ($results as $result) { | |||
$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; | |||
} | |||
} | |||
} |