Example #1
0
 public function criar(Turma $e)
 {
     $sql = 'INSERT INTO turmas (curso_id, nivel_id, turno_id) VALUES (:curso_id, :nivel_id, :turno_id)';
     $statement = $this->_db->prepare($sql);
     $statement->bindParam(':curso_id', $e->getCurso()->getId(), PDO::PARAM_INT);
     $statement->bindParam(':nivel_id', $e->getNivel()->getId(), PDO::PARAM_INT);
     $statement->bindParam(':turno_id', $e->getTurno()->getId(), PDO::PARAM_INT);
     $ret = $statement->execute();
 }
Example #2
0
 function getAllTurmasByAluno($aluno_id, $estado = 1)
 {
     App::import('Model', 'Turma');
     App::import('Model', 'Inscricao');
     App::import('Model', 'Matricula');
     $turma = new Turma();
     $inscricao = new Inscricao();
     $Matricula = new Matricula();
     $plano_estudo = $this->query("Select planoestudo_id from matriculas where aluno_id = {$aluno}");
     $turma->recursive = -1;
     $turmas = $turma->getAllTurmasByAluno($plano_estudo[0]['matriculas']['planoestudo_id']);
     return $turmas;
 }
 public function getDelete($id)
 {
     if (Turma::whereId($id)->delete()) {
         Session::flash('success', 'Usuário deletado com sucesso!');
     } else {
         Session::flash('danger', 'Usuário não pode ser deletado!');
     }
     return Redirect::to('/turma');
 }
<?php

