Beispiel #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Cargo();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Cargo'])) {
         $model->attributes = $_POST['Cargo'];
         if ($model->save()) {
             $model->cod = $model->id;
             if ($model->update()) {
                 $this->redirect(array('view', 'id' => $model->id));
             }
         }
     }
     $this->render('create', array('model' => $model));
 }
Beispiel #2
0
<?php

//update do usuario requisitado via ajax com a matricula e cargo a serem editados
include_once 'config/database.php';
include_once 'funcionario.php';
include_once 'cargo.php';
$database = new Database();
$db = $database->getConnection();
$funcionario = new Funcionario($db);
$cargo = new Cargo($db);
$funcionario->nome = strip_tags($_POST['nome']);
$funcionario->matricula = $_POST['matricula'];
$cargo->nomeCargo = strip_tags($_POST['nomeCargo']);
$cargo->salario = $_POST['salario'];
$cargo->idcargo = $_POST['idcargo'];
$funcionario->update();
$cargo->update();