Exemplo n.º 1
0
<?php

include_once '../../includes.sys/ini.php';
include_once '../../includes.sys/metodos.php';
include_once '../DAO/SetoresDAO.php';
include_once '../Setores.class.php';
checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true');
include_once '../../head.php';
if (!in_array(233, listarAcesso())) {
    echo '<script language= "JavaScript">location.href="index.php";</script>';
}
$setores = new Setores();
$DAO = new SetoresDAO();
//Verifica se a acao de salvar foi iniciada
if (!empty($_POST['cmd']) && $_POST['cmd'] == 'inserir') {
    $setores->setUsuario(userId());
    $setores->setNome($_POST['nome']);
    $resultado = $DAO->Gravar($setores);
    if ($resultado == 1) {
        echo '<script language= "JavaScript">alert("Registro cadastrado com sucesso");</script>';
        echo '<script language= "JavaScript">location.href="new.php";</script>';
    } else {
        echo '<script language= "JavaScript">alert("Erro ao gravar o arquivo.");</script>';
        print_r($resultado);
    }
} else {
    $setores->setNome("");
}
?>
<!-- topbar ends -->
<div class="container-fluid">
Exemplo n.º 2
0
<?php

include_once "../../class/Carrega.class.php";
if (isset($_POST['enviar'])) {
    $object = new Setores();
    $object->setor = $_POST['setor'];
    $object->texto = $_POST['texto'];
    $object->Inserir();
    header("Location:ViewSetoresObj.php");
} else {
    if (isset($_POST['excluir'])) {
        $object = new Setores();
        $object->id = $_POST['id'];
        $object->Excluir();
        header("Location:ViewSetoresObj.php");
    } else {
        if (isset($_POST['atualizar'])) {
            $object = new Setores();
            $object->id = $_POST['id'];
            $object->setor = $_POST['setor'];
            $object->texto = $_POST['texto'];
            $object->Atualizar();
            header("Location:ViewSetoresObj.php");
        }
    }
}
Exemplo n.º 3
0
              <div class="box box-info">
                <div class="box-header">
                  <h3 class="box-title">Listagem de setores</h3>
                  <a class="btn btn-info btn-flat pull-right" href="ViewSetoresObj.php" title="Atualizar resultados" data-toggle="tooltip" data-placement="left"><i class="fa fa-refresh"></i></a>
                </div><!-- /.box-header -->
                <div class="box-body">
                  <table id="dataT" class="table table-bordered table-hover">
                    <thead>
                      <tr>
                        <th>Setor</th>
                        <th>Opções</th>
                      </tr>
                    </thead>
                    <tbody>
                    <?php 
$listar = new Setores();
$list = $listar->listar();
if ($list != null) {
    foreach ($list as $line) {
        ?>
                      <tr class="odd gradeX">
                        <form name="view" action="EditSetorObj.php" method="post">
                        <td><?php 
        echo $line->setor;
        ?>
</td>
                        <td>
                          <input type='hidden' name='id' value='<?php 
        echo $line->id;
        ?>
'>
Exemplo n.º 4
0
<?php

include_once '../../includes.sys/ini.php';
include_once '../../includes.sys/metodos.php';
include_once '../DAO/SetoresDAO.php';
include_once '../Setores.class.php';
checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true');
include_once '../../head.php';
if (!in_array(231, listarAcesso())) {
    echo '<script language= "JavaScript">location.href="index.php";</script>';
}
$setor = new Setores();
$DAO = new SetoresDAO();
//Verifica se a acao de salvar foi iniciada
if (!empty($_POST['cmd']) && $_POST['cmd'] == 'editar') {
    $setor->setId(limpaTexto($_POST['id']));
    $setor->setUsuario(userId());
    $setor->setNome($_POST['documento']);
    $resultado = $DAO->Atualizar($setor);
    if ($resultado == 1) {
        echo '<script language= "JavaScript">alert("Registro alterado com sucesso");</script>';
        echo '<script language= "JavaScript">location.href="index.php";</script>';
    } else {
        echo '<script language= "JavaScript">alert("Erro ao gravar o arquivo.");</script>';
        print_r($resultado);
    }
} else {
    $setor->setId(limpaTexto($_GET['id']));
    $query = $DAO->Listar("SELECT * FROM " . MYSQL_BASE_SETOR . " WHERE status = 'S' AND id = " . $setor->getId());
    if ($query->rowCount() == 1) {
        foreach ($query as $row) {
Exemplo n.º 5
0
          <h1>Setores</h1>
        </section>
        <!-- Main content -->
        <section class="content">
          <div class="row">
            <div class="col-lg-12">
              <!-- Horizontal Form -->
              <div class="box box-success">
                <div class="box-header with-border">
                  <h3 class="box-title">Edição de informações de setores</h3>
                </div><!-- /.box-header -->
                <!-- form start -->
                <?php 
$id = $_POST["id"];
if (isset($_POST["editar"])) {
    $edit = new Setores();
    $comp = $edit->editar($id);
    if ($edit != null) {
        ?>
                <form class="form-horizontal" id="form" method="post" action="CrudSetores.php">
                  <div class="box-body">
                      <div class="form-group">
                        <label for="setor" class="col-sm-2 control-label">Setor:</label>
                        <div class="col-sm-10">
                          <input type="text" class="form-control" name="setor" id="setor" placeholder="Digite aqui" value="<?php 
        echo $comp->setor;
        ?>
" required>
                        </div>
                      </div>
                      <div class="form-group">