require 'common.inc.php';
$regraPessoa = new Pessoa();
$regraTurma = new Turma();
try {
    if (array_key_exists('excluir', $_GET)) {
        $id_pessoa = intval($_GET['excluir']);
        $regraPessoa->excluir($id_pessoa);
        $msgsucesso = 'Pessoa removida com sucesso!';
        header('Location: ' . WEB_PATH . '/admin/pessoas?sucesso=' . urlencode($msgsucesso));
        exit;
    }
    if (count($_POST) > 0) {
        $id_pessoa = intval($_POST['id_pessoa']);
        if ($id_pessoa > 0) {
            $pessoa = $regraPessoa->pegar($id_pessoa);
            $pessoa = $regraPessoa->pegarDoPost($pessoa);
            $regraPessoa->alterar($pessoa);
            $msgsucesso = 'Pessoa alterar com sucesso!';
        } else {
            $pessoa = $regraPessoa->pegarDoPost($pessoa);
            //var_dump($pessoa, $_POST);
            //exit();
            $id_pessoa = $regraPessoa->inserir($pessoa);
            $msgsucesso = 'Pessoa adicionado com sucesso!';
        }
        header('Location: ' . WEB_PATH . '/admin/pessoa?pessoa=' . $id_pessoa . '&sucesso=' . urlencode($msgsucesso));
        exit;
    }
} catch (Exception $e) {
 public function getSearch()
 {
     $term = Input::get('term');
     $alunos = Aluno::whereRaw('aluno.nome COLLATE UTF8_GENERAL_CI LIKE ?')->join('turma', 'turma.id', '=', 'aluno.turma_id')->orWhereRaw('sigla COLLATE UTF8_GENERAL_CI LIKE ?')->orWhereRaw('descricao COLLATE UTF8_GENERAL_CI LIKE ?')->setBindings(['%' . $term . '%', '%' . $term . '%', '%' . $term . '%'])->get();
     $turmas = Turma::whereRaw('sigla COLLATE UTF8_GENERAL_CI LIKE ?')->orWhereRaw('descricao COLLATE UTF8_GENERAL_CI LIKE ?')->setBindings(['%' . $term . '%', '%' . $term . '%'])->get();
     return View::make('aluno.search', ['alunos' => $alunos]);
 }
Example #6
0
 function cadastrar()
 {
     $this->init_session();
     //Recupera o id do usuário logado
     $idUsuario = $this->escape("user");
     $nome = $this->escape("nome");
     $curso = $this->escape("curso");
     $idInstrutor1 = $this->escape("idInstrutor1");
     $idInstrutor2 = $this->escape("idInstrutor2");
     $idInstrutor3 = $this->escape("idInstrutor3");
     $idInstrutor4 = $this->escape("idInstrutor4");
     $periodo = $this->escape("periodo");
     $local = $this->escape("local");
     $dataTurma = $this->escape("dataTurma");
     $valor = $this->escape("valor");
     $status = "Ativo";
     $usuario = Doctrine::getTable("Usuario")->find($idUsuario);
     $turma = new Turma();
     $turma->nome = $nome;
     $turma->idCurso = $curso;
     $turma->idInstrutor1 = $idInstrutor1;
     $turma->idInstrutor2 = $idInstrutor2;
     $turma->idInstrutor3 = $idInstrutor3;
     $turma->idInstrutor4 = $idInstrutor4;
     $turma->periodo = $periodo;
     $turma->local = $local;
     $turma->dataTurma = $dataTurma;
     $turma->valor = $valor;
     $turma->status = $status;
     $turma->usuarioResponsavel = $usuario->login;
     if ($turma->trySave()) {
         $this->success("Turma cadastrada com sucesso.");
     } else {
         $this->error("Erro ao cadastrar a turma. Tente novamente ou contate o administrador.");
     }
 }
Example #7
0
$novaConexao = new Conexao($conexaoBD['bd'], $conexaoBD['usuario'], $conexaoBD['senha'], $conexaoBD['host']);
$novaConexao->getConexao();
/**
 * Array para somar a qtde total 
 * de aulas por disciplinas
 */
$qtdeAulas = array();
/**
 * Recebe a instancia da classe Data 
 */
$Data = new Datas();
/**
 * Recebe a instancia da classe Turma
 * @param int, código do curso
 */
$turma = new Turma($curso, $periodoCurso, $turnoCurso);
$gradeTurma = $turma->montaGrade();
if ($gradeTurma != false) {
    /**
     * Separador da data
     */
    $dataInicial = explode("-", $inicioPeriodo);
    /**
     * Atribui a data de inicio do período
     * as váriaveis dia e mes
     */
    $dia = $dataInicial[0];
    $mes = $dataInicial[1];
    /**
     * Recupera o último dia do mês
     */
Example #8
0
<?php

include_once ROOT . "model/admin/turma.php";
$param_login = isset($_GET['l']) ? $_GET['l'] : '-1';
$login_errado = isset($_GET['n']) ? $_GET['n'] : '-1';
$Turma = new Turma();
$series_ativas = $Turma->lista_turmas($_SESSION['ESCOLA'], true);
// apenas turmas ativas
require ROOT . 'view/login/vlogin_passar_de_ano.php';
Example #9
0
    echo "Acesso negado";
    exit;
}
?>
<h2>Administra&ccedil;&atilde;o de turmas</h2>
<?php 
if (isset($_REQUEST['delete'])) {
    $turma = new Turma($_REQUEST['delete']);
    if ($turma->remove()) {
        echo "<p>Turma removida</p>";
    } else {
        echo "<p>Erro ao remover turma! Verifique se a turma tem 0 alunos</p>";
    }
}
if (isset($_REQUEST['submit'])) {
    $turma = new Turma();
    if ($turma->create($_REQUEST['nome'])) {
        echo "<p>Turma criada</p>";
    } else {
        echo "<p>Erro ao criar turma!</p>";
    }
}
?>
<p>Turmas cadastradas:</p>
<table><tr><th colspan=2>Nome</th><th>Alunos</th><th>Exerc&iacute;cios</th></tr>
<?php 
foreach (ListTurmas() as $turma) {
    echo "<tr><td><a href='?delete=" . $turma->getId() . "'><img src='img/x.png'></a></td><td>" . $turma->getNome() . "</td><td>" . $turma->getAlunos() . "</td><td>" . $turma->getNEx() . "</td></tr>";
}
?>
</table>
Example #10
0
 function update_turma_turno()
 {
     App::Import('Model', 'Turma');
     $turma = new Turma();
     //var_dump($this->data['Inscricao']);
     //$turno_id = $turma->find('list',array('conditions'=>array('id'=>$this->data['Inscricao']['t0010turma_id'])));;
     $turno_id = $turma->getTurnoTurma($this->data['Inscricao']['t0010turma_id']);
     $turno = $turno_id[0]['ttu']['name'];
     //var_dump($turno);
     $this->set('turno', $turno);
     $this->layout = 'ajax';
 }
Example #11
0
 function fecho_da_turma()
 {
     App::Import('Model', 'Turma');
     $turma = new Turma();
     App::Import('Model', 'Logmv');
     $logmv = new Logmv();
     if (!empty($this->data) && $this->data["Turma"]["t0009anolectivo_id"] != "") {
         $turmas = $turma->upDateTurma($this->data["Turma"]["\tt0009anolectivo_id"], $this->data["Turma"]["t0003curso_id"]);
         //var_dump($this->data["Turma"]["t0009anolectivo_id"]);
         //$logmv->logUpdate(9,$this->Session->read('Auth.User.id'),$this->data["Turma"]["t0003curso_id"],"Feicho da Turma");
         $this->Session->setFlash('** Dados Editados com Sucesso **', 'flashok');
         $this->redirect(array('action' => 'index'));
     }
     $anolectivos = $this->Turma->Anolectivo->find('list');
     $cursos = $this->Turma->Curso->find('list');
     $this->set(compact('t0009anolectivos', 't0003cursos'));
 }
 public function destroy($id)
 {
     $mensalidade = Mensalidade::find($id);
     $mensalidade->delete();
     $t = new Turma();
     $turmas = $t->all()->lists('tur_nome', 'tur_id');
     $a = new Mensalidade();
     $mensalidades = $a->all();
     return view('mensalidade.create', ['mensalidades' => $mensalidades, 'turmas' => $turmas]);
 }
Example #13
0
 function listagem_de_Pautas()
 {
     App::Import('Model', 'Curso');
     App::Import('Model', 'Turma');
     App::Import('Model', 'Anolectivo');
     App::Import('Model', 'Planoestudo');
     $planoestudo = new Planoestudo();
     $curso = new Curso();
     $turma = new Turma();
     $t0009anolectivo = new Anolectivo();
     $cursos = $curso->find('list', array('order' => array('name ASC')));
     $turmas = $turma->find('list', array('conditions' => array('estado' => 1), 'order' => array('name ASC')));
     $planoestudos = $planoestudo->find('list', array('order' => array('name ASC')));
     $Anolectivos = $t0009anolectivo->find('list');
     $this->set(compact('t0003cursos', 't0010turmas', 't0009anolectivos', 't0005planoestudos'));
 }
Example #14
0
 function update_turma_funcionario()
 {
     App::Import('Model', 'Turma');
     $turma = new Turma();
     $turma11 = new Turma();
     App::Import('Model', 'Funcionario');
     $funcionario = new funcionario();
     $turmas11 = $turma11->find('all');
     //var_dump($this->data);
     //var_dump($this->data["Avaliacaos"]["docente"]);
     $turmas = $turma->find('list', array('conditions' => array('t0009anolectivo_id' => $this->data["Avaliacaos"]["t0009anolectivo_id"]), 'order' => array('name ASC'), 'estado' => 1));
     //var_dump('This data111: '.$turma['Funcionario']['codigo']);
     $this->set('turmas', $turmas);
     $this->layout = 'ajax';
 }
Example #15
0
 function delete($id = null)
 {
     App::Import('Model', 'Logmv');
     $logmv = new Logmv();
     App::Import('Model', 'User');
     $users = new User();
     App::Import('Model', 'Turma');
     $turmas = new Turma();
     if (!$id) {
         $this->Session->setFlash('Codigo Invalido para %s', 'flasherror');
         $this->redirect(array('action' => 'index'));
     }
     $dados = $turmas->getTurmasByFuncionario($id);
     if (empty($dados)) {
         $user_id = $users->getUserByFuncionario($id);
         //var_dump($user_id[0]["us"]["id"]);
         $users = $users->deleteUser($user_id[0]["us"]["id"]);
         if ($this->Funcionario->delete($id)) {
             $this->Session->setFlash('Dados deletedos com sucesso ', 'flashok');
             $this->redirect(array('action' => 'index'));
         }
     }
     $this->Session->setFlash('Nao e possivel apagar. Turmas associadas ao Funcionario', 'flasherror');
     $this->redirect(array('action' => 'index'));
 }
    // armazena esta frase no arquivo de LOG
    TTransaction::log("** inserindo turma 1");
    // instancia um novo objeto Turma
    $turma = new Turma();
    $turma->dia_semana = 1;
    $turma->turno = 'M';
    $turma->professor = 'Carlo Bellini';
    $turma->sala = '100';
    $turma->data_inicio = '2002-09-01';
    $turma->encerrada = FALSE;
    $turma->ref_curso = 2;
    $turma->store();
    // armazena o objeto
    // armazena esta frase no arquivo de LOG
    TTransaction::log("** inserindo turma 2");
    $turma = new Turma();
    $turma->dia_semana = 'Segunda';
    $turma->turno = 'Manhã';
    $turma->professor = 'Sérgio Crespo';
    $turma->sala = '200';
    $turma->data_inicio = '2004-09-01';
    $turma->encerrada = FALSE;
    $turma->ref_curso = 3;
    $turma->store();
    // armazena o objeto
    // finaliza a transação
    TTransaction::close();
    echo "Registros inseridos com Sucesso<br>\n";
} catch (Exception $e) {
    // exibe a mensagem gerada pela exceção
    echo '<b>Erro</b>' . $e->getMessage();
Example #17
0
                $value = $val;
                break;
            }
        }
        $rows[$key] = $value;
    }
    return $rows;
}
// create a new EditableGrid object
$grid = new EditableGrid();
/* 
*  Add columns. The first argument of addColumn is the name of the field in the databse. 
*  The second argument is the label that will be displayed in the header
*/
$grid->addColumn('id', 'Cdg', 'integer', NULL, false);
$grid->addColumn('TURMA_NOME', 'Série', 'string');
$grid->addColumn('TURMA_ANO', 'Ano', 'string');
//$grid->addColumn('firstname', 'Firstname', 'string');
//$grid->addColumn('age', 'Age', 'integer');
//$grid->addColumn('height', 'Height', 'float');
/* The column id_country and id_continent will show a list of all available countries and continents. So, we select all rows from the tables */
$grid->addColumn('TURMA_PROF', 'Prof.', 'string', fetch_pairs($System, 'SELECT USUARIO_CDG,USUARIO_NOME ' . ' FROM USUARIO ' . ' LEFT JOIN USUARIO_ESCOLA ON USUARIOESCOLA_USUARIO = USUARIO_CDG ' . ' WHERE USUARIOESCOLA_ESCOLA = ' . $_SESSION['ESCOLA']), true);
//$grid->addColumn('TURMA', 'Turma', 'STRING',NULL,false);
//$grid->addColumn('id_continent', 'Continent', 'string' , fetch_pairs($mysqli,'SELECT id, name FROM continent'),true);
//$grid->addColumn('id_country', 'Country', 'string', fetch_pairs($mysqli,'SELECT id, name FROM country'),true );
//$grid->addColumn('lastvisit', 'Lastvisit', 'date');
//$grid->addColumn('website', 'Website', 'string');
$grid->addColumn('action', 'Ações', 'html', NULL, false, 'id');
$Turma = new Turma();
$result = $Turma->resultset_turmas($_SESSION['ESCOLA']);
$grid->renderJSON($result);
Example #18
0
<?php

include_once '../../config.php';
include ROOT . "model/admin/turma.php";
$turma_cdg = isset($_GET['t']) ? $_GET['t'] : -1;
$valor_bloqueio = isset($_GET['b']) ? $_GET['b'] : -1;
if ($valor_bloqueio != -1) {
    $Turma = new Turma();
    $Turma->bloquear_turmas($turma_cdg, $valor_bloqueio, $_SESSION['ESCOLA']);
    header('Location: ' . ROOT_URL . 'control/admin/bloqueio.php');
}
Example #19
0
<?php

require '../../../config.php';
require ROOT . 'model/admin/turma.php';
$turma_cdg = isset($_POST['turma_cdg']) ? $_POST['turma_cdg'] : -1;
$letra = isset($_POST['letra']) ? $_POST['letra'] : '';
$serie = isset($_POST['serie']) ? $_POST['serie'] : '';
$ano = isset($_POST['ano']) ? $_POST['ano'] : '';
$prof = isset($_POST['prof']) ? $_POST['prof'] : $_SESSION['USUARIO_CDG'];
$redirecionar = isset($_POST['redirecionar']) ? $_POST['redirecionar'] : 1;
$turma_cdg = $turma_cdg == '' ? -1 : $turma_cdg;
$Turma = new Turma($turma_cdg);
$turma_inserida = $Turma->gravar($letra, $serie, $ano, $prof, $_SESSION['ESCOLA'], $turma_cdg);
if ($turma_inserida != -1) {
    $turma_cdg = $turma_inserida;
}
if ($redirecionar == 1) {
    header("Location: " . ROOT_URL . "control/cadastros/turmas/edit_turma.php?t=" . $turma_cdg . "&s=s");
}
Example #20
0
<?php

require 'common.inc.php';
$regraCurso = new Curso();
$regraTurma = new Turma();
$cursos = $regraCurso->listar(CURSO_ATIVO);
$turnos = $regraTurma->listarTurno();
try {
    if (array_key_exists('excluir', $_GET)) {
        $id_turma = intval($_GET['excluir']);
        $regraTurma->excluir($id_turma);
        $msgsucesso = 'Turma removida com sucesso!';
        header('Location: ' . WEB_PATH . '/admin/turmas?sucesso=' . urlencode($msgsucesso));
        exit;
    }
    if (count($_POST) > 0) {
        $turma = $regraTurma->pegarDoPost();
        if ($turma->id_turma > 0) {
            $regraTurma->alterar($turma);
            $msgsucesso = 'Curso alterar com sucesso!';
        } else {
            $regraTurma->inserir($turma);
            $msgsucesso = 'Curso adicionado com sucesso!';
        }
        header('Location: ' . WEB_PATH . '/admin/turmas?sucesso=' . urlencode($msgsucesso));
        exit;
    }
} catch (Exception $e) {
    $msgerro = $e->getMessage();
}
$id_turma = intval($_GET['turma']);
<?php

if (is_numeric($_GET['curso']) && $_GET['curso'] != '') {
    require_once "../model/Turma.class.php";
    require_once "../model/conexao.class.php";
    require_once "../model/conf.php";
    $conexao = new Conexao($conexaoBD['bd'], $conexaoBD['usuario'], $conexaoBD['senha'], $conexaoBD['host']);
    $conexao->getConexao();
    /**
     * Define o curso a ser buscado;
     */
    $curso = $_GET['curso'];
    /*
     * Define se será buscado o turno
     * ou não
     */
    $turno = $_GET['turno'];
    /*
    		if($turno = 'turno'){
    					$turma = new Turma($curso,0,0);
    					$periodos = $turma->buscaTurnoCurso();
    				}else{*/
    $turma = new Turma($curso, $turno, 0);
    $periodos = $turma->gradePeriodos();
    //}
    echo isset($periodos) && $periodos != false ? $periodos : "<option>Nenhuma informação encontrada.</option>";
} else {
    echo "<option>Não foi possível encontrar o curso.</option>";
}