Index: Dev/branches/cakephp/app/app_controller.php
===================================================================
--- Dev/branches/cakephp/app/app_controller.php	(revision 126)
+++ Dev/branches/cakephp/app/app_controller.php	(revision 127)
@@ -50,5 +50,4 @@
         $this->Auth->loginError = "This message shows up when the wrong credentials are used";
         $this->Auth->authError = "Please log in first.";
-//        $this->Auth->loginRedirec
         $this->Auth->logoutRedirect = array('controller' => 'pages', 'action' => 'home');
     }
Index: Dev/branches/cakephp/app/controllers/pages_controller.php
===================================================================
--- Dev/branches/cakephp/app/controllers/pages_controller.php	(revision 126)
+++ Dev/branches/cakephp/app/controllers/pages_controller.php	(revision 127)
@@ -84,4 +84,10 @@
             $title_for_layout = Inflector::humanize($path[$count - 1]);
         }
+        
+        if ($page == 'home')
+        {
+            $this->home();
+        }
+        
         $this->set(compact('page', 'subpage', 'title_for_layout'));
         $this->render(implode('/', $path));
@@ -89,5 +95,8 @@
 
     function home() {
-        
+        if($this->Auth->user())
+        {
+            $this->redirect(array('action' => 'display', 'mainmenu'));
+        }
     }
 
Index: Dev/branches/cakephp/app/controllers/users_controller.php
===================================================================
--- Dev/branches/cakephp/app/controllers/users_controller.php	(revision 126)
+++ Dev/branches/cakephp/app/controllers/users_controller.php	(revision 127)
@@ -66,4 +66,5 @@
                 $this->User->create();
                 $this->User->save($this->data);
+                $this->redirect(array('action' => 'login'));
             } else {
                 $this->Session->setFlash('Could not register. Try again.');
Index: Dev/branches/cakephp/app/models/question.php
===================================================================
--- Dev/branches/cakephp/app/models/question.php	(revision 127)
+++ Dev/branches/cakephp/app/models/question.php	(revision 127)
@@ -0,0 +1,30 @@
+<?php
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * Description of question
+ *
+ * @author fpvanagthoven
+ */
+class Question extends AppModel {
+    var $name = 'Question';
+    
+    var $code;
+    var $category;
+    var $title;
+    var $description;
+    var $type;
+    
+    var $hasMany = array(
+        'Answer' => array(
+            'className' => 'Answer',
+            'foreignKey' => 'question_code'
+        )
+    );
+}
+
+?>
Index: Dev/branches/cakephp/app/mysql.sql
===================================================================
--- Dev/branches/cakephp/app/mysql.sql	(revision 126)
+++ Dev/branches/cakephp/app/mysql.sql	(revision 127)
@@ -1,2 +1,4 @@
+DROP TABLE IF EXISTS users;
+
 CREATE TABLE users (
     id integer auto_increment,
Index: Dev/branches/cakephp/app/tmp/logs/debug.log
===================================================================
--- Dev/branches/cakephp/app/tmp/logs/debug.log	(revision 126)
+++ Dev/branches/cakephp/app/tmp/logs/debug.log	(revision 127)
@@ -15,2 +15,4 @@
 2011-10-14 14:24:59 Debug: Notice (8): Undefined offset: 1 in [C:\wamp\www\researchtool\branches\cakephp\cake\libs\view\view.php, line 854]
 2011-10-14 14:24:59 Debug: Notice (8): Undefined offset: 0 in [C:\wamp\www\researchtool\branches\cakephp\cake\libs\view\view.php, line 859]
+2011-10-14 15:26:26 Debug: Notice (8): Undefined variable: applications in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\application_menu.ctp, line 17]
+2011-10-14 15:30:35 Debug: Notice (8): Undefined variable: surveys in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\survey_menu.ctp, line 22]
Index: Dev/branches/cakephp/app/tmp/logs/error.log
===================================================================
--- Dev/branches/cakephp/app/tmp/logs/error.log	(revision 126)
+++ Dev/branches/cakephp/app/tmp/logs/error.log	(revision 127)
@@ -1,2 +1,18 @@
 2011-10-14 14:24:59 Warning: Warning (2): strpos() expects parameter 1 to be string, array given in [C:\wamp\www\researchtool\branches\cakephp\cake\libs\view\view.php, line 851]
 2011-10-14 14:24:59 Warning: Warning (2): strpos() expects parameter 1 to be string, array given in [C:\wamp\www\researchtool\branches\cakephp\cake\libs\view\view.php, line 853]
