summaryrefslogtreecommitdiffstats
path: root/application/modules/fbgui/controllers/IndexController.php
blob: fe457b6cc2e47bd8b410deb4c23284752c717585 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php

class Fbgui_IndexController extends Zend_Controller_Action
{

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

    public function indexAction()
    {    
    	if(isset($_SESSION['postdata'])){ 
    		$_POST = ($_SESSION['postdata']);
			unset($_SESSION['postdata']);
    	}
    	$keys = $this->_request->getParam('keys');
    	$post = $this->_request->getParam('post');
    	if($post != '' && $keys != ''){    		
    		$keys = $keys;
    		$post = $post;
	    	$_POST =  array_combine ( $keys ,  $post );
	    	print_a($keys, $data,$_POST);
    	}    	
        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 sessionID is '.$session->getID(),
					'Your alphasessionID is '.$session->getAlphasessionID(),
					'Your client is '.$session->getClientID());
			
			// Request Bootmenu
			$pbsFilter = new Pbs_Filter();
			$bootmenuID = $pbsFilter->evaluate();
			if($bootmenuID != null){
				print_a('goto bootmenu '.$bootmenuID);
				$bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
				$res = $bootmenuentriesMapper->findBy('bootmenuID',$bootmenuID);
				$this->view->entries = $res;
			}
			else{
				print_a('no filter is valid, goto login');
				#$this->_redirect('/dev/auth/index/');
			}
		}
		else{
    		echo "<h1>Not Welcome</h1>";
    		print_a($_POST);
    	}
    	
    }


}