本文整理汇总了PHP中database::getRows方法的典型用法代码示例。如果您正苦于以下问题:PHP database::getRows方法的具体用法?PHP database::getRows怎么用?PHP database::getRows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类database
的用法示例。
在下文中一共展示了database::getRows方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buscarRoles
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);
}
示例2: buscarTiposDeContrato
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);
}
示例3: buscarPermisos
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);
}
示例4: buscarArchivos
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);
}
示例5: buscarLineas
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);
}
示例6: buscarUsuarios
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);
//*/
}
示例7: buscarFichas
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);
}
示例8: getCentro
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);
}
}
示例9: getFacultad
function getFacultad()
{
try {
$sql = "SELECT * FROM FACULTAD ORDER BY CLAVE";
$this->facultad = database::getRows($sql);
} catch (customException $e) {
throw new customException($sql);
}
}
示例10: getRolePerms
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"];
}
}
示例11: initMenu
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;
}
示例12: initRoles
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"]);
}
}
示例13: getObjetivos
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;
}
示例14: obtenerRoles
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;
}
//*/
}
示例15: getAlertas
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;"> No existen alertas por el momento....</span><br>
<br/>
</a>
</li>';
$alertas .= '</ul>';
}
return $alertas;
}