source: pro-bachkim-filespace/sourcecode/application/modules/ajax/controllers/privatecontent.php @ 11

Last change on this file since 11 was 11, checked in by dungnv, 11 years ago
File size: 2.6 KB
Line 
1<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2/**
3 * PrivateContent Class
4 *
5 * @author dzungnv02
6 *
7 */
8
9class PrivateContent extends MX_Controller
10{
11        /* private $_aryDir = array(
12                                0 => array ('id' => 1, 'name' => 'Dir 1', 'parentID' => 0),
13                                1 => array ('id' => 2, 'name' => 'Dir 2', 'parentID' => 0),
14                                2 => array ('id' => 3, 'name' => 'Dir 1.1', 'parentID' => 1),
15                                3 => array ('id' => 4, 'name' => 'Dir 1.1.1', 'parentID' => 3),
16                                4 => array ('id' => 5, 'name' => 'Dir 1.1.1.1', 'parentID' => 4),
17                                5 => array ('id' => 6, 'name' => 'Dir 1.1.2', 'parentID' => 3),
18                                6 => array ('id' => 7, 'name' => 'Dir 3', 'parentID' => 0),
19                                7 => array ('id' => 8, 'name' => 'Dir 3.1', 'parentID' => 7)
20                );
21       
22        private $_aryFile = array(
23                                0 => array('id' => 1, 'name' => 'File 1', 'minetype' => 'text', 'size' => '1.5MB', 'parentID' => 1),
24                                1 => array('id' => 2, 'name' => 'File 2', 'minetype' => 'text', 'size' => '1.6MB', 'parentID' => 1),
25                                2 => array('id' => 3, 'name' => 'File 3', 'minetype' => 'text', 'size' => '1.7MB', 'parentID' => 2),
26                                3 => array('id' => 4, 'name' => 'File 4', 'minetype' => 'text', 'size' => '1.8MB', 'parentID' => 2),
27                                4 => array('id' => 5, 'name' => 'File 5', 'minetype' => 'text', 'size' => '1.8MB', 'parentID' => 0),
28                                5 => array('id' => 6, 'name' => 'File 6', 'minetype' => 'text', 'size' => '1.8MB', 'parentID' => 3),
29                                5 => array('id' => 7, 'name' => 'File 7', 'minetype' => 'text', 'size' => '1.8MB', 'parentID' => 5)
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());
39                echo json_encode($aryData);
40        }
41
42        public function createDir () {
43                $parentDir =  $this->input->post('parentID',TRUE);
44                $name =  $this->input->post('name',TRUE);
45               
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                }
54        }
55       
56        public function deleteDir () {
57                $dirID =  $this->input->post('id',TRUE);
58                $delAllChild = $this->input->post('delallchild',TRUE);
59               
60                $aryChild = $this->objDirectory->getAllChild($dirID);
61                echo json_encode($aryChild);
62        }
63
64}
65
66/* End of file directory.php */
67/* Location: ./application/modules/ajax/controllers/directory.php */
Note: See TracBrowser for help on using the repository browser.