function render_static_mostrar($sujeto, $param)
{
    $resultado = SmartyInit();
    $plantilla = "static/" . $sujeto . ".tpl";
    $salida = $resultado->fetch($plantilla);
    return $salida;
}
function render_admin_restore($param)
{
    $resultado = SmartyInit();
    $plantilla = "restore.tpl";
    $resultado->assign("accion", "index?actor=backup&accion=restorestart");
    $salida = $resultado->fetch($plantilla);
    return $salida;
}
function render_user_buscar($param)
{
    vwSessionSetVar('search', 'new');
    $resultado = SmartyInit();
    $resultado->assign("dropCond1", BoleanDropDown("cond1", " "));
    $resultado->assign("dropCond2", BoleanDropDown("cond2", " "));
    $resultado->assign("dropCond3", BoleanDropDown("cond3", " "));
    $resultado->assign("dropCond4", BoleanDropDown("cond4", " "));
    $resultado->assign("dropCond5", BoleanDropDown("cond5", " "));
    $resultado->assign("dropCond6", BoleanDropDown("cond6", " "));
    $resultado->assign("dropCond7", BoleanDropDown("cond7", " "));
    $resultado->assign("dropCond8", BoleanDropDown("cond8", " "));
    $resultado->assign('dropDwArchivo', html_entity_decode(ArchivosDropDown(), ENT_QUOTES));
    $resultado->assign('dropDwSeccion', html_entity_decode(SeccionesDropDown(), ENT_QUOTES));
    $resultado->assign("accion", "index.php?actor=buscador&accion=resultados");
    $plantilla = "busqueda.tpl";
    $salida = $resultado->fetch($plantilla);
    return $salida;
}
function UsuarioPager($pagina_actual)
{
    list($db) = Getdb();
    $tables = GetTables();
    $table = $tables['t']['usuarios'];
    $cols = $tables['c']['usuarios'];
    $rs = $db->Execute("Select * from {$table}");
    $items = $rs->PO_RecordCount($table, " 1=1") + 0;
    $pages = ceil($items / 10);
    if ($pages <= 1) {
        return "";
    }
    for ($i = 1; $i < $pages + 1; $i++) {
        $elementos[]['value'] = $i;
        $elementos[]['url'] = "admin.php?actor=usuarios&accion=listarusuarios?pagina={$i}";
    }
    $paginador = SmartyInit();
    $paginador->assign('PagActual', $pagina_actual);
    $paginador->assign('Paginas', $elementos);
    return $paginador->fetch('Secpaginador.tpl');
}
function render_usuario_showprefs($param)
{
    $id = vwSessionGetVar('uid');
    list($db) = Getdb();
    $tblUsuarios = GetTable('usuarios');
    $colUsuarios = GetCols('usuarios');
    $sql = "SELECT {$colUsuarios['preferencias']} from {$tblUsuarios} where {$colUsuarios['uid']}=" . $id;
    $rs = $db->Execute($sql);
    if ($rs === false) {
        // Error
        die($sql);
    }
    $z = $rs->FetchRow();
    $preferencias = compact($z);
    if (trim($preferencias) == "") {
        $preferencias = "Items=25\nNotify=false";
    }
    $pref = explode("\n", $preferencias);
    list($notify) = explode("=", $pref[2]);
    $notify = $notify == "true" ? true : false;
    list($items) = explode("=", $pref[1]);
    if ($items < 5) {
        $items = 25;
    }
    $resultado = SmartyInit();
    $resultado->assign("accion", $mensaje);
    $resultado->assign("items", $items);
    $resultado->assign("notify", $notify);
    $resultado->assign("uidz", vwSessionGetVar('uid'));
    $plantilla = "usuarios/usrprefs.tpl";
    $salida = $resultado->fetch($plantilla);
    return $salida;
}
function SmartyFetch(&$oSmarty, $sTemplateName, $sTemplateSet = '')
{
    SmartyInit($oSmarty, $sTemplateName, $sTemplateSet);
    return $oSmarty->fetch($sTemplateName);
}
Beispiel #7
0
function GenDropDwn($idElemento, $sql, $id = -1, $null = false)
{
    if (trim($idElemento) == "" || trim($sql) == "") {
        return null;
    }
    list($db) = Getdb();
    $rs = $db->Execute($sql);
    if ($rs === false) {
        return null;
    }
    $Elementos = $rs->GetRows();
    if ($null) {
        $Elementos[] = array('id' => '', 'etiqueta' => "Vacio");
    }
    $smarty = SmartyInit();
    $DropDown = "dropdown.tpl";
    $smarty->assign('Elementos', $Elementos);
    $smarty->assign('idSel', $id);
    $smarty->assign('idElemento', $idElemento);
    return $smarty->fetch($DropDown);
}
function render_admin_okdel($param)
{
    $resultado = SmartyInit();
    $plantilla = "seccion/admdelcheck.tpl";
    $id = $param['sid'];
    $resultado->assign("confirmadelurl", "index?actor=secciones&accion=delseccion&id={$id}");
    $resultado->assign("rechazadelurl", "index.php?actor=secciones&accion=listar");
    $resultado->assign("mensaje", $param['mensaje']);
    $salida = $resultado->fetch($plantilla);
    return $salida;
}
 function renderPagerRow()
 {
     $row = SmartyInit();
     $CurrentUrl = CurrentUrl();
     if (!(strpos($CurrentUrl, "start=") === false)) {
         $CurrentUrl = substr($CurrentUrl, 0, strpos($CurrentUrl, "start=") - 1);
     }
     if (strpos($CurrentUrl, "?") === false) {
         $CurrentUrl .= "?";
     } else {
         if (strpos($CurrentUrl, "&", strlen($CurrentUrl) - 1) === false) {
             $CurrentUrl .= "&";
         }
     }
     list($db) = Getdb();
     $rs = $db->Execute($this->sql);
     if (!($rs === false)) {
         $this->total = $rs->PO_RecordCount($this->table, $this->where);
     } else {
         return null;
     }
     $perpage = $this->rows;
     if ($perpage >= $this->total) {
         $PageArray[] = array('Page' => 1, 'start' => 0, 'Selected' => 1);
     } else {
         if ($start <= 0) {
             $start = 1;
         }
         $TotalPaginas = 1 + floor($this->total / $perpage);
         $PaginaActual = 1 + floor($this->start / $perpage);
         $PageArray = array();
         for ($paginas = 1; $paginas < $TotalPaginas + 1; $paginas++) {
             $PageArray[] = array('Page' => $paginas, 'start' => $paginas > 1 ? ($paginas - 1) * $perpage : 0, 'Selected' => $paginas == $PaginaActual ? 1 : 0);
         }
     }
     $row->assign('Paginas', $PageArray);
     $row->assign('baseurl', $CurrentUrl);
     $Pager = $row->fetch("freeLister_pager.tpl");
     return $Pager;
 }
