Changeset 75


Ignore:
Timestamp:
08/08/11 15:12:46 (14 years ago)
Author:
fpvanagthoven
Message:

Application should now just be RDF-saved. Beginning on DashboardTool?.php.

Location:
Dev/trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/applicationcreation.php

    r66 r75  
    44if (is_null($_SESSION['username']))
    55    redirect('index.php');
     6
     7$application = null;
     8
     9/* TODO: Bas! Dit aanpassen zodat application wordt opgeslagen. */
     10if(!empty($_POST))
     11{
     12        $title = $_POST['applicationTitle'];
     13        $description = $_POST['applicationDescription'];
     14        $application = new Application($title, $description);
     15        var_dump($application);
     16}
     17
    618?>
    719<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     
    2234            <div id="content">
    2335                <?php
    24                     new ApplicationCreationTool();
     36                    new ApplicationCreationTool($application);
    2537                ?>
    2638            </div>
  • Dev/trunk/classes/Application.php

    r57 r75  
    77 */
    88class Application {
     9    public $title;
     10    public $description;
     11    public $style;
    912
    10     private $title;
    11     private $description;
    12     private $style;
    13 
    14     public function __construct() {
    15        
     13    public function __construct($title = null, $description = null, $style = null) {
     14        $this->title = $title;
     15                $this->description = $description;
     16                $this->style = $style;
    1617    }
    1718
  • Dev/trunk/classes/ApplicationCreationTool.php

    r72 r75  
    1010 * @author fpvanagthoven
    1111 */
    12 class ApplicationCreationTool {
     12class ApplicationCreationTool
     13{
     14        private $application;
    1315
    14     private $application;
     16        public function __construct($application = null)
     17        {
     18                $this->application = $application;
    1519
    16     public function __construct($application = null) {
    17         $this->application = $application;
    18        
    19         $this->javascript();
    20         if(!empty($_POST))
    21             redirect('mainmenu.php');
    22         ?>
    23         <div class="creation">
    24             <form id="applicationCreationForm" action="" method="post">
    25                 <?php
    26                 $this->title();
    27                 $this->description();
    28                
    29                 $this->done();
    30                 ?>
    31             </form>
    32         </div>
    33         <?php
    34     }
    35    
    36     private function javascript() {
    37         ?>
    38         <script type="text/javascript" src="js/creation.js"></script>
    39         <script language="JavaScript" type="text/javascript">
     20                $this->javascript();
    4021
    41         </script>
    42         <?php
    43     }
     22                $this->init();
     23        }
    4424
    45     private function title() {
    46         if (isset($this->application->title))
    47             $value = $this->application->title;
    48         else
    49             $value = 'Untitled Application';
    50         ?>
    51         <input type="text" id="applicationTitle" class="titleBox" name="applicationTitle" value="<?php echo str_replace("\"", "&quot;", $value); ?>" onblur="handleBlur(this)" onfocus="handleFocus(this)" />
    52         <?php
    53     }
     25        private function javascript()
     26        {
     27                ?>
     28                <script type="text/javascript" src="js/creation.js"></script>
     29                <script language="JavaScript" type="text/javascript">
    5430
    55     private function description() {
    56         if (isset($this->application->description))
    57             $value = $this->application->description;
    58         else
    59             $value = 'Write a description for this application here.';
    60         ?>
    61         <textarea id="applicationDescription" class="descriptionBox" name="applicationDescription" onblur="handleBlur(this)" onfocus="handleFocus(this)"><?php echo $value; ?></textarea>
    62         <?php
    63     }
    64    
    65     private function done() {
    66         ?>
    67         <input type="submit" class="surveyButton topRight" value="Done" />
    68         <?php
    69     }
     31                </script>
     32                <?php
     33        }
    7034
     35        private function init()
     36        {
     37                ?>
     38                <div class="creation">
     39                        <form id="applicationCreationForm" action="" method="post">
     40                                <?php
     41                                $this->title();
     42                                $this->description();
     43
     44                                $this->done();
     45                                ?>
     46                        </form>
     47                </div>
     48                <?php
     49        }
     50
     51        private function title()
     52        {
     53                if (isset($this->application->title))
     54                        $value = $this->application->title;
     55                else
     56                        $value = 'Untitled Application';
     57                ?>
     58                <input type="text" id="applicationTitle" class="titleBox" name="applicationTitle" value="<?php echo str_replace("\"", "&quot;", $value); ?>" onblur="handleBlur(this)" onfocus="handleFocus(this)" />
     59                <?php
     60        }
     61
     62        private function description()
     63        {
     64                if (isset($this->application->description))
     65                        $value = $this->application->description;
     66                else
     67                        $value = 'Write a description for this application here.';
     68                ?>
     69                <textarea id="applicationDescription" class="descriptionBox" name="applicationDescription" onblur="handleBlur(this)" onfocus="handleFocus(this)"><?php echo $value; ?></textarea>
     70                <?php
     71        }
     72
     73        private function done()
     74        {
     75                ?>
     76                <input type="submit" class="surveyButton topRight" value="Done" />
     77                <?php
     78        }
    7179}
    7280?>
  • Dev/trunk/classes/Survey.php

    r57 r75  
    1616    public $description;
    1717    public $questions;
     18       
     19        public $results;
    1820
    1921    public function __construct($id, $title, $description = null) {
     
    2224        $this->description = $description;
    2325        $this->questions = array();
     26               
     27                $this->results = null;
    2428    }
     29       
     30        public function addQuestion($question)
     31        {
     32                array_push($this->questions, $question);
     33        }
     34       
     35        public function setResults($surveyResults)
     36        {
     37                $this->results = $surveyResults;
     38        }
    2539
    2640    public static function getSurvey($info) {
     
    5670        return $survey;
    5771    }
     72       
     73        /**
     74         * TODO: Should return Results-object from reading RDF-database
     75         * @param type $surveyID
     76         */
     77        public static function getResults($surveyID)
     78        {
     79               
     80        }
    5881
    5982}
  • Dev/trunk/css/awesome.css

    r68 r75  
    326326}
    327327
     328.padding1em {
     329        padding: 1em;
     330}
     331
    328332.topMargin {
    329333    margin-top: 2em;
     
    402406}
    403407
     408.borderRadius {
     409        -moz-border-radius: 15px;
     410    border-radius: 15px;
     411}
     412
     413.boxShadow {
     414        -moz-box-shadow: 2px 2px 2px #888;
     415    -webkit-box-shadow: 2px 2px 2px #888;
     416    box-shadow: 2px 2px 2px #888;
     417}
     418
    404419/* ##################################################################
    405420   ===================== STYLESHEET OF GLORY ======================== */
     
    451466    width: 50%;
    452467}
     468
     469/* ##################################################################
     470   ===================== STYLESHEET OF GLORY ======================== */
     471.resultsDiv {
     472        height: 10em;
     473        border: 1px solid white;
     474}
     475
     476.resultDiv {
     477        width: 10em;
     478        height: 10em;
     479        border: 1px solid white;
     480        background-color: #c6c6c6;
     481        float: left;
     482        margin-left: 2em;
     483}
  • Dev/trunk/dashboard.php

    r73 r75  
    33
    44if (is_null($_SESSION['username']))
    5     redirect('index.php');
     5        redirect('index.php');
     6
     7/* MOCK SURVEY */
     8
     9$survey = new Survey('ultimateid', 'The Epic Survey');
     10$question1 = new Question('question1id', 'Age', 'int', 'What is your age?');
     11$question2 = new Question('question2id', 'Identity', 'mc', 'Are you freakazoid?');
     12$question2->answers = array('yes', 'no', 'maybe');
     13
     14$survey->addQuestion($question1);
     15$survey->addQuestion($question2);
     16
     17/* MOCK RESULTS */
     18
     19
     20$survey1Results = new SurveyResults();
     21
     22$question1Answers = array(3, 5, 12, 134, 5, 40); // int
     23$question2Answers = array('yes', 'no', 'no', 'yes', 'maybe', 'no');     // Multiple choice
     24
     25$question1Result = new QuestionResult(ResultType::INTEGER, $question1Answers);
     26$question2Result = new QuestionResult(ResultType::MULTIPLE_CHOICE, $question2Answers);
     27
     28$survey1Results->addQuestionResult($question1Result);
     29$survey1Results->addQuestionResult($question2Result);
     30
     31/*  COMBINE */
     32
     33$survey->setResults($survey1Results);
     34
     35$surveys = array($survey);
     36
    637?>
    738<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     
    1243        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    1344            <title></title>
    14             <?php new StyleSheet(); ?>
     45                        <?php new StyleSheet(); ?>
     46                        <script type="text/javascript" src="d3/d3.js"></script>
    1547    </head>
    1648    <body>
    1749        <div id="header">
    18             <?php new Logo(); ?>
     50                        <?php new Logo(); ?>
    1951        </div>
    2052        <div id="wrapper">
    2153
    2254            <div id="content">
    23                 <?php
    24                 ?>
     55                                <?php new DashboardTool($surveys); ?>
    2556            </div>
    2657        </div>
  • Dev/trunk/mainmenu.php

    r64 r75  
    2424
    2525$surveys = Loader::loadSurveys();
     26
    2627?>
    2728
Note: See TracChangeset for help on using the changeset viewer.