Пример #1
0
 function deleteAction()
 {
     $album_id = $this->_request->getParam('album_id', 0);
     $template_id = $this->_request->getParam('template_id', 0);
     $viewers = new Viewers();
     if ($this->_request->isPost()) {
         $del = $this->_request->getPost('confirm');
         $return_to = $this->_request->getParam('return_to', 0);
         if (strcmp($del, 'Confirm') == 0 && $album_id > 0 && $template_id > 0) {
             $viewers->delete('album_id = ' . $album_id . ' AND template_id = ' . $template_id);
         }
         $this->_redirect('/album/view/id/' . $album_id . '/view/viewers');
     } elseif ($album_id > 0 && $template_id > 0) {
         $this->view->title = 'Confirm Deletion';
         $form = new ViewerDeleteForm();
         $in_return_to = $this->_request->getParam('return_to');
         if ($in_return_to) {
             $return_to = new PP_Form_Element_Hidden('return_to');
             $return_to->setValue($in_return_to);
             $form->addElement($return_to);
         }
         $form->confirm->setLabel('Confirm');
         $form->cancel->setLabel('Cancel');
         $this->view->form = $form;
     }
 }
Пример #2
0
 function deleteAction()
 {
     $id = $this->_request->getParam('id', 0);
     $templates = new Templates();
     if ($this->_request->isPost()) {
         $confirm = $this->_request->getPost('confirm');
         $return_to = $this->_request->getParam('return_to', 0);
         if (!strcmp($confirm, 'Confirm') && $id > 0) {
             $templates->delete('id=' . $id);
             // remove all the viewers using this template
             $viewer_class = new Viewers();
             $viewer_class->delete('template_id' . $id);
         } elseif (!strcmp($return_to, 'view')) {
             $this->_redirect('/template/view/id/' . $id);
             return;
         }
         $this->_redirect('/template/list');
     } elseif ($id > 0) {
         $this->view->title = 'Confirm Deletion';
         $templates = new Templates();
         $template = $templates->fetchRow('id=' . $id);
         $this->view->template_name = $template->name;
         $form = new TemplateDeleteForm();
         $in_return_to = $this->_request->getParam('return_to', 0);
         if ($in_return_to) {
             $return_to = new PP_Form_Element_Hidden('return_to');
             $return_to->setValue($in_return_to);
             $form->addElement($return_to);
         }
         $form->confirm->setLabel('Confirm');
         $form->cancel->setLabel('Cancel');
         $this->view->form = $form;
     }
 }
Пример #3
0
 function deleteAction()
 {
     $id = $this->_request->getParam('id', 0);
     $albums = new Albums();
     if ($this->_request->isPost()) {
         $del = $this->_request->getPost('confirm');
         $return_to = $this->_request->getParam('return_to', 0);
         if (strcmp($del, 'Confirm') == 0 && $id > 0) {
             $albums->delete('id=' . $id);
         } elseif (!strcmp($return_to, 'view')) {
             $this->_redirect('/album/view/id/' . $id);
             return;
         }
         $this->_redirect('/album/list');
     } elseif ($id > 0) {
         $this->view->title = 'Confirm Deletion';
         $album = $albums->fetchRow('id=' . $id);
         $this->view->album_title = $album->title;
         $form = new AlbumDeleteForm();
         $in_return_to = $this->_request->getParam('return_to', 0);
         if ($in_return_to) {
             $return_to = new PP_Form_Element_Hidden('return_to');
             $return_to->setValue($in_return_to);
             $form->addElement($return_to);
         }
         $form->confirm->setLabel('Confirm');
         $form->cancel->setLabel('Cancel');
         $this->view->form = $form;
     } else {
         /* we were given a bad ID */
     }
 }