Beispiel #10
0
 function renderPagerRow2()
 {
     $row = SmartyInit();
     $row->assign('titles', $this->ColsToShow);
     $row->assign('ordenado', $this->orden);
     $CurrentUrl = CurrentUrl();
     if (!(strpos($CurrentUrl, "start=") === false)) {
         $CurrentUrl = substr($CurrentUrl, 0, strpos($CurrentUrl, "start=") - 1);
     }
     if (strpos($CurrentUrl, "?") === false) {
         $CurrentUrl .= "?";
     } else {
         if (strpos($CurrentUrl, "&", strlen($CurrentUrl) - 1) === false) {
             $CurrentUrl .= "&";
         }
     }
     if (isset($this->sql) && count($this->sql) >= 0) {
         $this->total = count($this->sql);
     } else {
         return null;
     }
     $perpage = $this->rows;
     if ($perpage >= $this->total) {
         $PageArray[] = array('Page' => 1, 'start' => 0, 'Selected' => 1);
     } else {
         if ($start <= 0) {
             $start = 1;
         }
         $TotalPaginas = 1 + floor($this->total / $perpage);
         $PaginaActual = 1 + floor($this->start / $perpage);
         $PageArray = array();
         for ($paginas = 1; $paginas < $TotalPaginas + 1; $paginas++) {
             $PageArray[] = array('Page' => $paginas, 'start' => $paginas > 1 ? ($paginas - 1) * $perpage : 0, 'Selected' => $paginas == $PaginaActual ? 1 : 0);
         }
     }
     $row->assign('Paginas', $PageArray);
     $row->assign('baseurl', $CurrentUrl);
     $row->assign('Cols', $this->cols);
     $Pager = $row->fetch("lister_pager.tpl");
     return $Pager;
 }
function render_admin_okdelrsc($param)
{
    $aid = $param['rid'];
    list($db) = Getdb();
    $tbl = GetTable('recursos');
    $col = GetCols('recursos');
    $sidcol = $col['rid'];
    DelOldRsc($aid);
    $sql = "DELETE FROM {$tbl} WHERE {$sidcol}='{$aid}'";
    $resultado = $db->Execute($sql);
    if ($db->ErrorNo() != 0) {
        $mensaje = "Ha ocurrido un error al borrar el recurso";
    } else {
        $mensaje = "El recurso ha sido borrado correctamente";
    }
    $resultado = SmartyInit();
    $plantilla = "mensaje.tpl";
    $resultado->assign("mensaje", $mensaje);
    $salida = $resultado->fetch($plantilla);
    return $salida;
}
function MostrarRecursos($did)
{
    list($db) = Getdb();
    $tbl = GetTable('recursos');
    $col = GetCols('recursos');
    $sql = "SELECT * FROM {$tbl} WHERE {$col['did']}={$did}";
    $rs = $db->Execute($sql);
    if ($db->ErrorNo() != 0) {
        $param['ruta'] = "error";
        $param['mensaje'] = "Ha ocurrido leer el archivo de la base de datos.";
        render($param);
        die;
    }
    $aux = $rs->GetRows();
    foreach ($aux as $value) {
        $value = fromdbtocms($value, "recursos");
        if (trim($value['url']) != "") {
            $total['url']['total'] = $total['url']['total'] + 1;
            $total['url']['rsc'][] = $value;
            $total['url']['prv'] = false;
        } else {
            $media = returnMedia($value['archivo']);
            if (!isset($total[$media]['prv'])) {
                $aux = isAValidMedia($value["archivo"]);
                $total[$media]['prev'] = $aux['preview'];
                if ($media == "pdf") {
                    $total['prevext'] = ".pdf.jpg";
                } else {
                    $total['prevext'] = ".jpg";
                }
            }
            $value['archivo'] = substr($value['archivo'], 0, strrpos($value['archivo'], '.'));
            $total[$media]['total'] = $total[$media]['total'] + 1;
            $total[$media]['rsc'][] = $value;
        }
    }
    $output = "";
    $resultado = SmartyInit();
    if (trim($media) != "") {
        foreach ($total as $k => $v) {
            if ($v['total'] > 0) {
                $resultado->assign('tipo', $k);
                $resultado->assign('recursos', $v['rsc']);
                $resultado->assign('numero', $v['total']);
                $resultado->assign('previo', $v['prev']);
                $resultado->assign('rel', $did);
                $resultado->assign('ext', $v['prevext']);
                $resultado->assign('prevs', vwSessionGetVar('uid'));
                $output = $output . $resultado->fetch("recursos.tpl");
            }
        }
    }
    if (trim($output) == "") {
        return "";
    } else {
        return $output;
    }
}
function render_msg($mensaje, $timeout, $url)
{
    $resultado = SmartyInit();
    $resultado->assign("mensaje", $mensaje);
    if ($timeout + 1 > 1 && trim($url) != "") {
        $resultado->assign("jscript", TimedRedirect($timeout, $url));
    }
    $plantilla = "msgred.tpl";
    $salida = $resultado->fetch($plantilla);
    return $salida;
}
function render_user_vermis($param)
{
    require_once "lister.php";
    $sf = vwVarFromInput('sf');
    $start = vwVarFromInput('start');
    $up = vwVarFromInput('up');
    list($db) = Getdb();
    $tbl = GetTable('autorizaciones');
    $col = GetCols('autorizaciones');
    $sql = "Select * from {$tbl}";
    $Cols = array(array("dbname" => $col['autid'], "label" => "id", "width" => "45px", "sortable" => false), array("dbname" => $col['rid'], "label" => "Recurso", "width" => "70px", "sortable" => false, "dropdown" => true, "dropcall" => array("funcion" => "cbzRecursos", "valor" => $col['rid'])), array("dbname" => $col['estado'], "label" => "Estado", "width" => "45px", "sortable" => false, 'dropdown' => true, 'dropcall' => array("funcion" => "cbzEstados", "valor" => $col['estado'])), array("dbname" => $col['razon'], "label" => "Nombre", "width" => "200px", "sortable" => true));
    $opciones = array(array("funcion" => "cbautorizacionUsrDelete", "valor" => "{$col['autid']}"), array("funcion" => "cbautorizacionUsrEditar", "valor" => "{$col['autid']}"));
    $acciones = array();
    $archivList = new Lister("admAutorizaciones", $sql, 25, $Cols, $col['autid'], $opciones, "dg-admautorizaciones.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 = cbautorizacionAdmAdd();
        $listado = "<br><center><a link href='{$aux['url']}'>{$aux['etiqueta']}</a></center>";
    }
    $resultado = SmartyInit();
    $plantilla = "autorizacion/listarautorizacion.tpl";
    $resultado->assign("listado", $listado);
    $salida = $resultado->fetch($plantilla);
    vwSessionSetVar('urlantigua', CurrentUrl());
    return $salida;
}
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;
}