Changeset 38 for Dev


Ignore:
Timestamp:
07/22/11 17:13:04 (14 years ago)
Author:
fpvanagthoven
Message:

Surveys can be loaded with UID.

Location:
Dev/trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/classes/SurveyButton.php

    r36 r38  
    2828    }
    2929
    30     public static function loadSurveyButton() {
     30    /**
     31     *
     32     * @param Survey $surveys An array of surveys
     33     */
     34    public static function loadSurveyButton($surveys) {
    3135        ?>
    32 
    33         <form action="surveycreation.php" method="post">
    34 
    35             <input type="submit" value="Load survey" class="surveyButton bigSurveyButton" />
    36 
     36        <form id="loadForm" action="surveycreation.php" method="post">
     37            <input type="button" onclick="loadSurvey()" value="Load survey" class="surveyButton bigSurveyButton" />
    3738        </form>
    38 
     39        <br/>
     40        <select id="surveysToLoad" size="1000">
     41            <?php
     42            foreach ($surveys as $survey) {
     43                ?><option value='<?php echo $survey->id; ?>'><?php echo $survey->title; ?></option><?php
     44        }
     45            ?>
     46        </select>
    3947        <?php
    4048    }
  • Dev/trunk/css/style.css

    r36 r38  
    145145    font-weight: bold;
    146146    background-color: #fff;
    147     border: 2px solid #aaa;
     147    border: 1px solid #aaa;
    148148    -moz-border-radius: 6px;
    149149    border-radius: 6px;
     
    185185    color: gray;
    186186}
     187
     188
     189
     190/* ##################################################################
     191   ===================== STYLESHEET OF GLORY ======================== */
     192
     193#surveysToLoad {
     194    width: 20em;
     195    height: 10em;
     196}
  • Dev/trunk/index.php

    r36 r38  
    1 <?php require 'classes/master.php'; //should be at top of every page   ?>
     1<?php require 'classes/master.php'; //should be at top of every page   
     2
     3/* make an array of survey mock objects */
     4$surveys = array();
     5
     6$aSurvey = new Survey('71a5c2ee19f172c6f0fe22ec1bfa2083', 'TestGameTest Survey Title');
     7$bSurvey = new Survey('0e999e625e6c45867e2c64b5228c684d', 'Ultimate Survey');
     8$cSurvey = new Survey('dceea2af20c3ce6a7175dd0e96e0f2cb', 'Super Survey');
     9
     10array_push($surveys, $aSurvey);
     11array_push($surveys, $bSurvey);
     12array_push($surveys, $cSurvey);
     13?>
    214
    315<!DOCTYPE html>
     
    719        <title>Facilitator</title>
    820        <link rel="stylesheet" type="text/css" href="css/style.css" />
     21        <script type="text/javascript" src="js/menu.js"></script>
    922    </head>
    1023    <body>
     
    1932                    <?php
    2033                    SurveyButton::newSurveyButton();
    21                     SurveyButton::loadSurveyButton();
     34                    SurveyButton::loadSurveyButton($surveys);
    2235                    ?>
    2336                </div>
  • Dev/trunk/surveycreation.php

    r36 r38  
    33
    44$savedSurvey = null;
     5$timeStamp = null;
     6var_dump($_POST);
    57
    6 if (isset($_POST['timeStamp']))
    7 {
    8     $timeStamp = $_POST['timeStamp'];
    9        
    10         echo 'This is what gets sent:';
    11         var_dump($_POST);
    12         echo '<br/><br/>';
    13         $surveyDBI =  new SurveyDatabaseInterface();
    14         $surveyDBI->setSurveyInfo($_POST);
    15         $info = $surveyDBI->getSurveyInfo();
    16         echo '<br/><br/>';
    17         echo 'This is what I get back:';
    18         var_dump($info);
    19        
    20         $savedSurvey = Survey::getSurvey($info);
    21 }
    22 else {
    23     $timeStamp = null;
     8/* LOAD SURVEY */
     9if (isset($_POST['UID'])) {
     10    $surveyID = $_POST['UID'];
     11    $surveyDBI = new SurveyDatabaseInterface($surveyID);
     12    $info = $surveyDBI->getSurveyInfo();
     13   
     14    $savedSurvey = Survey::getSurvey($info);
    2415}
    2516
     17/* AUTOSAVE */
     18else if (isset($_POST['timeStamp'])) {
     19    $timeStamp = $_POST['timeStamp'];
     20
     21    echo 'This is what gets sent:';
     22    var_dump($_POST);
     23    echo '<br/><br/>';
     24    $surveyDBI = new SurveyDatabaseInterface();
     25    $surveyDBI->setSurveyInfo($_POST);
     26    $info = $surveyDBI->getSurveyInfo();
     27    echo '<br/><br/>';
     28    echo 'This is what I get back:';
     29    var_dump($info);
     30
     31    $savedSurvey = Survey::getSurvey($info);
     32}
    2633?>
    2734
     
    4249
    4350            <div id="content">
    44                 <?php
    45      
    46                 new SurveyCreationTool($savedSurvey, $timeStamp);
    47                 ?>
     51<?php
     52new SurveyCreationTool($savedSurvey, $timeStamp);
     53?>
    4854            </div>
    4955        </div>
Note: See TracChangeset for help on using the changeset viewer.