diff options
| author | michael pereira | 2011-03-08 14:53:36 +0100 |
|---|---|---|
| committer | michael pereira | 2011-03-08 14:53:36 +0100 |
| commit | b457bd7b0e70b3f76fd1d30b7d31ff2d609b4de8 (patch) | |
| tree | b861c99b5942e74d77ca2a7b58865ee93dcb3010 /application | |
| parent | BootMenu fix (diff) | |
| download | pbs2-b457bd7b0e70b3f76fd1d30b7d31ff2d609b4de8.tar.gz pbs2-b457bd7b0e70b3f76fd1d30b7d31ff2d609b4de8.tar.xz pbs2-b457bd7b0e70b3f76fd1d30b7d31ff2d609b4de8.zip | |
BootMenuEntries select
Diffstat (limited to 'application')
| -rw-r--r-- | application/configs/application.ini | 27 | ||||
| -rw-r--r-- | application/controllers/BootmenuController.php | 40 | ||||
| -rw-r--r-- | application/forms/BootmenuEntriesAdd.php | 25 | ||||
| -rw-r--r-- | application/forms/BootmenuEntriesEdit.php | 24 | ||||
| -rw-r--r-- | application/views/scripts/bootiso/index.phtml | 9 | ||||
| -rw-r--r-- | application/views/scripts/bootmenu/index.phtml | 22 | ||||
| -rw-r--r-- | application/views/scripts/bootos/index.phtml | 9 | ||||
| -rw-r--r-- | application/views/scripts/config/index.phtml | 9 |
8 files changed, 95 insertions, 70 deletions
diff --git a/application/configs/application.ini b/application/configs/application.ini deleted file mode 100644 index c02bd7c..0000000 --- a/application/configs/application.ini +++ /dev/null @@ -1,27 +0,0 @@ -[production] -phpSettings.display_startup_errors = 0 -phpSettings.display_errors = 0 -includePaths.library = APPLICATION_PATH "/../library" -bootstrap.path = APPLICATION_PATH "/Bootstrap.php" -bootstrap.class = "Bootstrap" -appnamespace = "Application" -resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" -resources.frontController.params.displayExceptions = 0 -resources.db.adapter = PDO_MYSQL -resources.db.params.host = localhost -resources.db.params.username = root -resources.db.params.password = lsfks -resources.db.params.dbname = pbs -resources.db.isDefaultTableAdapter = true -resources.view[] = "" - -[staging : production] - -[testing : production] -phpSettings.display_startup_errors = 1 -phpSettings.display_errors = 1 - -[development : production] -phpSettings.display_startup_errors = 1 -phpSettings.display_errors = 1 -resources.frontController.params.displayExceptions = 1 diff --git a/application/controllers/BootmenuController.php b/application/controllers/BootmenuController.php index 2a0ec8a..1b4bbfb 100644 --- a/application/controllers/BootmenuController.php +++ b/application/controllers/BootmenuController.php @@ -2,7 +2,7 @@ class BootmenuController extends Zend_Controller_Action { - + public function init() { $db = Zend_Db_Table::getDefaultAdapter(); @@ -12,24 +12,31 @@ class BootmenuController extends Zend_Controller_Action { $bootmenumapper = new Application_Model_BootMenuMapper(); $bootmenuentriesmapper = new Application_Model_BootMenuEntriesMapper(); - $bootmenuentries = array(); + $this->view->bootmenulist = $bootmenumapper->fetchAll(); + + $bootmenuentries = array(); foreach ($this->view->bootmenulist as $bootmenu){ $bootmenuentries[$bootmenu->getID()] = $bootmenuentriesmapper->findBy('bootmenuID',$bootmenu->getID()); } $this->view->bootmenuentrylist = $bootmenuentries; - } public function addbootmenuentryAction() { $bootmenuID = $this->_request->getParam('bootmenuID'); + $bootosmapper = new Application_Model_BootOsMapper(); +// $bootmenuentriesmapper = new Application_Model_BootMenuEntriesMapper(); +// +// $bootoslist = $this->arrayDiff($bootosmapper->fetchAll(), $bootmenuentriesmapper->findBy('bootmenuID',$bootmenuID)); + if (!isset($_POST["addbootmenuentry"])){ - $addbootmenuentryForm = new Application_Form_BootmenuEntriesAdd(); + $addbootmenuentryForm = new Application_Form_BootmenuEntriesAdd(array('bootoslist'=>$bootosmapper->fetchAll())); + } else { $addbootmenuentryForm = new Application_Form_BootmenuEntriesAdd($_POST); - + if ($addbootmenuentryForm->isValid($_POST)) { $bootmenuentry = new Application_Model_BootMenuEntries($_POST); @@ -130,18 +137,20 @@ class BootmenuController extends Zend_Controller_Action { $bootmenuentryID = $this->_request->getParam('bootmenuentryID'); $bootmenuID = $this->_request->getParam('bootmenuID'); + $bootosmapper = new Application_Model_BootOsMapper(); if (!isset($_POST["editbootmenuentry"])){ $bootmenuentryID = $this->_request->getParam('bootmenuentryID'); if (!isset($bootmenuentryID) || !is_numeric($bootmenuentryID)){ $this->_redirect('/bootmenu'); } else { - $bootmenuentry = new Application_Model_BootMenuEntries(); - $bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper(); - $bootmenuentrymapper->find($bootmenuentryID, $bootmenuentry); + $bootmenuentry = new Application_Model_BootMenuEntries(); + $bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper(); + $bootmenuentrymapper->find($bootmenuentryID, $bootmenuentry); + + $editbootmenuentryForm = new Application_Form_BootmenuEntriesEdit(array('bootoslist'=>$bootosmapper->fetchAll())); - $editbootmenuentryForm = new Application_Form_BootmenuEntriesEdit(); - $editbootmenuentryForm->populate($bootmenuentry->toArray()); + $editbootmenuentryForm->populate($bootmenuentry->toArray()); } }else{ $editbootmenuentryForm = new Application_Form_BootmenuEntriesEdit($_POST); @@ -200,6 +209,17 @@ class BootmenuController extends Zend_Controller_Action $this->_redirect('/bootmenu'); } + private function arrayDiff($a, $b){ + foreach($a as $k1 => $i1){ + foreach($b as $k2 => $i2){ + if($i1->getID() == $i2->getBootosID()){ + unset($a[$k1]); + } + } + } + return $a; + } + } diff --git a/application/forms/BootmenuEntriesAdd.php b/application/forms/BootmenuEntriesAdd.php index 0577ede..c18b54c 100644 --- a/application/forms/BootmenuEntriesAdd.php +++ b/application/forms/BootmenuEntriesAdd.php @@ -2,13 +2,14 @@ class Application_Form_BootmenuEntriesAdd extends Zend_Form { + private $bootoslist; public function init() { $this->setName("BootMenuEntryAdd"); $this->setMethod('post'); - $this->addElement('text', 'title', array( + $this->addElement('text', 'title', array( 'filters' => array('StringTrim'), 'validators' => array( array('StringLength', false, array(0, 50)), @@ -17,15 +18,14 @@ class Application_Form_BootmenuEntriesAdd extends Zend_Form 'label' => 'Title:', )); - $this->addElement('text', 'bootosID', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'BootOsID:', - 'value' => '1', - )); + $bootosfield = $this->createElement('select','bootosID'); + $bootosfield ->setLabel('BootOs:'); + + foreach($this->bootoslist as $bootos){ + $bootosfield->addMultiOption($bootos->getID(), $bootos->getTitle()); + } + $bootosfield->setRegisterInArrayValidator(false); + $this->addElement($bootosfield); $this->addElement('text', 'kcl', array( 'filters' => array('StringTrim'), @@ -66,6 +66,11 @@ class Application_Form_BootmenuEntriesAdd extends Zend_Form )); } + + public function setBootoslist($bootoslist){ + $this->bootoslist = $bootoslist; + + } diff --git a/application/forms/BootmenuEntriesEdit.php b/application/forms/BootmenuEntriesEdit.php index e69dc8b..added01 100644 --- a/application/forms/BootmenuEntriesEdit.php +++ b/application/forms/BootmenuEntriesEdit.php @@ -2,7 +2,14 @@ class Application_Form_BootmenuEntriesEdit extends Zend_Form { + + private $bootoslist; + public function setBootoslist($bootoslist){ + $this->bootoslist = $bootoslist; + + } + public function init() { $this->setName("BootMenuEntryAdd"); @@ -17,15 +24,14 @@ class Application_Form_BootmenuEntriesEdit extends Zend_Form 'label' => 'Title:', )); - $this->addElement('text', 'bootosID', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'BootOsID:', - 'value' => '1', - )); + $bootosfield = $this->createElement('select','bootosID'); + $bootosfield ->setLabel('BootOs:'); + + foreach($this->bootoslist as $bootos){ + $bootosfield->addMultiOption($bootos->getID(), $bootos->getTitle()); + } + $bootosfield->setRegisterInArrayValidator(false); + $this->addElement($bootosfield); $this->addElement('text', 'kcl', array( 'filters' => array('StringTrim'), diff --git a/application/views/scripts/bootiso/index.phtml b/application/views/scripts/bootiso/index.phtml index d1b939a..171d85f 100644 --- a/application/views/scripts/bootiso/index.phtml +++ b/application/views/scripts/bootiso/index.phtml @@ -1,4 +1,11 @@ <h1>BootISO</h1> + +<style> +table{font-family:verdana;font-size:12px;} +td{border:1px solid #CCC;} +tr.entry{background-color:#E0ECF8;} +</style> + <table border=1> <tr> <th>ID</th> @@ -12,7 +19,7 @@ <th>Public</th> </tr> <?php foreach ($this->bootisolist as $bootiso): ?> - <tr> + <tr class=entry> <td><?php echo $this->escape($bootiso->getID()); ?></td> <td><?php echo $this->escape($bootiso->getTitle()); ?></td> <td><?php echo $this->escape($bootiso->getGroupID()); ?></td> diff --git a/application/views/scripts/bootmenu/index.phtml b/application/views/scripts/bootmenu/index.phtml index e40ac90..a5c4fec 100644 --- a/application/views/scripts/bootmenu/index.phtml +++ b/application/views/scripts/bootmenu/index.phtml @@ -10,7 +10,7 @@ tr.bootentry{background-color:#E0ECF8;} <table border=1> <tr> - <th>ID</th> +<!--<th>ID</th>--> <th>Title</th> <th>GroupID</th> <th>MembershipID</th> @@ -18,12 +18,12 @@ tr.bootentry{background-color:#E0ECF8;} </tr> <?php foreach ($this->bootmenulist as $bootmenu): ?> <tr class=bootmenu> - <td><?php echo $this->escape($bootmenu->getID()); ?></td> + <!--<td><?php echo $this->escape($bootmenu->getID()); ?></td>--> <td><?php echo $this->escape($bootmenu->getTitle()); ?></td> <td><?php echo $this->escape($bootmenu->getGroupID()); ?></td> <td><?php echo $this->escape($bootmenu->getMembershipID()); ?></td> <td><?php echo $this->escape(date('Y-m-d H:i:s', $bootmenu->getCreated())); ?></td> - <td class=nostyle><a href="<?php echo $this->url( + <td><a href="<?php echo $this->url( array( 'controller' => 'bootmenu', 'action' => 'editbootmenu', @@ -31,7 +31,7 @@ tr.bootentry{background-color:#E0ECF8;} ), 'default', true, false) ?>">Edit Bootmenu</a></td> - <td class=nostyle><a href="<?php echo $this->url( + <td><a href="<?php echo $this->url( array( 'controller' => 'bootmenu', 'action' => 'deletebootmenu', @@ -39,7 +39,7 @@ tr.bootentry{background-color:#E0ECF8;} ), 'default', true) ?>">Delete Bootmenu</a></td> - <td class=nostyle><a href="<?php echo $this->url( + <td><a href="<?php echo $this->url( array( 'controller' => 'bootmenu', 'action' => 'addbootmenuentry', @@ -50,9 +50,9 @@ tr.bootentry{background-color:#E0ECF8;} </tr> <tr> <th></th> - <th>ID</th> +<!--<th>ID</th>--> <th>Title</th> - <th>BootmenuID</th> +<!--<th>BootmenuID</th>--> <th>BootOSID</th> <th>kcl</th> <th>ConfigID</th> @@ -60,14 +60,14 @@ tr.bootentry{background-color:#E0ECF8;} </tr> <?php foreach ($this->bootmenuentrylist[$bootmenu->getID()] as $bootmenuentry): ?> <tr class=bootentry><td class=nostyle></td> - <td><?php echo $this->escape($bootmenuentry->getID()); ?></td> + <!--<td><?php echo $this->escape($bootmenuentry->getID()); ?></td>--> <td><?php echo $this->escape($bootmenuentry->getTitle()); ?></td> - <td><?php echo $this->escape($bootmenuentry->getBootmenuID()); ?></td> + <!--<td><?php echo $this->escape($bootmenuentry->getBootmenuID()); ?></td>--> <td><?php echo $this->escape($bootmenuentry->getBootosID()); ?></td> <td><?php echo $this->escape($bootmenuentry->getkcl()); ?></td> <td><?php echo $this->escape($bootmenuentry->getConfigID()); ?></td> <td><?php echo $this->escape($bootmenuentry->getOrder()); ?></td> - <td class=nostyle><a href="<?php echo $this->url( + <td><a href="<?php echo $this->url( array( 'controller' => 'bootmenu', 'action' => 'editbootmenuentry', @@ -76,7 +76,7 @@ tr.bootentry{background-color:#E0ECF8;} ), 'default', true, false) ?>">Edit Entry</a></td> - <td class=nostyle><a href="<?php echo $this->url( + <td><a href="<?php echo $this->url( array( 'controller' => 'bootmenu', 'action' => 'removebootmenuentry', diff --git a/application/views/scripts/bootos/index.phtml b/application/views/scripts/bootos/index.phtml index f7f6e0f..86bcdff 100644 --- a/application/views/scripts/bootos/index.phtml +++ b/application/views/scripts/bootos/index.phtml @@ -1,4 +1,11 @@ <h1>BootOS</h1> + +<style> +table{font-family:verdana;font-size:12px;} +td{border:1px solid #CCC;} +tr.entry{background-color:#E0ECF8;} +</style> + <table border=1> <tr> <th>ID</th> @@ -15,7 +22,7 @@ <th>Public</th> </tr> <?php foreach ($this->bootoslist as $bootos): ?> - <tr> + <tr class=entry> <td><?php echo $this->escape($bootos->getID()); ?></td> <td><?php echo $this->escape($bootos->getTitle()); ?></td> <td><?php echo $this->escape($bootos->getGroupID()); ?></td> diff --git a/application/views/scripts/config/index.phtml b/application/views/scripts/config/index.phtml index 5348387..e273b27 100644 --- a/application/views/scripts/config/index.phtml +++ b/application/views/scripts/config/index.phtml @@ -1,4 +1,11 @@ <h1>Config</h1> + +<style> +table{font-family:verdana;font-size:12px;} +td{border:1px solid #CCC;} +tr.entry{background-color:#E0ECF8;} +</style> + <table border=1> <tr> <th>ID</th> @@ -9,7 +16,7 @@ <th>Changed</th> </tr> <?php foreach ($this->configlist as $config): ?> - <tr> + <tr class=entry> <td><?php echo $this->escape($config->getID()); ?></td> <td><?php echo $this->escape($config->getTitle()); ?></td> <td><?php echo $this->escape($config->getGroupID()); ?></td> |
