summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon2011-03-30 16:14:22 +0200
committerSimon2011-03-30 16:14:22 +0200
commit6c6094d82c3d8a682c8c9a0c6cb157fadcd2eba7 (patch)
treef30e090eb73097ab76d0d755910b5211dd7b9a3e
parentMerge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff)
downloadpbs2-6c6094d82c3d8a682c8c9a0c6cb157fadcd2eba7.tar.gz
pbs2-6c6094d82c3d8a682c8c9a0c6cb157fadcd2eba7.tar.xz
pbs2-6c6094d82c3d8a682c8c9a0c6cb157fadcd2eba7.zip
Filter können auf höher gelegene BootMenus verweisen
-rw-r--r--application/modules/user/controllers/FilterController.php34
-rw-r--r--application/modules/user/forms/Filter.php13
-rw-r--r--pbs-newdata.sql17
-rw-r--r--pbs.sql2
4 files changed, 43 insertions, 23 deletions
diff --git a/application/modules/user/controllers/FilterController.php b/application/modules/user/controllers/FilterController.php
index 9c53bcd..c8cd2e5 100644
--- a/application/modules/user/controllers/FilterController.php
+++ b/application/modules/user/controllers/FilterController.php
@@ -53,6 +53,7 @@ class User_FilterController extends Zend_Controller_Action
$ff->setID($filter['filterID']);
$allFilter[] = $ff;
}
+
$this->view->filters = $allFilter;
}
@@ -62,14 +63,29 @@ class User_FilterController extends Zend_Controller_Action
if(!Pbs_Acl::checkRight('fa'))
$this->_redirect('/user');
- $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;
+ $rr = new Application_Model_GroupGroupsMapper();
+ $groupMapper = new Application_Model_GroupMapper();
+ $parentGroups = $rr->getParentGroups($this->membership->getGroupID());
+ $bootmenus = array();
+ foreach($parentGroups as $parentGroup){
+ foreach($parentGroup as $p){
+ $bmmapper = new Application_Model_BootMenuMapper();
+ $result = $bmmapper->findBy('groupID',$p);
+ foreach($result as $rr){
+ $bm = new Application_Model_BootMenu();
+ $bm->setOptions($rr);
+ $bm->setID($rr['bootmenuID']);
+ if($bm->getMembershipID() == null){
+ $group = new Application_Model_Group();
+ $groupMapper->find($bm->getGroupID(),$group);
+
+ $name = $group->getTitle();
+ $bootmenus[$name][$bm->getID()] = $bm->getTitle();
+ }
+ }
+ }
}
+
$this->view->bootmenus = $bootmenus;
if (!isset($_POST["add"])){
@@ -82,7 +98,7 @@ class User_FilterController extends Zend_Controller_Action
$newfilter = new Application_Model_Filter($_POST);
$newfilter->setCreated(time());
$newfilter->setGroupID($this->membership->getGroupID());
- $newfilter->setMembershipID($this->membership->getID());
+ $newfilter->setMembershipID(null);
$newfilter2 = new Application_Model_FilterMapper();
$id = $newfilter2->save($newfilter);
@@ -173,7 +189,7 @@ class User_FilterController extends Zend_Controller_Action
$newfilterentry = new Application_Model_Filter($_POST);
$newfilterentry->setID($this->_request->getParam('filterID'));
$newfilterentry->setGroupID($this->membership->getGroupID());
- $newfilterentry->setMembershipID($this->membership->getID());
+ $newfilterentry->setMembershipID(null);
// ACL: if he is only allowed to edit filterpriority
if(Pbs_Acl::checkRight('fefp')){
diff --git a/application/modules/user/forms/Filter.php b/application/modules/user/forms/Filter.php
index 21d5765..4526a61 100644
--- a/application/modules/user/forms/Filter.php
+++ b/application/modules/user/forms/Filter.php
@@ -27,11 +27,14 @@ class user_Form_Filter extends Zend_Form
$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());
- }
- }
+ /*if(count($this->bootmenus)>0){
+ foreach($this->bootmenus as $bm){
+ foreach($bm as $id => $g){
+ $bootmenufield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ }*/
+ $bootmenufield->setMultioptions($this->bootmenus);
$bootmenufield->setRegisterInArrayValidator(false);
$this->addElement($bootmenufield);
diff --git a/pbs-newdata.sql b/pbs-newdata.sql
index 13061c9..c32ee1f 100644
--- a/pbs-newdata.sql
+++ b/pbs-newdata.sql
@@ -68,6 +68,7 @@ INSERT INTO `pbs_client` (`clientID`, `groupID`,`macadress`, `hardwarehash`) VAL
(11, 2, 'af:54:07:87:63:44', '98413218152196816519841365419816'),
(12, 2, '87:21:74:52:96:20', '98741298132516132169813516981616'),
(13, 2, '14:47:58:47:36:48', '32168132068132068513216053516513');
+(14, 1, '64:46:85:A1:89:23', '9684216842068420616841asd6516984');
-- Adding config
INSERT INTO `pbs_config` (`configID`, `title`, `groupID`, `membershipID`, `shellscript`, `created`) VALUES
@@ -111,11 +112,11 @@ INSERT INTO `pbs_pool` (`poolID`, `groupID`, `title`, `description`, `location`)
-- Adding Bootmenus
INSERT INTO `pbs_bootmenu` (`bootmenuID`, `membershipID`, `groupID`, `title`, `created`) VALUES
-(1, 1, 1, 'Bootmenu 1', '1299694422'),
-(2, 1, 1, 'Bootmenu 2', '1299694433'),
-(3, 1, 1, 'Bootmenu 3', '1299694441'),
-(4, 1, 1, 'Bootmenu 4', '1299694454'),
-(5, 1, 1, 'Bootmenu 5', '1299694461');
+(1, NULL, 1, 'Bootmenu 1', '1299694422'),
+(2, NULL, 1, 'Bootmenu 2', '1299694433'),
+(3, NULL, 1, 'Bootmenu 3', '1299694441'),
+(4, NULL, 1, 'Bootmenu 4', '1299694454'),
+(5, NULL, 1, 'Bootmenu 5', '1299694461');
-- Adding BootOs to BootMenus
INSERT INTO `pbs_bootmenuentries` (`bootmenuentriesID`, `bootosID`, `bootmenuID`, `title`, `kcl`, `kclappend`, `configID`, `order`) VALUES
@@ -151,9 +152,9 @@ INSERT INTO `pbs_session` (`sessionID`, `alphasessionID`,`clientID`, `bootmenuen
-- Adding Filter
INSERT INTO `pbs_filter` (`filterID`, `membershipID`, `groupID`, `bootmenuID`, `title`, `description`, `created`, `priority`) VALUES
-(1, 1, 1, 1, 'Filter 1', 'Innerhalb der Uni', '', 1),
-(2, 1, 1, 2, 'Filter 2', 'Ausserhalb der Uni', '', 1),
-(3, 1, 1, 3, 'Filter 3', 'Montags-Freitag \r\nvon 8 bis 16 Uhr \r\nInnerhalb der Uni', '', 10);
+(1, NULL, 1, 1, 'Filter 1', 'Innerhalb der Uni', '', 1),
+(2, NULL, 1, 2, 'Filter 2', 'Ausserhalb der Uni', '', 1),
+(3, NULL, 1, 3, 'Filter 3', 'Montags-Freitag \r\nvon 8 bis 16 Uhr \r\nInnerhalb der Uni', '', 10);
-- Adding Filterentries
INSERT INTO `pbs_filterentries` (`filterentriesID`, `filterID`, `filtertypeID`, `filtervalue`, `filtervalue2`) VALUES
diff --git a/pbs.sql b/pbs.sql
index 832badc..bd4985d 100644
--- a/pbs.sql
+++ b/pbs.sql
@@ -531,7 +531,7 @@ INSERT INTO `pbs`.`pbs_right` (`rightID`, `rightcategoryID`, `shortcut`, `title`
-- Filter
-- Filter Übersicht ansehen
-(NULL, '11', 'fo', 'Show overview of Pool', NULL),
+(NULL, '11', 'fo', 'Show overview of Filter', NULL),
-- Filter anlegen
(NULL, '11', 'fa', 'Create new Filter', NULL),
-- Filter bearbeiten