Changeset 15019 for events/phpframework/piece_framework/trunk/web/frontend/webapp/actions/Account/PictureAction.php
- Timestamp:
- 07/02/08 00:58:49 (6 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
events/phpframework/piece_framework/trunk/web/frontend/webapp/actions/Account/PictureAction.php
r14106 r15019 13 13 require_once 'Piece/Unity/Service/FlowAction.php'; 14 14 require_once 'Piece/Unity/Service/Runemaster.php'; 15 require_once 'Phwittr/Self.php'; 15 16 require_once 'Phwittr/Account.php'; 16 17 … … 40 41 */ 41 42 42 var $_ userId;43 var $_self; 43 44 44 45 /**#@-*/ … … 50 51 function entryForm() 51 52 { 52 if (is_null($this->_ userId)) {53 $ user = $this->_context->getSession()->getAttribute('user');54 $this->_ userId = $user->id;53 if (is_null($this->_self)) { 54 $loginUser = $this->_context->getSession()->getAttribute('loginUser'); 55 $this->_self = new Phwittr_Self($loginUser->id); 55 56 } 56 57 } … … 60 61 $master = new Piece_Unity_Service_Runemaster(); 61 62 $master->addForm('AccountPicture', '/account/picture', true, true); 63 64 $viewElement = $this->_context->getViewElement(); 65 $viewElement->setElementByRef('self', $this->_self); 62 66 } 63 67 … … 71 75 72 76 $saveFilePath = PHWITTR_PROFILE_IMAGES_DIRECTORY . 73 "/{$this->_ userId}" . "/{$formValue->uploadedData['name']}";77 "/{$this->_self->id}" . "/{$formValue->uploadedData['name']}"; 74 78 $saveDirectory = dirname($saveFilePath); 75 79 … … 78 82 move_uploaded_file($formValue->uploadedData['tmp_name'], $saveFilePath); 79 83 80 $account = new Phwittr_Account(); 81 $account->updatePicture($this->_userId, $saveFilePath); 84 Phwittr_Account::updatePicture($this->_self->id, $saveFilePath); 85 unset($this->_self); 86 $this->_self = null; 82 87 83 88 return 'DisplayForm'; … … 93 98 { 94 99 if (!file_exists($directory)) { 95 mkdir( dirname($directory));100 mkdir($directory); 96 101 } else { 97 102 $dir = new DirectoryIterator($directory); … … 100 105 continue; 101 106 } 102 if ($dir->isDir()) { 103 $this->_removeInnerDirectory("{$directory}/{$target}"); 104 rmdir("{$directory}/{$target}"); 105 } else { 106 unlink("{$directory}/{$target}"); 107 } 107 unlink("{$directory}/{$target}"); 108 108 } 109 109 }
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)