public function gravarAction() { $id = $this->_getParam('id', null); $sala = new Sala(); $dados = $this->_getAllParams(); if ($id) { $rowSala = $sala->find($id)->current(); } else { $rowSala = $sala->createRow(); unset($dados['id']); } $rowSala->setFromArray($dados); try { $rowSala->save(); } catch (Exception $e) { echo '<pre>Exception: '; print_r($e); echo '</pre>'; echo '<pre>Data: '; print_r($rowSala); echo '</pre>'; exit; } $this->_redirect('salas/index'); }
public static function editar() { $agenda = new Agenda(); $agenda->selecionarPorId($_GET['id']); $evento = new Evento(); $evento->selecionarPorId($agenda->fkEvento); $sala = new Sala(); $salas = $sala->listar(); $arrListaDatas = Funcao::retornaDataIntervalo($evento->dataInicio, $evento->dataFim); $arrHoraInicial = Funcao::intervaloDeHoraPorMinutos('07:00', '23:30'); $arrHoraFinal = Funcao::intervaloDeHoraPorMinutos('07:00', '23:30'); if (!empty($_POST)) { $agenda = new Agenda(); foreach ($_POST as $pKey => $p) { if ($pKey == 'dia') { $agenda->{$pKey} = Funcao::dateFormatToDatabase($p); } else { $agenda->{$pKey} = $p; } } $idAgenda = $agenda->salvar(); $evento = new Evento(); $evento->selecionarPorId($_POST['fkEvento']); self::redirecionar(Configuracao::$baseUrl . self::$viewController . '/listar/' . $evento->id . '-' . Funcao::prepararLink($evento->nome) . Configuracao::$extensaoPadrao); } self::$corpo = "editar"; self::$variaveis = array('agenda' => $agenda, 'salas' => $salas, 'evento' => $evento, 'dias' => $arrListaDatas, 'horaInicial' => $arrHoraInicial, 'horaFinal' => $arrHoraFinal); self::renderizar(self::$viewController); }
public function formularioAction() { $id = $this->_getParam('id', null); $atividade = new Atividade(); if ($id) { $rowAtividade = $atividade->find($id)->current(); $nomeUsuario = $rowAtividade->findParentUsuario()->nome; // Verifica se o usuário que é palestrante da atividade é o usuário logado if (Zend_Auth::getInstance()->getIdentity()->id != $rowAtividade->id_palestrante) { if (Zend_Auth::getInstance()->getIdentity()->sRole != 'admin') { $this->_addMessage('Você não pode modificar esta atividade'); $this->_redirect('participantes'); } } } else { $rowAtividade = $atividade->createRow(); $nomeUsuario = Zend_Auth::getInstance()->getIdentity()->nome; } if (Zend_Auth::getInstance()->getIdentity()->sRole == 'admin') { // Carrega salas $rowSetSalas = Sala::build()->fetchAll(null, 'nome'); $aSalas = array(); foreach ($rowSetSalas as $rowSala) { $aSalas[$rowSala->id] = $rowSala->nome; } $this->view->salas = $aSalas; // Carrega situações $aSituacao[Atividade::SUBMETIDO] = 'Aguardando aprovação'; $aSituacao[Atividade::APROVADO] = 'Aprovado'; $aSituacao[Atividade::REJEITADO] = 'Rejeitado'; $this->view->situacao = $aSituacao; } $this->view->nomeUsuario = $nomeUsuario; $this->view->row = $rowAtividade; }
public static function editar() { $sala = new Sala(); $sala->selecionarPorId($_GET['id']); $evento = new Evento(); $evento->selecionarPorId($sala->fkEvento); if (!empty($_POST)) { $sala = new Sala(); foreach ($_POST as $pKey => $p) { $sala->{$pKey} = $p; } $idSala = $sala->salvar(); $evento = new Evento(); $evento->selecionarPorId($_POST['fkEvento']); self::redirecionar(Configuracao::$baseUrl . self::$viewController . '/listar/' . $evento->id . '-' . Funcao::prepararLink($evento->nome) . Configuracao::$extensaoPadrao); } self::$corpo = "editar"; self::$variaveis = array('sala' => $sala); self::renderizar(self::$viewController); }
public function run() { DB::table('user_usr')->delete(); User::create(array('nome_usr' => 'Achiles Gomes', 'email_usr' => '*****@*****.**', 'pass_usr' => Hash::make('123456'))); User::create(array('nome_usr' => 'Admin', 'email_usr' => '*****@*****.**', 'pass_usr' => Hash::make('123'))); DB::table('salas_au')->delete(); Sala::create(array('predio_au' => 'B', 'sala_au' => '5')); Sala::create(array('predio_au' => 'B', 'sala_au' => '13')); Sala::create(array('predio_au' => 'C', 'sala_au' => '7')); Sala::create(array('predio_au' => 'C', 'sala_au' => '11')); Sala::create(array('predio_au' => 'C', 'sala_au' => '12')); Sala::create(array('predio_au' => 'C', 'sala_au' => '13')); Sala::create(array('predio_au' => 'C', 'sala_au' => '47')); Sala::create(array('predio_au' => 'C', 'sala_au' => '59')); }
/** * Show the application dashboard to the user. * * @return Response */ public function index() { //return view('home'); $sala = Sala::with('periodos')->get(); dd($sala); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $this->sala->find($id)->delete(); return Redirect::route('admin.salas.index'); }
<?php include_once realpath(dirname(__FILE__) . '/Sala.class.php'); $Sala = new Sala(); switch ($_REQUEST['a']) { case 'listar': permisos(CONFIGURACION, 'r'); $Sala->listar(); break; case 'ingresarForm': permisos(CONFIGURACION, 'w'); $Sala->ingresarForm(); break; case 'ingresar': permisos(CONFIGURACION, 'w'); $Sala->ingresar(); break; case 'actualizarForm': permisos(CONFIGURACION, 'u'); $Sala->actualizarForm(); break; case 'actualizar': permisos(CONFIGURACION, 'u'); $Sala->actualizarDatos(); break; case 'eliminar': permisos(CONFIGURACION, 'd'); $Sala->borrar($_REQUEST['id']); break; }
/**ADMIN LOGIN**/ // route to show the login form Route::get('/', array('uses' => 'HomeController@showLogin')); Route::get('login', array('uses' => 'HomeController@showLogin')); // route to process the form Route::post('login', array('uses' => 'HomeController@doLogin')); Route::get('admin/logout', array('uses' => 'HomeController@doLogout')); Route::get('/admin', array('as' => 'admin', 'before' => 'auth', 'uses' => 'AdminController@adminIndex')); Route::group(array('before' => 'auth'), function () { Route::get('/admin/matriz/adicionar', 'MatrizController@add'); Route::get('/admin/matriz/edit/{id}', 'MatrizController@edit'); Route::get('/admin/matriz/pdf/{id}', 'MatrizController@createPDF'); Route::post('/admin/matriz/store', 'MatrizController@store'); Route::get('/api/admin/matriz/adicionar-matriz', function () { $predio = Input::get('predio'); $local = Sala::where('predio_au', '=', $predio)->get(); return Response::json($local); }); Route::resource('/admin/salas', 'SalasController'); Route::resource('/admin/professor', 'ProfessorController'); Route::resource('/admin/aluno', 'AlunoController'); Route::resource('/admin/disciplina', 'DisciplinaController'); Route::resource('/admin/matriz', 'MatrizController'); Route::resource('/admin/componente_curricular', 'ComponenteCurricularController'); Route::get('/admin/disciplina', 'DisciplinaController@index'); /*Dependência*/ Route::get('/admin/dependencia/{id}', 'DependenciaController@dependencia'); Route::post('/admin/dependencia/store', 'DependenciaController@store'); Route::get('/admin/dependencia/edit/{id}', 'DependenciaController@edit'); Route::patch('/admin/dependencia/update/{id}', 'DependenciaController@update'); Route::delete('/admin/dependencia/delete/{id}', 'DependenciaController@destroy');
public function run() { DB::table('Salas')->delete(); Sala::create(array('nombre' => 'Sala 1', 'butacas' => '330', 'funcionarioId' => '1', 'localId' => '1')); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Sala::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<table class="table table-striped table-bordered"> <thead> <tr> <th width="10%" >ID</th> <th width="1%" >Dia</th> <th width="1%" >Sala</th> <th width="1%" >Início</th> <th width="1%" >Fim</th> <th width="70%" >Texto</th> <th width="20%" class="td-actions"></th> </tr> </thead> <tbody> <?php foreach ($lista as $l) { $sala = new Sala(); $sala->selecionarPorId($l->fkSala); ?> <tr> <td><?php echo $l->id; ?> </td> <td><?php echo Funcao::dateFormat($l->dia); ?> </td> <td><?php echo $sala->nome_pt; ?> </td>
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'sala-funcion-form', 'enableAjaxValidation' => false)); ?> <p class="help-block">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <?php echo $form->dropDownListRow($model, 'funcion_id', CHtml::listData(Funcion::model()->findAll(), 'id', 'nombre'), array('prompt' => 'Seleccione una Funcion', 'class' => 'span5')); ?> <?php echo $form->dropDownListRow($model, 'sala_id', CHtml::listData(Sala::model()->findAll(), 'id', 'nombre'), array('prompt' => 'Seleccione una Sala', 'class' => 'span5')); ?> <?php echo $form->textFieldRow($model, 'fecha', array('class' => 'span5')); ?> <?php echo $form->textFieldRow($model, 'hora', array('class' => 'span5')); ?> <?php echo $form->textFieldRow($model, 'precio', array('class' => 'span5')); ?>
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($idSala) { $sala = Sala::find($idSala); $sala->delete(); return Response::json(array('error' => false, 'message' => 'Sala eliminada'), 200); }