+2011-10-14 15:26:26 Warning: Warning (2): Missing argument 1 for ApplicationMenu::__construct(), called in C:\wamp\www\researchtool\branches\cakephp\app\views\elements\application_menu.ctp on line 63 and defined in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\application_menu.ctp, line 10]
+2011-10-14 15:30:35 Warning: Warning (2): Missing argument 1 for SurveyMenu::__construct(), called in C:\wamp\www\researchtool\branches\cakephp\app\views\elements\survey_menu.ctp on line 72 and defined in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\survey_menu.ctp, line 14]
+2011-10-14 15:30:35 Warning: Warning (2): Invalid argument supplied for foreach() in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\survey_menu.ctp, line 62]
+2011-10-14 15:30:43 Warning: Warning (2): Invalid argument supplied for foreach() in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\survey_menu.ctp, line 62]
+2011-10-14 15:32:33 Warning: Warning (2): Invalid argument supplied for foreach() in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\survey_menu.ctp, line 62]
+2011-10-14 15:32:52 Warning: Warning (2): Invalid argument supplied for foreach() in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\survey_menu.ctp, line 62]
+2011-10-14 15:39:24 Warning: Warning (2): Invalid argument supplied for foreach() in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\survey_menu.ctp, line 62]
+2011-10-14 15:39:26 Warning: Warning (2): Invalid argument supplied for foreach() in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\survey_menu.ctp, line 62]
+2011-10-14 15:39:26 Warning: Warning (2): Invalid argument supplied for foreach() in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\survey_menu.ctp, line 62]
+2011-10-14 15:39:27 Warning: Warning (2): Invalid argument supplied for foreach() in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\survey_menu.ctp, line 62]
+2011-10-14 15:41:42 Warning: Warning (2): Invalid argument supplied for foreach() in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\survey_menu.ctp, line 62]
+2011-10-14 15:42:35 Warning: Warning (2): Invalid argument supplied for foreach() in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\survey_menu.ctp, line 62]
+2011-10-14 15:42:37 Warning: Warning (2): Invalid argument supplied for foreach() in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\survey_menu.ctp, line 62]
+2011-10-14 15:42:37 Warning: Warning (2): Invalid argument supplied for foreach() in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\survey_menu.ctp, line 62]
+2011-10-14 15:42:38 Warning: Warning (2): Invalid argument supplied for foreach() in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\survey_menu.ctp, line 62]
+2011-10-14 15:47:04 Warning: Warning (2): Invalid argument supplied for foreach() in [C:\wamp\www\researchtool\branches\cakephp\app\views\elements\survey_menu.ctp, line 62]
Index: Dev/branches/cakephp/app/views/elements/application_menu.ctp
===================================================================
--- Dev/branches/cakephp/app/views/elements/application_menu.ctp	(revision 127)
+++ Dev/branches/cakephp/app/views/elements/application_menu.ctp	(revision 127)
@@ -0,0 +1,64 @@
+<?php
+
+/**
+ * Description of ApplicationMenu
+ *
+ * @author fpvanagthoven
+ */
+class ApplicationMenu extends Menu {
+
+    public function __construct($applications = null) {
+        ?><fieldset class="menu"><?php
+        parent::__construct('Application');
+        ?> <div class="menuButtons"> <?php
+        ApplicationMenu::createApplicationButton();
+        ApplicationMenu::loadApplicationButton();
+        ?> </div> <?php
+        ApplicationMenu::loadApplicationList($applications);
+        ?></fieldset><?php
+    }
+
+    public static function createApplicationButton() {
+        ?>
+
+        <form action="applicationcreation.php" method="post">
+
+            <input type="submit" value="New" class="surveyButton bigSurveyButton" />
+
+        </form>
+
+        <?php
+    }
+
+    /**
+     *
+     * @param Survey $surveys An array of surveys
+     */
+    public static function loadApplicationButton() {
+        ?>
+        <form id="loadApplicationForm" action="applicationcreation.php" method="post">
+            <input type="button" onclick="loadApplication()" value="Load / Edit" class="surveyButton bigSurveyButton" />
+        </form>
+
+
+        <?php
+    }
+
+    public static function loadApplicationList($applications) {
+        ?>
+        <select id="applicationsToLoad" class="toLoad" size="1000">
+            <?php
+            if (!empty($applications)) {
+                foreach ($applications as $application) {
+                    ?><option value='<?php echo $application->id; ?>'><?php echo $application->title; ?></option><?php
+            }
+        }
+            ?>
+        </select>
+        <?php
+    }
+
+}
+
+new ApplicationMenu();
+?>
Index: Dev/branches/cakephp/app/views/elements/menu.ctp
===================================================================
--- Dev/branches/cakephp/app/views/elements/menu.ctp	(revision 127)
+++ Dev/branches/cakephp/app/views/elements/menu.ctp	(revision 127)
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Description of Menu
+ *
+ * @author fpvanagthoven
+ */
+class Menu {
+
+    private $title;
+
+    public function __construct($title) {
+        $this->title = $title;
+
+        $this->menuTitle();
+    }
+
+    public function menuTitle() {
+        ?>
+        <legend><h2><?php echo $this->title; ?></h2></legend>
+        <?php
+    }
+
+}
+?>
Index: Dev/branches/cakephp/app/views/elements/question_menu.ctp
===================================================================
--- Dev/branches/cakephp/app/views/elements/question_menu.ctp	(revision 127)
+++ Dev/branches/cakephp/app/views/elements/question_menu.ctp	(revision 127)
@@ -0,0 +1,32 @@
+<?php
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * Description of QuestionMenu
+ *
+ * @author fpvanagthoven
+ */
+class QuestionMenu extends Menu {
+
+    public function __construct() {
+        ?> <fieldset class="menu"> <?php
+        parent::__construct('Questions');
+        QuestionMenu::accessDatabaseButton();
+        ?></fieldset> <?php
+    }
+
+    public static function accessDatabaseButton() {
+        ?>
+        <form id="accessDatabase" action="questioncreation.php" method="post">
+            <input type="submit" value="Access Database" class="surveyButton bigSurveyButton" />
+        </form>
+        <?php
+    }
+
+}
+
+new QuestionMenu();
+?>
Index: Dev/branches/cakephp/app/views/elements/session_menu.ctp
===================================================================
--- Dev/branches/cakephp/app/views/elements/session_menu.ctp	(revision 127)
+++ Dev/branches/cakephp/app/views/elements/session_menu.ctp	(revision 127)
@@ -0,0 +1,68 @@
+<?php
+/**
+ * Description of SessionMenu
+ *
+ * @author fpvanagthoven
+ */
+class SessionMenu extends Menu {
+
+    public function __construct() {
+        ?> <fieldset class="menu"> <?php
+        parent::__construct('Session');
+        ?> <div class="menuButtons"> <?php
+        SessionMenu::createSessionButton();
+        SessionMenu::loadSessionButton();
+        SessionMenu::startSessionButton();
+        ?> </div> <?php
+        SessionMenu::loadSessionList(null);
+        ?></fieldset><?php
+    }
+
+    public static function createSessionButton() {
+        ?>
+
+        <form action="sessioncreation.php" method="post">
+
+            <input type="submit" value="New" class="surveyButton bigSurveyButton" />
+
+        </form>
+
+        <?php
+    }
+
+    public static function loadSessionButton() {
+        ?>
+        <form id="loadSessionForm" action="sessioncreation.php" method="post">
+            <input type="button" onclick="loadSession()" value="Load / Edit" class="surveyButton bigSurveyButton" />
+        </form>
+        <?php
+    }
+
+    public static function startSessionButton() {
+        ?>
+        <form action="session.php" method="post">
+            <input type="button" onclick="startSession()" value="Start" class="surveyButton bigSurveyButton" />
+        </form>
+        <?php
+    }
+
+    public static function loadSessionList($sessions) {
+        ?>
+        <select class="toLoad" size="1000">
+            <?php
+            if (!empty($sessions)) {
+                foreach ($sessions as $session) {
+                    ?><option value='<?php echo $session->id; ?>'><?php echo $session->title; ?></option><?php
+            }
+        }
+            ?>
+        </select>
+        <?php
+    }
+
+}
+
+
+
+new SessionMenu();
+?>
Index: Dev/branches/cakephp/app/views/elements/survey_menu.ctp
===================================================================
--- Dev/branches/cakephp/app/views/elements/survey_menu.ctp	(revision 127)
+++ Dev/branches/cakephp/app/views/elements/survey_menu.ctp	(revision 127)
@@ -0,0 +1,73 @@
+<?php
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * Description of SurveyMenu
+ *
+ * @author fpvanagthoven
+ */
+class SurveyMenu extends Menu {
+
+    public function __construct($surveys = null) {
+        ?> <fieldset class="menu"> <?php
+        parent::__construct('Survey');
+        ?> <div class="menuButtons"> <?php
+        SurveyMenu::newSurveyButton();
+        SurveyMenu::loadSurveyButton();
+//        SurveyMenu::deleteSurveyButton();
+        ?> </div> <?php
+        SurveyMenu::loadSurveyList($surveys);
+        ?> </fieldset> <?php
+    }
+
+    public static function newSurveyButton() {
+        ?>
+
+        <form action="surveycreation.php" method="post">
+
+            <input type="submit" value="New" class="surveyButton bigSurveyButton" />
+
+        </form>
+
+        <?php
+    }
+
+    public static function loadSurveyButton() {
+        ?>
+        <form id="loadForm" action="surveycreation.php" method="post">
+            <input type="button" onclick="loadSurvey()" value="Load / Edit" class="surveyButton bigSurveyButton" />
+        </form>
+        <?php
+    }
+
+    public static function deleteSurveyButton() {
+        ?>
+        <form action="" method="post">
+            <input type="button" onclick="delSurvey()" value="Delete survey" class="surveyButton bigSurveyButton" />
+        </form>
+        <?php
+    }
+
+    /**
+     *
+     * @param Survey $surveys An array of surveys
+     */
+    public static function loadSurveyList($surveys) {
+        ?>
+        <select id="surveysToLoad" class="toLoad" size="1000">
+            <?php
+            foreach ($surveys as $survey) {
+                ?><option value='<?php echo $survey->id; ?>'><?php echo $survey->title; ?></option><?php
+        }
+            ?>
+        </select>
+        <?php
+    }
+
+}
+
+new SurveyMenu();
+?>
Index: Dev/branches/cakephp/app/views/pages/mainmenu.ctp
===================================================================
--- Dev/branches/cakephp/app/views/pages/mainmenu.ctp	(revision 126)
+++ Dev/branches/cakephp/app/views/pages/mainmenu.ctp	(revision 127)
@@ -1,1 +1,10 @@
-<div class="menu">mainmenuuu</div>
+<?php
+echo $this->Session->flash('auth');
+echo $this->Session->flash();
+
+echo $this->element('menu');
+echo $this->element('session_menu');
+echo $this->element('application_menu');
+echo $this->element('survey_menu');
+echo $this->element('question_menu');
+?>
