function buscarRoles()
 {
     // maximo por pagina
     $limit = $_GET["s"];
     // pagina pedida
     $pag = (int) $_GET["p"];
     if ($pag < 1) {
         $pag = 1;
     }
     $offset = ($pag - 1) * $limit;
     $limit = $limit * $pag;
     if (isset($_GET['sort'])) {
         switch ($_GET['sort']) {
             case 1:
                 $order = "FECHA_R DESC ";
                 break;
         }
     }
     if (isset($_GET['filter'])) {
         $filter = "'" . str_replace(";", "','", $_GET['filter']) . "'";
     } else {
         $nivel = $_SESSION['session']['nodo'];
         $filter = "'{$nivel}' ";
     }
     $sql = "SELECT  *\nFROM    ( SELECT ROW_NUMBER() OVER ( ORDER BY {$order} ) AS RowNum, *\n          FROM      ROLES\n         \n        ) AS RowConstrainedResult\nWHERE   RowNum > {$offset}\n    AND RowNum <= {$limit} \nORDER BY {$order}";
     if (isset($_GET['q']) && $_GET['q'] != "") {
         $sql .= "AND (ROLE LIKE '%" . $_GET['q'] . "%') ";
     }
     $this->roles = database::getRows($sql);
     $this->totalnum = database::getNumRows($sql);
     //CALCULAMOS EL TOTAL DE PAGINAS
     $this->totalPag = ceil($this->totalnum / $limit);
 }
 function buscarTiposDeContrato()
 {
     // maximo por pagina
     $limit = $_GET["s"];
     // pagina solicitada
     $pag = (int) $_GET["p"];
     if ($pag < 1) {
         $pag = 1;
     }
     $offset = ($pag - 1) * $limit;
     $limit = $limit * $pag;
     if (isset($_GET['sort'])) {
         switch ($_GET['sort']) {
             case 1:
                 $order = "FECHA_R DESC ";
                 break;
         }
     }
     if (isset($_GET['q']) && $_GET['q'] != "") {
         $buscar = "WHERE (DESCRIPCION LIKE '%" . $_GET['q'] . "%') ";
     } else {
         $buscar = "";
     }
     $sql = "\n\t\t\tSELECT *\n\t\t\tFROM ( SELECT ROW_NUMBER() OVER ( ORDER BY {$order} ) AS RowNum, *\n\t\t\t          FROM  TIPOS_CONTRATO {$buscar}\n\t\t\t      ) AS RowConstrainedResult\n\t\t\tWHERE RowNum > {$offset} AND RowNum <= {$limit}\n\t\t\tORDER BY {$order}\n\t\t\t";
     try {
         $this->rows = database::getRows($sql);
         $total = database::getNumRows($sql);
         $this->totalnum = $total;
     } catch (customException $e) {
         throw new customException($sql);
     }
     //CALCULAMOS EL TOTAL DE PAGINAS
     $this->totalPag = ceil($this->totalnum / $limit);
 }
 function buscarPermisos()
 {
     // maximo por pagina
     $limit = $_GET["s"];
     $tamaño = $_GET["s"];
     // pagina pedida
     $pag = (int) $_GET["p"];
     if ($pag < 1) {
         $pag = 1;
     }
     $offset = ($pag - 1) * $limit;
     $limit = $limit * $pag;
     if (isset($_GET['sort'])) {
         switch ($_GET['sort']) {
             case 1:
                 $order = "PERMISO ";
                 break;
         }
     }
     $tipo = $_GET['Tipo'];
     $sql = "SELECT * \n                FROM (select PK1, PERMISO, DESCRIPCION, FECHA_R,TIPO, row_number() \n                OVER (order by  {$order}) AS \n                RowNumber FROM PERMISOS WHERE TIPO = '{$tipo}') \n                Derived WHERE RowNumber BETWEEN '{$offset}' AND '{$limit}' ";
     //echo $sql;
     $sqlcount = "SELECT PK1, PERMISO, DESCRIPCION,FECHA_R \n                     FROM PERMISOS WHERE TIPO = '{$tipo}'";
     if (isset($_GET['q']) && $_GET['q'] != "") {
         $sql .= "AND (PERMISO LIKE '%" . $_GET['q'] . "%') ";
     }
     $this->permisos = database::getRows($sql);
     $this->totalnum = database::getNumRows($sqlcount);
     //CALCULAMOS EL TOTAL DE PAGINAS
     $this->totalPag = ceil($this->totalnum / $tamaño);
 }
