Ignore:
Timestamp:
Jun 4, 2014 5:53:33 PM (11 years ago)
Author:
dungnv
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pro-bachkim-filespace/sourcecode/application/modules/ajax/controllers/privatecontent.php

    r10 r11  
    99class PrivateContent extends MX_Controller
    1010{
    11        
    12         public function __construct() {
    13                 parent::__construct();
    14         }
    15        
    16         public function getContent () {
    17                 $aryDir = array(
     11        /* private $_aryDir = array(
    1812                                0 => array ('id' => 1, 'name' => 'Dir 1', 'parentID' => 0),
    1913                                1 => array ('id' => 2, 'name' => 'Dir 2', 'parentID' => 0),
     
    2519                                7 => array ('id' => 8, 'name' => 'Dir 3.1', 'parentID' => 7)
    2620                );
    27                
    28                 $aryFile = array(
     21       
     22        private $_aryFile = array(
    2923                                0 => array('id' => 1, 'name' => 'File 1', 'minetype' => 'text', 'size' => '1.5MB', 'parentID' => 1),
    3024                                1 => array('id' => 2, 'name' => 'File 2', 'minetype' => 'text', 'size' => '1.6MB', 'parentID' => 1),
     
    3428                                5 => array('id' => 6, 'name' => 'File 6', 'minetype' => 'text', 'size' => '1.8MB', 'parentID' => 3),
    3529                                5 => array('id' => 7, 'name' => 'File 7', 'minetype' => 'text', 'size' => '1.8MB', 'parentID' => 5)
    36                 );
    37                
    38                 $aryData = array('DIRECTORIES' => $aryDir, 'FILES' => $aryFile);
    39                
     30                ); */
     31       
     32        public function __construct() {
     33                parent::__construct();
     34                $this->load->model('Directory_model', 'objDirectory', TRUE);
     35        }
     36       
     37        public function getContent () {
     38                $aryData = array('DIRECTORIES' =>  $this->objDirectory->getAllDirectory() , 'FILES' => $this->objDirectory->getAllFile());
    4039                echo json_encode($aryData);
    4140        }
    4241
    4342        public function createDir () {
     43                $parentDir =  $this->input->post('parentID',TRUE);
     44                $name =  $this->input->post('name',TRUE);
    4445               
     46                if (!is_null($parentDir) && !is_null($name)) {
     47                       
     48                        $maxID = $this->objDirectory->getMaxID (true);
     49                        $aryDir = array('id' => (int)$maxID + 1, 'name' => $name, 'parentID' => $parentDir, 'maxID' => $maxID);
     50                       
     51                        $result = $this->objDirectory->createDir($aryDir);
     52                        echo json_encode($aryDir);
     53                }
    4554        }
    4655       
    4756        public function deleteDir () {
     57                $dirID =  $this->input->post('id',TRUE);
     58                $delAllChild = $this->input->post('delallchild',TRUE);
    4859               
     60                $aryChild = $this->objDirectory->getAllChild($dirID);
     61                echo json_encode($aryChild);
    4962        }
    5063
Note: See TracChangeset for help on using the changeset viewer.