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
<div class="actions clearfix"> | |
<div class="btns"> | |
<a class="btn submit" href="/admin/index/save" title="Criar Post">Criar Post</a> | |
</div> | |
</div> | |
<label class="divisor"><span>Lista de Posts</span></label> | |
<table class="datatable"> | |
<thead> | |
<tr> | |
<th>Título</th> |
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 echo $this->doctype(); ?> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<?php echo $this->headTitle('ZF2 '. $this->translate('Skeleton Application'))->setSeparator(' - ')->setAutoEscape(false) ?> | |
<?php echo $this->headMeta()->appendName('viewport', 'width=device-width, initial-scale=1.0') ?> | |
<!-- Le styles --> |
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
/** | |
* Testa a página inicial, que deve mostrar os posts | |
*/ | |
public function testIndexAction() | |
{ | |
// Cria posts para testar | |
$postA = $this->addPost(); | |
$postB = $this->addPost(); | |
// Invoca a rota index |
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
/** | |
* Mostra os posts cadastrados | |
* @return void | |
*/ | |
public function indexAction() | |
{ | |
$post = $this->getTable('Application\Model\Post'); | |
$sql = $post->getSql(); | |
$select = $sql->select(); |
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 | |
// module/Admin/config/module.config.php: | |
return array( | |
'controllers' => array( //add module controllers | |
'invokables' => array( | |
'Admin\Controller\Index' => 'Admin\Controller\IndexController', | |
), | |
), |
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 | |
//queries used by tests | |
return array( | |
'posts' => array( | |
'create' => 'CREATE TABLE if not exists posts ( | |
id INT NOT NULL AUTO_INCREMENT , | |
title VARCHAR(250) NOT NULL , | |
description TEXT NOT NULL , | |
post_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , | |
PRIMARY KEY (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
<?php | |
namespace Admin\Model; | |
use Core\Test\ModelTestCase; | |
use Admin\Model\User; | |
use Zend\InputFilter\InputFilterInterface; | |
/** | |
* @group Model | |
*/ |
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 | |
namespace Admin\Service; | |
use DateTime; | |
use Core\Test\ServiceTestCase; | |
use Admin\Model\User; | |
use Core\Model\EntityException; | |
use Zend\Authentication\AuthenticationService; | |
/** |
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 | |
namespace Admin\Service; | |
use Core\Service\Service; | |
use Zend\Authentication\AuthenticationService; | |
use Zend\Authentication\Adapter\DbTable as AuthAdapter; | |
use Zend\Db\Sql\Select; | |
/** | |
* Serviço responsável pela autenticação da aplicação |
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
//ou adicionar no array do module.config.php (ou outro config) | |
'service_manager' => array( | |
'factories' => array( | |
'Session' => function($sm) { | |
return new Zend\Session\Container('ZF2napratica'); | |
}, | |
'Admin\Service\Auth' => function($sm) { |