Beispiel #4
0
 function buscarArchivos()
 {
     // maximo por pagina
     $limit = $_GET["s"];
     // pagina pedida
     $pag = (int) $_GET["p"];
     if ($pag < 1) {
         $pag = 1;
     }
     $offset = ($pag - 1) * $limit;
     if (isset($_GET['sort'])) {
         switch ($_GET['sort']) {
             case 1:
                 $order = "FECHA_R DESC ";
                 break;
         }
     } else {
         $order = "FECHA_R DESC ";
     }
     if (isset($_GET['filter'])) {
         $filter = "'" . str_replace(";", "','", $_GET['filter']) . "'";
         $categorias = "WHERE TIPO IN( {$filter} ) ";
     } else {
         $categorias = "";
     }
     $sql = "SELECT  *\nFROM    ( SELECT ROW_NUMBER() OVER ( ORDER BY FECHA_R ) AS RowNum, *\n          FROM  APOYOS\n           {$categorias} \n        ) AS RowConstrainedResult\nWHERE   RowNum >= {$offset}\n    AND RowNum <= {$limit}\nORDER BY {$order}";
     if (isset($_GET['q']) && $_GET['q'] != "") {
         $sql .= "AND (TITULO LIKE '%" . $_GET['q'] . "%') ";
     }
     $this->archivos = database::getRows($sql);
     $this->totalnum = database::getNumRows($sql);
     //CALCULAMOS EL TOTAL DE PAGINAS
     $this->totalPag = ceil($this->totalnum / $limit);
 }
Beispiel #5
0
 function buscarLineas()
 {
     // maximo por pagina
     $limit = $_GET["s"];
     // pagina pedida
     $pag = (int) $_GET["p"];
     if ($pag < 1) {
         $pag = 1;
     }
     $offset = ($pag - 1) * $limit;
     $limit = $limit * $pag;
     if (isset($_GET['sort'])) {
         switch ($_GET['sort']) {
             case 1:
                 $order = " PK1 DESC ";
                 break;
         }
     }
     if (isset($_GET['q']) && $_GET['q'] != "") {
         $buscar = "WHERE (DESCRIPCION LIKE '%" . $_GET['q'] . "%') ";
     } else {
         $buscar = "";
     }
     $sql = "SELECT  *\nFROM    ( SELECT ROW_NUMBER() OVER ( ORDER BY {$order} ) AS RowNum, *\n          FROM      LINEAS_INV {$buscar}\n          \n         \n        ) AS RowConstrainedResult\nWHERE   RowNum > {$offset}\n    AND RowNum <= {$limit} \nORDER BY {$order}";
     try {
         //echo $sql;
         $this->lineas = database::getRows($sql);
         $total = database::getNumRows($sql);
         $this->totalnum = $total;
     } catch (customException $e) {
         throw new customException($sql);
     }
     //CALCULAMOS EL TOTAL DE PAGINAS
     $this->totalPag = ceil($this->totalnum / $limit);
 }
 function buscarUsuarios($idCentro)
 {
     $this->usuarios = array();
     // maximo por pagina
     $limit = $_GET["s"];
     // pagina pedida
     $pag = (int) $_GET["p"];
     if ($pag < 1) {
         $pag = 1;
     }
     $offset = ($pag - 1) * $limit;
     $limit = $limit * $pag;
     if (isset($_GET['sort'])) {
         switch ($_GET['sort']) {
             case 1:
                 $order = "FECHA_R DESC ";
                 break;
         }
     }
     //$plan = $_GET['IDPlan'];
     $sql = "\n\t\t\tWITH RESPONSABLES AS\n\t\t\t(\n\t\t\t\tSELECT R.PK1 AS ID ,U.IMAGEN,U.PK1,U.NOMBRE,U.APELLIDOS,U.EMAIL,U.PK_JERARQUIA,U.DISPONIBLE\n\t\t\t\t,R.PK_USUARIO, R.ROL\n\t\t\t\t,ROW_NUMBER() OVER ( ORDER BY U.FECHA_R ) AS RowNum\n\t\t\t\tFROM RESPONSABLES_CENTRO R, USUARIOS U\n\t\t\t\tWHERE U.PK1 = R.PK_USUARIO AND R.CENTRO='{$idCentro}'\n\t\t\t)\n\t\t\tSELECT * FROM RESPONSABLES\n\t\t\tWHERE RowNum >= {$offset} AND RowNum < {$limit}\n\t\t";
     if (isset($_GET['q']) && $_GET['q'] != "") {
         $sql .= " AND (NOMBRE LIKE '%" . $_GET['q'] . "%') ";
     }
     //echo "[  ".$sql." ]";
     $this->usuarios = database::getRows($sql);
     //	$sql2 = " SELECT * FROM USUARIOS ";
     $this->totalnum = database::getNumRows($sql);
     //CALCULAMOS EL TOTAL DE PAGINAS
     $this->totalPag = ceil($this->totalnum / $limit);
     //*/
 }
