admin users are hosts by default, host selection is no longer required, any admin user can schedule/maniuplate all shows.
This commit is contained in:
parent
2b1163a157
commit
da175e0702
3 changed files with 36 additions and 40 deletions
|
@ -6,11 +6,11 @@ class UserController extends Zend_Controller_Action
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||||
$ajaxContext->addActionContext('get-hosts', 'json')
|
$ajaxContext->addActionContext('get-hosts', 'json')
|
||||||
->addActionContext('get-user-data-table-info', 'json')
|
->addActionContext('get-user-data-table-info', 'json')
|
||||||
->addActionContext('get-user-data', 'json')
|
->addActionContext('get-user-data', 'json')
|
||||||
->addActionContext('remove-user', 'json')
|
->addActionContext('remove-user', 'json')
|
||||||
->initContext();
|
->initContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
|
@ -19,54 +19,51 @@ class UserController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function addUserAction()
|
public function addUserAction()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
$this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.js','text/javascript');
|
$this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile('/js/airtime/user/user.js','text/javascript');
|
$this->view->headScript()->appendFile('/js/airtime/user/user.js','text/javascript');
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$form = new Application_Form_AddUser();
|
$form = new Application_Form_AddUser();
|
||||||
|
|
||||||
if ($request->isPost()) {
|
if ($request->isPost()) {
|
||||||
if ($form->isValid($request->getPost())) {
|
if ($form->isValid($request->getPost())) {
|
||||||
|
|
||||||
$formdata = $form->getValues();
|
$formdata = $form->getValues();
|
||||||
if ($form->validateLogin($formdata)){
|
if ($form->validateLogin($formdata)){
|
||||||
$user = new User($formdata['user_id']);
|
$user = new User($formdata['user_id']);
|
||||||
$user->setFirstName($formdata['first_name']);
|
$user->setFirstName($formdata['first_name']);
|
||||||
$user->setLastName($formdata['last_name']);
|
$user->setLastName($formdata['last_name']);
|
||||||
$user->setLogin($formdata['login']);
|
$user->setLogin($formdata['login']);
|
||||||
if ($formdata['password'] != "xxxxxx")
|
if ($formdata['password'] != "xxxxxx")
|
||||||
$user->setPassword($formdata['password']);
|
$user->setPassword($formdata['password']);
|
||||||
$user->setType($formdata['type']);
|
$user->setType($formdata['type']);
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
$form->reset();
|
$form->reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHostsAction()
|
public function getHostsAction()
|
||||||
{
|
{
|
||||||
$search = $this->_getParam('term');
|
$search = $this->_getParam('term');
|
||||||
$this->view->hosts = User::getHosts($search);
|
$this->view->hosts = User::getHosts($search);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserDataTableInfoAction()
|
public function getUserDataTableInfoAction()
|
||||||
{
|
{
|
||||||
$post = $this->getRequest()->getPost();
|
$post = $this->getRequest()->getPost();
|
||||||
$users = User::getUsersDataTablesInfo($post);
|
$users = User::getUsersDataTablesInfo($post);
|
||||||
|
|
||||||
|
die(json_encode($users));
|
||||||
die(json_encode($users));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserDataAction()
|
public function getUserDataAction()
|
||||||
{
|
{
|
||||||
$id = $this->_getParam('id');
|
$id = $this->_getParam('id');
|
||||||
$this->view->entries = User::GetUserData($id);
|
$this->view->entries = User::GetUserData($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeUserAction()
|
public function removeUserAction()
|
||||||
|
|
|
@ -22,8 +22,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
|
||||||
//Add hosts selection
|
//Add hosts selection
|
||||||
$hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts');
|
$hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts');
|
||||||
$hosts->setLabel('Hosts:')
|
$hosts->setLabel('Hosts:')
|
||||||
->setMultiOptions($options)
|
->setMultiOptions($options);
|
||||||
->setRequired(true);
|
|
||||||
|
|
||||||
$this->addElement($hosts);
|
$this->addElement($hosts);
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ class User {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getHosts($search=NULL) {
|
public static function getHosts($search=NULL) {
|
||||||
return User::getUsers(array('H', 'A'), $search);
|
return User::getUsers(array('H'), $search);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getUsersDataTablesInfo($datatables_post) {
|
public static function getUsersDataTablesInfo($datatables_post) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue