public function editAction() { $form = new Show_Form(); $mdlShow = new Slideshow_Show(); if ($this->_request->isPost() && $form->isValid($_POST) && $this->_request->getParam('isInsert') != true) { $values = $form->getValues(); $results = $mdlShow->updateShow($values['id'], $values['name'], $values['description']); $show = $results->page; } else { $id = $this->_request->getParam('id'); $show = $mdlShow->find($id)->current(); $form->populate($show->toArray()); } $form->setAction($this->baseUrl . '/mod_slideshow/show/edit'); $submit = $form->getElement('submit'); $submit->setLabel($this->view->getTranslation('Update Slideshow')); $this->view->form = $form; $this->view->show = $show; $mdlSlide = new Slideshow_Slide(); $this->view->slides = $mdlSlide->getSlides($show->id); $slideForm = new Slide_Form(); $slideForm->removeElement('image'); $slideForm->removeElement('imagepath'); $slideForm->removeElement('previewpath'); $slideForm->removeElement('image_preview'); $slideForm->removeElement('caption'); $slideFormValues['show_id'] = $show->id; $slideForm->populate($slideFormValues); $slideForm->setAction($this->baseUrl . '/mod_slideshow/slide/create'); $submit = $slideForm->getElement('submit'); $submit->setLabel($this->view->getTranslation('Add New Slide')); $this->view->slideForm = $slideForm; $this->view->breadcrumbs[$show->name] = $this->baseUrl . '/mod_slideshow/show/edit/id/' . $show->id; $this->view->toolbarLinks['Add to my bookmarks'] = $this->baseUrl . '/admin/index/bookmark/url/mod_slideshow/show/edit/id/' . $show->id; $this->view->toolbarLinks['Delete'] = $this->baseUrl . '/mod_slideshow/show/delete/id/' . $show->id; }
public function reorderAction() { $mdlShow = new Slideshow_Show(); $mdlSlide = new Slideshow_Slide(); if ($this->_request->isPost()) { //sort the slides $ids = Digitalus_Filter_Post::raw('id'); $mdlSlide->sortSlides($ids); $show = Digitalus_Filter_Post::get('show'); $url = '/mod_slideshow/show/edit/id/' . $show; $this->_redirect($url); } else { $show = $this->_request->getParam('show'); } $this->view->slides = $mdlSlide->getSlides($show); $this->view->show = $mdlShow->find($show)->current(); }