source: Dev/trunk/classes/Loader.php @ 85

Last change on this file since 85 was 85, checked in by basvannuland, 14 years ago

Base for all databases done. not tested. Need frontend to properly test.

File size: 1.4 KB
Line 
1<?php
2
3/**
4 * Helper class to load stuff
5 *
6 * @author fpvanagthoven
7 */
8class Loader {
9
10    /**
11     *
12     * @return array Array of Surveys with id and title
13     */
14    public static function loadSurveys() {
15        $surveys = array();
16
17        $surveyDBI = new SurveyCreationDatabaseInterface(null);
18        $surveyIDTitles = $surveyDBI->getExistingSurveys();
19
20        foreach ($surveyIDTitles as $id => $title) {
21            $survey = new Survey($id, $title);
22            array_push($surveys, $survey);
23        }
24       
25        return $surveys;
26    }
27   
28    public static function loadApplications()
29    {
30        $applications = array();
31       
32        $applicationDBI = new ApplicationDatabaseInterface(null);
33        $applicationTitles = $applicationDBI->getExistingApplications();
34       
35        foreach ($applicationTitles as $id => $title) {
36            $application = new Application($id, $title);
37            array_push($applications, $application);
38        }
39       
40        return $applications;
41    }
42   
43    public static function loadSessions()
44    {
45        $sessions = array();
46       
47        $sessionDBI = new SessionCreationDatabaseInterface(null);
48        $sessionTitles = $sessionDBI->getExistingSessions();
49       
50        foreach ($sessionIDTitles as $id => $title) {
51            $session = new Application($id, $title);
52            array_push($sessions, $session);
53        }
54       
55        return $sessions;
56    }
57
58}
59
60?>
Note: See TracBrowser for help on using the repository browser.