public function deleteAction() { $id = $this->_request->getParam('id'); $mdlBlog = new Blog_Blog(); $mdlBlog->deletePageById($id); $this->_forward('index', 'index'); }
public function editAction() { $form = new Post_Form(); $mdlBlog = new Blog_Blog(); $mdlPost = new Blog_Post(); if ($this->_request->isPost() && $form->isValid($_POST)) { $values = $form->getValues(); $blog = $mdlPost->updatePost($values['id'], $values['title'], $values['teaser'], $values['content']); $post = $mdlPost->openPost($values['id']); } else { $id = $this->_request->getParam('id'); $post = $mdlPost->openPost($id); $postArray['id'] = $post->id; $postArray['blog_id'] = $post->blogId; $postArray['title'] = $post->title; $postArray['teaser'] = $post->teaser; $postArray['content'] = $post->content; $form->populate($postArray); } $blog = $mdlBlog->find($post->blogId)->current(); $form->setAction($this->baseUrl . '/mod_blog/post/edit'); $submit = $form->getElement('submit'); $submit->setLabel($this->view->getTranslation('Update Post')); $this->view->form = $form; $this->view->blog = $blog; $this->view->post = $post; $this->view->breadcrumbs[$blog->name] = $this->baseUrl . '/mod_blog/blog/edit/id/' . $blog->id; $this->view->breadcrumbs[$post->title] = $this->baseUrl . '/mod_blog/post/edit/id/' . $post->id; $this->view->toolbarLinks['Delete'] = $this->baseUrl . '/mod_blog/post/delete/id/' . $post->id; }
public function indexAction() { $blogForm = new Blog_Form(); $blogForm->setAction($this->baseUrl . '/mod_blog/blog/create'); $submit = $blogForm->getElement('submit'); $submit->setLabel($this->view->getTranslation('Create Blog')); $this->view->form = $blogForm; $mdlBlog = new Blog_Blog(); $this->view->blogs = $mdlBlog->getBlogs(); }
/** * */ public function selectBlog($name, $value) { $mdlBlog = new Blog_Blog(); $blogs = $mdlBlog->getBlogs(); if ($blogs == null) { return $this->view->getTranslation('There are no blogs to view!'); } else { $options[] = $this->view->getTranslation('Select One'); foreach ($blogs as $blog) { $options[$blog->id] = $blog->name; } $form = new Digitalus_Form(); $select = $form->createElement('select', $name, array('multiOptions' => $options, 'belongsTo' => 'module')); return $select; } }
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); } } }