[1] | 1 | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
---|
| 2 | /**
|
---|
[10] | 3 | * PrivateContent Class
|
---|
[1] | 4 | *
|
---|
| 5 | * @author dzungnv02
|
---|
| 6 | *
|
---|
| 7 | */
|
---|
| 8 |
|
---|
[10] | 9 | class PrivateContent extends MX_Controller
|
---|
[1] | 10 | {
|
---|
[11] | 11 | /* private $_aryDir = array(
|
---|
[10] | 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 | );
|
---|
[11] | 21 |
|
---|
| 22 | private $_aryFile = array(
|
---|
[10] | 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)
|
---|
[11] | 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());
|
---|
[10] | 39 | echo json_encode($aryData);
|
---|
| 40 | }
|
---|
[1] | 41 |
|
---|
[10] | 42 | public function createDir () {
|
---|
[11] | 43 | $parentDir = $this->input->post('parentID',TRUE);
|
---|
| 44 | $name = $this->input->post('name',TRUE);
|
---|
[10] | 45 |
|
---|
[11] | 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 | }
|
---|
[10] | 54 | }
|
---|
| 55 |
|
---|
| 56 | public function deleteDir () {
|
---|
[11] | 57 | $dirID = $this->input->post('id',TRUE);
|
---|
| 58 | $delAllChild = $this->input->post('delallchild',TRUE);
|
---|
[10] | 59 |
|
---|
[11] | 60 | $aryChild = $this->objDirectory->getAllChild($dirID);
|
---|
| 61 | echo json_encode($aryChild);
|
---|
[10] | 62 | }
|
---|
[1] | 63 |
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 | /* End of file directory.php */
|
---|
| 67 | /* Location: ./application/modules/ajax/controllers/directory.php */ |
---|