コード例 #1
0
ファイル: ShowController.php プロジェクト: nononochi/shiori
 public function downloadAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout->disableLayout();
     $id = $this->getRequest()->getParam('id');
     $shioriMain = new ShioriMain();
     $shiori = $shioriMain->getShioriData($id);
     if (empty($shiori) === true) {
         $this->_redirect('/show/');
     }
     $fileName = "shiori_{$shiori[ShioriMain::COLUMN_START_DATE]}_{$shiori[ShioriMain::COLUMN_END_DATE]}.html";
     $this->getResponse()->setHeader('Content-disposition', 'attachment; filename="' . $fileName . '"', true)->setHeader('Content-type', 'text/octet-stream')->sendHeaders();
     $shiori[ShioriMain::COLUMN_DETAIL] = nl2br($shiori[ShioriMain::COLUMN_DETAIL]);
     $this->view->assign('shiori', $shiori);
     $cssFile = file_get_contents('css/download.css');
     $this->view->assign('css', $cssFile);
     $this->render('download');
 }
コード例 #2
0
ファイル: EditController.php プロジェクト: nononochi/shiori
 public function deleteAction()
 {
     $id = $this->getRequest()->getParam('id');
     if (ShioriMain::isValidateNumber($id) === false) {
         $this->_redirect('/');
     }
     $this->_shioriMain->deleteShiori($id);
     $this->_redirect('/show/');
 }