Changeset 889


Ignore:
Timestamp:
Apr 15, 2015 4:28:18 PM (10 years ago)
Author:
dungnv
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/www/deploy/20150304/application/modules/ajax/controllers/privatecontent.php

    r877 r889  
    22/**
    33 * PrivateContent Class
    4  * 
     4 *
    55 * @author dzungnv02
    66 *
     
    2828); */
    2929
    30 class PrivateContent extends MX_Controller 
     30class PrivateContent extends MX_Controller
    3131{
    3232
     
    3838                $this->vservices->setUserId($user['us_id']);
    3939        }
    40        
     40
    4141        public function getContent () {
    42                 $xmlData = $this->vservices->getPrivateTree(); 
    43                
     42                $xmlData = $this->vservices->getPrivateTree();
     43
    4444                $this->xml->parse($xmlData);
    45                
     45
    4646                $aryDirs = array();
    4747                $aryFiles = array();
    4848                write_file('log.txt', var_export($xmlData, true));
    49                
     49
    5050                if (!isset($this->xml->tree)) {
    5151                        $aryError = array('err' => 'KhÃŽng thể kết nối đến máy chá»§!', 'errCode' => '-1');
     
    5454                        return;
    5555                }
    56                
     56
    5757                $aryError = array('err' => $this->xml->tree->_param['err'], 'errCode' => (int)$this->xml->tree->_param['errCode']);
    58                
     58
    5959                if (isset($this->xml->tree->folderlist->folder)) {
    6060                        if (is_array($this->xml->tree->folderlist->folder)) {
     
    6868                        }
    6969                }
    70                
     70
    7171                if (isset($this->xml->tree->filelist->file)) {
    7272                        if (is_array($this->xml->tree->filelist->file)) {
    7373                                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);
    7577                                }
    7678                        }else {
     
    8789                $parentDir =  $this->input->post('fparentid',TRUE);
    8890                $name =  $this->input->post('fname',TRUE);
    89                
     91
    9092                $xmlData = $this->vservices->actionExecute('mkdir',array('name' => $name, 'parent_id' => $parentDir == 0 ? -1:$parentDir));
    91                
     93
    9294                $this->xml->parse($xmlData);
    93                
     95
    9496                $aryError = array('err' => $this->xml->status->_param['err'], 'errCode' => (int)$this->xml->status->_param['errCode']);
    9597                $aryData = array('id' => $this->xml->status->_param['id'], 'name' => $this->xml->status->_param['name'], 'parentID' => $parentDir, 'ERROR' => $aryError);
    9698                echo json_encode($aryData);
    9799        }
    98        
     100
    99101        public function delete () {
    100102                $delobj =  $this->input->post('delobj',TRUE);
     
    105107                if (isset($this->xml->tree->folder)) {
    106108                        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) {
    108110                                        $aryFolders['DIRECTORIES'][] = $folder->_param['id'];
    109111                                }
     
    113115                        }
    114116                }
    115                
     117
    116118                if (isset($this->xml->tree->file)) {
    117119                        if (is_array($this->xml->tree->file)) {
     
    124126                        }
    125127                }
    126                
     128
    127129                $aryError = array('err' => $this->xml->tree->_param['err'], 'errCode' => (int)$this->xml->tree->_param['errCode']);
    128130                $aryData = array('DIRECTORIES' => isset($aryFolders['DIRECTORIES']) ? $aryFolders['DIRECTORIES'] : array(), 'FILES' => isset($aryFolders['FILES'])? $aryFolders['FILES'] : array() ,'ERROR' => $aryError);
    129131                echo json_encode($aryData);
    130132        }
    131        
     133
    132134        public function rename() {
    133135                $id =  $this->input->post('id',TRUE);
    134136                $data =  $this->input->post('data',TRUE);
    135                
     137
    136138                /* $aryData = array();
    137139                $aryData['RESULT'] = $this->objDirectory->rename($id, $newName, $objectType);;
     
    144146                $data =  $this->input->post('data',TRUE);
    145147                $act =  $this->input->post('act',TRUE);
    146                
     148
    147149                $xmlData = $this->vservices->actionExecute('copy' ,array('act' => $act,'data' => $data, 'destination' => $destination == 0 ? -1:$destination));
    148                
     150
    149151                error_log(date('YmdHis').' - $xmlData: '.var_export($xmlData, TRUE), 3, '/srv/www/sbg/log/file.log');
    150                
     152
    151153                $this->xml->parse($xmlData);
    152                
     154
    153155                $aryNewDirs =   isset($this->xml->data->folderdata) ? json_decode($this->xml->data->folderdata->_value) : array();
    154156                $aryNewFiles =  isset($this->xml->data->filedata) ? json_decode($this->xml->data->filedata->_value) : array();
    155                
     157
    156158                $aryData = array('DIRECTORIES' => $aryNewDirs, 'FILES' => $aryNewFiles);
    157159                $aryData['ERROR'] = array('err' => $this->xml->data->_param['err'], 'errCode' => (int)$this->xml->data->_param['errCode']);;
    158160                echo json_encode($aryData);
    159161        }
    160        
     162
    161163        public function upload() {
    162                
     164
    163165        }
    164166}
Note: See TracChangeset for help on using the changeset viewer.