Пример #1
0
 public function todasCategorias()
 {
     $helper = new Helper();
     $helper->categoriaJson = 'categorias';
     $helper->nombreJson = 'categorias';
     $existeJson = $helper->existeJson('categorias');
     if ($existeJson) {
         return $helper->leerJson(true);
     } else {
         $categorias = $this->todos(self::$modelo);
         $helper->crearJson($categorias);
         return $helper->leerJson(true);
     }
 }
Пример #2
0
 public function enlacesMenu($tipo)
 {
     $categoria = array_key_exists($tipo, $this->categorias) ? $this->categorias[$tipo] : 0;
     $categorias = $this->getCategorias();
     $helper = new Helper();
     $helper->categoriaJson = 'menu';
     $helper->nombreJson = $tipo;
     $existeJson = $helper->existeJson($tipo);
     if ($existeJson) {
         return $helper->leerJson(true);
     } else {
         $this->query = 'call sp_getMenuJerarquia(' . $categoria . ');';
         foreach ($this->seleccion() as $key => $enlace) {
             //1 = nivel base
             if ($enlace['nivel'] == 1) {
                 $enlaces[] = array('id' => $enlace['id'], 'idcategoria' => $enlace['categoria'], 'clavecategoria' => $categorias[$enlace['categoria']]['clave'], 'categoria' => $categorias[$enlace['categoria']]['valor'], 'nombre' => $enlace['nombre'], 'enlace' => $enlace['enlace'], 'clase' => $enlace['clase'], 'tipo' => $enlace['tipo_enlace'], 'target' => $enlace['target'], 'nivel' => $enlace['nivel'], 'hijos' => (string) count($this->getItem($enlace['hijos'])), 'items' => $this->getItem($enlace['hijos']));
             }
         }
         $helper->crearJson($enlaces);
         return $helper->leerJson(true);
     }
 }