diff options
author | michael pereira | 2011-03-22 12:33:04 +0100 |
---|---|---|
committer | michael pereira | 2011-03-22 12:33:04 +0100 |
commit | 24635afb8e43dde32ae6894d75f737327364d5d5 (patch) | |
tree | ff44af5399a36a40ab29ba11508838897aca3d44 | |
parent | Bootiso & Preboot update (diff) | |
parent | FBGui nutzt nun Session bzw Cookies (diff) | |
download | pbs2-24635afb8e43dde32ae6894d75f737327364d5d5.tar.gz pbs2-24635afb8e43dde32ae6894d75f737327364d5d5.tar.xz pbs2-24635afb8e43dde32ae6894d75f737327364d5d5.zip |
fbgui index merge
-rw-r--r-- | application/controllers/IndexController.php | 2 | ||||
-rw-r--r-- | application/models/GroupGroupsMapper.php | 32 | ||||
-rw-r--r-- | application/modules/fbgui/controllers/IndexController.php | 31 | ||||
-rw-r--r-- | application/modules/fbgui/layouts/fbgui.phtml | 22 | ||||
-rw-r--r-- | application/modules/user/controllers/FilterController.php | 23 | ||||
-rw-r--r-- | application/modules/user/controllers/IndexController.php | 4 |
6 files changed, 48 insertions, 66 deletions
diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php index 83fbe08..d26f8d4 100644 --- a/application/controllers/IndexController.php +++ b/application/controllers/IndexController.php @@ -12,7 +12,7 @@ class IndexController extends Zend_Controller_Action { if(stristr($_SERVER['HTTP_USER_AGENT'],'prebootGUI')){ $_SESSION['postdata'] = $_POST; - $this->_redirect('/fbgui/index/index/data/'.json_encode($_POST)) ; + $this->_redirect('/fbgui/index/index'); } diff --git a/application/models/GroupGroupsMapper.php b/application/models/GroupGroupsMapper.php index 181d12d..0ea5e5f 100644 --- a/application/models/GroupGroupsMapper.php +++ b/application/models/GroupGroupsMapper.php @@ -87,6 +87,38 @@ class Application_Model_GroupGroupsMapper } return $entries; } + // Gets All groupIDs of the parent groups begins with the + public function getParentGroups($groupID, &$data=null, $level=1) { + $db = Zend_Db_Table::getDefaultAdapter(); + $query = 'SELECT parentID FROM pbs_groupgroups WHERE groupID="'.$groupID.'"'; + $stmt = $db->query($query); + $result = $stmt->fetchAll(); + foreach($result as $row){ + // save the current groupID in level-list + $data[$level][] = $row['parentID']; + + // get the function recursive an increase the level + $data = $this->getParentGroups($row['parentID'], $data, $level+1); + } + return $data; + } + + // Gets all childs-groups from a given group + public function getChildGroups($groupID, &$data=null, $level=1) { + $db = Zend_Db_Table::getDefaultAdapter(); + $query = 'SELECT groupID FROM pbs_groupgroups WHERE parentID="'.$groupID.'"'; + $stmt = $db->query($query); + $result = $stmt->fetchAll(); + foreach($result as $row){ + // save the current groupID in level-list + $data[$level][] = $row['groupID']; + + // get the function recursive an increase the level + $data = $this->getChildGroups($row['groupID'], $data, $level+1); + } + return $data; + } + diff --git a/application/modules/fbgui/controllers/IndexController.php b/application/modules/fbgui/controllers/IndexController.php index 09332bf..adbe4cb 100644 --- a/application/modules/fbgui/controllers/IndexController.php +++ b/application/modules/fbgui/controllers/IndexController.php @@ -10,29 +10,14 @@ class Fbgui_IndexController extends Zend_Controller_Action public function indexAction() { - - $params = $this->_request->getParam('data'); - $keys = $this->_request->getParam('keys'); - $post = $this->_request->getParam('post'); + $params = $this->_request->getParam('postdata'); + if(isset($_SESSION['postdata'])){ $_POST = ($_SESSION['postdata']); unset($_SESSION['postdata']); - } - elseif($params != ''){ - print_a(json_decode($this->_request->getParam('data'))); - $data = array(); - $data = json_decode($this->_request->getParam('data')); - $_POST['bootisoID'] = $data->bootisoID; - $_POST['mac'] = $data->mac; - $_POST['hardwarehash'] = $data->hardwarehash; - } - elseif($post != '' && $keys != ''){ - $keys = $keys; - $post = $post; - $_POST = array_combine ( $keys , $post ); - print_a($keys, $data,$_POST); - } - if(isset($_POST['bootisoID'])){ + } + + if(isset($_POST['bootisoID']) || isset($_POST['serialnumber'])){ // Create a session $n = new Pbs_Session(); @@ -108,9 +93,9 @@ class Fbgui_IndexController extends Zend_Controller_Action $sessionMapper->save($session); echo "<h1>Downloading</h1>"; echo "<script>\n"; - echo "fbgui.startDownload('http://132.230.2.27/dev/resource/getkernel/".$_SESSION['alphasessionID']."/file/kernel');\n"; - echo "fbgui.startDownload('http://132.230.2.27/dev/resource/getkernel/".$_SESSION['alphasessionID']."/file/initramfs');\n"; - echo "fbgui.startDownload('http://132.230.2.27/dev/resource/getkernel/".$_SESSION['alphasessionID']."/file/kcl');\n"; + echo "fbgui.startDownload('http://132.230.4.27/dev/resource/getkernel/alpha/".$_SESSION['alphasessionID']."/file/kernel');\n"; + echo "fbgui.startDownload('http://132.230.4.27/dev/resource/getinitramfs/alpha/".$_SESSION['alphasessionID']."/file/initramfs');\n"; + echo "fbgui.startDownload('http://132.230.4.27/dev/resource/getkcl/alpha/".$_SESSION['alphasessionID']."/file/kcl');\n"; echo "fbgui.getSession('".$_SESSION['alphasessionID']."');\n"; echo "</script>"; diff --git a/application/modules/fbgui/layouts/fbgui.phtml b/application/modules/fbgui/layouts/fbgui.phtml index e3b286a..335e3c5 100644 --- a/application/modules/fbgui/layouts/fbgui.phtml +++ b/application/modules/fbgui/layouts/fbgui.phtml @@ -27,27 +27,7 @@ echo $this->headScript()."\n"; <ul> <li>Controller: <ul> - <li><a href='/dev/person'>Person</a></li> - <li><a href='/dev/group'>Group</a></li> - <li><a href='/dev/role'>Role</a></li> - <li><a href='/dev/bootiso'>BootIso</a></li> - <li><a href='/dev/bootmenu'>BootMenu</a></li> - <li><a href='/dev/config'>Config</a></li> - <li><a href='/dev/bootos'>BootOs</a></li> - <li><a href='/dev/client'>Client</a></li> - <li><a href='/dev/filter'>Filter</a></li> - <li><a href='/dev/pool'>Pool</a></li> - <li><a href='/dev/session'>Session</a></li> - <?php if (!Zend_Auth::getInstance()->hasIdentity()) {?> - <li><a href='/dev/auth/login'>Login</a></li> - <li><a href='/dev/auth/register'>Register</a></li> - <?php - } else {?> - <li><a href='/dev/auth/delete'>Account Löschen</a></li> - <li><a href='/dev/auth/logout'>Logout</a></li> - <?php - } - ?> + </ul> </li> diff --git a/application/modules/user/controllers/FilterController.php b/application/modules/user/controllers/FilterController.php index 307c40d..d604aba 100644 --- a/application/modules/user/controllers/FilterController.php +++ b/application/modules/user/controllers/FilterController.php @@ -173,27 +173,8 @@ class User_FilterController extends Zend_Controller_Action $this->_redirect('/user/filter/index/modifyresult/error'); } } - } - - // $parent is the parent of the children we want to see - // $level is increased when we go deeper into the tree - private function display_children($parent, $level, &$data) { - // retrieve all children of $parent - $result = mysql_query('SELECT groupID FROM pbs_groupgroups '. - 'WHERE parentID="'.$parent.'";'); - - // display each child - while ($row = mysql_fetch_array($result)) { - // indent and display the title of this child - $data[$level][] = str_repeat(' ',$level).$row['title']; - - // call this function again to display this - // child's children - $data = display_children($row['title'], $level+1,$data); - } - return $data; - } - + } + private function prepareFormData(){ $poolMapper = new Application_Model_PoolMapper(); $pools = $poolMapper->findBY('groupID',$this->membership->getGroupID()); diff --git a/application/modules/user/controllers/IndexController.php b/application/modules/user/controllers/IndexController.php index 8b295e0..74e1da7 100644 --- a/application/modules/user/controllers/IndexController.php +++ b/application/modules/user/controllers/IndexController.php @@ -22,6 +22,10 @@ class User_IndexController extends Zend_Controller_Action ); } $this->view->links = $links; + + $ggMapper = new Application_Model_GroupGroupsMapper(); + print_a('Your Parent Groups', $ggMapper->getParentGroups($_SESSION['membershipID'])); + print_a('Your Child Groups',$ggMapper->getChildGroups($_SESSION['membershipID'])); } } |