<?php
require_once 'lib/Database/Connection.php';
require_once 'Crud.php';
class UsuarioModel extends Crud
{
protected $table = 'usuario';
private $nome;
private $arquivo;
private $formacao;
private $nivel;
private $email;
private $senha;
private $curso;
private $disciplina;
private $periodo;
public function setNome($nome)
{
$this->nome = $nome;
}
public function setArquivo()
{
$this->arquivo = $arquivo;
}
public function setFormacao($formacao)
{
$this->formacao = $formacao;
}
public function setNivel($nivel)
{
$this->nivel = $nivel;
}
public function setEmail($email)
{
$this->email = $email;
}
public function setSenha($senha)
{
$this->senha = $senha ;
}
public function setCurso($curso)
{
$this->curso = $curso;
}
public function setDisciplina($disciplina)
{
$this->disciplina = $disciplina;
}
public function setPeriodo($periodo)
{
$this->periodo = $periodo;
}
public function insert()
{
$sql = "INSERT INTO $this->table (nome, arquivo, formacao, nivel, email, senha, curso, disciplina, periodo) VALUES (:nome, :arquivo, :formacao, :nivel, :email, :senha, :curso, :disciplina, :periodo)";
$stmt = Connection::prepare($sql);
$stmt->bindParam(':nome', $this->nome);
$stmt->bindParam(':arquivo', $this->arquivo);
$stmt->bindParam(':formacao',$this->formacao );
$stmt->bindParam(':nivel', $this->nivel);
$stmt->bindParam(':email', $this->email);
$stmt->bindParam(':senha', $this->senha);
$stmt->bindParam(':curso', $this->curso);
$stmt->bindParam(':disciplina',$this->disciplina);
$stmt->bindParam(':periodo', $this->periodo);
return $stmt->execute();
}
public function update($id)
{
$sql = "UPDATE $this->table SET nome = :nome, arquivo = :arquivo, formacao = :formacao, nivel = :nivel, email = :email, senha = :senha, curso = :curso, disciplina = :disciplina, periodo = :periodo WHERE id = :id";
$stmt = Connection::prepare($sql);
$stmt->bindParam(':nome', $this->nome);
$stmt->bindParam(':arquivo', $this->arquivo);
$stmt->bindParam(':formacao',$this->formacao );
$stmt->bindParam(':nivel', $this->nivel);
$stmt->bindParam(':email', $this->email);
$stmt->bindParam(':senha', $this->senha);
$stmt->bindParam(':curso', $this->curso);
$stmt->bindParam(':disciplina',$this->disciplina);
$stmt->bindParam(':periodo', $this->periodo);
$stmt->bindParam(':id', $id);
return $stmt->execute();
}