Archived
1
0
Fork 0

Some work on the admin module

This commit is contained in:
Fredric N 2010-10-30 13:48:46 +02:00
parent a54fef3f64
commit 2dd98c8253
5 changed files with 50 additions and 1 deletions

View file

@ -0,0 +1,26 @@
<?php
class Admin_BlogController extends Fiktiv_Controller_Action
{
public function indexAction()
{
$form = $this->view->form = $this->_getCreateForm();
if ($this->_request->isPost() && $form->isValid($this->_request->getPost())) {
$this->_savePost($form);
}
}
private function _savePost($form)
{
$post = new BlogPost($form->getValues());
//$this->dataService->BlogPost->save($post);
Zend_Debug::dump($post);
}
protected function _getCreateForm()
{
require_once APPLICATION_PATH . '/forms/Admin_BlogCreate.php';
return new Admin_BlogCreate();
}
}

View file

@ -2,6 +2,18 @@
class Admin_IndexController extends Fiktiv_Controller_Action
{
public function preDispatch() {
$acl = Zend_Registry::get('Zend_Acl');
$auth = Zend_Auth::getInstance();
if (!$auth->hasIdentity() || !$acl->isAllowed($auth->getIdentity()->userRole, 'admin', 'read')) {
$this->_redirect('/');
exit;
}
}
public function indexAction()
{

View file

@ -13,6 +13,12 @@
<body>
<div id="wrapper" class="small">
<ul style="margin-bottom: 40px;">
<li><a href="<?=$this->url(array('controller' => 'index'), 'admin', true) ?>">Dashboard</a></li>
<li><a href="<?=$this->url(array('controller' => 'blog'), 'admin', true) ?>">Skapa ny blogpost</a></li>
</ul>
<?=$this->layout()->content ?>
</div>

View file

@ -0,0 +1,2 @@
<h1>Blog funkis</h1>
<?=$this->form ?>

View file

@ -1 +1,4 @@
<h1>Admin module, more here later.</h1>
<h1>Admin module, more here later.</h1>