eventService = $eventService;
}
public function save(IModel $model) {
if( $this->eventService->saveOrUpdate($model) ) {
if( $model->getDn()==NULL ) {
// New Event
$this->layout->echoln(_("Event created successfully."));
}else {
// Event edited
$this->layout->echoln(_("Event updated successfully."));
}
}else {
if( $model->getDn()==NULL ) {
// New Event
$this->layout->echoln(_("Failed creating Event."));
}else {
// Event edited
$this->layout->echoln(_("Failed saving Event."));
}
}
}
}
if( isset($_REQUEST['new']) ) {
$access = Access::ANONYMOUS;
}else {
$access = Access::VISITOR;
}
$layout = new DefaultLayout($access);
$layout->init();
$eventService = $GLOBALS['ClassFactory']->getEventService();
$rangeService = $GLOBALS['ClassFactory']->getRangeService();
if( isset($_SESSION['sess_uid']) ) {
$layout->echoln("
"._("Create Event")."
");
$eventModel = new Event(NULL);
}else {
$layout->echoln(""._("Create Event")."
");
$eventModel = NULL;
}
if( isset($eventModel) ) {
$form = new createEvent($layout, $eventModel, $eventService);
$uidField = new TextField("title", "Event title");
//$uidField->setClass("disabled");
$form->addField($uidField);
$rangeOfTheEventField = new SelectField("range", "RangeOfTheEvent", $rangeService->loadActive(), false, 1);
$form->addField($rangeOfTheEventField->setCompulsory(true));
$arrivalDate = new DateSelectField("arrival", "Arrival date");
$arrivalDate ->setYear(date("Y"), 10);
$form->addField($arrivalDate);
$departureDate = new DateSelectField("departure", "Departure date");
$departureDate ->setYear(date("Y"), 10);
$form->addField($departureDate);
$applicationStart = new DateSelectField("applicationStart", "Apply to participate(start)");
$applicationStart ->setYear(date("Y"), 10);
$form->addField($applicationStart);
$applicationEnd = new DateSelectField("applicationEnd", "Apply to participate(end)");
$applicationEnd ->setYear(date("Y"), 10);
$form->addField($applicationEnd);
$eventPlaces = new TextAreaField("place", "Event places");
$form->addField($eventPlaces);
$fee = new TextField("fee", "Participation fee (€)");
$form->addField($fee);
$accomPlace = new SelectField("accomPlace", "Accommodation place",
array('Gym'=>"Gym",
'Hostel/dormitory'=>"Hostel / dormitory",
'AtOurHomes'=>"At our homes",
'Hotel'=>"Hotel"), false, 1);
$form->addField($accomPlace);
$accomCapacity = new SelectField("accomCapacity", "Accommodation capacity",
array('1-4'=>"1-4 people per room",
'5-8'=>"5-8 people per room",
'9+'=>"9+ people per room",), false, 1);
$form->addField($accomCapacity);
$accomType = new SelectField("accomType", "Accommodation type",
array('bed'=>"bed",
'couch'=>"couch",
'matress/sleeping bag'=>"matress / sleeping bag",), false, 1);
$form->addField($accomType);
$numberOfParticipants = new TextField("participants", "Number of participants");
$form->addField($numberOfParticipants);
$omsHandlesApplications = new RadioField("omsHandlesApplications", "Applications will be handled through", array('OMS'=>"AEGEE OMS (this system)", 'other'=>"we will handle them ourselves (other, external system)"), " ");
$form->addField($omsHandlesApplications);
$applicationLink = new TextField("applicationLink", "Link to the system");
$form->addField($applicationLink);
$form->display();
}
$layout->page_footer();
/*
function __construct(){
$layout = new ImportLayout(Access::ANONYMOUS, "./");
$layout->init();
$sql = new MySQL(EVENTS_MYSQL_HOST, EVENTS_MYSQL_USER, EVENTS_MYSQL_PASS, EVENTS_MYSQL_DB);
$query = "SELECT name
FROM ranges;";
$sql->query($query);
$array=$sql->fetchArray();
echo "
CREATE EVENT
";
//echo" Event title:
";
echo"
";
//$layout->page_footer();
}
}*/
?>