questions = $questions; $this->loadQuestionsToJavascript(); $this->javascript(); $this->displayList(); $this->displayEditPanel(); } /** * Loads the questions that PHP retrieved from database * into javascript. This is done so that the page does not need * to refresh in order to load an entire question in to the form. * * The javascript array will have question codes as keys. * The value is a javascript Question object that gets created from * the PHP object. */ private function loadQuestionsToJavascript() { // ?>
displayForm(); ?>
questionCategorySelect(); ?>
questions as $question) { $category = $question->category; array_push($categories, $category); } $categories = array_unique($categories); // You might want to escape quotes and stuff here foreach ($categories as $category) { ?> questions = $this->sortByCategory($this->questions); $currentCategory = null; foreach ($this->questions as $question) { if (is_null($currentCategory)) { ?> category; } else if ($currentCategory != $question->category) { /* Next category */ ?>category; ?> /* function loadQuestionIn() should still be made */ category == $q2->category) { if($q1->code < $q2->code) return -1; else return 1; } return ($q1->category < $q2->category) ? -1 : 1; } ?>