summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/configs/application.ini2
-rw-r--r--application/controllers/BootosController.php58
-rw-r--r--application/forms/BootosCreate.php5
-rw-r--r--application/forms/BootosEdit.php103
-rw-r--r--application/views/scripts/bootos/editbootos.phtml5
-rw-r--r--application/views/scripts/bootos/index.phtml42
6 files changed, 197 insertions, 18 deletions
diff --git a/application/configs/application.ini b/application/configs/application.ini
index 9bfaec2..6970da3 100644
--- a/application/configs/application.ini
+++ b/application/configs/application.ini
@@ -10,7 +10,7 @@ resources.frontController.params.displayExceptions = 0
resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.username = root
-resources.db.params.password = 123456
+resources.db.params.password = lsfks
resources.db.params.dbname = pbs
resources.db.isDefaultTableAdapter = true
diff --git a/application/controllers/BootosController.php b/application/controllers/BootosController.php
index 7ce4ae3..5f096a6 100644
--- a/application/controllers/BootosController.php
+++ b/application/controllers/BootosController.php
@@ -39,8 +39,7 @@ class BootosController extends Zend_Controller_Action
echo "Message: " . $e->getMessage() . "<br/>";
}
- echo "BootOS erfolgreich angelegt. <br/>";
- return;
+ $this->_redirect('/bootos');
}
}
@@ -49,12 +48,63 @@ class BootosController extends Zend_Controller_Action
public function editbootosAction()
{
- // action body
+ $bootosID = $this->_request->getParam('bootosID');
+
+ if (!isset($_POST["editbootos"])){
+ $bootosID = $this->_request->getParam('bootosID');
+ if (!isset($bootosID)){
+ $this->_redirect('/bootos');
+ } else {
+ $bootos = new Application_Model_BootOs();
+ $bootosmapper = new Application_Model_BootOsMapper();
+ $bootosmapper->find($bootosID, $bootos);
+
+ $editbootosForm = new Application_Form_BootosEdit();
+ $editbootosForm->populate($bootos->toArray());
+ }
+ }else{
+ $editbootosForm = new Application_Form_BootosEdit($_POST);
+
+ if ($editbootosForm->isValid($_POST)) {
+
+ $bootos = new Application_Model_BootOs($_POST);
+ if($bootos->getConfigID() == '')
+ $bootos->setConfigID(NULL);
+ $bootosmapper = new Application_Model_BootOsMapper();
+ $date = new DateTime();
+ $bootos->setCreated($date->getTimestamp());
+ $bootos->setID($bootosID);
+
+ try {
+ $bootosmapper->save($bootos);
+ }catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ }
+
+ $this->_redirect('/bootos');
+ }
+
+ }
+
+ $this->view->editbootosForm = $editbootosForm;
+
}
public function deletebootosAction()
{
- // action body
+ $bootosID = $this->_request->getParam('bootosID');
+ if (!isset($bootosID)){
+ $this->_redirect('/bootos');
+ } else {
+ $bootos = new Application_Model_BootOs();
+ $bootos->setID($bootosID);
+ $bootosmapper = new Application_Model_BootOsMapper();
+ $bootosmapper->delete($bootos);
+ }
+ $this->_redirect('/bootos');
+
}
diff --git a/application/forms/BootosCreate.php b/application/forms/BootosCreate.php
index ca279a0..a9648e4 100644
--- a/application/forms/BootosCreate.php
+++ b/application/forms/BootosCreate.php
@@ -100,6 +100,11 @@ class Application_Form_BootosCreate extends Zend_Form
'ignore' => true,
'label' => 'Create BootOS',
));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/bootos"'
+ ));
+
}
diff --git a/application/forms/BootosEdit.php b/application/forms/BootosEdit.php
index 70f11da..3bc522f 100644
--- a/application/forms/BootosEdit.php
+++ b/application/forms/BootosEdit.php
@@ -5,9 +5,110 @@ class Application_Form_BootosEdit extends Zend_Form
public function init()
{
- /* Form Elements & Other Definitions Here ... */
+ $this->setName("BootOsEdit");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+
+ $this->addElement('text', 'configID', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'ConfigID:',
+ ));
+
+ $this->addElement('text', 'groupID', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'GroupID:',
+ 'value' => '1',
+ ));
+
+ $this->addElement('text', 'path_init', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Init-Path:',
+ ));
+
+ $this->addElement('text', 'path_kernel', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Kernel-Path:',
+ ));
+
+ $this->addElement('text', 'defaultkcl', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Default-KCL:',
+ ));
+
+ $this->addElement('textarea', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'Description:',
+ ));
+
+ $date = new DateTime();
+ $date->add(new DateInterval('P1Y'));
+ $this->addElement('text', 'expires', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'Expires:',
+ 'value' => $date->format('Y-m-d'),
+ ));
+
+
+ $this->addElement('text', 'public', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Public-Level:',
+ ));
+
+ $this->addElement('submit', 'editbootos', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Edit BootOS',
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/bootos"'
+ ));
+
}
}
+
+
diff --git a/application/views/scripts/bootos/editbootos.phtml b/application/views/scripts/bootos/editbootos.phtml
index f36d3d0..43813de 100644
--- a/application/views/scripts/bootos/editbootos.phtml
+++ b/application/views/scripts/bootos/editbootos.phtml
@@ -1 +1,4 @@
-<br /><br /><center>View script for controller <b>Bootos</b> and script/action name <b>editbootos</b></center> \ No newline at end of file
+<?php
+$this->editbootosForm->setAction($this->url());
+echo $this->editbootosForm;
+?>
diff --git a/application/views/scripts/bootos/index.phtml b/application/views/scripts/bootos/index.phtml
index 2fef182..828a8bf 100644
--- a/application/views/scripts/bootos/index.phtml
+++ b/application/views/scripts/bootos/index.phtml
@@ -15,20 +15,40 @@
</tr>
<?php foreach ($this->bootoslist as $bootos): ?>
<tr>
- <td><?php echo $bootos->getID(); ?></td>
- <td><?php echo $bootos->getTitle(); ?></td>
- <td><?php echo $bootos->getGroupID(); ?></td>
- <td><?php echo $bootos->getConfigID(); ?></td>
- <td><?php echo $bootos->getPath_init(); ?></td>
- <td><?php echo $bootos->getPath_kernel(); ?></td>
- <td><?php echo $bootos->getDefaultkcl(); ?></td>
- <td><?php echo $bootos->getDescription(); ?></td>
- <td><?php echo $bootos->getCreated(); ?></td>
- <td><?php echo $bootos->getExpires(); ?></td>
- <td><?php echo $bootos->getPublic(); ?></td>
+ <td><?php echo $this->escape($bootos->getID()); ?></td>
+ <td><?php echo $this->escape($bootos->getTitle()); ?></td>
+ <td><?php echo $this->escape($bootos->getGroupID()); ?></td>
+ <td><?php echo $this->escape($bootos->getConfigID()); ?></td>
+ <td><?php echo $this->escape($bootos->getPath_init()); ?></td>
+ <td><?php echo $this->escape($bootos->getPath_kernel()); ?></td>
+ <td><?php echo $this->escape($bootos->getDefaultkcl()); ?></td>
+ <td><?php echo $this->escape($bootos->getDescription()); ?></td>
+ <td><?php echo $this->escape($bootos->getCreated()); ?></td>
+ <td><?php echo $this->escape($bootos->getExpires()); ?></td>
+ <td><?php echo $this->escape($bootos->getPublic()); ?></td>
+ <td><a href="<?php echo $this->url(
+ array(
+ 'controller' => 'bootos',
+ 'action' => 'editbootos',
+ 'bootosID' => $bootos->getID()
+ ),
+ 'default',
+ true, false) ?>">Edit BootOS</a></td>
+ <td><a href="<?php echo $this->url(
+ array(
+ 'controller' => 'bootos',
+ 'action' => 'deletebootos',
+ 'bootosID' => $bootos->getID()
+ ),
+ 'default',
+ true) ?>">Delete BootOS</a></td>
</tr>
<?php endforeach; ?>
</table>
+<br/>
+<?php echo $this->formButton('createbootos', 'Create BootOS', array(
+ 'onclick' => 'self.location="/bootos/createbootos"'))?>
+