public static function start() { $target = isset($_GET['target']) ? $_GET['target'] : 'showForm'; switch ($target) { case 'register': require_once dirname(__FILE__) . '/ParticipationView.php'; if (isset($_GET['idExhibition']) && $_GET['idExhibition'] > 0) { require_once dirname(__FILE__) . '/Dog.php'; $dog = new Dog(); $dog->setBreed('retriiver')->setGender('m')->setBirthDate('2000-12-21'); require_once dirname(__FILE__) . '/Exhibition.php'; $exhibition = new Exhibition(); $exhibition->setId($_GET['idExhibition']); $exhibition->setCompleteExhibition(); $exhibition->insertDog($dog); echo ParticipationView::buildMessage(array('dog' => $dog, 'exhibition' => $exhibition)); } else { echo ParticipationView::buildErrorMessage(); } break; case 'showForm': default: require_once dirname(__FILE__) . '/Exhibition.php'; $exhibitions = Exhibition::getListOfTypeExhibitions(); require_once dirname(__FILE__) . '/ParticipationView.php'; echo ParticipationView::buildRegistrationForm(array('exhibitions' => $exhibitions)); break; } }
public static function getListOfTypeExhibitions() { $exhibition = new Exhibition(); $exhibition->setId(1); $exhibition->timestamp = '2015-12-14 9:30:00'; $exhibition->location = 'Tallinn'; Exhibition::$exhibitions[1] = $exhibition; $exhibition = new Exhibition(); $exhibition->setId(2); $exhibition->timestamp = '2015-12-15 10:0:00'; $exhibition->location = 'Pärnu'; Exhibition::$exhibitions[2] = $exhibition; $exhibition = new Exhibition(); $exhibition->setId(3); $exhibition->timestamp = '2015-12-16 10:30:00'; $exhibition->location = 'Eitea'; Exhibition::$exhibitions[3] = $exhibition; return Exhibition::$exhibitions; }
// require_once dirname(__FILE__) . '/ParticipationView.php'; // echo ParticipationView::buildRegistrationForm(array ('exhibitions' => $exhibitions)); // break; // } // } // } // } // Controller::start(); require_once dirname(__FILE__) . '/Exhibition.php'; //lõin muutuja (mis on objekt) exhibition1, millel on omadused ja funktsioonid, mis on määratud klassis Exhibition $exhibition1 = new Exhibition(); $exhibition1->setId(1); $exhibition1->setLocation('Pärnu'); $exhibition1->setTimestamp('2015-12-30 09:00:00'); $exhibition2 = new Exhibition(); $exhibition2->setId(2); $exhibition2->setLocation('Tallinn'); $exhibition2->setTimestamp('2015-12-20 10:00:00'); Exhibition::insertExhibition($exhibition1); Exhibition::insertExhibition($exhibition2); $exhibition1->setLocation('Tartu'); echo '<pre>'; var_dump(Exhibition::getExhibitions()); echo '</pre>'; require_once dirname(__FILE__) . '/Dog.php'; $dog1 = new Dog(); $dog1->setId(1); $dog1->setBreed('retriiver'); $dog1->setBirthDate('2014-12-30 09:00:00'); $dog2 = new Dog(); $dog2->setId(2);