Changeset 889
- Timestamp:
- Apr 15, 2015 4:28:18 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/www/deploy/20150304/application/modules/ajax/controllers/privatecontent.php
r877 r889 2 2 /** 3 3 * PrivateContent Class 4 * 4 * 5 5 * @author dzungnv02 6 6 * … … 28 28 ); */ 29 29 30 class PrivateContent extends MX_Controller 30 class PrivateContent extends MX_Controller 31 31 { 32 32 … … 38 38 $this->vservices->setUserId($user['us_id']); 39 39 } 40 40 41 41 public function getContent () { 42 $xmlData = $this->vservices->getPrivateTree(); 43 42 $xmlData = $this->vservices->getPrivateTree(); 43 44 44 $this->xml->parse($xmlData); 45 45 46 46 $aryDirs = array(); 47 47 $aryFiles = array(); 48 48 write_file('log.txt', var_export($xmlData, true)); 49 49 50 50 if (!isset($this->xml->tree)) { 51 51 $aryError = array('err' => 'KhÃŽng thá» kết ná»i Äến máy chá»§!', 'errCode' => '-1'); … … 54 54 return; 55 55 } 56 56 57 57 $aryError = array('err' => $this->xml->tree->_param['err'], 'errCode' => (int)$this->xml->tree->_param['errCode']); 58 58 59 59 if (isset($this->xml->tree->folderlist->folder)) { 60 60 if (is_array($this->xml->tree->folderlist->folder)) { … … 68 68 } 69 69 } 70 70 71 71 if (isset($this->xml->tree->filelist->file)) { 72 72 if (is_array($this->xml->tree->filelist->file)) { 73 73 foreach($this->xml->tree->filelist->file as $key=>$value){ 74 $aryFiles[] = array('id' => $value->_param['id'], 'name' => $value->_value, 'parentID' => $value->_param['parentid'] == -1 ? 0:$value->_param['parentid'], 'minetype' => $value->_param['filetype'], 'size' => $value->_param['size'],'thumbnail' => $value->_param['thumbnail'],'fileurl' => $value->_param['fileurl']); 74 //$fileUrl = dirname(dirname(dirname($value->_param['fileurl']))); 75 $fileUrl = $value->_param['fileurl']; 76 $aryFiles[] = array('id' => $value->_param['id'], 'name' => $value->_value, 'parentID' => $value->_param['parentid'] == -1 ? 0:$value->_param['parentid'], 'minetype' => $value->_param['filetype'], 'size' => $value->_param['size'],'thumbnail' => $value->_param['thumbnail'],'fileurl' => $fileUrl); 75 77 } 76 78 }else { … … 87 89 $parentDir = $this->input->post('fparentid',TRUE); 88 90 $name = $this->input->post('fname',TRUE); 89 91 90 92 $xmlData = $this->vservices->actionExecute('mkdir',array('name' => $name, 'parent_id' => $parentDir == 0 ? -1:$parentDir)); 91 93 92 94 $this->xml->parse($xmlData); 93 95 94 96 $aryError = array('err' => $this->xml->status->_param['err'], 'errCode' => (int)$this->xml->status->_param['errCode']); 95 97 $aryData = array('id' => $this->xml->status->_param['id'], 'name' => $this->xml->status->_param['name'], 'parentID' => $parentDir, 'ERROR' => $aryError); 96 98 echo json_encode($aryData); 97 99 } 98 100 99 101 public function delete () { 100 102 $delobj = $this->input->post('delobj',TRUE); … … 105 107 if (isset($this->xml->tree->folder)) { 106 108 if (is_array($this->xml->tree->folder)) { 107 foreach ($this->xml->tree->folder as $key => $folder) { 109 foreach ($this->xml->tree->folder as $key => $folder) { 108 110 $aryFolders['DIRECTORIES'][] = $folder->_param['id']; 109 111 } … … 113 115 } 114 116 } 115 117 116 118 if (isset($this->xml->tree->file)) { 117 119 if (is_array($this->xml->tree->file)) { … … 124 126 } 125 127 } 126 128 127 129 $aryError = array('err' => $this->xml->tree->_param['err'], 'errCode' => (int)$this->xml->tree->_param['errCode']); 128 130 $aryData = array('DIRECTORIES' => isset($aryFolders['DIRECTORIES']) ? $aryFolders['DIRECTORIES'] : array(), 'FILES' => isset($aryFolders['FILES'])? $aryFolders['FILES'] : array() ,'ERROR' => $aryError); 129 131 echo json_encode($aryData); 130 132 } 131 133 132 134 public function rename() { 133 135 $id = $this->input->post('id',TRUE); 134 136 $data = $this->input->post('data',TRUE); 135 137 136 138 /* $aryData = array(); 137 139 $aryData['RESULT'] = $this->objDirectory->rename($id, $newName, $objectType);; … … 144 146 $data = $this->input->post('data',TRUE); 145 147 $act = $this->input->post('act',TRUE); 146 148 147 149 $xmlData = $this->vservices->actionExecute('copy' ,array('act' => $act,'data' => $data, 'destination' => $destination == 0 ? -1:$destination)); 148 150 149 151 error_log(date('YmdHis').' - $xmlData: '.var_export($xmlData, TRUE), 3, '/srv/www/sbg/log/file.log'); 150 152 151 153 $this->xml->parse($xmlData); 152 154 153 155 $aryNewDirs = isset($this->xml->data->folderdata) ? json_decode($this->xml->data->folderdata->_value) : array(); 154 156 $aryNewFiles = isset($this->xml->data->filedata) ? json_decode($this->xml->data->filedata->_value) : array(); 155 157 156 158 $aryData = array('DIRECTORIES' => $aryNewDirs, 'FILES' => $aryNewFiles); 157 159 $aryData['ERROR'] = array('err' => $this->xml->data->_param['err'], 'errCode' => (int)$this->xml->data->_param['errCode']);; 158 160 echo json_encode($aryData); 159 161 } 160 162 161 163 public function upload() { 162 164 163 165 } 164 166 }
Note: See TracChangeset
for help on using the changeset viewer.