Archived
1
0
Fork 0

Updating blog administration

This commit is contained in:
Fredric N 2011-02-26 14:15:01 +01:00
parent b2c54ec874
commit 3b4d093389
6 changed files with 52 additions and 14 deletions

View file

@ -4,18 +4,23 @@ class Admin_BlogController extends Fiktiv_Controller_Action
{
public function indexAction()
{
// Load models
$posts = new ModelBlogPost();
// Get form
$form = $this->view->form = $this->_getCreateForm();
if ($this->_request->isPost() && $form->isValid($this->_request->getPost())) {
$this->_savePost($form);
// Populate form
if ($this->_getParam('id', null)) {
$post = $posts->find($this->_getParam('id'))->current();
$form->populate($post->toArray());
}
}
private function _savePost($form)
{
$post = new BlogPost($form->getValues());
//$this->dataService->BlogPost->save($post);
Zend_Debug::dump($post);
// Save post
if ($this->_request->isPost() && $form->isValid($this->_request->getPost())) {
$posts->createPost($form->getValues(), $this->_getParam('id', null));
#$this->_redirect('index');
}
}
protected function _getCreateForm()