summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichael pereira2011-03-05 13:12:23 +0100
committermichael pereira2011-03-05 13:12:23 +0100
commit92e5b7a7b6bb780ef5e788b7711f8a999ac80f41 (patch)
tree9886c2229205ea8478e9a0bf0ca9fc5fb8de68e8
parentMerge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff)
downloadpbs2-92e5b7a7b6bb780ef5e788b7711f8a999ac80f41.tar.gz
pbs2-92e5b7a7b6bb780ef5e788b7711f8a999ac80f41.tar.xz
pbs2-92e5b7a7b6bb780ef5e788b7711f8a999ac80f41.zip
bootos v1
-rw-r--r--.gitignore1
-rw-r--r--.zfproject.xml26
-rw-r--r--application/controllers/BootosController.php68
-rw-r--r--application/controllers/IndexController.php3
-rw-r--r--application/forms/AuthDelete.php28
-rw-r--r--application/forms/BootosCreate.php107
-rw-r--r--application/forms/BootosDelete.php13
-rw-r--r--application/forms/BootosEdit.php13
-rw-r--r--application/forms/BootosIndex.php13
-rw-r--r--application/models/BootOs.php14
-rw-r--r--application/models/BootOsMapper.php14
-rw-r--r--application/views/scripts/bootos/createbootos.phtml4
-rw-r--r--application/views/scripts/bootos/deletebootos.phtml1
-rw-r--r--application/views/scripts/bootos/editbootos.phtml1
-rw-r--r--application/views/scripts/bootos/index.phtml35
-rw-r--r--tests/application/controllers/BootosControllerTest.php20
16 files changed, 348 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index b6618cb..3743eb5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
library/
+.metadata/
.project
.buildpath
.settings/
diff --git a/.zfproject.xml b/.zfproject.xml
index ad4a683..3927d78 100644
--- a/.zfproject.xml
+++ b/.zfproject.xml
@@ -29,6 +29,12 @@
<actionMethod actionName="removefilter"/>
<actionMethod actionName="editfilter"/>
</controllerFile>
+ <controllerFile controllerName="Bootos">
+ <actionMethod actionName="index"/>
+ <actionMethod actionName="createbootos"/>
+ <actionMethod actionName="editbootos"/>
+ <actionMethod actionName="deletebootos"/>
+ </controllerFile>
</controllersDirectory>
<formsDirectory>
<formFile formName="AuthLogin"/>
@@ -37,6 +43,10 @@
<formFile formName="FilterCreate"/>
<formFile formName="AuthDelete"/>
<formFile formName="FilterAdd"/>
+ <formFile formName="BootosCreate"/>
+ <formFile formName="BootosDelete"/>
+ <formFile formName="BootosEdit"/>
+ <formFile formName="BootosIndex"/>
</formsDirectory>
<layoutsDirectory enabled="false"/>
<modelsDirectory>
@@ -151,6 +161,21 @@
<viewControllerScriptsDirectory forControllerName="Filter">
<viewScriptFile forActionName="editfilter"/>
</viewControllerScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Bootos">
+ <viewScriptFile forActionName="index"/>
+ </viewControllerScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Index">
+ <viewScriptFile forActionName="createbootos"/>
+ </viewControllerScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Bootos">
+ <viewScriptFile forActionName="createbootos"/>
+ </viewControllerScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Bootos">
+ <viewScriptFile forActionName="editbootos"/>
+ </viewControllerScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Bootos">
+ <viewScriptFile forActionName="deletebootos"/>
+ </viewControllerScriptsDirectory>
</viewScriptsDirectory>
<viewHelpersDirectory/>
<viewFiltersDirectory enabled="false"/>
@@ -188,6 +213,7 @@
<testApplicationControllerFile filesystemName="AuthControllerTest.php"/>
<testApplicationControllerFile filesystemName="PersonControllerTest.php"/>
<testApplicationControllerFile filesystemName="FilterControllerTest.php"/>
+ <testApplicationControllerFile filesystemName="BootosControllerTest.php"/>
</testApplicationControllerDirectory>
</testApplicationDirectory>
<testLibraryDirectory>
diff --git a/application/controllers/BootosController.php b/application/controllers/BootosController.php
new file mode 100644
index 0000000..7ce4ae3
--- /dev/null
+++ b/application/controllers/BootosController.php
@@ -0,0 +1,68 @@
+<?php
+
+class BootosController extends Zend_Controller_Action
+{
+
+ public function init()
+ {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ }
+
+ public function indexAction()
+ {
+ $bootosmapper = new Application_Model_BootOsMapper();
+ $this->view->bootoslist = $bootosmapper->fetchAll();
+ }
+
+ public function createbootosAction()
+ {
+ if (!isset($_POST["createbootos"])){
+ $createbootosForm = new Application_Form_BootosCreate();
+ } else {
+
+ $createbootosForm = new Application_Form_BootosCreate($_POST);
+
+ if ($createbootosForm->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());
+
+ try {
+ $bootosmapper->save($bootos);
+ }catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+
+ }
+ echo "BootOS erfolgreich angelegt. <br/>";
+ return;
+ }
+ }
+
+ $this->view->createbootosForm = $createbootosForm;
+ }
+
+ public function editbootosAction()
+ {
+ // action body
+ }
+
+ public function deletebootosAction()
+ {
+ // action body
+ }
+
+
+}
+
+
+
+
+
+
+
diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php
index 0c4fe03..1ff6319 100644
--- a/application/controllers/IndexController.php
+++ b/application/controllers/IndexController.php
@@ -14,5 +14,8 @@ class IndexController extends Zend_Controller_Action
}
+
}
+
+
diff --git a/application/forms/AuthDelete.php b/application/forms/AuthDelete.php
new file mode 100644
index 0000000..4e9c92d
--- /dev/null
+++ b/application/forms/AuthDelete.php
@@ -0,0 +1,28 @@
+<?php
+
+class Application_Form_AuthDelete extends Zend_Form
+{
+
+ public function init()
+ {
+ $this->setName("Delete");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'ID', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'ID:',
+ ));
+ $this->addElement('submit', 'delete', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Delete',
+ ));
+ }
+
+
+}
+
diff --git a/application/forms/BootosCreate.php b/application/forms/BootosCreate.php
new file mode 100644
index 0000000..ca279a0
--- /dev/null
+++ b/application/forms/BootosCreate.php
@@ -0,0 +1,107 @@
+<?php
+
+class Application_Form_BootosCreate extends Zend_Form
+{
+
+ public function init()
+ {
+ $this->setName("BootOsCreate");
+ $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', 'createbootos', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Create BootOS',
+ ));
+ }
+
+
+}
+
diff --git a/application/forms/BootosDelete.php b/application/forms/BootosDelete.php
new file mode 100644
index 0000000..c62608f
--- /dev/null
+++ b/application/forms/BootosDelete.php
@@ -0,0 +1,13 @@
+<?php
+
+class Application_Form_BootosDelete extends Zend_Form
+{
+
+ public function init()
+ {
+ /* Form Elements & Other Definitions Here ... */
+ }
+
+
+}
+
diff --git a/application/forms/BootosEdit.php b/application/forms/BootosEdit.php
new file mode 100644
index 0000000..70f11da
--- /dev/null
+++ b/application/forms/BootosEdit.php
@@ -0,0 +1,13 @@
+<?php
+
+class Application_Form_BootosEdit extends Zend_Form
+{
+
+ public function init()
+ {
+ /* Form Elements & Other Definitions Here ... */
+ }
+
+
+}
+
diff --git a/application/forms/BootosIndex.php b/application/forms/BootosIndex.php
new file mode 100644
index 0000000..1e6505a
--- /dev/null
+++ b/application/forms/BootosIndex.php
@@ -0,0 +1,13 @@
+<?php
+
+class Application_Form_BootosIndex extends Zend_Form
+{
+
+ public function init()
+ {
+ /* Form Elements & Other Definitions Here ... */
+ }
+
+
+}
+
diff --git a/application/models/BootOs.php b/application/models/BootOs.php
index 57d1423..a2eea2f 100644
--- a/application/models/BootOs.php
+++ b/application/models/BootOs.php
@@ -2,11 +2,15 @@
class Application_Model_BootOs
{
- protected $_bootisoID;
- protected $_membershipID;
+ protected $_bootosID;
+ protected $_configID;
protected $_groupID;
- protected $_serialnumber;
+ protected $_title;
+ protected $_path_init;
+ protected $_path_kernel;
+ protected $_defaultkcl;
protected $_created;
+ protected $_description;
protected $_expires;
protected $_public;
@@ -48,11 +52,11 @@ class Application_Model_BootOs
}
- public function getBootosID()
+ public function getID()
{
return $this->_bootosID;
}
- public function setBootosID($_bootosID)
+ public function setID($_bootosID)
{
$this->_bootosID = $_bootosID;
return $this;
diff --git a/application/models/BootOsMapper.php b/application/models/BootOsMapper.php
index 0c5d30f..9807911 100644
--- a/application/models/BootOsMapper.php
+++ b/application/models/BootOsMapper.php
@@ -31,14 +31,12 @@ class Application_Model_BootOsMapper
public function save(Application_Model_BootOs $botos)
{
-
- $data = array('bootisoID'=> $botos->getBootisoID() ,'membershipID'=> $botos->getMembershipID() ,'groupID'=> $botos->getGroupID() ,'serialnumber'=> $botos->getSerialnumber() ,'created'=> $botos->getCreated() ,'expires'=> $botos->getExpires() ,'public'=> $botos->getPublic() );
-
+ $data = array('bootosID'=> $botos->getID() ,'configID'=> $botos->getConfigID() ,'groupID'=> $botos->getGroupID() ,'title'=> $botos->getTitle() ,'path_init'=> $botos->getPath_init() ,'path_kernel'=> $botos->getPath_kernel() ,'defaultkcl'=> $botos->getDefaultkcl() ,'created'=> $botos->getCreated() ,'description'=> $botos->getDescription() ,'expires'=> $botos->getExpires() ,'public'=> $botos->getPublic() );
if (null === ($id = $botos->getID()) ) {
- unset($data['botosID']);
+ unset($data['bootosID']);
$this->getDbTable()->insert($data);
} else {
- $this->getDbTable()->update($data, array('botosID = ?' => $id));
+ $this->getDbTable()->update($data, array('bootosID = ?' => $id));
}
}
@@ -47,7 +45,7 @@ class Application_Model_BootOsMapper
if (null === ($id = $botos->getID()) ) {
return;
} else {
- $this->getDbTable()->delete(array('botosID = ?' => $id));
+ $this->getDbTable()->delete(array('bootosID = ?' => $id));
}
}
@@ -60,7 +58,7 @@ class Application_Model_BootOsMapper
$row = $result->current();
- $botos->setBootisoID($row->bootisoID)->setMembershipID($row->membershipID)->setGroupID($row->groupID)->setSerialnumber($row->serialnumber)->setCreated($row->created)->setExpires($row->expires)->setPublic($row->public);
+ $botos->setID($row->bootosID)->setConfigID($row->configID)->setGroupID($row->groupID)->setTitle($row->title)->setPath_init($row->path_init)->setPath_kernel($row->path_kernel)->setDefaultkcl($row->defaultkcl)->setCreated($row->created)->setDescription($row->description)->setExpires($row->expires)->setPublic($row->public);
}
public function fetchAll()
@@ -70,7 +68,7 @@ class Application_Model_BootOsMapper
foreach ($resultSet as $row) {
$entry = new Application_Model_BootOs();
- $entry->setBootisoID($row->bootisoID)->setMembershipID($row->membershipID)->setGroupID($row->groupID)->setSerialnumber($row->serialnumber)->setCreated($row->created)->setExpires($row->expires)->setPublic($row->public);
+ $entry->setID($row->bootosID)->setConfigID($row->configID)->setGroupID($row->groupID)->setTitle($row->title)->setPath_init($row->path_init)->setPath_kernel($row->path_kernel)->setDefaultkcl($row->defaultkcl)->setCreated($row->created)->setDescription($row->description)->setExpires($row->expires)->setPublic($row->public);
$entries[] = $entry;
}
diff --git a/application/views/scripts/bootos/createbootos.phtml b/application/views/scripts/bootos/createbootos.phtml
new file mode 100644
index 0000000..3d35695
--- /dev/null
+++ b/application/views/scripts/bootos/createbootos.phtml
@@ -0,0 +1,4 @@
+<?php
+$this->createbootosForm->setAction($this->url());
+echo $this->createbootosForm;
+?>
diff --git a/application/views/scripts/bootos/deletebootos.phtml b/application/views/scripts/bootos/deletebootos.phtml
new file mode 100644
index 0000000..4893fbc
--- /dev/null
+++ b/application/views/scripts/bootos/deletebootos.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>Bootos</b> and script/action name <b>deletebootos</b></center> \ No newline at end of file
diff --git a/application/views/scripts/bootos/editbootos.phtml b/application/views/scripts/bootos/editbootos.phtml
new file mode 100644
index 0000000..f36d3d0
--- /dev/null
+++ b/application/views/scripts/bootos/editbootos.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>Bootos</b> and script/action name <b>editbootos</b></center> \ No newline at end of file
diff --git a/application/views/scripts/bootos/index.phtml b/application/views/scripts/bootos/index.phtml
new file mode 100644
index 0000000..2fef182
--- /dev/null
+++ b/application/views/scripts/bootos/index.phtml
@@ -0,0 +1,35 @@
+<h1>BootOS</h1>
+<table border=1>
+ <tr>
+ <th>ID</th>
+ <th>Title</th>
+ <th>GroupID</th>
+ <th>ConfigID</th>
+ <th>Init</th>
+ <th>Kernel</th>
+ <th>Kcl</th>
+ <th>Description</th>
+ <th>Created</th>
+ <th>Expires</th>
+ <th>Public</th>
+ </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>
+ </tr>
+ <?php endforeach; ?>
+</table>
+
+
+
+
diff --git a/tests/application/controllers/BootosControllerTest.php b/tests/application/controllers/BootosControllerTest.php
new file mode 100644
index 0000000..c9c8b5c
--- /dev/null
+++ b/tests/application/controllers/BootosControllerTest.php
@@ -0,0 +1,20 @@
+<?php
+
+require_once 'PHPUnit/Framework/TestCase.php';
+
+class BootosControllerTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ /* Setup Routine */
+ }
+
+ public function tearDown()
+ {
+ /* Tear Down Routine */
+ }
+
+
+}
+