2010-12-17 23:56:01 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class UserController extends Zend_Controller_Action
|
|
|
|
{
|
|
|
|
|
|
|
|
public function init()
|
|
|
|
{
|
2011-02-08 01:03:14 +01:00
|
|
|
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
|
|
|
$ajaxContext->addActionContext('get-hosts', 'json')
|
|
|
|
->addActionContext('get-user-data-table-info', 'json')
|
|
|
|
->initContext();
|
2010-12-17 23:56:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function indexAction()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public function addUserAction()
|
2011-02-08 01:03:14 +01:00
|
|
|
{
|
|
|
|
$this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.js','text/javascript');
|
|
|
|
$this->view->headScript()->appendFile('/js/airtime/user/user.js','text/javascript');
|
2010-12-17 23:56:01 +01:00
|
|
|
$request = $this->getRequest();
|
2011-02-08 01:03:14 +01:00
|
|
|
$form = new Application_Form_AddUser();
|
|
|
|
|
|
|
|
if ($request->isPost()) {
|
|
|
|
if ($form->isValid($request->getPost())) {
|
|
|
|
|
|
|
|
$formdata = $form->getValues();
|
|
|
|
User::addUser($formdata);
|
|
|
|
$form->reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->view->form = $form;
|
2010-12-17 23:56:01 +01:00
|
|
|
}
|
|
|
|
|
2011-01-25 00:44:28 +01:00
|
|
|
public function getHostsAction()
|
|
|
|
{
|
2011-02-08 01:03:14 +01:00
|
|
|
$search = $this->_getParam('term');
|
|
|
|
|
|
|
|
$this->view->hosts = User::getHosts($search);
|
2011-01-26 05:14:35 +01:00
|
|
|
}
|
2011-01-25 00:44:28 +01:00
|
|
|
|
2011-02-08 01:03:14 +01:00
|
|
|
public function getUserDataTableInfoAction()
|
|
|
|
{
|
|
|
|
$post = $this->getRequest()->getPost();
|
|
|
|
$users = User::getUsersDataTablesInfo($post);
|
|
|
|
|
|
|
|
die(json_encode($users));
|
|
|
|
}
|
2010-12-17 23:56:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-25 00:44:28 +01:00
|
|
|
|
|
|
|
|
2011-02-08 01:03:14 +01:00
|
|
|
|
|
|
|
|