This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Notifications</title> | |
</head> | |
<body> | |
<center><h2>Notifications</h2></center> | |
<div id="notification"></div> | |
<script src="http://www.google.com/jsapi"></script> | |
<script type="text/javascript"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> | |
<title>Blog</title> | |
</head> | |
<body> | |
<?php | |
//mostra as mensagens de erro caso existam | |
$session = Zend_Session::start(); | |
if(isset($session->erro)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Application_Form_LoginForm extends Zend_Form | |
{ | |
public function init() | |
{ | |
//nome do formulário | |
$this->setName('Login'); | |
//elemento para o campo username |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Application_Form_Post extends Zend_Form | |
{ | |
public function init() | |
{ | |
$this->setName('Post'); | |
$id = new Zend_Form_Element_Hidden('id'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Posts</h1> | |
<a href="/post/create">Adicionar</a> | |
<?php foreach($this->posts as $p) {?> | |
<h3><?php echo $p['title']; ?></h3> | |
<p><?php echo nl2br($p['description']); ?></p> | |
<p><a href="/post/update/id/<?php echo $p['id'];?>">Editar</a></p> | |
<p><a href="/post/delete/id/<?php echo $p['id'];?>">Excluir</a></p> | |
<?php } ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function createAction() | |
{ | |
$form = new Application_Form_Post(); | |
$post = new Application_Model_Posts(); | |
//tem dados | |
if ($this->_request->isPost()) { | |
//form valido | |
if ($form->isValid($this->_request->getPost())) { | |
$id = $post->insert($form->getValues()); | |
$this->_redirect('post/retrieve'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function updateAction() | |
{ | |
$form = new Application_Form_Post(); | |
$form->setAction('/post/update'); | |
$form->submit->setLabel('Alterar'); | |
$posts = new Application_Model_Posts(); | |
//tem dados | |
if ($this->_request->isPost()) { | |
//form valido |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resources.db.adapter = "Pdo_Mysql" | |
resources.db.params.host = "localhost" | |
resources.db.params.username = "root" | |
resources.db.params.password = "vertrigo" | |
resources.db.params.dbname = "blog" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function indexAction() { | |
//adiciona o formulario | |
$form = new Application_Form_LoginForm(); | |
//verifica se tem dados enviados | |
if ($this->_request->isPost()) { | |
$formData = $this->_request->getPost(); | |
//se o formulário está válido | |
if ($form->isValid($formData)) { | |
//pega uma instancia e cria caso não exista | |
$auth = Zend_Auth::getInstance(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
</head> | |
<body> | |
<h2>Blog do Minetto</h2> | |
<?php | |
//mensagens de erro | |
$messages = new Zend_Session_Namespace('Messages'); | |
if(isset($messages->erro)) |