summaryrefslogtreecommitdiffstats
path: root/application/modules/fbgui
diff options
context:
space:
mode:
authorSimon2011-04-19 15:43:00 +0200
committerSimon2011-04-19 15:43:00 +0200
commitc31d8e9959efade437fb0a661f6f44329cc74664 (patch)
tree48afaad36266c251f3df4928ed18d6e09478413c /application/modules/fbgui
parentAufgeräumt und verschoben (diff)
downloadpbs2-c31d8e9959efade437fb0a661f6f44329cc74664.tar.gz
pbs2-c31d8e9959efade437fb0a661f6f44329cc74664.tar.xz
pbs2-c31d8e9959efade437fb0a661f6f44329cc74664.zip
Code autoformatiert
Diffstat (limited to 'application/modules/fbgui')
-rw-r--r--application/modules/fbgui/controllers/IndexController.php167
1 files changed, 83 insertions, 84 deletions
diff --git a/application/modules/fbgui/controllers/IndexController.php b/application/modules/fbgui/controllers/IndexController.php
index 398bdf1..26f12fb 100644
--- a/application/modules/fbgui/controllers/IndexController.php
+++ b/application/modules/fbgui/controllers/IndexController.php
@@ -13,67 +13,68 @@
class Fbgui_IndexController extends Zend_Controller_Action
{
protected $membership;
-
- public function init()
- {
- /* Initialize action controller here */
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
-
- $membershipMapper = new Application_Model_MembershipMapper();
+
+ public function init()
+ {
+ /* Initialize action controller here */
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+
+ $membershipMapper = new Application_Model_MembershipMapper();
$this->membership = new Application_Model_Membership();
$membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
- }
+ }
- public function errorAction()
- {
- $result = $this->_request->getParam('serialresult');
+ public function errorAction()
+ {
+ $result = $this->_request->getParam('serialresult');
if($result != ""){
$pbsNotifier = new Pbs_Notifier();
$this->view->notification = $pbsNotifier->notify('serial',$result);
- }
- }
-
- public function indexAction()
- {
+ }
+ }
+
+ public function indexAction()
+ {
$mySession = new Zend_Session_Namespace('pbs');
-
- if(count($mySession->postdata)<=0)
+
+ if(count($mySession->postdata)<=0){
$mySession->postdata = $_POST;
-
+ }
+
$d = new Pbs_Debug();
$d->debug(array('FBGuiIndexController',$_SERVER['REMOTE_ADDR'],implode("\t",$mySession->postdata)));
- if(isset($mySession->postdata['bootisoID']) || isset($mySession->postdata['serialnumber'])){
- // Create a session
- $n = new Pbs_Session();
-
- $bootisomapper = new Application_Model_BootIsoMapper();
- $bootiso = new Application_Model_BootIso();
- if(isset($mySession->postdata['bootisoID'])){
- $bootisomapper->find($mySession->postdata['bootisoID'],$bootiso);
- $groupID = $bootiso->getGroupID();
- }
- elseif(isset($mySession->postdata['serialnumber'])){
- $results = $bootisomapper->findBy(array('serialnumber' => $mySession->postdata['serialnumber']),true);
+ if(isset($mySession->postdata['bootisoID']) || isset($mySession->postdata['serialnumber'])){
+ // Create a session
+ $n = new Pbs_Session();
+
+ $bootisomapper = new Application_Model_BootIsoMapper();
+ $bootiso = new Application_Model_BootIso();
+ if(isset($mySession->postdata['bootisoID'])){
+ $bootisomapper->find($mySession->postdata['bootisoID'],$bootiso);
+ $groupID = $bootiso->getGroupID();
+ }
+ elseif(isset($mySession->postdata['serialnumber'])){
+ $results = $bootisomapper->findBy(array('serialnumber' => $mySession->postdata['serialnumber']),true);
if(count($results) == 0){
$this->_redirect('/fbgui/index/error/serialresult/noserial2');
}
- $bootiso->setOptions($results[0]);
- $bootiso->setID($results[0]['bootisoID']);
- $groupID = $bootiso->getGroupID();
-
- }
-
- $client = new Application_Model_Client();
- $client->setMacadress($mySession->postdata['mac']);
- $client->setHardwarehash($mySession->postdata['hardwarehash']);
+ $bootiso->setOptions($results[0]);
+ $bootiso->setID($results[0]['bootisoID']);
+ $groupID = $bootiso->getGroupID();
+
+ }
+
+ $client = new Application_Model_Client();
+ $client->setMacadress($mySession->postdata['mac']);
+ $client->setHardwarehash($mySession->postdata['hardwarehash']);
$client->setGroupID($groupID);
$client = $n->createClient($client);
$clientID = $client->getID();
-
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
-
- if(!isset($_SESSION['alphasessionID'])){
+
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+
+ if(!isset($_SESSION['alphasessionID'])){
$session = new Application_Model_Session();
$session->setBootisoID($bootiso->getID());
$session->setClientID($clientID);
@@ -81,11 +82,11 @@ class Fbgui_IndexController extends Zend_Controller_Action
if($this->membership->getID() != ''){
$session->setMembershipID($this->membership->getID());
}
- $session->setIp($_SERVER['REMOTE_ADDR']);
+ $session->setIp($_SERVER['REMOTE_ADDR']);
$session = $n->createSession($session);
- $_SESSION['alphasessionID'] = $session->getAlphasessionID();
+ $_SESSION['alphasessionID'] = $session->getAlphasessionID();
}
- else{
+ else{
$session = new Application_Model_Session();
$sessionMapper = new Application_Model_SessionMapper();
$sessions = $sessionMapper->findBy(array('alphasessionID'=>$_SESSION['alphasessionID']));
@@ -100,74 +101,72 @@ class Fbgui_IndexController extends Zend_Controller_Action
$bootmenuID = $pbsFilter->evaluate();
if($bootmenuID != null){
$this->view->alphasessionID = $_SESSION['alphasessionID'];
-// print_a('Debug Output',
-// 'Session is now set',
-// 'Your sessionID is '.$session->getID(),
-// 'Your alphasessionID is '.$session->getAlphasessionID(),
-// 'Your client is '.$session->getClientID(),
-// 'goto bootmenu '.$bootmenuID);
-
+ // print_a('Debug Output',
+ // 'Session is now set',
+ // 'Your sessionID is '.$session->getID(),
+ // 'Your alphasessionID is '.$session->getAlphasessionID(),
+ // 'Your client is '.$session->getClientID(),
+ // 'goto bootmenu '.$bootmenuID);
+
$bootmenuMapper = new Application_Model_BootMenuMapper();
$bm = $bootmenuMapper->find($bootmenuID);
$this->view->title = $bm->getTitle();
-
+
$bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
$res = $bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID),false);
$this->view->entries = $res;
- #print_a(Zend_Auth::getInstance()->hasIdentity(),$bm->MembershipID ,$this->membership->getID());
- if (!Zend_Auth::getInstance()->hasIdentity()) {
- # $pbsNotifier = new Pbs_Notifier();
- # $this->view->notification = $pbsNotifier->notify("This is not your Bootmenu. You have to login to get your own Bootmenu.<br />Click here to <a href='/fbgui/auth/login/'>login</a>",'info');
+
+ if (!Zend_Auth::getInstance()->hasIdentity()) {
$this->view->loginmenu = true;
}
- if(Zend_Auth::getInstance()->hasIdentity()){
+
+ if(Zend_Auth::getInstance()->hasIdentity()){
if($bm->MembershipID != '' && $bm->MembershipID == $this->membership->getID()){}
else{
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify("This is not your Bootmenu. There is currently a BootMenu with a higher priority active.",'info');
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify("This is not your Bootmenu. There is currently a BootMenu with a higher priority active.",'info');
}
}
}
else{
-
-// print_a('Debug Output',
-// 'Session is now set',
-// 'Your sessionID is '.$session->getID(),
-// 'Your alphasessionID is '.$session->getAlphasessionID(),
-// 'Your client is '.$session->getClientID(),
-// 'there is no bootmenu for you');
-
+ // print_a('Debug Output',
+ // 'Session is now set',
+ // 'Your sessionID is '.$session->getID(),
+ // 'Your alphasessionID is '.$session->getAlphasessionID(),
+ // 'Your client is '.$session->getClientID(),
+ // 'there is no bootmenu for you');
+
$pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify("There is no BootMenu to show. Please log in to get your BootMenu.<br />Click here to <a href='/fbgui/auth/login/'>login</a>",'error');
-
+ $this->view->notification = $pbsNotifier->notify("There is no BootMenu to show. Please log in to get your BootMenu.<br />Click here to <a href='/fbgui/auth/login/'>login</a>",'error');
+
}
}
else{
- #$this->_redirect('/fbgui/index/error/serialresult/noserial');
- }
-
- }
+ #$this->_redirect('/fbgui/index/error/serialresult/noserial');
+ }
+
+ }
public function startAction(){
$bootmenuntryID = $this->_request->getParam('bme');
$a = $_SESSION['alphasessionID'];
$bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
$bootmenuentry = new Application_Model_BootMenuEntries();
$bootmenuentriesMapper->find($bootmenuntryID,$bootmenuentry);
-
+
$sessionMapper = new Application_Model_SessionMapper();
- $session_k = $sessionMapper->findBy(array('alphasessionID' => $a),true);
-
- $session = new Application_Model_Session();
+ $session_k = $sessionMapper->findBy(array('alphasessionID' => $a),true);
+
+ $session = new Application_Model_Session();
$session->setOptions($session_k[0]);
$session->setID($session_k[0]['sessionID']);
- #print_a($bootmenuentry);
+
$session->setBootmenuentryID($bootmenuntryID);
$session->setBootosID($bootmenuentry->getBootosID());
$sessionMapper->save($session);
-
-
+
+
$this->view->host = '132.230.4.27';
- $this->view->alphasessionID = $a;
+ $this->view->alphasessionID = $a;
}
}