Changeset 185 for Dev/trunk/classes


Ignore:
Timestamp:
12/15/11 17:09:49 (13 years ago)
Author:
fpvanagthoven
Message:
 
Location:
Dev/trunk/classes
Files:
3 edited

Legend:

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

    r177 r185  
    1616
    1717        <br />
    18        
     18
    1919        <div id="toolbox" class="largeFrame">
    2020            <div class="largeTitle">Toolbox</div>
    2121            <div class="content">
    2222                <p style="float: left; clear:both; margin-bottom: 1em;">Add new:</p>
    23                 <div class="bigButton vert" onClick="SubmitToolbox('Survey');"><img src="images/icons/survey.png" class="buttonIcon" /><p>Survey</p></div>
    24                 <div class="bigButton vert" onClick="SubmitToolbox('Application');"><img src="images/icons/application.png" class="buttonIcon" /><p>Application</p></div>
    25                 <div class="bigButton vert" onClick="SubmitToolbox('Dashboard');"><img src="images/icons/dashboard.png" class="buttonIcon" /><p>Dashboard</p></div>
     23                <div class="bigButton toolbox" onClick="submitToolbox('Survey');"><img src="images/icons/survey.png" class="buttonIcon" /><p>Survey</p></div>
     24                <div class="bigButton toolbox" onClick="submitToolbox('Application');"><img src="images/icons/application.png" class="buttonIcon" /><p>Application</p></div>
     25                <div class="bigButton toolbox" onClick="submitToolbox('Dashboard');"><img src="images/icons/dashboard.png" class="buttonIcon" /><p>Dashboard</p></div>
    2626            </div>
    2727        </div>
    28        
    29        
    30         <!--
    31         <form name="toolbox" action="pipelineEditor.php" method="POST">
    32             <fieldset id="toolbox">
    33                 <div class="fieldsetTitle">Toolbox</div>
    34                 <p>Add new: </p>
    35                 <div class="creationButton" onClick="SubmitToolbox('Survey');"><img src="images/icons/survey.png" class="buttonIcon"/><p>Survey</p></div>
    36                 <div class="creationButton" onClick="SubmitToolbox('Application');"><img src="images/icons/application.png" class="buttonIcon"/><p>Application</p></div>
    37                 <div class="creationButton" onClick="SubmitToolbox('Dashboard');"><img src="images/icons/dashboard.png" class="buttonIcon"/><p>Dashboard</p></div>
    38             </fieldset>
    39         </form>
    40        
    41         -->
    4228        <?php
    4329    }
  • Dev/trunk/classes/pipelineSequencer.php

    r181 r185  
    8181        <script type="text/javascript">
    8282            $(document).ready(function() {
    83                 loadSequencer();      // true means it is the first refresh of the page.
     83                loadSequencer();
    8484            });
    8585        </script>
     
    8787    }
    8888
    89     public function LoadSession($currentSession) {   // Initialize variables on page load.
    90         if (!isset($currentSession)) {
     89    public function LoadSession() {   // Initialize variables on page load.
     90        // Redirect if no session is set
     91        if (!isset($_SESSION['currentSession'])) {
    9192            redirect("selectSession.php");
    9293        }
    93         if (isset($_SESSION['updateNeeded'])) {    // user has performed an operation that flags session to be reloaded from DB, or is first load of page for that session
    94             $sessionResults = $this->dbi->get("Session", array("uid" => $currentSession));
    95 
    96             if (count($sessionResults) > 0) {
    97                 $_SESSION['localSessionCopy'] = $sessionResults[0];
    98                 unset($_SESSION['updateNeeded']);
    99             } else {
    100                 die("No session with that UID found!");
    101             }
     94        // Store the current session in internal variable
     95        $results = $this->dbi->get("Session", array("uid"=> $_SESSION['currentSession']));
     96        if (!empty($results)) {
     97            (is_array($results)) ? $this->loadedSession = $results[0] : $this->loadedSession = $results;
    10298        }
    103 
    104         if (isset($_SESSION['localSessionCopy']) && !empty($_SESSION['localSessionCopy'])) {
    105 
    106             $this->loadedSession = $_SESSION['localSessionCopy'];
    107             unset($_SESSION['updateNeeded']);
     99        else {
     100            // Throw error and quit if no results found
     101            die("No session with that UID found!");
    108102        }
    109103    }
    110104
    111105    public function HandlePostData() {
    112         if (isset($_POST['editSelected'])) {
    113             if (isset($_POST['selectedStep']) && !empty($_POST['selectedStep'])) {
    114                 redirect("editredirect.php");
    115             }
    116         }
    117 
    118         if (isset($_POST['moveSelectedLeft'])) {
    119             if (isset($_POST['selectedStep']) && !empty($_POST['selectedStep'])) {
    120                 $this->MoveStep($_POST['selectedStep'], -1);
    121             }
    122         }
    123 
    124         if (isset($_POST['moveSelectedRight'])) {
    125             if (isset($_POST['selectedStep']) && !empty($_POST['selectedStep'])) {
    126                 $this->MoveStep($_POST['selectedStep'], 1);
    127             }
    128         }
    129 
    130         if (isset($_POST['objectToCreate']) && !empty($_POST['objectToCreate'])) {
    131             switch (strtolower($_POST['objectToCreate'])) {
    132                 case "survey":
    133                     redirect("createsurvey.php");
    134                     break;
    135                 case "application":
    136                     redirect("createapplication.php");
    137                     break;
    138                 case "dashboard":
    139                     redirect("createdashboard.php");
    140                     break;
    141                 default:
    142                     // Er is iets fout gegaan, want er is geen valid type meegegeven!
    143                     break;
    144             }
    145         }
     106               
    146107    }
    147108
  • Dev/trunk/classes/surveyEditorWidget.php

    r182 r185  
    1212class surveyEditorWidget {
    1313
    14     private $loadedSession;
     14    private $loadedSurvey;
     15    private $dbi;
    1516
    1617    public function __construct() {
    1718        // Set basic variables
    1819        // Should probably include a default empty survey for the sake of safety
     20        $dbi = new DatabaseInterface();
    1921    }
    2022
    2123    public function handlePost() {
    2224        // Get POSTed data and store variables to class instance properties
    23         // Most important: loadedSession!
    24 
    25         //var_dump($_POST);
    26 
    2725        $dbi = new DatabaseInterface();
    2826        if (isset($_POST['objectUid']) && !empty($_POST['objectUid'])) {
    2927            $surveyResults = $dbi->get("Survey", array("uid" => $_POST['objectUid']));
    30             if (count($surveyResults) > 0) {
    31                 $this->loadedSurvey = $surveyResults[0];
     28            if (!empty($surveyResults)) {
     29                (is_array($surveyResults)) ? $this->loadedSurvey = $surveyResults[0] : $this->loadedSurvey = $surveyResults;
    3230            } else {
    33                 var_dump("No surveys found!");
     31                die("No surveys found!");
    3432            }
    3533        } else {
    36             var_dump("Incorrect or null uid passed!");
     34            die("Incorrect or null uid passed!");
    3735        }
    3836    }
    3937
    4038    public function init() {
     39        $questionString = "";
     40        foreach ($this->loadedSurvey->questions as $question) {
     41            $questionString .= $question->uid . ",";
     42        }
    4143        // echo the HTML markup to display the editor on the screen
    4244        ?>
    4345
    4446        <div id="surveyEditor" class="largeFrame">
    45             <div class="largeTitle">
    46                 Survey name
     47            <div class="largeTitle" id="surveyTitle">
     48                <?php echo $this->loadedSurvey->title; ?>
    4749            </div>
    48             <div id="surveyEditorContent" class="innerLargeFrame">
     50            <div id="seqContent" class="innerLargeFrame">
     51                <div id="seqContentWrapper">
    4952
    50                 <!--
    51                 <div id="questionUID" class="smallFrame">
    52                     <div class="smallTitle"><div class="listNumber">1</div>#QUESTION-IDENT-NO</div>
    53                     <div class="content">
    54                         <p class="questionBody">
    55                             This is the question body text. This is what the user will read when he is answering the survey.This is the question body text. This is what the user will read when he is answering the survey.This is the question body text. This is what the user will read when he is answering the survey.
    56                         </p>
    57                         <div class="questionParamsView">
    58                             PARAMETERS GO HERE, probably in one line (Only answer type and identifier?) Tags?
    59                         </div>
    60                     </div>
    61                     <div id="questionDisplayControls" class="controls">
    62                         <input type="button" value="Edit" onClick="javascript:alert('editing not yet supported');" class =" smallButton"/>
    63                         <input type="button" value="Remove" onClick="javascript:alert('removing not yet supported');" class =" smallButton"/>
    64                     </div>
    6553                </div>
    66                 -->
    67 
     54            </div>
     55            <div id="surveyEditorVertControls" class="vertControls">
     56                <div class="segment">
     57                    <label>Move</label>
     58                    <input type="button" id="vertControls_MoveUp" class="bigButton vertical" value="˄" />
     59                    <input type="button" id="vertControls_MoveDown" class="bigButton vertical" value="Ë
     60" />
     61                </div>
     62                <input type="button" id="vertControls_Add" class="bigButton vertical" value="+" onClick="addQuestion_Click();" />
    6863            </div>
    6964            <div id="surveyEditorControls" class="controls">
     65                <div id="pageControls">
     66                    <input type="button" value="<<" id="pageControls_first" onClick="" />
     67                    <input type="button" value="<" id="pageControls_previous" onClick="" />
     68                    Page <input type="text" value="1" id="pageControls_current" onChange="" class="smallTextField" /> of 5
     69                    <input type="button" value=">" id="pageControls_next" onClick="" />
     70                    <input type="button" value=">>" id="pageControls_last" onClick="" />
     71                </div>
     72
    7073                <input type="button" value="Discard survey" onClick="javascript:alert('discard not yet supported');" class="smallButton" />
    7174                <input type="button" value="Save survey" onClick="javascript:alert('save not yet supported');" class="smallButton" />
     
    7578
    7679
    77         <form name="hiddenFields">
    78             <input type="hidden" id="surveyUid" value="<?php echo $this->loadedSurvey->uid; ?>" />
    79             <input type="hidden" id="questionUids" value="<?php echo $this->loadedSurvey->questions; ?>" />
    80             <input type="hidden" id="surveyTitle" value="<?php echo $this->loadedSurvey->title; ?>" />
    81             <input type="hidden" id="numQuestions" value="<?php echo count($this->loadedSurvey->questions); ?>" />
    82             <input type="hidden" id="surveyDescription" value="<?php echo $this->loadedSurvey->description; ?>" />
     80        <form id="hiddenInputs">
     81            <input type="hidden" id="surveyUidField" value="<?php echo $this->loadedSurvey->uid; ?>" />
     82            <input type="hidden" id="questionUidsField" value="<?php echo $questionString ?>" />
     83            <input type="hidden" id="surveyTitleField" value="<?php echo $this->loadedSurvey->title; ?>" />
     84            <input type="hidden" id="numQuestionsField" value="<?php echo count($this->loadedSurvey->questions); ?>" />
     85            <input type="hidden" id="surveyDescriptionField" value="<?php echo $this->loadedSurvey->description; ?>" />
    8386        </form>
    8487
     
    9093        // output the javascript tags and needed functions in the head of the page
    9194        ?>
    92         <script type="text/javascript" src="js/surveyEditorScripts.js"></script>
     95        <script type="text/javascript" src="js/sequencerScripts.js"></script>
     96        <script type="text/javascript" src="js/generalscripts.js"></script>
    9397        <script type="text/javascript" src="js/jquery.js"></script>
    9498        <script type="text/javascript">
    9599            $(document).ready(function() {
    96                 loadSurvey();
     100                loadSequencer();
    97101            });
    98102        </script>
Note: See TracChangeset for help on using the changeset viewer.