Beispiel #7
0
 function buscarFichas()
 {
     // maximo por pagina
     $limit = $_GET["s"];
     // pagina pedida
     $pag = (int) $_GET["p"];
     if ($pag < 1) {
         $pag = 1;
     }
     $offset = ($pag - 1) * $limit;
     if (isset($_GET['sort'])) {
         switch ($_GET['sort']) {
             case 1:
                 $order = "FECHA_R DESC ";
                 break;
         }
     }
     if (isset($_GET['filter'])) {
         $filter = "'" . str_replace(";", "','", $_GET['filter']) . "'";
     } else {
         $nivel = $_SESSION['session']['nodo'];
         $filter = "'{$nivel}' ";
     }
     $sql = "SELECT PK1, NOMBRE, DESCRIPCION, URL, PADRE ,ORDEN,DISPONIBLE,PK_PERMISO,FECHA_R \n                FROM (select PK1, NOMBRE, DESCRIPCION, URL, PADRE ,ORDEN,DISPONIBLE,PK_PERMISO,FECHA_R, row_number() \n                OVER (order by  {$order}) AS \n                RowNumber FROM FICHAS) \n                Derived WHERE RowNumber BETWEEN '{$offset}' AND '{$limit}' ";
     if (isset($_GET['q']) && $_GET['q'] != "") {
         $sql .= "AND (NOMBRE LIKE '%" . $_GET['q'] . "%') ";
     }
     $this->fichas = database::getRows($sql);
     $this->totalnum = database::getNumRows($sql);
     //CALCULAMOS EL TOTAL DE PAGINAS
     $this->totalPag = ceil($this->totalnum / $limit);
 }
 function getCentro()
 {
     try {
         $sql = "SELECT PK1,NOMBRE FROM JERARQUIAS WHERE TIPO = 'C' ORDER BY FECHA_R";
         $this->centro = database::getRows($sql);
     } catch (customException $e) {
         throw new customException($sql);
     }
 }
 function getFacultad()
 {
     try {
         $sql = "SELECT * FROM FACULTAD ORDER BY CLAVE";
         $this->facultad = database::getRows($sql);
     } catch (customException $e) {
         throw new customException($sql);
     }
 }
Beispiel #10
0
 function getRolePerms($role_id)
 {
     $this->permisos = array();
     $sql = "SELECT P.PK1,P.PERMISO \n                FROM ROLES_PERMISOS RP, ROLES R, PERMISOS P \n                WHERE RP.PK_PERMISO = P.PK1 and \n                R.PK1 = RP.PK_ROL and\n                RP.PK_ROL = '{$role_id}'";
     $rows = database::getRows($sql);
     foreach ($rows as $row) {
         $this->permisos[$row["PK1"]] = $row["PERMISO"];
     }
 }
Beispiel #11
0
 function initMenu($nivel = 0, $submenu = false, $idmenu = "", $idsubmenu = "")
 {
     $idmenu = isset($_GET['Menu']) ? $_GET['Menu'] : $idmenu;
     $idsubmenu = isset($_GET['SubMenu']) ? $_GET['SubMenu'] : $idsubmenu;
     $lista = '<ul';
     if (!$submenu) {
         $lista .= ' class="Menu">';
     } else {
         $lista .= ' class="subMenu">';
     }
     // Obtenemos los datos los dependientes del nivel solicitado
     $sql = sprintf("SELECT PK1, NOMBRE,URL, PADRE,PK_PERMISO FROM FICHAS WHERE PADRE = '{$nivel}' ORDER BY ORDEN");
     $rows = database::getRows($sql);
     // Para cada dependiente del nivel solicitado...
     foreach ($rows as $r) {
         // Abrimos el nodo con el nombre del primer dependiente
         $lista .= '<li';
         if (!$submenu) {
             //Agregamos las Fichas superiores del Menu
             //Validamos si tiene permiso
             if ($this->passport->privilegios->hasPrivilege($r['PK_PERMISO'])) {
                 //echo $r['NOMBRE'];
                 if ($idmenu == $r['PK1']) {
                     $lista .= ' id="active">' . htmlentities($r['NOMBRE'], ENT_QUOTES, "ISO-8859-1") . '';
                 } else {
                     $lista .= '><a href="' . $r['URL'] . '">' . htmlentities($r['NOMBRE'], ENT_QUOTES, "ISO-8859-1") . '</a>';
                 }
             }
         } else {
             if ($this->passport->privilegios->hasPrivilege($r['PK_PERMISO'])) {
                 if ($idsubmenu == $r['PK1']) {
                     $lista .= ' id="subActive">' . htmlentities($r['NOMBRE'], ENT_QUOTES, "ISO-8859-1");
                 } else {
                     $lista .= '><a href="' . $r['URL'] . '">' . htmlentities($r['NOMBRE'], ENT_QUOTES, "ISO-8859-1") . '</a>';
                 }
             }
         }
         // Utilizaremos esta variable para ver si seguimos consultado la BDD
         $tiene_dependientes = null;
         $id = $r['PK1'];
         $sql = sprintf("SELECT * FROM FICHAS WHERE PADRE = '{$id}'");
         $tiene_dependientes = database::getNumRows($sql);
         // Si tiene dependientes, ejecutamos recursivamente
         // tomando como parámetro el nuevo nivel
         if ($tiene_dependientes > 0) {
             if ($idmenu == $r['PK1']) {
                 $lista .= $this->initMenu($r['PK1'], TRUE, $idmenu, $idsubmenu);
             }
         }
         // Cerramos el nodo
         $lista .= '</li>';
     }
     // Cerramos la lista
     $lista .= '</ul>';
     return $lista;
 }
