Ejemplo n.º 1
0
function render_admin_listarsecciones($param)
{
    require_once "lister.php";
    $sf = vwVarFromInput('sf');
    $start = vwVarFromInput('start');
    $up = vwVarFromInput('up');
    list($db) = Getdb();
    $tbl = GetTable('secciones');
    $col = GetCols('secciones');
    $sql = "Select * from {$tbl}";
    $Cols = array(array("dbname" => $col['sid'], "label" => "id", "width" => "45px", "sortable" => false), array("dbname" => $col['nombre'], "label" => "Nombre", "width" => "200px", "sortable" => true));
    $opciones = array(array("funcion" => "cbSeccionEdit", "valor" => "{$col['sid']}"), array("funcion" => "cbSeccionDelete", "valor" => "{$col['sid']}"));
    $acciones = array(array('funcion' => "cbSeccionAdmAdd"));
    $archivList = new Lister("admSecciones", $sql, 25, $Cols, $col['sid'], $opciones, "dg-admsecciones.css");
    $archivList->table = "{$tbl}";
    $archivList->where = "";
    $archivList->GeneralActions = $acciones;
    if ($sf != "") {
        $archivList->SetSort($sf, $up);
    }
    if ($start != "") {
        $archivList->SetStart($start);
    }
    $listado = $archivList->render();
    if ($listado === null || trim($listado) == "") {
        $aux = cbSeccionAdmAdd();
        $listado = "<br><center><a link href='{$aux['url']}'>{$aux['etiqueta']}</a></center>";
    }
    $resultado = SmartyInit();
    $plantilla = "seccion/listarseccion.tpl";
    $resultado->assign("listado", $listado);
    $salida = $resultado->fetch($plantilla);
    vwSessionSetVar('urlantigua', CurrentUrl());
    return $salida;
}
Ejemplo n.º 2
0
function render_usuario_fixprefs($param)
{
    list($notify, $items, $uid) = vwVarFromInput('notify', 'items', 'uid');
}
Ejemplo n.º 3
0
function render_user_listarResultados($param)
{
    $col = GetCols('documentos');
    $tbl = GetTable('documentos');
    list($db) = Getdb();
    if (vwSessionGetVar('search') == "new") {
        list($cond1, $cond2, $cond3, $cond4, $cond5, $cond6, $cond7, $cond8) = vwVarFromInput('cond1', 'cond2', 'cond3', 'cond4', 'cond5', 'cond6', 'cond7', 'cond8');
        list($aid, $sid, $signatura, $folios, $siglos, $periodo, $resumen, $notas) = vwVarFromInput('aid', 'sid', 'signatura', 'folios', 'siglos', 'periodo', 'resumen', 'notas');
        $ft1 = true;
        $ft2 = true;
        $condiciones = array();
        if (trim($aid) != "") {
            $semaforo = true;
            if ($cond1 != "REQ") {
                $semaforo = false;
            }
            $condiciones[] = array("condicion" => "{$col['aid']}=" . trim($aid), "requerido" => $semaforo);
        }
        if (trim($sid) != "") {
            $semaforo = true;
            if ($cond2 != "REQ") {
                $semaforo = false;
            }
            $condiciones[] = array("condicion" => "{$col['sid']}=" . trim($sid), "requerido" => $semaforo);
        }
        if (trim($signatura) != "") {
            $semaforo = true;
            if ($cond3 != "REQ") {
                $semaforo = false;
            }
            $condiciones[] = array("condicion" => "{$col['signatura']} like '%" . htmlentities(trim($signatura), ENT_QUOTES) . "%'", "requerido" => $semaforo);
        }
        if (trim($folios) != "") {
            $semaforo = true;
            if ($cond4 != "REQ") {
                $semaforo = false;
            }
            $condiciones[] = array("condicion" => "{$col['folios']} like '%" . htmlentities(trim($folios), ENT_QUOTES) . "%'", "requerido" => $semaforo);
        }
        if (trim($siglos) != "") {
            $semaforo = true;
            if ($cond5 != "REQ") {
                $semaforo = false;
            }
            $condiciones[] = array("condicion" => "{$col['siglos']} like '%" . htmlentities(trim($siglos), ENT_QUOTES) . "%'", "requerido" => $semaforo);
        }
        if (trim($periodo) != "") {
            $semaforo = true;
            if ($cond6 != "REQ") {
                $semaforo = false;
            }
            $items = ParsePeriodForSearch($periodo);
            $condicion = "";
            $prev = "";
            $semaforo1 = false;
            foreach ($items as $item) {
                if (!$semaforo1) {
                    $semaforo1 = true;
                    $prev = " OR ";
                }
                $condicion = $condicion . $prev . " {$col['periodo']} like '%{$item}%'";
                $semaforo1 = true;
            }
            if (trim($condicion) != "") {
                $condiciones[] = array("condicion" => "({$condicion})", "requerido" => $semaforo);
            }
        }
        if (trim($resumen) != "") {
            $resumen = str_replace("'", "", $resumen);
            $semaforo = true;
            if ($cond7 != "REQ") {
                $semaforo = false;
            }
            $condiciones[] = array("condicion" => " MATCH ({$col['resumen']}) AGAINST ('" . htmlentities(trim($resumen), ENT_NOQUOTES) . "' IN BOOLEAN MODE)", "requerido" => $semaforo);
            $ft1 = " MATCH ({$col['resumen']}) AGAINST ('" . htmlentities(trim($resumen), ENT_NOQUOTES) . "' IN BOOLEAN MODE) AS puntuaje1";
        }
        if (trim($notas) != "") {
            $notas = str_replace("'", "", $notas);
            $semaforo = true;
            if ($cond8 != "REQ") {
                $semaforo = false;
            }
            $condiciones[] = array("condicion" => " MATCH ({$col['notas']}) AGAINST ('" . htmlentities(trim($notas), ENT_NOQUOTES) . "' IN BOOLEAN MODE)", "requerido" => $semaforo);
            $ft2 = " MATCH ({$col['notas']}) AGAINST ('" . htmlentities(trim($notas), ENT_NOQUOTES) . "' IN BOOLEAN MODE) AS puntuaje2";
        }
        $sqlwhere = "";
        $semaforo = false;
        foreach ($condiciones as $condicion) {
            if (!$semaforo) {
                $sqlwhere = $condicion['condicion'];
                $semaforo = true;
            } else {
                switch ($condicion['requerido']) {
                    case false:
                        $sqlwhere = $sqlwhere . " OR {$condicion['condicion']}";
                        break;
                    case true:
                        $sqlwhere = "({$sqlwhere}) AND {$condicion['condicion']}";
                        break;
                }
            }
        }
        if ($ft1 != true || $ft2 != true) {
            if ($ft1 != true && $ft2 != true) {
                $sql2 = "SELECT *, {$ft1},{$ft2} FROM {$tbl} WHERE {$sqlwhere} ORDER BY puntuaje1 desc, puntuaje2 desc;";
            } else {
                if ($ft2 == true) {
                    $sql2 = "SELECT *, {$ft1} FROM {$tbl} WHERE {$sqlwhere};";
                } else {
                    $sql2 = "SELECT *, {$ft2} FROM {$tbl} WHERE {$sqlwhere};";
                }
            }
        } else {
            $sql2 = "SELECT * FROM {$tbl} WHERE {$sqlwhere} ";
        }
        vwSessionSetVar('sqlsearch', $sql2);
        //vwSessionSetVar('sqlbase',$sqlbase);
        vwSessionSetVar('sqlwhere', $sqlwhere);
        vwSessionSetVar('search', "no");
    } else {
        $sql2 = vwSessionGetVar('sqlsearch');
        $sqlwhere = vwSessionGetVar('sqlwhere');
    }
    $sf = $param['start'] + 0;
    $rs = $db->SelectLimit($sql2, 25, $sf);
    if ($rs === false) {
        $mensaje = "Ha generado una busqueda incorrecta, revise los datos introducidos";
    } else {
        $items = $rs->GetRows();
        if (trim($items[0][$col['aid']] < 1)) {
            $mensaje = "No hay registros que cumplan sus criterios de busqueda";
        }
    }
    /* Aqui comienza el uso del nuevo Lister .... */
    $Cols = array(array("dbname" => $col['aid'], "showcall" => array("funcion" => 'cbzArchivos', "valor" => $col['aid'])), array("dbname" => $col['sid'], "showcall" => array("funcion" => 'cbzSecciones', "valor" => $col['sid'])), array("dbname" => $col['periodo'], "showcall" => array("funcion" => 'cbzPeriodo', "valor" => $col['periodo'])), array("dbname" => "EXTRA", "showcall" => array("funcion" => 'cbzRecursos', "valor" => $col['did'])));
    $options = array(array('funcion' => 'cbzMasInfo', 'valor' => $col['did']));
    $lister = new freeLister("usrListado", "freeLister1.css", "resultDocs.tpl", $col['did'], 25, $Cols, $options, $sqlwhere, $sql2);
    $lister->SetStart($param['start'] + 0);
    $z = $lister->render();
    return $z;
}
Ejemplo n.º 4
0
 function _edit()
 {
     $items = vwVarFromInput("tbItems");
     for ($z = 1; $z < $items + 1; $z++) {
         if (vwVarFromInput("tbItemEdit{$z}") != "N") {
         }
     }
 }
