Changeset 12875
- Timestamp:
- Sep 13, 2009, 2:08:45 AM (13 years ago)
- Location:
- OpenPNE3/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
OpenPNE3/trunk/apps/pc_backend/modules/monitoringFunction/actions/actions.class.php
r12874 r12875 37 37 $params = $request->getParameter('page', 1); 38 38 $this->pager = Doctrine::getTable('File') 39 ->getImageFile s($params);39 ->getImageFilePager($params); 40 40 } 41 41 42 42 43 /** 43 * Executes adminUseraction44 * Executes fileDelete action 44 45 * 45 46 * @param sfRequest $request A request object … … 47 48 public function executeDelete(sfWebRequest $request) 48 49 { 49 $this->image = Doctrine::getTable('File')->find($request->getParameter('id')); 50 $this->image = Doctrine::getTable('File') 51 ->find($request->getParameter('id')); 50 52 $this->forward404Unless($this->image); 51 53 … … 55 57 ( 56 58 'notice', 57 sfContext::getInstance()->getI18N()->__('画像の削除が完了しました') 59 sfContext::getInstance()->getI18N() 60 ->__('画像の削除が完了しました') 58 61 ); 59 62 $this->redirect('monitoringFunction/list'); 60 63 } 61 64 } 65 62 66 /** 63 * Executes deleteUseraction67 * Executes editImage action 64 68 * 65 69 * @param sfRequest $request A request object … … 71 75 if ($request->isMethod(sfWebRequest::POST)) 72 76 { 73 $this->form->bindAndSave( 77 $this->form->bindAndSave 78 ( 74 79 $request->getParameter('image'), 75 80 $request->getFiles('image') … … 78 83 ( 79 84 'notice', 80 sfContext::getInstance()->getI18N()->__('画像の追加が完了しました') 85 sfContext::getInstance()->getI18N() 86 ->__('画像の追加が完了しました') 81 87 ); 82 88 $this->redirect('monitoringFunction/list'); 83 89 } 84 90 } 91 92 /** 93 * Executes fileList action 94 * 95 * @param sfRequest $request A request object 96 */ 97 public function executeFileList(sfWebRequest $request) 98 { 99 $params = $request->getParameter('page', 1); 100 $this->pager = Doctrine::getTable('File') 101 ->getFilePager($params); 102 } 103 104 /** 105 * Executes fileDelete action 106 * 107 * @param sfRequest $request A request object 108 */ 109 public function executeDeleteFile(sfWebRequest $request) 110 { 111 $this->file = Doctrine::getTable('File') 112 ->find($request->getParameter('id')); 113 114 if ($request->isMethod(sfWebRequest::POST)) { 115 $this->file->delete(); 116 $this->getUser()->setFlash 117 ( 118 'notice', 119 sfContext::getInstance()->getI18N() 120 ->__('ファイルの削除が完了しました') 121 ); 122 $this->redirect('monitoringFunction/fileList'); 123 } 124 } 125 126 /** 127 * Executes downloadFile action 128 * 129 * @param sfRequest $request A request object 130 */ 131 public function executeDownloadFile(sfWebRequest $request) 132 { 133 $this->file = Doctrine::getTable('File') 134 ->find($request->getParameter('id')); 135 $this->fileBin = Doctrine::getTable('FileBin') 136 ->find($request->getParameter('id')); 137 $original_filename = $this->file->getOriginalFilename(); 138 if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) { 139 $original_filename = mb_convert_encoding($original_filename, 'SJIS', 'UTF-8'); 140 } 141 $original_filename = str_replace(array("\r", "\n"), '', $original_filename); 142 143 header('Content-Disposition: attachment; filename="' . $original_filename . '"'); 144 header('Content-Length: '. strlen($this->fileBin->getBin())); 145 header('Content-Type: application/octet-stream'); 146 echo $this->fileBin->getBin(); 147 exit; 148 } 85 149 } -
OpenPNE3/trunk/data/fixtures/010_import_backend_monitoring_function_navi.yml
r12874 r12875 15 15 ja_JP: 16 16 caption: "画像アップロード・削除" 17 18 backend_monitoring_function_navi_file_list: 19 type: "monitoring_function_submenu" 20 uri: "monitoringFunction/fileList" 21 sort_order: 30 22 Translation: 23 ja_JP: 24 caption: "ファイルアップロードリスト" -
OpenPNE3/trunk/lib/model/doctrine/FileTable.class.php
r12874 r12875 18 18 } 19 19 20 public function get ImageFiles($page = 1, $size = 20)20 public function getFilePager($page = 1, $size = 20) 21 21 { 22 $q = $this->getImageOrderdQuery(); 22 $q = $this->getImageOrderdQuery() 23 ->where('type NOT LIKE ?', 'image%'); 23 24 return $this->getPager($q, $page, $size); 24 25 } … … 26 27 public function getImageFilePager($page = 1, $size = 20) 27 28 { 28 $q = $this->getImageOrderdQuery(); 29 $q = $this->getImageOrderdQuery() 30 ->where('type LIKE ?', 'image%'); 29 31 return $this->getPager($q, $page, $size); 30 32 } … … 42 44 protected function getImageOrderdQuery() 43 45 { 44 return $this->createQuery()-> where('type LIKE ?', 'image%')->orderBy('id DESC');46 return $this->createQuery()->orderBy('id DESC'); 45 47 } 46 48 }
Note: See TracChangeset
for help on using the changeset viewer.