Example #1
0
 public function existe()
 {
     $categoria = $this->atributos['slug'];
     $datos = JaCategoriasQuery::create()->filterByTitulo($categoria)->findOne();
     $helper = new Helper();
     $resultado = array('existe' => false);
     if ($helper->contieneDatos($datos->toArray())) {
         $resultado = array('existe' => true, 'id' => $datos->getId(), 'titulo' => $datos->getTitulo());
     }
     return $resultado;
 }
Example #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);
     }
 }
Example #3
0
 public function existeCategoria()
 {
     $this->where = $this->atributos;
     $datos = $this->unico(self::$modelo);
     $helper = new Helper();
     $resultado = array('existe' => false);
     if ($helper->contieneDatos($datos)) {
         $resultado = array('existe' => true, 'id' => $datos['id'], 'titulo' => $datos['titulo']);
     }
     return $resultado;
 }
Example #4
0
 public function verificaCredenciales($credencial)
 {
     $usuario = isset($credencial->usuario) ? $credencial->usuario : '';
     $clave = isset($credencial->clave) ? $credencial->clave : '';
     $valido = false;
     //busco el usuario en bd
     $_usuario = JaUsuariosQuery::create()->filterByUsuario($usuario, Criteria::EQUAL)->findOne();
     if (Config::$DEBUG) {
         $this->log(__FUNCTION__ . ' | ' . $this->debug->getLastExecutedQuery(), Logger::DEBUG);
     }
     //valido clave
     if (!empty($_usuario->getClave())) {
         $helper = new Helper();
         $valido = $helper->validarEncriptacion($clave, $_usuario->getClave());
     }
     if ($valido) {
         $credencialusuario = new \stdClass();
         $credencialusuario->usuario = $_usuario->getUsuario();
         $credencialusuario->rol = $this->getPerfilUsuario($_usuario->getId(), true);
         $usuarioactual = array('id' => $_usuario->getId(), 'nombre' => $_usuario->getNombre() . ' ' . $_usuario->getApellidos());
         $resultado = array('usuario' => $usuarioactual, 'estado' => true, 'token' => $this->getToken($credencialusuario));
     } else {
         $resultado = array('estado' => false);
     }
     return $resultado;
 }