public function editAction() { $form = new Blog_Form(); $mdlBlog = new Blog_Blog(); if ($this->_request->isPost() && $form->isValid($_POST) && $this->_request->getParam('isInsert') != true) { $values = $form->getValues(); $blog = $mdlBlog->updateBlog($values['id'], $values['name']); $blog = $blog->page; //the update blog function returns the results of open } else { $id = $this->_request->getParam('id'); $blog = $mdlBlog->find($id)->current(); $form->populate($blog->toArray()); } $form->setAction($this->baseUrl . '/mod_blog/blog/edit'); $submit = $form->getElement('submit'); $submit->setLabel($this->view->getTranslation('Update Blog')); $this->view->form = $form; $this->view->blog = $blog; $mdlPost = new Blog_Post(); $this->view->posts = $mdlPost->getPosts($blog->id); $postForm = new Post_Form(); $postFormValues['blog_id'] = $blog->id; $postForm->populate($postFormValues); $postForm->setAction($this->baseUrl . '/mod_blog/post/create'); $submit = $postForm->getElement('submit'); $submit->setLabel($this->view->getTranslation('Add New Post')); $this->view->postForm = $postForm; $this->view->breadcrumbs[$blog->name] = $this->baseUrl . '/mod_blog/blog/edit/id/' . $blog->id; $this->view->toolbarLinks['Delete'] = $this->baseUrl . '/mod_blog/blog/delete/id/' . $blog->id; }
public function blogAction() { if ($this->moduleData->blog > 0) { $mdlBlog = new Blog_Blog(); $mdlPost = new Blog_Post(); $page = Digitalus_Builder::getPage(); $params = $page->getParams(); if (isset($params['openPost']) && $params['openPost'] > 0) { $openPost = $mdlPost->openPost($params['openPost']); $this->view->openPost = $openPost; $this->view->blog = $mdlBlog->find($openPost->blogId)->current(); } else { $this->view->blog = $mdlBlog->find($this->moduleData->blog)->current(); $this->view->posts = $mdlPost->getPosts($this->moduleData->blog); } } }