- Timestamp:
- 09/19/11 18:04:48 (14 years ago)
- Location:
- Dev/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/classes/Loader.php
r112 r114 61 61 foreach ($questionCodesAndTitles as $code => $title) { 62 62 $info = $questionDBI->getQuestionInfo($code); 63 $question = Question::getQuestion($code, $info); 63 64 65 array_push($questions, $question); 64 66 } 67 68 return $questions; 65 69 } 66 70 -
Dev/trunk/classes/Question.php
r112 r114 19 19 public $category; 20 20 21 public function __construct($code, $title , $type = null, $description = null)21 public function __construct($code, $title = null, $type = null, $description = null) 22 22 { 23 23 $this->code = $code; … … 34 34 } 35 35 36 public static function getQuestion($ questionInfo)36 public static function getQuestion($code, $info) 37 37 { 38 $question = new Question($code); 39 $question->title = $info['questionTitle']; 40 $question->type = $info['questionType']; 41 if(isset($info['questionDescription'])) 42 $question->description = $info['questionDescription']; 43 $question->category = $info['questionCategory']; 38 44 45 $i = 1; 46 while (isset($info['ans' . $i])) 47 { 48 array_push($question->answers, $info['ans' . $i]); 49 $i++; 50 } 51 52 return $question; 39 53 } 40 54 -
Dev/trunk/classes/QuestionCreationTool.php
r112 r114 7 7 */ 8 8 class QuestionCreationTool { 9 10 private $list; 9 private $questions; 11 10 private $questionEditPanel; 12 11 13 public function __construct() { 12 public function __construct($questions) { 13 $this->questions = $questions; 14 14 $this->javascript(); 15 15 $this->displayList(); … … 295 295 var typeSelect = document.getElementById("questionTypeSelect"); 296 296 typeSelect.selectedIndex = 0; 297 clearSpecifications(); 297 298 } 298 299 … … 305 306 <div id="questionListWrapper"> 306 307 <select id="questionsList" size="9999"> 308 <?php $this->populateList(); ?> 307 309 </select> 308 310 </div> … … 326 328 <td id="categoryBox"><!-- Select should be filled with existing categories--> 327 329 <select id="questionCategorySelect" name="questionCategory"> 328 <option value=' Test Category'>Test Category</option>330 <option value='Uncategorized' selected='selected'>Uncategorized</option> 329 331 </select> 330 332 <!-- New category button --> … … 363 365 <?php 364 366 } 367 368 private function populateList() 369 { 370 foreach ($this->questions as $question) 371 { 372 ?> 373 <option value="<?php echo $question->code; ?>"> 374 <?php echo $question->code . " - " . $question->title; ?> 375 </option> 376 <?php 377 } 378 } 365 379 366 380 } -
Dev/trunk/questioncreation.php
r112 r114 1 1 <?php 2 2 require 'classes/master.php'; 3 3 $questionDBI = new QuestionCreationDatabaseInterface(); 4 4 /* If a question is saved */ 5 5 if(isset($_POST['questionCode'])) 6 6 { 7 $questionDBI = new QuestionCreationDatabaseInterface();8 7 echo $questionDBI->setQuestionInfo($_POST); // save to DB 9 8 } 10 9 11 $questions = Loader::load Questions();10 $questions = Loader::loadFullQuestions(); 12 11 var_dump($questions); 13 14 //$dbi = new QuestionCreationDatabaseInterface();15 //$info = $dbi->getQuestionInfo("testcode1");16 17 //var_dump($info);18 19 12 ?> 20 13 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
Note: See TracChangeset
for help on using the changeset viewer.