Beispiel #12
0
 function initRoles()
 {
     $user = $this->user_id;
     $this->roles = array();
     $sql = "SELECT R.PK1,R.ROLE \n                    FROM ROLES R, ROLES_USUARIO RU \n                    WHERE RU.PK_ROLE = R.PK1 AND\n                    RU.PK_USUARIO = '{$user}'";
     $rows = database::getRows($sql);
     foreach ($rows as $row) {
         $this->roles[$row["PK1"]] = new Permisos($row["PK1"]);
     }
 }
Beispiel #13
0
 function getObjetivos($idlinea)
 {
     $html = "";
     $sql = "SELECT * FROM PL_PESTRATEGICOS_OBJETIVOSE WHERE PK_LESTRATEGICA = '{$idlinea}'  ORDER BY ORDEN";
     $result = database::getRows($sql);
     $i = 1;
     foreach ($result as $row) {
         $html .= '	<tr><td>' . $i . '.  ' . htmlentities($row["OBJETIVO"], ENT_QUOTES, "ISO-8859-1") . '</td></tr>';
         $i++;
     }
     return $html;
 }
 function obtenerRoles()
 {
     $sql = "SELECT * FROM ROLES WHERE TIPO IN('P') ";
     $this->roles = database::getRows($sql);
     /*
     		$result = database::executeQuery($sql);
     		while ($row = mssql_fetch_array($result, MSSQL_ASSOC)) {
     		
     	     $this->roles[] = $row;
     		
             }
             //*/
 }
Beispiel #15
0
    function getAlertas()
    {
        $usuario = $_SESSION['session']['user'];
        $alertas = "";
        $sql = sprintf("SELECT * FROM NOTIFICACIONES WHERE TIPO = 'ALERT' AND PK_USUARIO = '{$usuario}' ORDER BY VISTO, FECHA_R DESC");
        $result = database::getRows($sql);
        $rows = database::getNumRows($sql);
        if ($rows > 0) {
            $alertas .= '<ul id="themes" class="dropdown-menu"  style="width: 320px; height: 373px;  overflow-y: auto;">';
            foreach ($result as $r) {
                $USER = $r['ENVIADO'];
                $sql2 = "SELECT IMAGEN,concat(TITULO,' ',NOMBRE,' ',APELLIDOS) AS NOMBRE FROM USUARIOS WHERE PK1='" . $USER . "'";
                $rowu = database::getRow($sql2);
                $alertas .= '<li ';
                $imagen = $rowu['IMAGEN'];
                if (trim($r['VISTO']) == "1") {
                    $objetivo = "<strike>" . $r['OBJETIVO'] . "</strike>";
                    $fecha = "<strike>" . $r['FECHA_R']->format('Y-m-d') . "</strike>";
                    $nombre = "<strike>" . htmlentities($rowu['NOMBRE']) . "</strike>";
                } else {
                    $objetivo = $r['OBJETIVO'];
                    $fecha = $r['FECHA_R']->format('Y-m-d');
                    $nombre = htmlentities($rowu['NOMBRE']);
                }
                $alertas .= '><a href="javascript:void(0)" onclick="goAlerta(\'' . $r['PK1'] . '\');" data-value="cerulean"> 
						<img src="media/usuarios/' . $imagen . '" height="45" width="45"  style="margin-top: 6px; position: absolute;" alt="">
						<span style="margin-left: 48px; font-size: 11px;"><i class="icon-hand-right"></i> ' . $objetivo . '</span><br/>
					    <span style="margin-left: 48px; font-size: 11px;"><i class="icon-user"></i> ' . $nombre . '</span><br/>
						<span style="font-size: 10px; margin-left: 48px;"><i class="icon-time"></i> ' . $fecha . '</span>
						</a>
						</li>
						<li class="divider"></li>';
            }
            $alertas .= '</ul>';
        } else {
            $alertas .= '<ul id="themes" class="dropdown-menu"  style="width: 300px; height:60px;  overflow-y: auto;">';
            $alertas .= '<li><a data-value="cerulean"  href="javascript:void(0)"> 
						<span style="margin-top: 18px; position: absolute;" class="icon icon-red icon-time"></span> 
						<br/>
					    <span style="margin-left: 18px; font-size: 11px;">&nbsp; No existen alertas por el momento....</span><br>
						<br/>
						</a>
						</li>';
            $alertas .= '</ul>';
        }
        return $alertas;
    }
Beispiel #16
0
 function buscarGrados()
 {
     // maximo por pagina
     $limit = $_GET["s"];
     // pagina pedida
     $pag = (int) $_GET["p"];
     if ($pag < 1) {
         $pag = 1;
     }
     $offset = ($pag - 1) * $limit;
     $limit = $limit * $pag;
     if (isset($_GET['sort'])) {
         switch ($_GET['sort']) {
             case 1:
                 $order = "CLAVE DESC ";
                 break;
             case 2:
                 $order = "DESCRIPCION DESC ";
                 break;
         }
     }
     /*if(isset($_GET['filter'])){
     			
     			$filter = "'".str_replace(";","','",$_GET['filter'])."'";
     	
     		}else{
     			$nivel =  $_SESSION['session']['nodo'];
     			$filter = "'$nivel' ";	
     		}*/
     if (isset($_GET['q']) && $_GET['q'] != "") {
         $buscar = "WHERE (DESCRIPCION LIKE '%" . $_GET['q'] . "%') ";
     } else {
         $buscar = "";
     }
     $sql = "SELECT  *\nFROM    ( SELECT ROW_NUMBER() OVER ( ORDER BY {$order} ) AS RowNum, *\n          FROM      GRADOS {$buscar}\n          \n         \n        ) AS RowConstrainedResult\nWHERE   RowNum > {$offset}\n    AND RowNum <= {$limit} \nORDER BY {$order}";
     try {
         $this->grados = database::getRows($sql);
         $total = database::getNumRows($sql);
         $this->totalnum = $total;
     } catch (customException $e) {
         throw new customException($sql);
     }
     //CALCULAMOS EL TOTAL DE PAGINAS
     $this->totalPag = ceil($this->totalnum / $limit);
 }
Beispiel #17
0
 function buscarFichas()
 {
     $this->fichas = array();
     // maximo por pagina
     $limit = $_GET["s"];
     $tamaño = $_GET["s"];
     // pagina pedida
     $pag = (int) $_GET["p"];
     if ($pag < 1) {
         $pag = 1;
     }
     $offset = ($pag - 1) * $limit;
     $limit = $limit * $pag;
     if (isset($_GET['sort'])) {
         switch ($_GET['sort']) {
             case 1:
                 $order = "FECHA_R DESC ";
                 break;
         }
     }
     /*
              $sql = "SELECT PK1, APLICACION, MODULO, MENSAJE, PK_USUARIO ,FECHA_R 
                     FROM (select PK1, APLICACION, MODULO, MENSAJE, PK_USUARIO ,FECHA_R, row_number() 
                     OVER (order by  $order) AS 
                     RowNumber FROM ACTIVIDAD_USUARIO) 
                     Derived WHERE RowNumber BETWEEN '$offset' AND '$limit' ";
     			
             if(isset($_GET['q']) && $_GET['q']!= ""){ 
     			$sql .= "AND (APLICACION LIKE '%".$_GET['q']."%') ";	
     		}
     */
     if (isset($_GET['q']) && $_GET['q'] != "") {
         $buscar = "WHERE  (APLICACION LIKE '%" . $_GET['q'] . "%') ";
     } else {
         $buscar = "";
     }
     $sql = "SELECT  *\nFROM    ( SELECT ROW_NUMBER() OVER ( ORDER BY {$order} ) AS RowNum, *\n          FROM      ACTIVIDAD_USUARIO\n           {$buscar}\n        ) AS RowConstrainedResult\nWHERE   RowNum > {$offset}\n    AND RowNum <= {$limit} \nORDER BY {$order}";
     $this->fichas = database::getRows($sql);
     $sqlcount = "SELECT PK1\n                     FROM ACTIVIDAD_USUARIO ";
     $this->totalnum = database::getNumRows($sqlcount);
     //CALCULAMOS EL TOTAL DE PAGINAS
     $this->totalPag = ceil($this->totalnum / $tamaño);
 }
Beispiel #18
0
 function buscarProyectos()
 {
     // maximo por pagina
     $limit = $_GET["s"];
     // pagina pedida
     $pag = (int) $_GET["p"];
     if ($pag < 1) {
         $pag = 1;
     }
     $offset = ($pag - 1) * $limit;
     $limit = $limit * $pag;
     if (isset($_GET['sort'])) {
         switch ($_GET['sort']) {
             case 1:
                 $order = "FECHA_R DESC ";
                 break;
         }
     }
     if (isset($_GET['filter'])) {
         $filter = "'" . str_replace(";", "','", $_GET['filter']) . "'";
         $filtro = " AND ( FACULTAD IN( {$filter} ) OR CENTRO IN( {$filter} ) ) ";
         if (trim($_GET['filter']) == "UAN") {
             $filtro = "";
         }
     } else {
         //$nivel =  $_SESSION['session']['nodo'];
         //$filter = "'$nivel' ";
         $filtro = "";
     }
     if (isset($_GET['q']) && $_GET['q'] != "") {
         $buscar = " WHERE (TITULO LIKE '%" . $_GET['q'] . "%') ";
     } else {
         $buscar = "";
     }
     $sql = "SELECT  *\nFROM    ( SELECT ROW_NUMBER() OVER ( ORDER BY {$order} ) AS RowNum, *\n          FROM      PROYECTOS  {$buscar}\t\n        \n        ) AS RowConstrainedResult\nWHERE   RowNum > {$offset}  AND RowNum <= {$limit}  {$filtro} ORDER BY {$order}";
     $this->proyectos = database::getRows($sql);
     $sqlcount = "SELECT PK1\n                     FROM PROYECTOS";
     $this->totalnum = database::getNumRows($sqlcount);
     //CALCULAMOS EL TOTAL DE PAGINAS
     $this->totalPag = ceil($this->totalnum / $limit);
 }
Beispiel #19
0
 function buscarPlanesEstrategicos()
 {
     // maximo por pagina
     $limit = $_GET["s"];
     // pagina pedida
     $pag = (int) $_GET["p"];
     if ($pag < 1) {
         $pag = 1;
     }
     $offset = ($pag - 1) * $limit;
     if (isset($_GET['sort'])) {
         switch ($_GET['sort']) {
             case 1:
                 $order = "FECHA_R DESC ";
                 break;
         }
     }
     $user = $_SESSION['session']['user'];
     $sql = "SELECT * FROM ROLES_USUARIO WHERE PK_USUARIO = '{$user}' AND PK_ROLE='R00'";
     $result = database::getNumRows($sql);
     if ($result != 0) {
         $filter = "";
     } else {
         $sql = "DECLARE @jerarquia VARCHAR(8000) = ''\n                   SELECT @jerarquia = @jerarquia + PK_JERARQUIA + ','\n                   FROM USUARIOS_JERARQUIA \n                   where PK_USUARIO = 'red'\n\n                   SELECT @jerarquia AS JERARQUIAS";
         //SELECT PK_JERARQUIA FROM USUARIOS_JERARQUIA WHERE PK_USUARIO = 'red'
         $row = database::getRow($sql);
         $jeararquias = "'" . str_replace(",", "','", $row['JERARQUIAS']) . "'";
         $filter = " AND PK_JERARQUIA IN( {$jeararquias} )";
     }
     $sql = "SELECT PK1, TITULO, DESCRIPCION, PK_JERARQUIA, DISPONIBLE,FECHA_I,FECHA_T,FECHA_R,PK_USUARIO,ELIMINADO \n                FROM (select PK1, TITULO, DESCRIPCION, PK_JERARQUIA, DISPONIBLE,FECHA_I,FECHA_T,FECHA_R,PK_USUARIO,ELIMINADO, row_number() \n                OVER (order by  {$order}) AS \n                RowNumber FROM PL_PESTRATEGICOS\t) \n                Derived WHERE RowNumber BETWEEN '{$offset}' AND '{$limit}' {$filter} ";
     if (isset($_GET['q']) && $_GET['q'] != "") {
         $sql .= "AND (TITULO LIKE '%" . $_GET['q'] . "%') ";
     }
     //echo $sql;
     $this->planes = database::getRows($sql);
     $this->totalnum = database::getNumRows($sql);
     //CALCULAMOS EL TOTAL DE PAGINAS
     $this->totalPag = ceil($this->totalnum / $limit);
 }
