CC-2166: Packaging Improvements. Moved the Zend app into airtime_mvc. It is now installed to /var/www/airtime. Storage is now set to /srv/airtime/stor. Utils are now installed to /usr/lib/airtime/utils/. Added install/airtime-dircheck.php as a simple test to see if everything is install/uninstalled correctly.
This commit is contained in:
parent
514777e8d2
commit
b11cbd8159
4546 changed files with 138 additions and 51 deletions
101
airtime_mvc/application/controllers/UserController.php
Normal file
101
airtime_mvc/application/controllers/UserController.php
Normal file
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
|
||||
class UserController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext->addActionContext('get-hosts', 'json')
|
||||
->addActionContext('get-user-data-table-info', 'json')
|
||||
->addActionContext('get-user-data', 'json')
|
||||
->addActionContext('remove-user', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
}
|
||||
|
||||
public function addUserAction()
|
||||
{
|
||||
$this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.js','text/javascript');
|
||||
$this->view->headScript()->appendFile('/js/airtime/user/user.js','text/javascript');
|
||||
$request = $this->getRequest();
|
||||
$form = new Application_Form_AddUser();
|
||||
|
||||
$this->view->successMessage = "";
|
||||
|
||||
if ($request->isPost()) {
|
||||
if ($form->isValid($request->getPost())) {
|
||||
|
||||
$formdata = $form->getValues();
|
||||
if ($form->validateLogin($formdata)){
|
||||
$user = new User($formdata['user_id']);
|
||||
$user->setFirstName($formdata['first_name']);
|
||||
$user->setLastName($formdata['last_name']);
|
||||
$user->setLogin($formdata['login']);
|
||||
if ($formdata['password'] != "xxxxxx")
|
||||
$user->setPassword($formdata['password']);
|
||||
$user->setType($formdata['type']);
|
||||
$user->setEmail($formdata['email']);
|
||||
$user->setSkype($formdata['skype']);
|
||||
$user->setJabber($formdata['jabber']);
|
||||
$user->save();
|
||||
|
||||
$form->reset();
|
||||
|
||||
if (strlen($formdata['user_id']) == 0){
|
||||
$this->view->successMessage = "<div class='success'>User added successfully!</div>";
|
||||
} else {
|
||||
$this->view->successMessage = "<div class='success'>User updated successfully!</div>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->form = $form;
|
||||
}
|
||||
|
||||
public function getHostsAction()
|
||||
{
|
||||
$search = $this->_getParam('term');
|
||||
$this->view->hosts = User::getHosts($search);
|
||||
}
|
||||
|
||||
public function getUserDataTableInfoAction()
|
||||
{
|
||||
$post = $this->getRequest()->getPost();
|
||||
$users = User::getUsersDataTablesInfo($post);
|
||||
|
||||
die(json_encode($users));
|
||||
}
|
||||
|
||||
public function getUserDataAction()
|
||||
{
|
||||
$id = $this->_getParam('id');
|
||||
$this->view->entries = User::GetUserData($id);
|
||||
}
|
||||
|
||||
public function removeUserAction()
|
||||
{
|
||||
// action body
|
||||
$id = $this->_getParam('id');
|
||||
$user = new User($id);
|
||||
|
||||
$this->view->entries = $user->delete();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue