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 | |
/** | |
* Album | |
* | |
* @package default | |
* @author Elton Minetto | |
**/ | |
class AlbumController extends Zend_Controller_Action { | |
/** |
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 | |
abstract class Application_Form_Pessoa extends Zend_Form { | |
public function init() { | |
$this->setName('Login'); | |
$username = new Zend_Form_Element_Text('username'); | |
$username->setLabel('Login')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty'); | |
$password = new Zend_Form_Element_Password('password'); | |
$password->setLabel('Senha')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty'); | |
$this->addElements(array($username, $password)); | |
} |
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_AlunoForm extends Application_Form_PessoaForm { | |
public function init() { | |
parent::init(); | |
$matricula = new Zend_Form_Element_Text('matricula'); | |
$matricula->setLabel('Matrícula')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty'); | |
$submit = new Zend_Form_Element_Submit('submit'); | |
$submit->setLabel('Entrar'); | |
$submit->setAttrib('id', 'Entrar'); |
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_Aluno extends Application_Form_Pessoa { | |
public function init() { | |
parent::init(); | |
$matricula = new Zend_Form_Element_Text('matricula'); | |
$matricula->setLabel('Matrícula')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty'); | |
$submit = new Zend_Form_Element_Submit('submit'); | |
$submit->setLabel('Entrar'); | |
$submit->setAttrib('id', 'Entrar'); |
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_Professor extends Application_Form_Pessoa { | |
public function init() { | |
parent::init(); | |
$disciplina = new Zend_Form_Element_Text('disciplina'); | |
$disciplina->setLabel('Disciplina')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty'); | |
$submit = new Zend_Form_Element_Submit('submit'); | |
$submit->setLabel('Entrar'); | |
$submit->setAttrib('id', 'Entrar'); |
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
;cache | |
cache.compression = true | |
cache.frontend.lifetime = 7200 | |
cache.frontend.automatic_serialization = true | |
;adaptador: File, Memcached ; APC | |
cache.backend.adapter = File | |
;cache em memcached | |
;cache.backend.options.srv1.host = localhost | |
;cache.backend.options.srv1.port = 11211 | |
;cache.backend.options.srv1.persistent = true |
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
/** | |
* Inicializa o cache | |
* | |
* @return void | |
* @author Elton Minetto | |
*/ | |
public function _initCache() | |
{ | |
$config = Zend_Registry::get('config')->cache; | |
$frontendOptions = array( |
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
$cache = Zend_Registry::get('cache'); | |
//busca os posts | |
$posts = new Application_Model_Posts; //cria um novo objeto Posts | |
//verifica se já está no cache o resultado | |
if(!$result = $cache->load('cachePosts')) { | |
//não existe no cache, processar e salvar | |
$result = $posts->fetchAll();//pega todos os posts | |
$cache->save($result, 'cachePosts'); | |
} | |
$this->view->data = $result; |
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
$cache = Zend_Registry::get('cache'); | |
if(!$form = $cache->load('Application_Form_Login')) { | |
$form = new Application_Form_Login; | |
//salva o form renderizado no cache | |
$cache->save($form->render(), 'Application_Form_Login'); | |
} | |
$this->view->form = $form; |
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 Blog_Session_Handler implements Zend_Session_SaveHandler_Interface{ | |
private $maxlifetime = 3600; | |
public $cache = ''; | |
public function __construct($cacheHandler) { | |
$this->cache = $cacheHandler; | |
} | |
public function open($save_path, $name) { |