public static function palestrantes() { $texto = new Texto(); $texto->selecionarPorId(2); $palestrante = new Palestrante(); $palestrantes = $palestrante->listar(null, 'nome'); self::$corpo = "palestrantes"; self::$variaveis = array('texto' => $texto, 'palestrantes' => $palestrantes); self::renderizar(self::$viewController); }
public static function excluir() { $palestrante = new Palestrante(); $palestrante->selecionarPorId($_POST['id']); $palestrante->excluir(); }
/** * API Method inserts a new Palestrante record and render response as JSON */ public function Create() { try { $json = json_decode(RequestUtil::GetBody()); if (!$json) { throw new Exception('The request body does not contain valid JSON'); } $palestrante = new Palestrante($this->Phreezer); // TODO: any fields that should not be inserted by the user should be commented out // this is an auto-increment. uncomment if updating is allowed // $palestrante->IdPalestrante = $this->SafeGetVal($json, 'idPalestrante'); $palestrante->Nome = $this->SafeGetVal($json, 'nome'); $palestrante->Email = $this->SafeGetVal($json, 'email'); $palestrante->Cpf = $this->SafeGetVal($json, 'cpf'); $palestrante->Cargo = $this->SafeGetVal($json, 'cargo'); $palestrante->ImagemAssinatura = $this->SafeGetVal($json, 'imagemAssinatura'); $palestrante->Validate(); $errors = $palestrante->GetValidationErrors(); if (count($errors) > 0) { $this->RenderErrorJSON('Verifique erros no preenchimento do formulário', $errors); } else { $palestrante->Save(); $this->RenderJSON($palestrante, $this->JSONPCallback(), true, $this->SimpleObjectParams()); } } catch (Exception $ex) { $this->RenderExceptionJSON($ex); } }