summaryrefslogblamecommitdiffstats
path: root/application/modules/fbgui/controllers/IndexController.php
blob: 5a99febcdea690d5760df6dea9cba0db2e5c755a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                                                          






























                                                                                                              









                                                                                                





                                            




     
<?php

class Fbgui_IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {    
    	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());
			
			// Request Bootmenu
			$pbsFilter = new Pbs_Filter();
			$bootmenuID = $pbsFilter->evaluate();
			if($bootmenuID != null){			
				$this->_redirect('/dev/bootmenu/index/bootmenuid/'.$bootmenuID);
			}
			else{
				$this->_redirect('/dev/auth/index/');
			}
		}
		else{
    		echo "<h1>Not Welcome</h1>";
    		print_a($_POST);
    	}
    	die();
    }


}