FS-Mod/Erstifahrt/SpecialErstifahrt_Informatik.php
Einhard Leichtfuß a17a08a7a3
Fix Spezial:Spezialseiten
This page (apparently) loads all special pages' code, which failed
because SpecialErstifahrt_Informatik.php and
SpecialErstifahrt_Mathematik.php each defined a class, both of the same
name.

Note that the two files are mostly identical, which is because they stem
from the same original file, which for some reason was not generalized,
but duplicated.  This should ideally be fixed.
2024-08-12 00:25:42 +02:00

353 lines
12 KiB
PHP

<?php
/**
* Special:Erstifahrt, a special page that implements an Erstifahrt form.
* @file
* @ingroup Extensions
* @author Björn Kinscher
* @copyright © 2010 Björn Kinscher
* @license GNU General Public Licence 2.0 or later
* modified 2014: Christian Zirkelbach
* modified 2019: Einhard Leichtfuß
* modified 2020: Bennet Bleßmann
* modified 2023: Malik Abdoul Hamidou
*/
if( !defined( 'MEDIAWIKI' ) ) {
echo( "not a valid entry point.\n" );
die( 1 );
}
/**
* Provides the Erstifahrt form
* @ingroup SpecialPage
*/
class SpecialErstifahrtInformatik extends SpecialPage {
/**
* Constructor
*/
public function __construct() {
parent::__construct( 'ErstifahrtInformatik' );
}
/**
* Main execution function
*
* @param $par Mixed: Parameters passed to the page
*/
public function execute( $par ) {
$out = $this->getOutput();
$request = $this->getRequest();
//wfLoadExtensionMessages( 'ErstifahrtPage' );
$action = $request->getVal( 'action' );
$f = new ErstifahrtForm_Informatik();
// for some reason we nolonger check that all required information is present
if ( 'submit' == $action && $request->wasPosted()) {
$debug = ($request->getVal('debug') ?? "") === "debug";
$data['name'] = $request->getText( 'wpErstifahrtName' );
$data['firstname'] = $request->getText( 'wpErstifahrtVorname' );
$data['callname'] = $request->getText( 'wpErstifahrtRufname' );
$data['address'] = $request->getText( 'wpErstifahrtAddress' );
$data['city'] = $request->getText( 'wpErstifahrtCity' );
$data['mobile'] = $request->getText( 'wpErstifahrtMobile' );
$data['mail'] = $request->getText( 'wpErstifahrtMail' );
$data['food'] = $request->getText( 'wpErstifahrtFood' );
$data['car'] = $request->getText( 'wpErstifahrtCar' );
if ( $data['car'] == 1 )
$data['car'] = "Ja";
else if ( $data['car'] == 2 )
$data['car'] = "Nein";
else
$data['car'] = "kA";
$data['wurst'] = $request->getText( 'wpErstifahrtWurst' );
if ( $data['wurst'] ) {
$data['wurst'] = "Ja";
}
else {
$data['wurst'] = "Nein";
}
$data['fleisch'] = $request->getText( 'wpErstifahrtFleisch' );
if ( $data['fleisch'] ) {
$data['fleisch'] = "Ja";
}
else {
$data['fleisch'] = "Nein";
}
$data['vegetarisch'] = $request->getText( 'wpErstifahrtVegetarisch' );
if ( $data['vegetarisch'] ) {
$data['vegetarisch'] = "Ja";
}
else {
$data['vegetarisch'] = "Nein";
}
$data['vegan'] = $request->getText( 'wpErstifahrtVegan' );
if ( $data['vegan'] ) {
$data['vegan'] = "Ja";
}
else {
$data['vegan'] = "Nein";
}
$data['carSize'] = $request->getText( 'wpErstifahrtCarSize' );
$out->setPageTitle( 'Erstifahrt Informatik: Anmeldung' );
$titleObj = SpecialPage::getTitleFor( 'ErstifahrtInformatik' );
$out->addHTML( "<p>Deine Anmeldung wurde erfolgreich übermittelt. Du stehst nun auf der Anmeldeliste und wirst von uns über den weiteren Ablauf informiert.</p>" );
$mailtext = <<<"MAIL"
Name:
{$data['name']}
Vorname:
{$data['firstname']}
Rufname:
{$data['callname']}
Adresse:
{$data['address']}
{$data['city']}
Handy: {$data['mobile']}
E-Mail: {$data['mail']}
Allergien/Besonderheiten für\x27s Essen:
{$data['food']}
Grillgut:
Wurst: {$data['wurst']}
Fleisch: {$data['fleisch']}
Käse: {$data['vegetarisch']}
Gemüse: {$data['vegan']}
Auto (Sitzplätze): {$data['car']} ({$data['carSize']})
MAIL;
$betreff = 'Erstifahrt Informatik: Anmeldung';
$header = 'From: noreply@fs-informatik.uni-kiel.de' . "\r\n" .
'Content-type: text/plain; charset=UTF-8' . "\r\n" .
'X-Mailer: FS-Wiki';
if ($debug) {
mail('amah@fs-infmath.uni-kiel.de' , "Debug: ".$betreff, $mailtext, $header);
} else {
mail('erstifahrt-informatik@fs-infmath.uni-kiel.de', $betreff , $mailtext, $header);
}
} else {
wfDebug( __METHOD__ . ": form\n" );
$f->showForm($out);
}
}
}
/**
* @todo document
* @ingroup SpecialPage
*/
class ErstifahrtForm_Informatik {
// These are the default values.
public $name = '';
public $firstname = '';
public $callname = '';
public $address = '';
public $city = '';
public $mobile = '';
public $mail = '';
public $food = '';
public $car = '';
public $carSize = '';
function showForm($out) {
$out->setPageTitle( 'Erstifahrt Informatik: Anmeldung' );
$titleObj = SpecialPage::getTitleFor( 'ErstifahrtInformatik' );
$action = $titleObj->getLocalURL( 'action=submit' );
$out->addHTML( "<p>Wenn noch Fragen bestehen oder Probleme aufgetreten sind, schickst Du bitte eine E-Mail an <a href=\"mailto:erstifahrt-informatik@fs-infmath.uni-kiel.de\">erstifahrt-informatik@fs-infmath.uni-kiel.de</a>.</p>" );
// prepare form elements
$lableName = Xml::label( 'Name*', 'wpErstifahrtName' );
$inputName = Xml::input( 'wpErstifahrtName', 60, $this->name, array( 'type' => 'text', 'maxlength' => 255 ) );
$lableVorname = Xml::label( 'Vorname*', 'wpErstifahrtVorname' );
$inputVorname = Xml::input( 'wpErstifahrtVorname', 60, $this->firstname, array( 'type' => 'text', 'maxlength' => 255 ) );
$lableCallname = Xml::label( 'ggf. Rufname', 'wpErstifahrtRufname' );
$inputCallname = Xml::input( 'wpErstifahrtRufname', 60, $this->callname, array( 'type' => 'text', 'maxlength' => 255 ) );
$lableAddress = Xml::label( 'Straße, Nr.*', 'wpErstifahrtAddress' );
$inputAddress = Xml::input( 'wpErstifahrtAddress', 60, $this->address, array( 'type' => 'text', 'maxlength' => 255 ) );
$lableCity = Xml::label( 'PLZ, Ort*', 'wpErstifahrtCity' );
$inputCity = Xml::input( 'wpErstifahrtCity', 60, $this->city, array( 'type' => 'text', 'maxlength' => 255 ) );
$lableMobile = Xml::label( 'Handynummer*', 'wpErstifahrtMobile' );
$inputMobile = Xml::input( 'wpErstifahrtMobile', 60, $this->mobile, array( 'type' => 'text', 'maxlength' => 255 ) );
$lableMail = Xml::label( 'E-Mail*', 'wpErstifahrtMail' );
$inputMail = Xml::input( 'wpErstifahrtMail', 60, $this->mail, array( 'type' => 'text', 'maxlength' => 255 ) );
$lableFood = Xml::label( 'Allergien/Besonderheiten für\'s Essen', 'wpErstifahrtFood' );
$inputFood = Xml::input( 'wpErstifahrtFood', 60, $this->food, array( 'type' => 'text', 'maxlength' => 255 ) );
$inputWurst = Xml::element( 'input', array('type' => 'checkbox', 'name' => 'wpErstifahrtWurst' , 'value' => '1' ) );
$inputFleisch = Xml::element( 'input', array('type' => 'checkbox', 'name' => 'wpErstifahrtFleisch' , 'value' => '1' ) );
$inputVegetarisch = Xml::element( 'input', array('type' => 'checkbox', 'name' => 'wpErstifahrtVegetarisch', 'value' => '1' ) );
$inputVegan = Xml::element( 'input', array('type' => 'checkbox', 'name' => 'wpErstifahrtVegan' , 'value' => '1' ) );
$inputCarYes = (( $this->car == 1 )
? Xml::element( 'input', array('type' => 'radio', 'name' => 'wpErstifahrtCar', 'value' => '1', 'selected' => 'selected' ) )
: Xml::element( 'input', array('type' => 'radio', 'name' => 'wpErstifahrtCar', 'value' => '1' ) ));
$inputCarNo = (( $this->car == 2 )
? Xml::element( 'input', array('type' => 'radio', 'name' => 'wpErstifahrtCar', 'value' => '2', 'selected' => 'selected' ) )
: Xml::element( 'input', array('type' => 'radio', 'name' => 'wpErstifahrtCar', 'value' => '2' ) ));
$lableCarSize = Xml::label( 'Falls ja, Anzahl Plätze (inkl. Fahrer)', 'wpErstifahrtCarSize' );
$inputCarSize = Xml::input( 'wpErstifahrtCarSize', 60, $this->carSize, array( 'type' => 'text', 'maxlength' => 255 ) );
$inputSubmit = Xml::submitButton( 'Senden', array( 'name' => 'wpErstifahrtSend', 'accesskey' => 's' ) );
// add form to output
$out->addHTML(
Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action, 'enctype' => 'multipart/form-data' ) ) .
Xml::openElement( 'fieldset' ) .
Xml::element( 'legend', null, 'Erstifahrt Informatik: Anmeldung' ) .
Xml::openElement( 'table', array( 'id' => 'erstifahrtheader' ) ) .
"<tr>
<td class='mw-label'>
$lableName
</td>
<td class='mw-input' id='mw-erstifahrtpage-name'>
$inputName
</td>
</tr>
<tr>
<td class='mw-label'>
$lableVorname
</td>
<td class='mw-input' id='mw-erstifahrtpage-vorname'>
$inputVorname
</td>
</tr>
<tr>
<td class='mw-label'>
$lableCallname
</td>
<td class='mw-input' id='mw-erstifahrtpage-rufname'>
$inputCallname
</td>
</tr>
<tr>
<td class='mw-label'>
$lableAddress
</td>
<td class='mw-input' id='mw-erstifahrtpage-address'>
$inputAddress
</td>
</tr>
<tr>
<td class='mw-label'>
$lableCity
</td>
<td class='mw-input' id='mw-erstifahrtpage-city'>
$inputCity
</td>
</tr>
<tr>
<td class='mw-label'>
$lableMobile
</td>
<td class='mw-input' id='mw-erstifahrtpage-mobile'>
$inputMobile
</td>
</tr>
<tr>
<td class='mw-label'>
$lableMail
</td>
<td class='mw-input' id='mw-erstifahrtpage-mail'>
$inputMail
</td>
</tr>
<tr>
<td class='mw-label'>
$lableFood
</td>
<td class='mw-input' id='mw-erstifahrtpage-food'>
$inputFood
</td>
</tr>
<tr>
<td class='mw-label'>Gewünschtes Grillgut*</td>
<td class='mw-input' id='mw-erstifahrtpage-grillgut'>
$inputWurst Würstchen<br />
$inputFleisch Fleisch<br />
$inputVegetarisch Käse (Vegetarisch)<br />
$inputVegan Gemüse (Vegan) <br />
</td>
</tr>
<tr>
<td class='mw-label'>Auto*</td>
<td class='mw-input' id='mw-erstifahrtpage-car'>
$inputCarYes Ja<br />
$inputCarNo Nein
</td>
</tr>
<tr>
<td class='mw-label'>
$lableCarSize
</td>
<td class='mw-input' id='mw-erstifahrtpage-carsize'>
$inputCarSize
</td>
</tr>
<tr>
<td></td>
<td class='mw-submit'>
$inputSubmit <br />
<br />
* Pflichtfeld.<br />
Bitte habt Verständnis, dass unvollständig ausgefüllte Anmeldungen nicht bearbeitet werden können.<br />
Alle mit * markierten Felder sind daher auszufüllen.<br />
<br />
</td>
</tr>
<tr>
<td colspan='2'><p><strong>Haftung und andere Pflichten des Teilnehmers</strong></p>
<ol>
<li>Für sämtliche Schäden, die der Teilnehmer durch vorsätzliches oder fahrlässiges Verhalten an Rechtsgütern
von Betreuern oder Dritten herbeiführt, haftet der Teilnehmer selbst.</li>
<li>Für ausreichenden Versicherungsschutz, insbesondere Kranken- sowie Haftpflichtversicherung, hat
der Teilnehmer selbst zu sorgen.</li>
<li>Der Teilnehmer verpflichtet sich, etwaige Veränderungen (bspw. den Nicht-Antritt der Fahrt) den Fachschaft
Informatik unverzüglich mitzuteilen.</li>
<li>Die Teilnahme an der Fahrt erfolgt auf eigene Gefahr.</li>
<li>Die Fachschaft Informatik übernimmt als Organisator der Fahrt keine Haftung für Unfälle, Diebstahl bzw. auf anderem
Wege abhanden gekommene Gegenstände sowie sonstige Schäden jeglicher Art, sofern ihnen kein vorsätzliches
oder grob fahrlässiges Verhalten nachzuweisen ist.</li>
</td>
</tr>" .
Xml::closeElement( 'table' ) .
Xml::closeElement( 'fieldset' ) .
Xml::closeElement( 'form' )
);
}
}