summaryrefslogtreecommitdiffstats
path: root/application/controllers/PersonController.php
blob: 65a4cca622dbbf174ea1401c9bb7d80862150b18 (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
<?php

class PersonController extends Zend_Controller_Action
{                          

    public function preDispatch()
    {
        
		if (!Zend_Auth::getInstance()->hasIdentity()) {			
			// TODO: quick hack fixxen
			$this->_redirect('/Auth/login');
		}
    }

    public function indexAction()
    {
        echo 'case2';
        // action body
    }

    public function registerAction()
    {
    	$db = Zend_Db_Table::getDefaultAdapter();

 		if (!isset($_POST["register"])){
	        $registerForm = new Application_Form_PersonRegister();
		} else {
		    $registerForm = new Application_Form_PersonRegister($_POST);
	 	
		    if ($registerForm->isValid($_POST)) {
		        $person = new Application_Model_Person($_POST);
		        var
		        if ($person != null) {
		            echo "Erfolgreich registriert";
		            var_dump($person);
		            var	          
					//$this->_redirect('/auth/login');
		            return;
		        } else {
					echo "Die angegebene Email-Adresse existiert bereits";
				} 
		    }
		}

        $this->view->registerForm = $registerForm;	
        
    }


}