diff options
Diffstat (limited to 'application')
14 files changed, 370 insertions, 21 deletions
diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php index df2f91c..9a65853 100644 --- a/application/controllers/IndexController.php +++ b/application/controllers/IndexController.php @@ -6,6 +6,17 @@ class IndexController extends Zend_Controller_Action public function init() { /* Initialize action controller here */ + if(stristr($_SERVER['HTTP_USER_AGENT'],'prebootGUI')){ + $redirector = $this->_helper->getHelper('Redirector'); + $redirector->gotoSimple('index', + 'Index', + 'fbgui', + array('keys' => array_keys($_POST), + 'post' => $_POST + ) + ); + + } } public function indexAction() diff --git a/application/modules/dev/controllers/FilterController.php b/application/modules/dev/controllers/FilterController.php index b346810..53900b3 100644 --- a/application/modules/dev/controllers/FilterController.php +++ b/application/modules/dev/controllers/FilterController.php @@ -10,12 +10,11 @@ class dev_FilterController extends Zend_Controller_Action public function init() { try{ - - $this->_filtermapper = new Application_Model_FilterMapper(); - }catch (Zend_Exception $e) { - echo "Error message 1: " . $e->getMessage() . "\n"; - } - $this->db = Zend_Db_Table::getDefaultAdapter(); + $this->_filtermapper = new Application_Model_FilterMapper(); + }catch (Zend_Exception $e) { + echo "Error message 1: " . $e->getMessage() . "\n"; + } + $this->db = Zend_Db_Table::getDefaultAdapter(); } public function indexAction() diff --git a/application/modules/fbgui/controllers/IndexController.php b/application/modules/fbgui/controllers/IndexController.php index 685feaa..238edb7 100644 --- a/application/modules/fbgui/controllers/IndexController.php +++ b/application/modules/fbgui/controllers/IndexController.php @@ -9,17 +9,44 @@ class Fbgui_IndexController extends Zend_Controller_Action } public function indexAction() - { - // action body - - // Call this Procedure after Login to create a session and save the alphasessionID to session - $n = new Pbs_Session(); - $session = new Application_Model_Session(); - $session->setBootisoID(1); - $session->setTime(time()); - $session->setIp($_SERVER['REMOTE_ADDR']); - $session = $n->createsession($session); - $_SESSION['alphasessionID'] = $session->getAlphasessionID(); + { + if(isset($this->_request->getParam('post')) && $this->_request->getParam('keys')){ + $data = $this->_request->getParam('post'); + $keys = $this->_request->getParam('keys'); + $_POST = array_combine ( $keys , $data ); + } + if(isset($_POST['bootisoID'])){ + // Create a session + $n = new Pbs_Session(); + + $bootisomapper = new Application_Model_BootIsoMapper(); + $bootiso = new Application_Model_BootIso(); + $bootisomapper->find($_POST['bootisoID'],$bootiso); + $groupID = $bootiso->getGroupID(); + + $client = new Application_Model_Client(); + $client->setMacadress($_POST['mac']); + $client->setHardwarehash($_POST['hardwarehash']); + $client->setGroupID($groupID); + $client = $n->createClient($client); + $clientID = $client->getID(); + + $session = new Application_Model_Session(); + $session->setBootisoID($_POST['bootisoID']); + $session->setClientID($clientID); + $session->setTime(time()); + $session->setIp($_SERVER['REMOTE_ADDR']); + $session = $n->createSession($session); + $_SESSION['alphasessionID'] = $session->getAlphasessionID(); + echo "<h1>Welcome</h1>"; + print_a('Session is now set','Your alphasessionID is '.$session->getAlphasessionID()); + $this->_redirect('/dev/bootmenu/index/bootmenuid/1'); + } + else{ + echo "<h1>Not Welcome</h1>"; + print_a($_POST); + } + die(); } diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php index d40e1b1..4bb2b35 100644 --- a/application/modules/user/controllers/ClientController.php +++ b/application/modules/user/controllers/ClientController.php @@ -5,6 +5,10 @@ class User_ClientController extends Zend_Controller_Action private $membership; public function init() { + if($_SESSION['membershipID'] ==''){ + $pbsNotifier = new Pbs_Notifier(); + echo $pbsNotifier->notify('No membershipID set','forbidden'); + } /* Initialize action controller here */ $membershipMapper = new Application_Model_MembershipMapper(); $this->membership = new Application_Model_Membership(); diff --git a/application/modules/user/controllers/FilterController.php b/application/modules/user/controllers/FilterController.php index 2704309..8ceefe3 100644 --- a/application/modules/user/controllers/FilterController.php +++ b/application/modules/user/controllers/FilterController.php @@ -2,13 +2,100 @@ class User_FilterController extends Zend_Controller_Action { - + protected $filterMapper; + protected $membershipMapper; public function init() { - /* Initialize action controller here */ + if($_SESSION['membershipID'] ==''){ + $pbsNotifier = new Pbs_Notifier(); + echo $pbsNotifier->notify('No membershipID set','forbidden'); + } + $this->filterMapper = new Application_Model_FilterMapper(); + + $membershipMapper = new Application_Model_MembershipMapper(); + $this->membership = new Application_Model_Membership(); + $membershipMapper->find($_SESSION['membershipID'],$this->membership); + + $this->db = Zend_Db_Table::getDefaultAdapter(); } public function indexAction() + { + // TODO: ACL: is he authorized to see this? + + $result = $this->_request->getParam('addresult'); + if($result != ""){ + $pbsNotifier = new Pbs_Notifier(); + $this->view->notification = $pbsNotifier->notify('create',$result); + } + + $filters = $this->filterMapper->findBy('groupID',$this->membership->getGroupID()); + foreach($filters as $filter){ + $ff = new Application_Model_Filter(); + $ff->setOptions($filter); + $ff->setID($filter['filterID']); + $allFilter[] = $ff; + } + $this->view->filters = $allFilter; + } + + public function addfilterAction() + { + // TODO: ACL: is he authorized to add a filter? + $bmmapper = new Application_Model_BootMenuMapper(); + $result = $bmmapper->findBy('groupID',$this->membership->getGroupID()); + foreach($result as $rr){ + $bm = new Application_Model_BootMenu(); + $bm->setOptions($rr); + $bm->setID($rr['bootmenuID']); + $bootmenus[] = $bm; + } + $this->view->bootmenus = $bootmenus; + + if (!isset($_POST["add"])){ + $addfilterform = new user_Form_Filter(array('buttontext' => 'Create Filter','bootmenus'=>$bootmenus)); + $this->view->addfilterform = $addfilterform; + }else { + $addfilterform = new user_Form_Filter(array('buttontext' => 'Create Filter','bootmenus'=>$bootmenus),$_POST); + if ($addfilterform->isValid($_POST)) { + try{ + $newfilter = new Application_Model_Filter($_POST); + $newfilter->setCreated(time()); + $newfilter->setGroupID($this->membership->getGroupID()); + $newfilter->setMembershipID($this->membership->getID()); + $newfilter2 = new Application_Model_FilterMapper(); + $newfilter2->save($newfilter); + $this->_redirect('/user/filter/index/addresult/ok'); + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + $this->_redirect('/user/filter/index/addresult/error'); + } + } + $this->view->addfilterform = $addfilterform; + } + } + + public function removefilterAction() + { + // action body + } + + public function editfilterAction() + { + // action body + } + + public function addfilterentryAction() + { + // action body + } + + public function editfilterentryAction() + { + // action body + } + + public function removefilterentryAction() { // action body } @@ -16,3 +103,15 @@ class User_FilterController extends Zend_Controller_Action } + + + + + + + + + + + + diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php index 7ff4da1..f786aa8 100644 --- a/application/modules/user/controllers/PoolController.php +++ b/application/modules/user/controllers/PoolController.php @@ -5,6 +5,11 @@ class User_PoolController extends Zend_Controller_Action private $membership; public function init() { + if($_SESSION['membershipID'] ==''){ + $pbsNotifier = new Pbs_Notifier(); + echo $pbsNotifier->notify('No membershipID set','forbidden'); + } + $membershipMapper = new Application_Model_MembershipMapper(); $this->membership = new Application_Model_Membership(); $membershipMapper->find($_SESSION['membershipID'],$this->membership); @@ -41,7 +46,14 @@ class User_PoolController extends Zend_Controller_Action } $poolMapper = new Application_Model_PoolMapper(); - $this->view->pools = $poolMapper->fetchAll(); + $pools = $poolMapper->findBy('groupID',$this->membership->getGroupID()); + foreach($pools as $pool){ + $ff = new Application_Model_Pool(); + $ff->setOptions($pool); + $ff->setID($pool['poolID']); + $yourpools[] = $ff; + } + $this->view->pools = $yourpools; $clientmapper = new Application_Model_ClientMapper(); $clients = $clientmapper->fetchAll(); diff --git a/application/modules/user/forms/Filter.php b/application/modules/user/forms/Filter.php new file mode 100644 index 0000000..69aaf4b --- /dev/null +++ b/application/modules/user/forms/Filter.php @@ -0,0 +1,68 @@ +<?php + +class user_Form_Filter extends Zend_Form +{ + + private $bootmenus; + + public function init() + { + $this->setName("Add Filter"); + $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('textarea', 'description', array( + 'filters' => array('StringTrim'), + 'required' => false, + 'label' => 'Description:', + )); + + $bootmenufield = $this->createElement('select','bootmenuID'); + $bootmenufield ->setLabel('Bootmenu:'); + + if(count($this->bootmenus)>0){ + foreach($this->bootmenus as $id => $g){ + $bootmenufield->addMultiOption($g->getID(), $g->getTitle()); + } + } + $bootmenufield->setRegisterInArrayValidator(false); + $this->addElement($bootmenufield); + + $this->addElement('text', 'priority', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Priority:', + )); + $this->addElement('submit', 'add', array( + 'required' => false, + 'ignore' => true, + 'label' => $this->buttontext, + )); + + $this->addElement('button', 'Cancel', array( + 'onclick' => 'self.location="/user/filter"' + )); + } + function setBootmenus($val){ + $this->bootmenus = $val; + return; + } + private $buttontext = 'Save'; + function setButtontext($v){ + $this->buttontext = $v; + } + + + +} + diff --git a/application/modules/user/views/scripts/filter/addfilter.phtml b/application/modules/user/views/scripts/filter/addfilter.phtml new file mode 100644 index 0000000..3c7eb9f --- /dev/null +++ b/application/modules/user/views/scripts/filter/addfilter.phtml @@ -0,0 +1,2 @@ +<?php +echo $this->addfilterform; diff --git a/application/modules/user/views/scripts/filter/addfilterentry.phtml b/application/modules/user/views/scripts/filter/addfilterentry.phtml new file mode 100644 index 0000000..f7240c8 --- /dev/null +++ b/application/modules/user/views/scripts/filter/addfilterentry.phtml @@ -0,0 +1 @@ +<br /><br /><center>View script for controller <b>Filter</b> and script/action name <b>addfilterentry</b></center>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/filter/editfilter.phtml b/application/modules/user/views/scripts/filter/editfilter.phtml new file mode 100644 index 0000000..452a096 --- /dev/null +++ b/application/modules/user/views/scripts/filter/editfilter.phtml @@ -0,0 +1 @@ +<br /><br /><center>View script for controller <b>Filter</b> and script/action name <b>editfilter</b></center>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/filter/editfilterentry.phtml b/application/modules/user/views/scripts/filter/editfilterentry.phtml new file mode 100644 index 0000000..60a1f6f --- /dev/null +++ b/application/modules/user/views/scripts/filter/editfilterentry.phtml @@ -0,0 +1 @@ +<br /><br /><center>View script for controller <b>Filter</b> and script/action name <b>editfilterentry</b></center>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/filter/index.phtml b/application/modules/user/views/scripts/filter/index.phtml index bace90f..94d77d7 100644 --- a/application/modules/user/views/scripts/filter/index.phtml +++ b/application/modules/user/views/scripts/filter/index.phtml @@ -1 +1,123 @@ -<br /><br /><center>View script for controller <b>Filter</b> and script/action name <b>index</b></center>
\ No newline at end of file +<h1>Filters</h1> +<?php if($this->notification != ''){echo $this->notification;} ?> +<?php echo $this->formButton('createconfig', 'Create Filter', array( + 'onclick' => 'self.location="/user/filter/addfilter"', + 'class' => 'addbutton'))?> + +<?php if ($this->filters): ?> + <table> + <tr> + <th>ID</th> + <th>Title</th> + <th>Description</th> + <th>Priority</th> + <th>TargetBootMenu</th> + <th colspan=3>Actions</th> + </tr> + <?php foreach ($this->filters as $filter): ?> + <tr class='entry'> + <td><?php echo $this->escape($filter->getID()) ?></td> + <td><?php echo $this->escape($filter->title) ?></td> + <td><?php echo $this->escape($filter->Description) ?></td> + <td><?php echo $this->escape($filter->priority) ?></td> + <td><?php echo $this->escape($filter->bootmenuID) ?></td> + <td class='action'><a href="<?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'filter', + 'action' => 'editfilter', + 'filterID' => $filter->getID() + ), + 'default', + true) ?>"><img src='/media/img/edit.png' alt='Edit Filter'/></a></td> + <td class='action'><a href="<?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'filter', + 'action' => 'removefilter', + 'filterID' => $filter->getID() + ), + 'default', + true) ?>"><img src='/media/img/delete.png' alt='Delete Filter'/></a></td> + <td class='action'><a href="<?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'filter', + 'action' => 'addfilterentry', + 'filterID' => $filter->getID() + ), + 'default', + true) ?>"><img src='/media/img/add.png' alt='Add Filterentry'/></a></td> + </tr> + <?php + $fe = new Application_Model_FilterEntriesMapper(); + # print_a($erg = $fe->findBy('filterID',$filter->getID())); + $erg = $fe->findBy('filterID',$filter->getID()); + ?> + <?php if (count($erg)>0): ?> + <tr class=detail> + <td class=arrowtop>↳</td> + <td colspan=7> + <?php + + ?> + <table> + <tr> + <th>Filtertype</th> + <th>Value</th> + <th>Value2</th> + <th colspan=2>Actions</th> + </tr> + <?php foreach ($erg as $filterentry): ?> + + <tr> + <td><?php + + $filter2 = new Application_Model_FilterTypeMapper(); + $erg = new Application_Model_FilterType(); + $filter2->find($filterentry['filtertypeID'],$erg); + //name zur ID finden + echo "[".$filterentry['filtertypeID']."] "; + echo $erg->getFiltertypename(); + + + ?></td> + <td><?php echo $filterentry['filtervalue'];?></td> + <td><?php echo $filterentry['filtervalue2'];?></td> + <td class='action'><a href="<?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'filter', + 'action' => 'editfilterentry', + 'filterentriesID' => $filterentry['filterentriesID'] + ), + 'default', + true) ?>"><img src='/media/img/edit.png' alt='Edit Filterentry'/></a> + <td class='action'><a href="<?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'filter', + 'action' => 'removefilterentry', + 'filterentriesID' => $filterentry['filterentriesID'] + ), + 'default', + true) ?>"><img src='/media/img/delete.png' alt='Delete Filterentry'/></a> + </tr> + + <?php endforeach ?> + </table> + </td> + </tr> + <?php endif;?> + <?php endforeach ?> + </table> + + +<?php else: ?> + + <p>There are no filters to display.</p> + +<?php endif;?> +<?php echo $this->formButton('createconfig', 'Test Filters', array( + 'onclick' => 'self.location="/user/filter/testevaluate"', + 'class' => 'addbutton'))?> diff --git a/application/modules/user/views/scripts/filter/removefilter.phtml b/application/modules/user/views/scripts/filter/removefilter.phtml new file mode 100644 index 0000000..a46f9ec --- /dev/null +++ b/application/modules/user/views/scripts/filter/removefilter.phtml @@ -0,0 +1 @@ +<br /><br /><center>View script for controller <b>Filter</b> and script/action name <b>removefilter</b></center>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/filter/removefilterentry.phtml b/application/modules/user/views/scripts/filter/removefilterentry.phtml new file mode 100644 index 0000000..dc7189d --- /dev/null +++ b/application/modules/user/views/scripts/filter/removefilterentry.phtml @@ -0,0 +1 @@ +<br /><br /><center>View script for controller <b>Filter</b> and script/action name <b>removefilterentry</b></center>
\ No newline at end of file |