diff options
Diffstat (limited to 'application/modules/backend/controllers/JsonController.php')
-rw-r--r-- | application/modules/backend/controllers/JsonController.php | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/application/modules/backend/controllers/JsonController.php b/application/modules/backend/controllers/JsonController.php new file mode 100644 index 0000000..61da947 --- /dev/null +++ b/application/modules/backend/controllers/JsonController.php @@ -0,0 +1,84 @@ +<?php + +class Backend_JsonController extends Zend_Controller_Action +{ + private $_mkernel; + private $_msources; + private $_msystems; + private $_mbootmedia; + private $_mmenus; + private $_logger; + + public function init() + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $this->_mkernels = new Model_Kernels(); + $this->_mmenus = new Model_Menus(); + $this->_msources = new Model_Sources(); + $this->_msystems = new Model_Systems(); + $this->_mbootmedia = new Model_Bootmedia(); + + + $this->_logger = new Zend_Log(); + $w = new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/debug.log'); + + $this->_logger->addWriter($w); + } + + public function indexAction() + { + // action body + } + + public function kernelAction() + { + $kernels = $this->_mkernels->fetchAll()->toArray(); + echo (json_encode($kernels)); + } + + public function menuAction() + { + $menus = $this->_mmenus->fetchAll()->toArray(); + echo (json_encode($menus)); + } + + public function bootmediaAction() + { + $bootmedia= $this->_mbootmedia->fetchAll()->toArray(); + echo (json_encode($bootmedia)); + } + + public function sourcesAction() + { + $sources = $this->_msources->fetchAll()->toArray(); + echo (json_encode($sources)); + + } + + public function systemsAction() + { + $ip = $this->getRequest()->getParam('ip'); + if (!empty($ip)) { + $s = $this->_msystems->select(); + $s->where('source = ?', $ip); + $systems = $this->_msystems->fetchAll($s)->toArray(); + } else { + $systems = $this->_msystems->fetchAll()->toArray(); + } + echo (json_encode($systems)); + } + + + +} + + + + + + + + + |