123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?php
- /*
- * Incluir en cada página para pintar el menú. Se necesita conexión de base de datos.
- * * @author Alejandro
- */
- class MainMenu {
- //put your code here
- private $xtpl, $menu, $pdo;
-
- /**
- * @param int $usr_id Id del usuario actual
- * @param int $menu_selected Id del menú seleccionado
- * @param PDO $this->pdo Conexión de base de datos
- */
- function __construct($titulo, $pdo, $menuArr){
- $this->titulo = trim($titulo);
- $this->menu = $menuArr;
- $this->pdo = $pdo;
- }
-
- private function creaMenu($id, $nombre){
- $this->xtpl->assign("MENU_ID", $id);
- $this->xtpl->assign("MENU_NOMBRE", $nombre);
-
- $this->xtpl->parse("main.sidebar.menus.menu.inactivo");
- $this->xtpl->parse("main.sidebar.menus.menu.collapsed");
- }
-
- public function printMenu(){
-
- require_once("./include/xTemplate/xtemplate.class.php");
- $this->xtpl = new XTemplate('./tpl/main_menu.tpl.html');
-
- //$this->xtpl->assign("LOGO_LINK", "main.php");
-
- $rutaLogo = "/img/logo_lasalle.png";
- //$rutaLogo = 'img/60_logo.svg'; //logo 60
- $this->xtpl->assign("LOGO_IMG", $rutaLogo);
-
- $stmt = $this->pdo->prepare('Select * from fs_sistema(null)');
- if(!$stmt->execute()){
- echo "Error al obtener sistemas";
- print_r($stmt->errorInfo());
- exit();
- }
- $sistemasArr = $stmt->fetchAll();
- $stmt->closeCursor();
- $stmt = null;
-
-
- //Menus superadmin
- /*
- foreach($sistemasArr as $sistema){
- $this->xtpl->assign("TEXTO", $sistema["Sistema_nombre"]);
- $this->xtpl->parse("main.sistemas.list.texto");
- }
- $this->xtpl->parse("main.sistemas.list");
- $this->xtpl->parse("main.sistemas");*/
- foreach($this->menu as $apsaOld){
- $this->xtpl->assign("MENU_LINK", $apsaOld["link"]);
- $this->xtpl->assign("MENU_NOMBRE", $apsaOld["nombre"]);
- $this->xtpl->parse("main.sidebar.menus.menu_link");
- }
- $this->xtpl->parse("main.sidebar.menus");
- $this->xtpl->parse("main.sidebar");
- $this->xtpl->parse("main.menu_index");
- if($this->titulo != "")
- $this->xtpl->assign("TITULO", $this->titulo);
- $this->xtpl->parse("main");
- $this->xtpl->out("main");
- }
-
-
- function printMenuFooter(){
-
- }
- /*
- * @return string Texto con el código HTML del menú
- */
- public function textMenu(){
- return $this->xtpl->text("main");
- }
-
- }
|