Beispiel #20
0
 function buscarNiveles()
 {
     // maximo por pagina
     $limit = $_GET["s"];
     // pagina pedida
     $pag = (int) $_GET["p"];
     if ($pag < 1) {
         $pag = 1;
     }
     $offset = ($pag - 1) * $limit;
     $idNivel = $_GET['Nivel'];
     if (isset($_GET['sort'])) {
         switch ($_GET['sort']) {
             case 1:
                 $order = "FECHA_R DESC ";
                 break;
         }
     }
     if (isset($_GET['filter'])) {
         $filter = "'" . str_replace(";", "','", $_GET['filter']) . "'";
     } else {
         $nivel = $_SESSION['session']['nodo'];
         $filter = "'{$nivel}' ";
     }
     /* $sql = "SELECT PK1, NOMBRE, DESCRIPCION, PADRE, DISPONIBLE ,FECHA_R,ELIMINADO 
        FROM (select PK1, NOMBRE, DESCRIPCION, PADRE, DISPONIBLE ,FECHA_R,ELIMINADO, row_number() 
        OVER (order by  ORDEN) AS 
        RowNumber FROM JERARQUIAS) 
        Derived WHERE RowNumber BETWEEN '$offset' AND '$limit' AND PADRE = '$idNivel'";*/
     $sql = "SELECT  *\nFROM    ( SELECT ROW_NUMBER() OVER ( ORDER BY {$order} ) AS RowNum, *\n          FROM      JERARQUIAS\n          WHERE     PADRE = '{$idNivel}' \n        ) AS RowConstrainedResult\nWHERE   RowNum > {$offset}\n    AND RowNum <= {$limit} \nORDER BY ORDEN";
     /*if(isset($_GET['q']) && $_GET['q']!= ""){ 
     			$sql .= "AND (NOMBRE LIKE '%".$_GET['q']."%') ";	
     		}*/
     $this->niveles = database::getRows($sql);
     $this->totalnum = database::getNumRows($sql);
     //CALCULAMOS EL TOTAL DE PAGINAS
     $this->totalPag = ceil($this->totalnum / $limit);
 }
Beispiel #21
0
 function buscarUsuarios()
 {
     // maximo por pagina
     $limit = $_GET["s"];
     $tamaño = $_GET["s"];
     // pagina pedida
     $pag = (int) $_GET["p"];
     if ($pag < 1) {
         $pag = 1;
     }
     $offset = ($pag - 1) * $limit;
     $limit = $limit * $pag;
     if (isset($_GET['sort'])) {
         switch ($_GET['sort']) {
             case 1:
                 $order = "FECHA_R DESC ";
                 break;
         }
     }
     if (isset($_GET['filter'])) {
         $filter = "'" . str_replace(";", "','", $_GET['filter']) . "'";
     } else {
         $nivel = $_SESSION['session']['nodo'];
         $filter = "'{$nivel}' ";
     }
     if (isset($_GET['q']) && $_GET['q'] != "") {
         $buscar = " AND (NOMBRE LIKE '%" . $_GET['q'] . "%') OR (PK1 LIKE '%" . $_GET['q'] . "%') ";
     } else {
         $buscar = "";
     }
     //(  FACULTAD IN( $filter ) OR FACULTAD IN( $filter ) OR CENTRO IN( $filter ) )
     $sql = "SELECT  *\nFROM    ( SELECT ROW_NUMBER() OVER ( ORDER BY {$order} ) AS RowNum, *\n          FROM      USUARIOS\n          WHERE     PK_JERARQUIA IN( {$filter} ) {$buscar}\n        ) AS RowConstrainedResult\nWHERE   RowNum > {$offset}\n    AND RowNum <= {$limit} \nORDER BY {$order}";
     $sqlcount = "SELECT * \n                     FROM USUARIOS WHERE PK_JERARQUIA IN( {$filter} ) {$buscar}";
     $this->usuarios = database::getRows($sql);
     $this->totalnum = database::getNumRows($sqlcount);
     //CALCULAMOS EL TOTAL DE PAGINAS
     $this->totalPag = ceil($this->totalnum / $tamaño);
 }
 function buscaTodosLosProductos()
 {
     // maximo por pagina
     $limit = $_GET["s"];
     // pagina solicitada
     $pag = (int) $_GET["p"];
     if ($pag < 1) {
         $pag = 1;
     }
     $offset = ($pag - 1) * $limit;
     $limit = $limit * $pag;
     if (isset($_GET['sort'])) {
         switch ($_GET['sort']) {
             case 1:
                 $order = " FECHA_R DESC ";
                 break;
             case 2:
                 $order = " PRODUCTO  ";
                 break;
         }
     }
     if (isset($_GET['q']) && $_GET['q'] != "") {
         $text = strtoupper($_GET['q']);
         $buscar = "WHERE (UPPER(PRODUCTO) LIKE '%{$text}%') ";
     } else {
         $buscar = "";
     }
     $sql = "\n\t\t\tSELECT *\n\t\t\tFROM ( SELECT ROW_NUMBER() OVER ( ORDER BY {$order} ) AS RowNum, *\n\t\t\t          FROM  CATALOGO_PRODUCTOS {$buscar}\n\t\t\t      ) AS RowConstrainedResult\n\t\t\tWHERE RowNum > {$offset} AND RowNum <= {$limit}\n\t\t\tORDER BY {$order}\n\t\t\t";
     try {
         $this->rows = database::getRows($sql);
         $total = database::getNumRows($sql);
         $this->totalnum = $total;
     } catch (customException $e) {
         throw new customException($sql);
     }
     //CALCULAMOS EL TOTAL DE PAGINAS
     $this->totalPag = ceil($this->totalnum / $limit);
 }
 function getComentariosResumen($id)
 {
     $sql = "SELECT * FROM PL_POPERATIVOS_RESUMENE_COMENTARIOS WHERE PK_POPERATIVO = '{$id}' ORDER BY FECHA_R DESC";
     $this->comentarios = database::getRows($sql);
 }
