Changeset 58


Ignore:
Timestamp:
07/27/11 15:01:07 (14 years ago)
Author:
fpvanagthoven
Message:

mainmenu.php tweaked for usability. When not logged in, the user gets redirected to index.php

Location:
Dev/trunk
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/applicationcreation.php

    r56 r58  
    11<?php
    22require 'classes/master.php';
     3
     4if (is_null($_SESSION['username']))
     5    redirect('index.php');
    36?>
    47<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  • Dev/trunk/classes/ApplicationMenu.php

    r57 r58  
    99
    1010    public function __construct() {
     11        ?> <div id="menu2" class="menu"> <?php
     12        ?> <div class="menuButtons"> <?php
    1113        ApplicationMenu::createApplicationButton();
     14        ApplicationMenu::loadApplicationButton();
     15        ?> </div> <?php
     16        ApplicationMenu::loadApplicationList(null);
     17        ?> </div> <?php
    1218    }
    1319
    1420    public static function createApplicationButton() {
    1521        ?>
     22
    1623        <form action="applicationcreation.php" method="post">
    1724
     
    2330    }
    2431
     32    /**
     33     *
     34     * @param Survey $surveys An array of surveys
     35     */
     36    public static function loadApplicationButton() {
     37        ?>
     38        <form id="loadApplicationForm" action="applicationcreation.php" method="post">
     39            <input type="button" onclick="loadApplication()" value="Load/Edit application" class="surveyButton bigSurveyButton" />
     40        </form>
     41
     42
     43        <?php
     44    }
     45
     46    public static function loadApplicationList($applications) {
     47        ?>
     48        <select id="applicationsToLoad" class="toLoad" size="1000">
     49            <?php
     50            foreach ($applications as $application) {
     51                ?><option value='<?php echo $application->id; ?>'><?php echo $application->name; ?></option><?php
     52        }
     53            ?>
     54        </select>
     55        <?php
     56
     57    }
     58
    2559}
    2660?>
  • Dev/trunk/classes/SessionMenu.php

    r57 r58  
    99
    1010    public function __construct() {
     11        ?> <div id="menu1" class="menu"> <?php
     12        ?> <div class="menuButtons"> <?php
    1113        SessionMenu::createSessionButton();
     14        SessionMenu::loadSessionButton();
     15        ?> </div> <?php
     16        SessionMenu::loadSessionList(null);
     17        ?> </div> <?php
    1218    }
    1319
     
    2430    }
    2531
     32    public static function loadSessionButton() {
     33        ?>
     34        <form id="loadSessionForm" action="sessioncreation.php" method="post">
     35            <input type="button" onclick="loadSession()" value="Load/Edit session" class="surveyButton bigSurveyButton" />
     36        </form>
     37        <?php
     38    }
     39
     40    public static function loadSessionList($sessions) {
     41        ?>
     42        <select class="toLoad" size="1000">
     43            <?php
     44            foreach ($sessions as $session) {
     45                ?><option value='<?php echo $session->id; ?>'><?php echo $session->title; ?></option><?php
     46        }
     47            ?>
     48        </select>
     49        <?php
     50    }
     51
    2652}
    2753?>
  • Dev/trunk/classes/SurveyMenu.php

    r57 r58  
    1313
    1414    public function __construct($surveys) {
     15        ?> <div id="menu3" class="menu"> <?php
     16        ?> <div class="menuButtons"> <?php
    1517        SurveyMenu::newSurveyButton();
    16         SurveyMenu::loadSurveyButton($surveys);
     18        SurveyMenu::loadSurveyButton();
     19        ?> </div> <?php
     20        SurveyMenu::loadSurveyList($surveys);
     21        ?> </div> <?php
    1722    }
    1823
     
    3338     * @param Survey $surveys An array of surveys
    3439     */
    35     public static function loadSurveyButton($surveys) {
     40    public static function loadSurveyButton() {
    3641        ?>
    3742        <form id="loadForm" action="surveycreation.php" method="post">
    38             <input type="button" onclick="loadSurvey()" value="Load survey" class="surveyButton bigSurveyButton" />
     43            <input type="button" onclick="loadSurvey()" value="Load/Edit survey" class="surveyButton bigSurveyButton" />
    3944        </form>
    40         <br/>
    41         <select id="surveysToLoad" size="1000">
     45        <?php
     46    }
     47
     48    public static function loadSurveyList($surveys) {
     49        ?>
     50        <select id="surveysToLoad" class="toLoad" size="1000">
    4251            <?php
    4352            foreach ($surveys as $survey) {
     
    4756        </select>
    4857        <?php
     58
    4959    }
    5060
  • Dev/trunk/classes/master.php

    r51 r58  
    1010// Determine our absolute document root
    1111define('DOC_ROOT', realpath(dirname(__FILE__) . '/../'));
     12
     13/* Session */
     14session_name("cpsft");   // Set a session name
     15session_start();  // Start the session
     16
     17
    1218
    1319function __autoload($class_name) {
  • Dev/trunk/css/style.css

    r53 r58  
    9797}
    9898
    99 #menu {
    100     width: 20em;
    101     margin: auto;
    102     padding: 3em;
    103     text-align: center;
    104     background-color: #E3E3E3;
    105     -moz-border-radius: 15px;
    106     border-radius: 15px;
    107 }
     99
    108100
    109101/* ##################################################################
     
    251243   ===================== STYLESHEET OF GLORY ======================== */
    252244
    253 #surveysToLoad {
    254     width: 20em;
     245.menu {
     246    width: 30em;
     247    margin: 1em auto 0 auto;
     248    padding: 2em;
     249    text-align: center;
     250    background-color: #E3E3E3;
     251    -moz-border-radius: 15px;
     252    border-radius: 15px;
     253}
     254
     255.menuButtons {
     256    float: left;
     257}
     258
     259.toLoad {
     260    width: 23em;
    255261    height: 10em;
    256262}
  • Dev/trunk/index.php

    r48 r58  
    3333
    3434            <div id="content">
    35                 <div id="menu">
     35                <div class="menu">
    3636                    <form action="mainmenu.php" method="POST">
    3737                        <h3>Username</h3>
  • Dev/trunk/mainmenu.php

    r57 r58  
    1010        if ($user_exists) {
    1111            $correct_password = $userDBI->checkUserPassword($_POST);
     12            /* session remembers login */
    1213            if (!$correct_password)
    1314                die("The password you entered is not correct!");
     15            else
     16                $_SESSION['username'] = $_POST['username'];
    1417        }
    1518        else
     
    1720    }
    1821}
    19 
     22else if (is_null($_SESSION['username']))
     23    redirect('index.php');
    2024
    2125$surveys = array();
     
    4751
    4852            <div id="content">
    49                 <div id="menu">               
    50                     <?php
    51                     new SessionMenu();
    52                     new ApplicationMenu();
    53                     new SurveyMenu($surveys);
    54                     ?>
    55                 </div>
     53                               
     54                    <?php new SessionMenu(); ?>
     55
     56                    <?php new ApplicationMenu(); ?>
     57               
     58                    <?php new SurveyMenu($surveys); ?>
     59
    5660            </div>
    5761        </div>
  • Dev/trunk/register.php

    r48 r58  
    1616        <div id="wrapper">
    1717            <div id="content">
    18                 <div id="menu">
     18                <div class="menu">
    1919                    <form action="index.php" method="POST"><br/>
    2020                        <h3>Username</h3>
  • Dev/trunk/sessioncreation.php

    r56 r58  
    11<?php
    22require 'classes/master.php';
     3
     4if (is_null($_SESSION['username']))
     5    redirect('index.php');
    36?>
    47<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     
    1922            <div id="content">
    2023                <?php
    21                
     24                    new SessionCreationTool();
    2225                ?>
    2326            </div>
  • Dev/trunk/survey.php

    r52 r58  
    11<?php
    22require 'classes/master.php';
     3
     4if (is_null($_SESSION['username']))
     5    redirect('index.php');
    36
    47if (isset($_GET['id']))
  • Dev/trunk/surveycreation.php

    r56 r58  
    11<?php
    22require 'classes/master.php';
     3
     4if (is_null($_SESSION['username']))
     5    redirect('index.php');
    36
    47$savedSurvey = null;
Note: See TracChangeset for help on using the changeset viewer.