-added new users management screen
This commit is contained in:
parent
ee5e8f48ce
commit
3b4fa1cc1a
20 changed files with 606 additions and 226 deletions
|
@ -50,7 +50,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$end = $this->_getParam('end', null);
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new User($userInfo->id, $userInfo->type);
|
||||
$user = new User($userInfo->id);
|
||||
if($user->isAdmin())
|
||||
$editable = true;
|
||||
else
|
||||
|
@ -111,7 +111,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$show = new Show(new User($userInfo->id, $userInfo->type));
|
||||
$show = new Show(new User($userInfo->id));
|
||||
$overlap = $show->addShow($data);
|
||||
|
||||
if(isset($overlap)) {
|
||||
|
@ -137,7 +137,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$showInstanceId = $this->_getParam('showInstanceId');
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new User($userInfo->id, $userInfo->type);
|
||||
$user = new User($userInfo->id);
|
||||
|
||||
if($user->isAdmin()) {
|
||||
$show = new ShowInstance($showInstanceId);
|
||||
|
@ -155,7 +155,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$showInstanceId = $this->_getParam('showInstanceId');
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new User($userInfo->id, $userInfo->type);
|
||||
$user = new User($userInfo->id);
|
||||
|
||||
if($user->isAdmin()) {
|
||||
$show = new ShowInstance($showInstanceId);
|
||||
|
@ -171,7 +171,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$showInstanceId = $this->_getParam('id');
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new User($userInfo->id, $userInfo->type);
|
||||
$user = new User($userInfo->id);
|
||||
|
||||
if($user->isAdmin()) {
|
||||
$show = new ShowInstance($showInstanceId);
|
||||
|
@ -185,7 +185,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$today_timestamp = date("Y-m-d H:i:s");
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new User($userInfo->id, $userInfo->type);
|
||||
$user = new User($userInfo->id);
|
||||
|
||||
$show = new ShowInstance($id);
|
||||
|
||||
|
@ -223,7 +223,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new User($userInfo->id, $userInfo->type);
|
||||
$user = new User($userInfo->id);
|
||||
$show = new ShowInstance($showInstanceId);
|
||||
|
||||
if($user->isHost($show->getShowId())) {
|
||||
|
@ -242,7 +242,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
{
|
||||
$showInstanceId = $this->_getParam('id');
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new User($userInfo->id, $userInfo->type);
|
||||
$user = new User($userInfo->id);
|
||||
$show = new ShowInstance($showInstanceId);
|
||||
|
||||
if($user->isHost($show->getShowId())) {
|
||||
|
@ -273,7 +273,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$search = $this->_getParam('search', null);
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new User($userInfo->id, $userInfo->type);
|
||||
$user = new User($userInfo->id);
|
||||
$show = new ShowInstance($showInstanceId);
|
||||
|
||||
if($user->isHost($show->getShowId())) {
|
||||
|
|
|
@ -6,9 +6,11 @@ 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')
|
||||
->initContext();
|
||||
$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()
|
||||
|
@ -17,37 +19,66 @@ class UserController extends Zend_Controller_Action
|
|||
|
||||
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();
|
||||
|
||||
if ($request->isPost()) {
|
||||
if ($form->isValid($request->getPost())) {
|
||||
|
||||
$formdata = $form->getValues();
|
||||
User::addUser($formdata);
|
||||
$form->reset();
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->form = $form;
|
||||
$this->view->headScript()->appendFile('/js/airtime/user/user.js','text/javascript');
|
||||
$request = $this->getRequest();
|
||||
$form = new Application_Form_AddUser();
|
||||
|
||||
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->save();
|
||||
|
||||
$form->reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$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));
|
||||
$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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,3 +87,7 @@ class UserController extends Zend_Controller_Action
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue