require_once 'catalogo-db-ops.php'; $limit = 15; // alterar para $_POST['limit'] caso queira dar ao usuário a opção de entrar com limite de resultados por página $total = trajCatalogoDBops::getTotalChaves(); $totalPags = ceil($total / $limit); if (isset($_POST['page'])) { if ($_POST['page'] > $totalPags) { $pagina = $totalPags; } else { $pagina = $_POST['page']; } } else { $pagina = 1; } $offset = ($pagina - 1) * $limit; $chaves = trajCatalogoDBops::getAllChaves($offset, $limit); $last = $offset + sizeof($chaves); ?> <table class="table-padrao table-condensed table-catalogo table-admin" id="table_chaves" > <caption>Palavras-chave</caption> <thead> <tr> <th class="th-id">ID</th> <th class="th-palavra">Palavra</th> </tr> </thead> <tfoot> <tr> <td colspan="2"> <div class="tfoot-info table-edit">
require_once 'catalogo-db-ops.php'; $option = $_POST['option']; if ($option == "edit_trab") { $trab = trajCatalogoDBops::getTrabalho($_POST['itemID']); $autor = $trab->autor; $chosenChaves = trajCatalogoDBops::getChaveIDsByTrab($trab->id); $file = $trab->arquivos; } elseif ($option == "filter_trab" && is_array($_POST['filters'])) { if (isset($_POST['filters']['autor'])) { $autor = $_POST['filters']['autor']; } if (isset($_POST['filters']['chaves'])) { $chosenChaves = explode(',', $_POST['filters']['chaves']); } } $chaves = trajCatalogoDBops::getAllChaves(); ?> <form class="form-horizontal" id="trabForm"> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <div class="control-group"> <label class="control-label" for="autor">Autor</label> <div class="controls"> <input type="text" name="autor" id="autor" value="<?php echo stripslashes(sanitize_text_field($autor)); ?>
$limit = 15; // alterar para $_POST['limit'] caso queira dar ao usuário a opção de entrar com limite de resultados por página $total = trajCatalogoDBops::getTotalTrabalhos($filters); // alterar query entrando parâmetro filter caso haja $totalPags = ceil($total / $limit); if (isset($_POST['page'])) { if ($_POST['page'] > $totalPags) { $pagina = $totalPags; } else { $pagina = $_POST['page']; } } else { $pagina = 1; } $offset = ($pagina - 1) * $limit; $trabalhos = trajCatalogoDBops::getAllTrabalhos($offset, $limit, $filters); $last = $offset + sizeof($trabalhos); if ($_POST['editable'] === "true") { $editable = TRUE; } else { $editable = FALSE; } ?> <table class="table table-condensed table-catalogo table-admin" id="table_publicacoes"> <caption>Trabalhos publicados</caption> <thead> <tr> <th class="th-autor">Autor</th> <th class="th-titulo">Título</th> <th class="th-revista">Revista</th>
echo "db"; } break; case "new_chave": $res = trajCatalogoDBops::setChaves($palavra); if (!$res) { echo "error"; } break; case "edit_chave": $res = trajCatalogoDBops::editChave(array("palavra" => $palavra), array("id" => $chaveID)); if (!$res) { echo "error"; } break; case "del_chave": $res = trajCatalogoDBops::delChave(array("id" => $chaveID)); if (!$res) { echo "error"; } break; case "del_files": $res = delFiles($fileName); if (!$res) { echo "error"; } break; default: break; } }