Ejemplo n.º 5
0
function render_admin_restoreStart($param)
{
    $error = false;
    $destino = vwVarFromInput('directorio');
    if (!file_exists($destino)) {
        $error = "Archivo o Directorio inexistente<br>";
    } else {
        if (!is_dir($destino)) {
            $error = "No ha especificado un directorio correcto";
        } else {
            if (!is_readable($destino)) {
                $error = "Lo siento pero no tiene los permisos adecuados";
            } else {
                $resultado = restoreSystem($destino);
                if (!$resultado) {
                    $error = "Ha habido un fallo en la restauracion de los datos";
                }
            }
        }
    }
    if (!($error === false)) {
        $param['ruta'] = "error";
        $param['mensaje'] = "{$error}";
        $param['timeout'] = "10";
        render($param);
        die;
    } else {
        return render_msg("La restauracion del sistema ha sido realizada con exito.", 5, "index.php");
    }
    die;
}
Ejemplo n.º 6
0
function render_admin_verrsc($param)
{
    $did = $param['did'];
    if ($did < 1) {
        $did = vwSessionGetVar('udid');
    } else {
        vwSessionSetVar('udid', $did);
    }
    if ($did < 1) {
        header('Location: index.php');
        die;
    }
    require_once "lister.php";
    $sf = vwVarFromInput('sf');
    $start = vwVarFromInput('start');
    $up = vwVarFromInput('up');
    list($db) = Getdb();
    $tbl = GetTable('recursos');
    $col = GetCols('recursos');
    $sql = "Select * from {$tbl} where {$col['did']}={$did}";
    $Cols = array(array("dbname" => $col['rid'], "label" => "id", "width" => "45px", "sortable" => true), array("dbname" => $col['titulo'], "label" => "T&itulo", "width" => "200px", "sortable" => true), array("dbname" => $col['url'], "label" => "URL", "width" => "200px", "sortable" => false), array("dbname" => $col['archivo'], 'label' => "Archivo", "width" => "100px", "sortable" => false));
    $opciones = array(array("funcion" => "cbRscEdit", "valor" => "{$col['rid']}"), array("funcion" => "cbRscDelete", "valor" => "{$col['rid']}"));
    $acciones = array(array('funcion' => "cbRscAdmAdd"));
    $archivList = new Lister("admRecursos", $sql, 25, $Cols, $col['rid'], $opciones, "dg-admrecursos.css");
    $archivList->table = "{$tbl}";
    $archivList->where = "{$col['did']}={$did}";
    $archivList->GeneralActions = $acciones;
    if ($sf != "") {
        $archivList->SetSort($sf, $up);
    }
    if ($start != "") {
        $archivList->SetStart($start);
    }
    $listado = $archivList->render();
    if ($listado === null || trim($listado) == "") {
        $aux = cbSeccionAdmAdd();
        $listado = "<br><center><a link href='{$aux['url']}'>{$aux['etiqueta']}</a></center>";
    }
    $resultado = SmartyInit();
    $plantilla = "document/listarsc.tpl";
    $resultado->assign("listado", $listado);
    $salida = $resultado->fetch($plantilla);
    vwSessionSetVar('urlantigua', CurrentUrl());
    return $salida;
}
Ejemplo n.º 7
0
                 break;
         }
     } else {
         $param['ruta'] = "error";
         $param['mensaje'] = "Accion no soportada";
     }
     render($param);
     die;
     break;
 case "usuarios":
     require_once 'usuarios/usuarios.aux.inc.php';
     // cargamos las funciones auxiliares...
     switch ($accion) {
         case "login":
             // funcion de login
             list($uname, $passwd) = vwVarFromInput('uname', 'clave');
             $result = checkUser($uname, $passwd);
             if ($result != USER_LOGIN_OK) {
                 // Si no es un usuario del sistema devolvemos un error
                 $param['ruta'] = "error";
                 switch ($result) {
                     case USER_BAD_LOGIN:
                         $param['mensaje'] = "La clave introducida es incorrecta, vuelva a intentarlo.";
                         $param['retry'] = true;
                         break;
                     case USER_BAD_USER:
                         $param['mensaje'] = "El usuario no existe en el sistema.";
                         $param['retry'] = true;
                         break;
                     case USER_UNKNOWN_ERROR:
                         $param['mensaje'] = "";
Ejemplo n.º 8
0
<?php

require_once 'tools.php';
print_r($_POST);
print_r($_GET);
print_r($_SERVER);
print_r($_FILES);
print_r($_ENV);
print_r($_COOKIE);
print_r($_SESSION);
$count = vwVarFromInput('count');
for ($z = 1; $z < $count + 1; $z++) {
    $var = vwVarFromInput("r{$z}");
    if ($var != "VIRGIN") {
        $stax[$z] = array("h" => vwVarFromInput("T{$z}"), "a" => vwVarFromInput("A{$z}"));
    }
}
print_r($stax);
die;
Ejemplo n.º 9
0
function render_admin_validaredicion($param)
{
    list($aid, $sid, $folios, $signatura, $siglos, $periodo, $resumen, $notas, $oldid) = vwVarFromInput("aid", "sid", "folios", "signatura", "siglos", "periodo", "resumen", "notas", 'oldid');
    // Comprobamos que el documento no existe ya
    list($db) = Getdb();
    $tbl = GetTable('documentos');
    $col = GetCols('documentos');
    $seccion = array("did" => $oldid, "aid" => $aid, "sid" => $sid, "folios" => htmlentities($folios, ENT_QUOTES), "signatura" => htmlentities($signatura, ENT_QUOTES), "siglos" => htmlentities($siglos, ENT_QUOTES), "periodo" => ParsePeriod($periodo), "resumen" => htmlentities($resumen, ENT_QUOTES), "notas" => htmlentities($notas, ENT_QUOTES));
    //$seccion=fromcmstodb($seccion,'documentos');
    $result = _update($seccion);
    if ($result) {
        $mensaje = "Los datos del archivo han sido cambiados correctamente";
    } else {
        $mensaje = "Ha habido un error en la actualizaci&oacute;n de los datos.<br>{$result}";
    }
    /* $resultado= SmartyInit();
    		$resultado->assign("mensaje",$mensaje);
    		$plantilla="mensaje.tpl";
    		$salida=$resultado->fetch($plantilla);
    		return $salida; */
    $url = vwSessionGetVar('urlantigua');
    vwSessionDelVar('urlantigua');
    return render_msg($mensaje, 3, $url);
}
Ejemplo n.º 10
0
     break;
 case "validar":
     $param['ruta'] = "{$actor}/{$accion}";
     $param['plantilla'] = "{$accion}";
     $param['previa'] = $previa;
     $param['sid'] = $sid;
     render_admin($param);
     break;
 case "edit":
     $param['ruta'] = "{$actor}/{$accion}";
     $param['plantilla'] = "{$accion}";
     $param['cid'] = $cid;
     render_admin($param);
     break;
 case "entrar":
     $cid = vwVarFromInput('cid');
     header("location:admin.php?actor=articulos&accion=listar&cid={$cid}");
     die;
     break;
 case "confirm":
     $param['ruta'] = "{$actor}/{$accion}";
     $param['plantilla'] = "{$accion}";
     $param['cid'] = $cid;
     render_admin($param);
     break;
 case "del":
     $param['ruta'] = "{$actor}/{$accion}";
     $param['plantilla'] = "{$accion}";
     $param['cid'] = $cid;
     render_admin($param);
     break;
function render_admin_listarestadisticas($param)
{
    require_once "lister.php";
    $sf = vwVarFromInput('sf');
    $start = vwVarFromInput('start');
    $up = vwVarFromInput('up');
    list($db) = Getdb();
    // Recursos
    $tbl = GetTable('recursos');
    $col = GetCols('recursos');
    $sql = "Select * from {$tbl}";
    $Cols = array(array("dbname" => $col['rid'], "label" => "id", "width" => "45px", "sortable" => false), array("dbname" => $col['nombre'], "label" => "Nombre", "width" => "200px", "sortable" => false), array("dbname" => $col['acceso'], "label" => "Nº Accesos", "width" => "45px", "sortable" => true), array("dbname" => $col['solicitud'], "label" => "Nº Solicitudes", "width" => "45px", "sortable" => true, "sort" => "D"));
    $opciones = array();
    $acciones = array();
    $recurList = new Lister("admRecursos", $sql, 25, $Cols, $col['rid'], $opciones, "dg-admrecursos.css");
    $recurList->table = "{$tbl}";
    $recurList->where = "";
    $recurList->GeneralActions = $acciones;
    if ($sf != "") {
        $recurList->SetSort($sf, $up);
    }
    if ($start != "") {
        $recurList->SetStart($start);
    }
    $listadoRecur = $recurList->render();
    if ($listadoRecur === null || trim($listadoRecur) == "") {
        $listadoRecur = "<br><center>No hay estadisticas a mostrar</a></center>";
    }
    //Documentos
    $tbl = GetTable('documentos');
    $col = GetCols('documentos');
    $sql = "Select * from {$tbl}";
    $Cols = array(array("dbname" => $col['did'], "label" => "id", "width" => "45px", "sortable" => false), array("dbname" => $col['visitas'], "label" => "Visitas", "width" => "45px", "sortable" => true, "sort" => "D"), array("dbname" => $col['signatura'], "label" => "Signatura", "width" => "200px", "sortable" => false));
    $opciones = array();
    $acciones = array();
    $docuList = new Lister("admDocumentos", $sql, 25, $Cols, $col['did'], $opciones, "dg-admdocumentos.css");
    $docuList->table = "{$tbl}";
    $docuList->where = "";
    $docuList->GeneralActions = $acciones;
    if ($sf != "") {
        $docuList->SetSort($sf, $up);
    }
    if ($start != "") {
        $docuList->SetStart($start);
    }
    $listadoDocu = $docuList->render();
    //****************
    if ($listadoDocu === null || trim($listadoDocu) == "") {
        $listadoDocu = "<br><center>No hay estadisticas a mostrar</a></center>";
    }
    ///********
    $listadoRegistros = eventos('registro');
    $listadoVerdoc = eventos('verdoc');
    $listadoVerrsc = eventos('verrsc');
    $listadoSolicitudes = eventos('solicitud');
    $listadoEdicion = eventos('editar');
    $listadoConceder = eventos('conceder');
    ///********
    $resultado = SmartyInit();
    $plantilla = "estadisticas/listarestadisticas.tpl";
    $resultado->assign("listadoRecur", $listadoRecur);
    $resultado->assign("listadoDocu", $listadoDocu);
    $resultado->assign("listadoRegistros", $listadoRegistros);
    $resultado->assign("listadoVerdoc", $listadoVerdoc);
    $resultado->assign("listadoVerrsc", $listadoVerrsc);
    $resultado->assign("listadoSolicitudes", $listadoSolicitudes);
    $resultado->assign("listadoConceder", $listadoConceder);
    $resultado->assign("listadoEdicion", $listadoEdicion);
    $salida = $resultado->fetch($plantilla);
    vwSessionSetVar('urlantigua', CurrentUrl());
    return $salida;
}