Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
b43db577dd
|
@ -6,11 +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')
|
||||
->addActionContext('get-user-data', 'json')
|
||||
->addActionContext('remove-user', '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()
|
||||
|
@ -19,54 +19,51 @@ 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();
|
||||
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;
|
||||
$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);
|
||||
$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);
|
||||
$this->view->entries = User::GetUserData($id);
|
||||
}
|
||||
|
||||
public function removeUserAction()
|
||||
|
|
|
@ -22,8 +22,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
|
|||
//Add hosts selection
|
||||
$hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts');
|
||||
$hosts->setLabel('Hosts:')
|
||||
->setMultiOptions($options)
|
||||
->setRequired(true);
|
||||
->setMultiOptions($options);
|
||||
|
||||
$this->addElement($hosts);
|
||||
}
|
||||
|
|
|
@ -147,13 +147,15 @@ class Show {
|
|||
}
|
||||
}
|
||||
|
||||
//add selected hosts to cc_show_hosts table.
|
||||
foreach ($data['add_show_hosts'] as $host) {
|
||||
$showHost = new CcShowHosts();
|
||||
$showHost->setDbShow($showId);
|
||||
$showHost->setDbHost($host);
|
||||
$showHost->save();
|
||||
}
|
||||
if(is_array($data['add_show_hosts'])) {
|
||||
//add selected hosts to cc_show_hosts table.
|
||||
foreach ($data['add_show_hosts'] as $host) {
|
||||
$showHost = new CcShowHosts();
|
||||
$showHost->setDbShow($showId);
|
||||
$showHost->setDbHost($host);
|
||||
$showHost->save();
|
||||
}
|
||||
}
|
||||
|
||||
Show::populateShowUntilLastGeneratedDate($showId);
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ class User {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
<button id="add-show-submit" class="right-floated">Add this show</button>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="schedule-show-what">
|
||||
<h3 class="collapsible-header"><span class="arrow-icon"></span>What</h3>
|
||||
<div id="schedule-show-what" class="collapsible-content">
|
||||
<?php echo $this->what ?>
|
||||
</div>
|
||||
<h3 class="collapsible-header"><span class="arrow-icon"></span>When</h3>
|
||||
|
|
|
@ -181,6 +181,9 @@ function setAddShowEvents() {
|
|||
|
||||
function showErrorSections() {
|
||||
|
||||
if($("#schedule-show-what .errors").length > 0) {
|
||||
$("#schedule-show-what").show();
|
||||
}
|
||||
if($("#schedule-show-when .errors").length > 0) {
|
||||
$("#schedule-show-when").show();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue