Ejemplo n.º 1
0
 public static function save($message, $level = Message::LEVEL_ERROR)
 {
     $c = __CLASS__;
     $message = new $c($message, $level);
     Session::start();
     $_SESSION['messages'][] = $message;
     return $message;
 }
Ejemplo n.º 2
0
 public function index()
 {
     $this->view->setJs(array("novo"));
     Session::nivelRestrito(array("usuario", "admin"));
     $this->view->footer = $this->getFooter('footer', 'index');
     //$this->view->t = $this->dashboards->listarUltimos();
     $this->view->titulo = "Pagina de Administracção";
     $this->view->renderizar('index');
 }
Ejemplo n.º 3
0
 public function __construct()
 {
     Session::nivelRestrito(array("gestor"));
     $this->nota = $this->LoadModelo('Nota');
     parent::__construct();
     $this->view->setCss(array('amaran.min', 'animate.min', 'layout', 'ie'));
     $this->view->setJs(array('novo', 'RGraph.bar', 'RGraph.common.core'));
     $this->view->menu = $this->getFooter('menu');
 }
Ejemplo n.º 4
0
 public function index()
 {
     if (!Session::get('autenticado')) {
         $this->redirecionar('login');
     }
     $this->view->titulo = "Pagina Incial";
     $this->view->setCss(array("css"));
     $this->redirecionar('dashboard');
 }
Ejemplo n.º 5
0
 public function __construct()
 {
     Session::nivelRestrito(array("gestor"));
     $this->programa = $this->LoadModelo('Programa');
     $this->docente = $this->LoadModelo('Docente');
     parent::__construct();
     $this->view->setJS(array('novo'));
     $this->view->setCss(array('amaran.min', 'animate.min', 'layout', 'ie'));
     $this->view->menu = $this->getFooter('menu');
 }
Ejemplo n.º 6
0
 public function __construct()
 {
     Session::nivelRestrito(array("gestor"));
     $this->matricula = $this->LoadModelo("Matricula");
     $this->nota = $this->LoadModelo("Nota");
     $this->mm = $this->LoadModelo("MatriculaModulo");
     parent::__construct();
     $this->view->setJs(array("novo"));
     $this->view->setCss(array('amaran.min', 'animate.min', 'layout', 'ie'));
     $this->view->menu = $this->getFooter('menu');
 }
Ejemplo n.º 7
0
 protected function getTokenValue($name)
 {
     // Start session
     Session::start();
     if (!empty($_SESSION[$name])) {
         return $_SESSION[$name];
     } else {
         $token = $this->generateToken();
         $_SESSION[$name] = $token;
         return $token;
     }
 }
Ejemplo n.º 8
0
 public function index()
 {
     Session::nivelRestrito(array("administrador"));
     if ($this->getInt('enviar') == 1) {
         $dados = $_POST;
         if (!$this->getSqlverifica('nome')) {
             $this->view->erro = "Porfavor Introduza um nome valido ";
             $this->view->renderizar("novo");
             exit;
         }
         if (!$this->getSqlverifica('login')) {
             $this->view->erro = "Porfavor Introduza um login valido ";
             $this->view->renderizar("novo");
             exit;
         }
         if (!$this->getSqlverifica('nivel')) {
             $this->view->erro = "Porfavor Selecciona um nivel para o usuario ";
             $this->view->renderizar("novo");
             exit;
         }
         if (!$this->alphaNumeric('senha')) {
             $this->view->erro = "Porfavor introduza uma senha valida para o  usuario ";
             $this->view->renderizar("novo");
             exit;
         }
         $c = $this->usuario->pesquisaPor($_POST['login']);
         if ($c) {
             $this->view->erro = "O usuario já esta registrado.";
             $this->view->renderizar("novo");
             exit;
         }
         $this->pessoa->setNome($dados['nome']);
         $r = $this->pessoa->adicionar($this->pessoa);
         if ($r) {
             $this->usuario->setLogin($dados['login']);
             $this->usuario->setNivel($dados['nivel']);
             $this->usuario->setSenha(Hash::getHash('md5', $dados['senha'], HASH_KEY));
             $ru = $this->usuario->adiciona($this->usuario, $r);
             if (!is_int($ru)) {
                 $this->view->erro = "Não Foi Possivel  Concretizar a operção  tenta mais tarde!";
                 $this->view->renderizar("index");
                 exit;
             } else {
                 $this->view->mensagem = "Registro  Efectuado com Sucesso";
                 $this->view->renderizar("novo");
                 exit;
             }
         }
     }
     $this->view->usuarios = $this->usuario->pesquisar();
     $this->view->renderizar("index");
 }
Ejemplo n.º 9
0
 public function index()
 {
     if (!Session::get('autenticado')) {
         $this->redirecionar('login');
     }
     $this->view->titulo = "Pagina Incial";
     if (!Session::get('autenticado')) {
         $this->redirecionar('login');
     }
     //        $this->view->setCss(array("css"));
     $this->view->footer = $this->getFooter('footer', 'index');
     $this->view->renderizar("index");
 }
Ejemplo n.º 10
0
 public function __construct()
 {
     Session::nivelRestrito(array("gestor"));
     $this->pessoa = $this->LoadModelo('Pessoa');
     $this->docente = $this->LoadModelo('Docente');
     $this->curso = $this->LoadModelo('Curso');
     $this->modulo = $this->LoadModelo('Modulo');
     $this->usuario = $this->LoadModelo('Usuario');
     $this->dm = $this->LoadModelo('DocentModulo');
     parent::__construct();
     $this->view->setCss(array('amaran.min', 'animate.min', 'layout', 'ie', 'multiple-select', 'bootstrap-dialog.min'));
     $this->view->setJs(array("novo", "jquery.multiple.select", 'bootstrap-dialog.min'));
     $this->view->menu = $this->getFooter('menu');
     $this->view->titulo = " Tabela de docentes cadastrados";
 }
Ejemplo n.º 11
0
 public function __construct()
 {
     parent::__construct();
     Session::nivelRestrito(array("gestor"));
     $this->pessoa = $this->LoadModelo('Pessoa');
     $this->aluno = $this->LoadModelo('Aluno');
     $this->curso = $this->LoadModelo('Curso');
     $this->matricula = $this->LoadModelo("Matricula");
     $this->nota = $this->LoadModelo("Nota");
     $this->view->menuVertical = $this->getFooter('menuVertical');
     $this->usuario = $this->LoadModelo("Usuario");
     $this->mm = $this->LoadModelo('MatriculaModulo');
     $this->view->titulo = "Tabela de Alunos Matriculados";
     $this->view->setCss(array('amaran.min', 'animate.min', 'layout', 'ie', 'multiple-select', 'bootstrap-dialog.min'));
     $this->view->setJs(array("novo", 'jquery.multiple.select', 'run_prettify', 'bootstrap-dialog.min'));
     $this->view->menu = $this->getFooter('menu');
 }
Ejemplo n.º 12
0
 public function gravar($mensagem)
 {
     $arquivo = $this->verificarArquivo();
     $texto = '---------Log Gerado em ' . date('d-m-Y H:m:s') . '------------' . "\n";
     $texto1 = 'IP da Maquina do Usuario: ' . $_SERVER['REMOTE_ADDR'] . "\n";
     $texto2 = 'Usuario: ' . Session::get('nome') . "\n";
     $texto3 = "Acção feita: " . $mensagem . "\n";
     $texto4 = "-------------------------------------------------------------------------------------------------" . "\n";
     $t = $texto . $texto1 . $texto2 . $texto3 . $texto4;
     if (!fwrite($arquivo, $t)) {
         $retorno = TRUE;
     } else {
         $retorno = FALSE;
     }
     fclose($arquivo);
     return $retorno;
 }
Ejemplo n.º 13
0
 public function logof()
 {
     Session::destruir(array('autenticado', 'nivel', 'nome', 'id', 'time'));
     $this->redirecionar("login");
 }
Ejemplo n.º 14
0
 public function alteraSenha()
 {
     if ($this->getInt('enviar') == 1) {
         $this->usuario->setSenha($_POST['senha']);
         $this->usuario->setId(Session::get('id'));
         if ($this->usuario->editarSenha($this->usuario)) {
             $this->view->mensagem = "Senha alterada com sucesso";
             $this->redirecionar("aluno/editar/" . Session::get('id'));
             exit;
         } else {
             $this->view->erro = "Erro ao alterar senha";
             $this->view->renderizar('senha');
             exit;
         }
     } else {
         $this->view->renderizar('senha');
     }
 }
Ejemplo n.º 15
0
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
use application\Session;
use application\Bootstrap;
use application\Request;
require './vendor/autoload.php';
require 'config/config.php';
//require 'config/cli-config.php';
require './config/autoload.php';
require './config/Doctrine.php';
try {
    Session::iniciar();
    Bootstrap::run(new Request());
} catch (Exception $ex) {
    echo $ex->getMessage();
}
Ejemplo n.º 16
0
 public function adicionar1($dados = FALSE)
 {
     if ($this->getInt('enviar')) {
         Session::get('pessoa');
         $id = $this->docente->pesquisar(Session::get('pessoa'));
         $_POST['docente'] = $id->getId();
         $dados = $_POST;
         if (!$this->getSqlverifica('curso')) {
             $this->view->erro = "Porfavor Selecciona um curso";
             $this->view->renderizar('novo1');
             exit;
         }
         if (!$this->getSqlverifica('modulo')) {
             $this->view->erro = "Porfavor Selecciona um modulo";
             $this->view->renderizar('novo1');
             exit;
         }
         if (!$this->getSqlverifica('data')) {
             $this->view->erro = "Porfavor Selecciona uma data";
             $this->view->renderizar('novo1');
             exit;
         }
         if (empty($_FILES['arquivo']["name"])) {
             $this->view->erro = "Porfavor Selecciona um arquivo";
             $this->view->renderizar('novo1');
             exit;
         }
         $diretorio = "upload/";
         move_uploaded_file($_FILES['arquivo']["tmp_name"], $diretorio . $_FILES['arquivo']["name"]);
         $this->materia->setNome($diretorio . $_FILES['arquivo']["name"]);
         $this->materia->setData($dados['data']);
         $p = $this->materia->pesquisarNome($diretorio . $_FILES['arquivo']["name"]);
         if ($p) {
             //$this->view->sms = "Já foi publicado um arquivo com esse nome";
             $this->view->renderizar('novo1');
             exit;
         }
         if ($this->materia->adiciona($this->materia, $dados)) {
             $this->view->mensagem = "Dados guardado com sucesso";
             $this->view->sms = "Dados guardado com sucesso";
             $this->view->renderizar('novo1');
             exit;
         } else {
             $this->view->sms = "Erro ao guardar dados";
             $this->view->renderizar('novo1');
             exit;
         }
     }
     $this->view->sms = "Adicionar Nova Matéria de Formação";
     $this->view->renderizar("novo1");
 }
Ejemplo n.º 17
0
                <?php if (Session::get('nivel') == "gestor"): $menu = "dashboard"; ?>
                <a class="brand" href="#">Painel de Gestão</a>

                <?php endif; ?>

                <?php if (Session::get('nivel') == "docente"): $menu = "dashboard/docente/"; ?>
                    <a class="brand" href="#">Painel de Docente</a>

                <?php endif; ?>

                <?php if (Session::get('nivel') == "aluno"): $menu = "dashboard/aluno/"; ?>
                    <a class="brand" href="#">Painel de Aluno</a>

                <?php endif; ?>

                <?php if (Session::get('nivel') == "administrador"): $menu = "dashboard/admin/"; ?>
                    <a class="brand" href="#">Painel de Administrador</a>

                <?php endif; ?>


        </h1>
        <h2 class="section_title"><?php if (isset($this->titulo)): echo $this->titulo;
                endif; ?></h2>
    </hgroup>
</header> <!-- end of header bar -->

<section id="secondary_bar" class="">
    <div class="user">
        <!-- <a class="logout_user" href="#" title="Logout">Logout</a> -->
    </div>
Ejemplo n.º 18
0
 public function apagar($id)
 {
     Session::nivelRestrito(array("admin"));
     if (!$this->filtraInt($id)) {
         $this->redirecionar("alarmencc");
     }
     if (!$this->alarme->listarId($this->filtraInt($id))) {
         $this->redirecionar("alarmencc");
     }
     $this->alarme->Delete($id);
     $this->redirecionar("alarmencc");
 }
Ejemplo n.º 19
0
 public final function run()
 {
     if (!$this->config) {
         throw new \RuntimeException('Call setConfig() first to get run application!');
     }
     // re-set app as global
     set_global('app', $this);
     $this->request = new Request();
     $this->response = new Response();
     // set application defaults
     $this->setDefaults();
     // security & performans checks
     if ($halt = $this->haltCheck()) {
         $this->halt($halt);
     }
     // hold output buffer
     $this->startOutputBuffer();
     $this->service = (new ServiceAdapter($this))->getService();
     // sessions used for only "site"
     if ($this->service->protocol == ServiceInterface::PROTOCOL_SITE) {
         $this->session = Session::init($this->config['app.session.cookie']);
     }
     if (!$this->service->isAllowedRequestMethod($this->request->method)) {
         // set fail stuff
         $this->response->setStatus(Status::METHOD_NOT_ALLOWED);
         $this->response->setContentType(ContentType::NONE);
         $output = '';
     } else {
         $output = $this->service->run();
     }
     // end output buffer
     $this->endOutputBuffer($output);
 }
Ejemplo n.º 20
0
 public function pesquisaDocenteNotas()
 {
     $id = $this->docente->pesquisar(Session::get('pessoa'));
     $t = $this->dm->listagem($id->getId());
     echo json_encode($t);
 }
Ejemplo n.º 21
0
        <div class="navbar navbar-fixed-top">
            <div class="navbar-inner">
                <div class="container-fluid">
                    <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </a>
                    <a class="brand" href="<?php 
URL;
?>
dashboard">Admin Panel</a>
                    <div class="nav-collapse collapse">
                        <ul class="nav pull-right">
                            <li class="dropdown">
                                <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown"> <i class="icon-user"></i> <?php 
print Session::get('nome');
?>
 <i class="caret"></i>

                                </a>
                                <ul class="dropdown-menu">
                                    <li>
                                        <a tabindex="-1" href="#">Perfil</a>
                                    </li>
                                    <li class="divider"></li>
                                    <li>
                                        <a tabindex="-1" href="<?php 
print URL;
?>
login/logof">Logout</a>
                                    </li>
Ejemplo n.º 22
0
 public function alteraTema()
 {
     $this->usuario->setId(Session::get('id'));
     $this->usuario->setTema($_POST['tema']);
     if ($this->usuario->editarTema($this->usuario)) {
         echo json_encode(array("mensagem" => "Tema alterado. Reiniciando..."));
         Session::destruir();
     } else {
         echo json_encode(array("mensagem" => "Erro ao alterar Tema"));
     }
 }
 public function apagar($id)
 {
     Session::nivelRestrito(array("admin"));
     if (!$this->filtraInt($id)) {
         $this->redirecionar("identificacao_turnos");
     }
     if (!$this->turno->listarId($this->filtraInt($id))) {
         $this->redirecionar("identificacao_turnos");
     }
     $this->turno->Delete($id);
     $this->redirecionar("identificacao_turnos");
 }