Some work on the admin module
This commit is contained in:
parent
a54fef3f64
commit
2dd98c8253
5 changed files with 50 additions and 1 deletions
26
application/modules/admin/controllers/BlogController.php
Normal file
26
application/modules/admin/controllers/BlogController.php
Normal 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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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()
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
2
application/modules/admin/views/scripts/blog/index.phtml
Normal file
2
application/modules/admin/views/scripts/blog/index.phtml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<h1>Blog funkis</h1>
|
||||
<?=$this->form ?>
|
||||
|
|
@ -1 +1,4 @@
|
|||
<h1>Admin module, more here later.</h1>
|
||||
<h1>Admin module, more here later.</h1>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Reference in a new issue