Beispiel #24
0
 function getPeriodos()
 {
     $id = $this->idplan;
     $sql = "SELECT * FROM PL_POPERATIVOS_PERIODOS WHERE PK_POPERATIVO = '{$id}' ORDER BY ORDEN ASC";
     $this->periodos = database::getRows($sql);
 }
 function EnviarRevisionDireccion($idProyecto, $clave)
 {
     //revisión centro
     $estado = 'D';
     $this->campos = array('ESTADO' => trim($estado), 'PK_USUARIO' => $_SESSION['session']['user']);
     $condition = "PK1 = '{$idProyecto}' ";
     database::updateRecords("PROYECTOS", $this->campos, $condition);
     //$usuario = $_SESSION['session']['user'];
     //DI
     $sql = "SELECT RU.PK_USUARIO,RU.PK_ROLE FROM ROLES_USUARIO RU, USUARIOS U WHERE  RU.PK_USUARIO = U.PK1 AND RU.PK_ROLE = 'R55CB5D677DE25' ";
     $this->di = database::getRows($sql);
     foreach ($this->Model->di as $row) {
         $passport = new Authentication();
         //rol y permiso tipo G
         if ($passport->getPrivilegioRol($row['PK_ROLE'], 'P55CB7A61EE43D')) {
             $this->EnviarCorreo($_SESSION['session']['user'], $row['PK_USUARIO'], $idProyecto);
         }
     }
 }
 function RegresarCentro($idProyecto, $clave)
 {
     //regreso a revisión centro
     $estado = 'R';
     $this->campos = array('ESTADO' => trim($estado), 'PK_USUARIO' => $_SESSION['session']['user']);
     $condition = "PK1 = '{$idProyecto}' ";
     database::updateRecords("PROYECTOS", $this->campos, $condition);
     $sql = "SELECT RC.PK_USUARIO,RC.ROL FROM RESPONSABLES_CENTRO RC, PROYECTOS P WHERE RC.CENTRO = P.CENTRO AND P.PK1 = '" . $idProyecto . "'";
     $this->asignados = database::getRows($sql);
     foreach ($this->asignados as $row) {
         $passport = new Authentication();
         if ($passport->getPrivilegioRol($row['ROL'], 'P55CA6A54A4FC0')) {
             $this->EnviarCorreo($_SESSION['session']['user'], $row['PK_USUARIO'], $idProyecto);
         }
     }
 }
 function obtenerGrados()
 {
     $sql = "SELECT * FROM GRADOS";
     $this->grados = database::getRows($sql);
 }
 function obtenerRoles()
 {
     $sql = "SELECT * FROM ROLES WHERE TIPO IN('A','G')";
     $this->roles = database::getRows($sql);
 }
 function getFortalezas()
 {
     $planoperativo = $_GET['IDPlan'];
     $sql = "SELECT * FROM PL_POPERATIVOS_FORTALEZAS WHERE PK_POPERATIVO = '{$planoperativo}' ORDER BY ORDEN";
     $this->fortalezas = database::getRows($sql);
 }
Beispiel #30
0
 function initSubNivelesInvestigadores($padre, &$nodo)
 {
     echo $this->investigador;
     $sql = "SELECT * FROM JERARQUIAS WHERE PADRE = '{$padre}' ORDER BY ORDEN";
     $rows = database::getRows($sql);
     $i = 0;
     foreach ($rows as $row) {
         $i++;
         $subNode = 'subNode' . $i;
         if ($this->hasNivel($row['PK1']) || isset($this->passport->privilegios->roles['R00'])) {
             $checkbox = "<input type='radio' name='jerarquia' ";
             if ($this->investigador == $row['PK1']) {
                 $checkbox .= "checked=\"checked\" ";
             }
             $checkbox .= " value=\"" . $row['PK1'] . "\" id='" . $row['PK1'] . "' >&nbsp;" . htmlentities($row['NOMBRE'], ENT_QUOTES, "ISO-8859-1");
             ${$subNode} =& $nodo->addItem(new HTML_TreeNodeXL($checkbox, "", $this->nodeProperties));
         }
         //$$subNode=&$nodo->addItem(new HTML_TreeNodeXL("<input type='radio' name='jerarquia' value='".$row['PK1']."' />&nbsp;".$row['NOMBRE'], "",$this->nodeProperties));
         $this->initSubNivelesInvestigadores($row['PK1'], ${$subNode});
     }
 }