summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorSebastian Wagner2011-09-08 17:42:47 +0200
committerSebastian Wagner2011-09-08 17:42:47 +0200
commit89b5b3122410339d273b4c5a447668f2e23675fb (patch)
treea1ba2edc46188423cbdee57d7da74afb7130b16f /application
parentminor (diff)
parentMerge branch 'master' of git.openslx.org:lsfks/projekte/poolctrl (diff)
downloadpoolctrl-89b5b3122410339d273b4c5a447668f2e23675fb.tar.gz
poolctrl-89b5b3122410339d273b4c5a447668f2e23675fb.tar.xz
poolctrl-89b5b3122410339d273b4c5a447668f2e23675fb.zip
Merge branch 'master' of git.openslx.org:lsfks/projekte/poolctrl
Diffstat (limited to 'application')
-rw-r--r--application/controllers/EventController.php24
-rw-r--r--application/forms/EventAdd.php65
-rw-r--r--application/forms/EventEdit.php17
3 files changed, 50 insertions, 56 deletions
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index 04541f4..7a45152 100644
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -248,17 +248,24 @@ class EventController extends Zend_Controller_Action
$addForm = new Application_Form_EventAdd(array('eventcategorylist' => $eventcategorylist, 'bootoslist' => $bootoslist, 'poollist' => $poollist, 'start' => $start, 'end' => $end, $this->getRequest()->getParams()));
if ($addForm->isValid($this->getRequest()->getParams())) {
$params = $this->getRequest()->getParams();
- $params['start'] = date ('Y-m-d H:i', strtotime($this->getRequest()->getParam('start')));
- if($params['end']) {
- $params['end'] = date ('Y-m-d H:i', strtotime($this->getRequest()->getParam('end')));
- } else {
+ if($params['immediate']) {
+ $params['start'] = date ('Y-m-d H:i', time());
unset($params['end']);
- }
- if($params['repeatEnd']) {
- $params['repeatEnd'] = date ('Y-m-d H:i', strtotime($this->getRequest()->getParam('repeatEnd')));
- } else {
unset($params['repeatEnd']);
$params['repeat'] = 0;
+ } else {
+ $params['start'] = date ('Y-m-d H:i', strtotime($this->getRequest()->getParam('start')));
+ if($params['end']) {
+ $params['end'] = date ('Y-m-d H:i', strtotime($this->getRequest()->getParam('end')));
+ } else {
+ unset($params['end']);
+ }
+ if($params['repeatEnd']) {
+ $params['repeatEnd'] = date ('Y-m-d H:i', strtotime($this->getRequest()->getParam('repeatEnd')));
+ } else {
+ unset($params['repeatEnd']);
+ $params['repeat'] = 0;
+ }
}
$event = new Application_Model_Event($params);
$event->setPbs_membershipID($this->userIDsNamespace['membershipID']);
@@ -443,6 +450,7 @@ class EventController extends Zend_Controller_Action
$filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['deletefilter'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "bootmenuid=" . $event->getPbs_filterID());
unset($filterApiResult);
}
+ $params['immediate'] = 0;
$event->setOptions($params);
$event->setID($eventID);
$bootmenuquery = "bootosID=" . $event->getPbs_bootosID() . "&startcounter=0&title=" . $event->getTitle() . "&defaultbootmenu=1&order=0&kcl=0";
diff --git a/application/forms/EventAdd.php b/application/forms/EventAdd.php
index 8d10686..ed62d74 100644
--- a/application/forms/EventAdd.php
+++ b/application/forms/EventAdd.php
@@ -112,9 +112,10 @@ class Application_Form_EventAdd extends Zend_Form
));
$this->addElement('checkbox', 'immediate', array(
- 'required' => false,
- 'label' => 'Immediate Event:',
- 'value'=>array(0,1),
+ 'onchange' => 'immediateChanged("immediate")',
+ 'required' => false,
+ 'label' => 'Immediate Event:',
+ 'value' => array(0,1),
));
$this->addElement('text', 'start', array(
@@ -156,51 +157,51 @@ class Application_Form_EventAdd extends Zend_Form
'required' => false,
'label' => 'Repeat end:',
'value' => 'mm/dd/yyyy H:min'
- ));
+ ));
- $this->addElement('text', 'participants', array(
+ $this->addElement('text', 'participants', array(
'filters' => array('StringTrim'),
'validators' => array(
- array('StringLength', false, array(0, 40)),
- ),
+ array('StringLength', false, array(0, 40)),
+ ),
'required' => false,
'label' => 'Participants:',
- ));
+ ));
- $this->addElement('text', 'note', array(
+ $this->addElement('text', 'note', array(
'filters' => array('StringTrim'),
'validators' => array(
- array('StringLength', false, array(0, 140)),
- ),
+ array('StringLength', false, array(0, 140)),
+ ),
'required' => false,
'label' => 'Note:',
- ));
+ ));
- $poolfield = $this->createElement('select','pbs_poolID');
- $poolfield ->setLabel('Pool:');
+ $poolfield = $this->createElement('select','pbs_poolID');
+ $poolfield ->setLabel('Pool:');
- if(count($this->poollist)>0){
- foreach($this->poollist as $pool => $p){
- $poolfield->addMultiOption($p->getID(), $p->getTitle());
- }
- }
+ if(count($this->poollist)>0){
+ foreach($this->poollist as $pool => $p){
+ $poolfield->addMultiOption($p->getID(), $p->getTitle());
+ }
+ }
- $poolfield->setRegisterInArrayValidator(false);
- $this->addElement($poolfield);
+ $poolfield->setRegisterInArrayValidator(false);
+ $this->addElement($poolfield);
- $bootosfield = $this->createElement('select','pbs_bootosID');
- $bootosfield ->setLabel('BootOS:');
+ $bootosfield = $this->createElement('select','pbs_bootosID');
+ $bootosfield ->setLabel('BootOS:');
- if(count($this->bootoslist)>0){
- foreach($this->bootoslist as $bootos => $b){
- $bootosfield->addMultiOption($b->getID(), $b->getTitle());
- }
- }
+ if(count($this->bootoslist)>0){
+ foreach($this->bootoslist as $bootos => $b){
+ $bootosfield->addMultiOption($b->getID(), $b->getTitle());
+ }
+ }
- $bootosfield->setRegisterInArrayValidator(false);
- $this->addElement($bootosfield);
+ $bootosfield->setRegisterInArrayValidator(false);
+ $this->addElement($bootosfield);
- $this->addElement('submit', 'add', array(
+ $this->addElement('submit', 'add', array(
'required' => false,
'ignore' => true,
'label' => 'Create Event'
@@ -210,7 +211,7 @@ class Application_Form_EventAdd extends Zend_Form
'required' => false,
'ignore' => true,
'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
+ 'onclick' => 'location.href="/event/"',
));
echo '<script type="text/javascript">
diff --git a/application/forms/EventEdit.php b/application/forms/EventEdit.php
index fb3faa3..e6a4c7a 100644
--- a/application/forms/EventEdit.php
+++ b/application/forms/EventEdit.php
@@ -84,21 +84,6 @@ class Application_Form_EventEdit extends Zend_Form
'value' => $this->params['title'],
));
- if( $this->params['immediate'] == 1) {
- $this->addElement('checkbox', 'immediate', array(
- 'required' => false,
- 'label' => 'Immediate Event:',
- 'value'=>array(0,1),
- 'checked' => 'checked',
- ));
- } else {
- $this->addElement('checkbox', 'immediate', array(
- 'required' => false,
- 'label' => 'Immediate Event:',
- 'value'=>array(0,1),
- ));
- }
-
$this->addElement('text', 'start', array(
'filters' => array('StringTrim'),
'validators' => array(
@@ -233,7 +218,7 @@ class Application_Form_EventEdit extends Zend_Form
'required' => false,
'ignore' => true,
'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
+ 'onclick' => 'location.href="/event/"',
));
echo '<script type="text/javascript">