Initial commit
This commit is contained in:
@@ -0,0 +1,627 @@
|
||||
<?php
|
||||
|
||||
namespace Internetfabrik\IfOberstufenplaner\Controller;
|
||||
|
||||
|
||||
use Internetfabrik\IfOberstufenplaner\Domain\Model\Fach;
|
||||
use Internetfabrik\IfOberstufenplaner\Domain\Model\Schule;
|
||||
use Internetfabrik\IfOberstufenplaner\Service\SessionHandler;
|
||||
use Internetfabrik\IfOberstufenplaner\PDF\Pdf;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class FaecherplanerController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var SessionHandler
|
||||
*/
|
||||
protected $sessionHandler;
|
||||
|
||||
protected $sessionKey = 'planer';
|
||||
|
||||
/**
|
||||
* entryRepository
|
||||
*
|
||||
* @var \Internetfabrik\IfOberstufenplaner\Domain\Repository\SchuleRepository
|
||||
* @inject
|
||||
*/
|
||||
protected $schuleRepository = NULL;
|
||||
// /**
|
||||
// * entryRepository
|
||||
// *
|
||||
// * @var \Internetfabrik\IfOberstufenplaner\Domain\Repository\SchuleRefRepository
|
||||
// * @inject
|
||||
// */
|
||||
// protected $schuleRefRepository = NULL;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*
|
||||
* Typen: nw: Naturwissenschaft, gw: Geisteswissenschaft, ae: Ästetische Fächer, sp: Sprache
|
||||
*/
|
||||
protected $faecher = [
|
||||
"amt" => ["name" =>"angew. Mathematik", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"blau", "typ" =>"nw", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"ain" => ["name" =>"angew. Informatik", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"blau", "typ" =>"nw", "isProfilfach" =>true, 'isSeminar' => false, "nurEinJahr"=>true],
|
||||
"arl" => ["name" =>"Archäologie", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"gelb", "typ" =>"gw", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"arc" => ["name" =>"Architektur", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"aph" => ["name" =>"Astrophysik", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"blau", "typ" =>"nw", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"ast" => ["name" =>"Allg. Sporttheorie", "wochenstunden" =>2, "profilfachWochenstunden" =>0, "farbe" =>"gruen", "typ" =>"ae", "isProfilfach" =>false],
|
||||
"b" => ["name" =>"Biologie", "wochenstunden" =>3, "profilfachWochenstunden" =>3, "farbe" =>"blau", "typ" =>"nw", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"bpr" => ["name" =>"Bildnerische Praxis", "wochenstunden" =>2, "profilfachWochenstunden" =>0, "farbe" =>"gruen", "typ" =>"ae", "isProfilfach" =>false],
|
||||
"bcp" => ["name" =>"biol.-chem. Prakt.", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"blau", "typ" =>"nw", "isProfilfach" =>true, 'isSeminar' => false, 'nurEinJahr'=>true],
|
||||
"bph" => ["name" =>"Biophysik", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"blau", "typ" =>"nw", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"c" => ["name" =>"Chemie", "wochenstunden" =>3, "profilfachWochenstunden" =>3, "farbe" =>"blau", "typ" =>"nw", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"cha" => ["name" =>"chem. Analyse", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"blau", "typ" =>"nw", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"chi" => ["name" =>"Chinesisch", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"d" => ["name" =>"Deutsch", "wochenstunden" =>4, "profilfachWochenstunden" =>0, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>false, 'isSeminar' => true],
|
||||
"e" => ["name" =>"Englisch", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"eth" => ["name" =>"Ethik", "wochenstunden" =>2, "profilfachWochenstunden" =>0, "farbe" =>"gelb", "typ" =>"gw", "isProfilfach" =>false, 'isSeminar' => true],
|
||||
"ev" => ["name" =>"Religionslehre ev.", "wochenstunden" =>2, "profilfachWochenstunden" =>0, "farbe" =>"gelb", "typ" =>"gw", "isProfilfach" =>false, 'isSeminar' => true],
|
||||
"fmd" => ["name" =>"Film-/Mediendesign", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"gruen", "typ" =>"ae", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"fot" => ["name" =>"Fotographie", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"gruen", "typ" =>"ae", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"f" => ["name" =>"Französisch", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"fko" => ["name" =>"fremdspr. Konversation", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"g" => ["name" =>"Geschichte", "wochenstunden" =>2, "profilfachWochenstunden" =>0, "farbe" =>"gelb", "typ" =>"gw", "isProfilfach" =>false, 'isSeminar' => true],
|
||||
"g_sk" => ["name" =>"Geschichte mit Sozialkunde", "wochenstunden" =>3, "profilfachWochenstunden" =>0, "farbe" =>"gelb", "typ" =>"gw", "isProfilfach" =>false],
|
||||
"geo" => ["name" =>"Geographie", "wochenstunden" =>2, "profilfachWochenstunden" =>2, "farbe" =>"gelb", "typ" =>"gw", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"gel" => ["name" =>"Geologie", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"gelb", "typ" =>"gw", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"gr" => ["name" =>"Griechisch", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"hbr" => ["name" =>"Hebräisch", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"i_g" => ["name" =>"Instrument/Gesang", "wochenstunden" =>1, "profilfachWochenstunden" =>0, "farbe" =>"gruen", "typ" =>"ae", "isProfilfach" =>false],
|
||||
"inf" => ["name" =>"Informatik", "wochenstunden" =>3, "profilfachWochenstunden" =>3, "farbe" =>"blau", "typ" =>"nw", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"itl" => ["name" =>"Informationstechnol.", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"blau", "typ" =>"nw", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"ien" => ["name" =>"Instrumentalensemble", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"it" => ["name" =>"Italienisch", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"jap" => ["name" =>"Japanisch", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"ku" => ["name" =>"Kunst", "wochenstunden" =>2, "profilfachWochenstunden" =>2, "farbe" =>"gruen", "typ" =>"ae", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"kug" => ["name" =>"Kunstgeschichte", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"gruen", "typ" =>"ae", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"l" => ["name" =>"Latein", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"lin" => ["name" =>"Linguistik", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"lit" => ["name" =>"Literatur", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"mt" => ["name" =>"Mathematik", "wochenstunden" =>4, "profilfachWochenstunden" =>0, "farbe" =>"blau", "typ" =>"nw", "isProfilfach" =>false, 'isSeminar' => true],
|
||||
"mil" => ["name" =>"Mineralogie", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"blau", "typ" =>"nw", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"mu" => ["name" =>"Musik", "wochenstunden" =>2, "profilfachWochenstunden" =>2, "farbe" =>"gruen", "typ" =>"ae", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"ngr" => ["name" =>"Neugriechisch", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"ndl" => ["name" =>"Niederländisch", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"pad" => ["name" =>"Pädagogik", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"gelb", "typ" =>"gw", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"phi" => ["name" =>"Philosophie", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"gelb", "typ" =>"gw", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"ph" => ["name" =>"Physik", "wochenstunden" =>3, "profilfachWochenstunden" =>3, "farbe" =>"blau", "typ" =>"nw", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"pln" => ["name" =>"Polnisch", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"po" => ["name" =>"Portugiesisch", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"psy" => ["name" =>"Psychologie", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"gelb", "typ" =>"gw", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"prd" => ["name" =>"Produktdesign", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"rmt" => ["name" =>"reine Mathem.", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"blau", "typ" =>"nw", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"reli_eth" => ["name" =>"Religion/Ethik", "wochenstunden" =>2, "profilfachWochenstunden" =>0, "farbe" =>"gelb", "typ" =>"gw", "isProfilfach" =>false],
|
||||
"rk" => ["name" =>"Religionslehre kath.", "wochenstunden" =>2, "profilfachWochenstunden" =>0, "farbe" =>"gelb", "typ" =>"gw", "isProfilfach" =>false, 'isSeminar' => true],
|
||||
"rht" => ["name" =>"Rhetorik", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"ru" => ["name" =>"Russisch", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"sk" => ["name" =>"Sozialkunde", "wochenstunden" =>2, "profilfachWochenstunden" =>0, "farbe" =>"gelb", "typ" =>"gw", "isProfilfach" =>false, 'isSeminar' => true],
|
||||
"sp" => ["name" =>"Spanisch", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"spo" => ["name" =>"Sport", "wochenstunden" =>4, "profilfachWochenstunden" =>0, "farbe" =>"gruen", "typ" =>"ae", "isProfilfach" =>false, 'isSeminar' => true],
|
||||
"swa" => ["name" =>"Sozialwissenschaftliche Arbeitsfelder", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"gelb", "typ" =>"gw", "isProfilfach" =>false, 'isSeminar' => false, 'isWsgsSeminar' => true],
|
||||
"ts" => ["name" =>"Tschechisch", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"tue" => ["name" =>"Türkisch", "wochenstunden" =>4, "profilfachWochenstunden" =>3, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"tuf" => ["name" =>"Theater und Film", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"ven" => ["name" =>"Vokalensemble", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"wr" => ["name" =>"Wi. & Recht", "wochenstunden" =>2, "profilfachWochenstunden" =>2, "farbe" =>"gelb", "typ" =>"gw", "isProfilfach" =>true, 'isSeminar' => true],
|
||||
"wen" => ["name" =>"Wirschaftsengl.", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"orange", "typ" =>"sp", "isProfilfach" =>true, 'isSeminar' => false],
|
||||
"win" => ["name" =>"Wirtschaftsinformatik", "wochenstunden" =>4, "profilfachWochenstunden" =>2, "farbe" =>"gelb", "typ" =>"gw", "isProfilfach" =>false, 'isSeminar' => false, 'isWsgwSeminar' => true]
|
||||
];
|
||||
|
||||
function step1Action() {
|
||||
$planerSess = $this->sessionHandler->restoreFromSession($this->sessionKey);
|
||||
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($this->request);exit;
|
||||
if ($planerSess == null) {
|
||||
$planerSess = array('step1'=>array());
|
||||
}
|
||||
if ($this->request->getMethod() == 'POST') {
|
||||
$errors = array();
|
||||
|
||||
if ($this->request->hasArgument('gym_art')) {
|
||||
$planerSess['step1']['gym_art'] = $this->request->getArgument('gym_art');
|
||||
} else {
|
||||
$errors[] = 'Sie haben keine Ausbildungsrichtung gewählt';
|
||||
}
|
||||
if ($this->request->hasArgument('fs1') && isset($this->faecher[$this->request->getArgument('fs1')])) {
|
||||
$planerSess['step1']['fs1'] = $this->request->getArgument('fs1');
|
||||
} else {
|
||||
$errors[] = 'Sie haben keine 1. Fremdsprache ausgewählt';
|
||||
}
|
||||
if ($this->request->hasArgument('fs2') && isset($this->faecher[$this->request->getArgument('fs2')])) {
|
||||
$planerSess['step1']['fs2'] = $this->request->getArgument('fs2');
|
||||
} else {
|
||||
$errors[] = 'Sie haben keine 2. Fremdsprache ausgewählt';
|
||||
}
|
||||
if ($planerSess['step1']['gym_art'] == 'sg' && $this->request->hasArgument('fs3') && isset($this->faecher[$this->request->getArgument('fs3')])) {
|
||||
$planerSess['step1']['fs3'] = $this->request->getArgument('fs3');
|
||||
} elseif ($planerSess['step1']['gym_art'] == 'sg') {
|
||||
$errors[] = 'Sie haben keine 3. Fremdsprache ausgewählt';
|
||||
} elseif (isset($planerSess['step1']['fs3'])) {
|
||||
|
||||
}
|
||||
|
||||
if ($this->request->hasArgument('fs_spt') && isset($this->faecher[$this->request->getArgument('fs_spt')])) {
|
||||
$planerSess['step1']['fs_spt'] = $this->request->getArgument('fs_spt');
|
||||
} elseif (isset($planerSess['step1']['fs_spt'])) {
|
||||
unset($planerSess['step1']['fs_spt']);
|
||||
}
|
||||
if (/*$planerSess['step1']['gym_art'] == 'sg' && */$this->request->hasArgument('fs_ne_spt') && isset($this->faecher[$this->request->getArgument('fs_ne_spt')])) {
|
||||
$planerSess['step1']['fs_ne_spt'] = $this->request->getArgument('fs_ne_spt');
|
||||
} elseif (isset($planerSess['step1']['fs_ne_spt'])) {
|
||||
unset($planerSess['step1']['fs_ne_spt']);
|
||||
}
|
||||
|
||||
if ($this->request->hasArgument('fs1_bis_klasse')) {
|
||||
$planerSess['step1']['fs1_bis_klasse'] = $this->request->getArgument('fs1_bis_klasse');
|
||||
}
|
||||
if ($this->request->hasArgument('fs2_bis_klasse')) {
|
||||
$planerSess['step1']['fs2_bis_klasse'] = $this->request->getArgument('fs2_bis_klasse');
|
||||
}
|
||||
|
||||
if ($planerSess['step1']['fs1_bis_klasse'] != 9 && $planerSess['step1']['fs2_bis_klasse'] != 9) {
|
||||
unset($planerSess['step1']['fs_ne_spt']);
|
||||
}
|
||||
|
||||
if ($this->request->hasArgument('gym_autocomplete')) {
|
||||
$planerSess['step1']['gym_autocomplete'] = $this->request->getArgument('gym_autocomplete');
|
||||
if ($this->request->hasArgument('gym_autocomplete_selected_uid')) {
|
||||
$planerSess['step1']['gym_autocomplete_selected_uid'] = $this->request->getArgument('gym_autocomplete_selected_uid');
|
||||
}
|
||||
} elseif (!empty($planerSess['step1']['gym_autocomplete'])) {
|
||||
unset($planerSess['step1']['gym_autocomplete']);
|
||||
unset($planerSess['step1']['gym_autocomplete_selected_uid']);
|
||||
}
|
||||
|
||||
$this->sessionHandler->writeToSession($planerSess, $this->sessionKey);
|
||||
|
||||
if (count($errors) > 0) {
|
||||
$this->addFlashMessage(
|
||||
implode("<br>", $errors),
|
||||
$messageTitle = null,
|
||||
$severity = \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR,
|
||||
$storeInSession = TRUE
|
||||
);
|
||||
$this->redirect('step1');exit;
|
||||
}
|
||||
if ($planerSess['step1']['gym_art'] == 'wsgw' || $planerSess['step1']['gym_art'] == 'wsgs') {
|
||||
$this->redirect('step2');
|
||||
} else {
|
||||
$this->redirect('step3');
|
||||
}
|
||||
}
|
||||
$this->view->assign('data', $planerSess);
|
||||
}
|
||||
|
||||
function step2Action() {
|
||||
$data = $this->sessionHandler->restoreFromSession($this->sessionKey);
|
||||
if ($data == null || $data['step1']['gym_art'] == null) {
|
||||
$this->redirect('step1'); exit;
|
||||
}
|
||||
if ($this->request->getMethod() == 'POST') {
|
||||
if ($this->request->hasArgument('g_sk_trennung')) {
|
||||
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(boolval($this->request->getArgument('g_sk_trennung')));exit;
|
||||
// $data['step2']['g_sk_trennung'] = boolval($this->request->getArgument('g_sk_trennung')); // doesnt work @stage
|
||||
if (strtoupper($this->request->getArgument('g_sk_trennung')) == 'TRUE') {
|
||||
$data['step2']['g_sk_trennung'] = true;
|
||||
} else {
|
||||
$data['step2']['g_sk_trennung'] = false;
|
||||
}
|
||||
$this->sessionHandler->writeToSession($data, $this->sessionKey);
|
||||
$this->redirect('step3');exit;
|
||||
} else {
|
||||
$this->addFlashMessage(
|
||||
'Bitte geben Sie an, ob Sie dieses Pflichtfach als ein gemeinsames Fach (2+1 Wochenstunden) oder als zwei separate Fächer (je 2 Wochenstunden) belegen möchten',
|
||||
$messageTitle = null,
|
||||
$severity = \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR,
|
||||
$storeInSession = TRUE
|
||||
);
|
||||
$this->redirect('step2');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->assign('data', $data);
|
||||
}
|
||||
|
||||
function step3Action() {
|
||||
$data = $this->sessionHandler->restoreFromSession($this->sessionKey);
|
||||
if ($data == null || $data['step1']['gym_art'] == null) {
|
||||
$this->redirect('step1'); exit;
|
||||
}
|
||||
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($data);
|
||||
// Fremdsprachenauswahl
|
||||
$fsAuswahl = array(
|
||||
$data['step1']['fs1'] => $this->faecher[$data['step1']['fs1']]['name']
|
||||
);
|
||||
if (isset($data['step1']['fs2'])) {
|
||||
$fsAuswahl[$data['step1']['fs2']] = $this->faecher[$data['step1']['fs2']]['name'];
|
||||
}
|
||||
if ($data['step1']['gym_art'] == 'sg' && isset($data['step1']['fs3'])) {
|
||||
$fsAuswahl[$data['step1']['fs3']] = $this->faecher[$data['step1']['fs3']]['name'];
|
||||
}
|
||||
|
||||
if ($this->request->getMethod() == 'POST') {
|
||||
$isError = false;
|
||||
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($this->request->getArguments());
|
||||
if ($this->request->hasArgument('vorbelegung_fs1') && isset($this->faecher[$this->request->getArgument('vorbelegung_fs1')])) {
|
||||
$data['step3']['vorbelegung_fs1'] = $this->request->getArgument('vorbelegung_fs1');
|
||||
} else {
|
||||
$this->addFlashMessage(
|
||||
'Sie haben keine Fremdsprache ausgewählt',
|
||||
$messageTitle = null,
|
||||
$severity = \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR,
|
||||
$storeInSession = TRUE
|
||||
);
|
||||
$isError = true;
|
||||
}
|
||||
if ($this->request->hasArgument('vorbelegung_nw1') && isset($this->faecher[$this->request->getArgument('vorbelegung_nw1')])) {
|
||||
$data['step3']['vorbelegung_nw1'] = $this->request->getArgument('vorbelegung_nw1');
|
||||
} else {
|
||||
$this->addFlashMessage(
|
||||
'Sie haben keine Naturwissenschaft ausgewählt',
|
||||
$messageTitle = null,
|
||||
$severity = \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR,
|
||||
$storeInSession = TRUE
|
||||
);
|
||||
$isError = true;
|
||||
}
|
||||
if (!isset($data['step1']['fs_ne_spt'])) { // Nur bei nicht ausgewaehlten fs_ne_spt moeglich
|
||||
if ($this->request->hasArgument('vorbelegung_fs_nw') && isset($this->faecher[$this->request->getArgument('vorbelegung_fs_nw')])) {
|
||||
$data['step3']['vorbelegung_fs_nw'] = $this->request->getArgument('vorbelegung_fs_nw');
|
||||
} else {
|
||||
$this->addFlashMessage(
|
||||
'Sie haben keine zweite Sprache oder Naturwissenschaft ausgewählt',
|
||||
$messageTitle = null,
|
||||
$severity = \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR,
|
||||
$storeInSession = TRUE
|
||||
);
|
||||
$isError = true;
|
||||
}
|
||||
}
|
||||
if ($this->request->hasArgument('vorbelegung_geo_wr') && isset($this->faecher[$this->request->getArgument('vorbelegung_geo_wr')])) {
|
||||
$data['step3']['vorbelegung_geo_wr'] = $this->request->getArgument('vorbelegung_geo_wr');
|
||||
} else {
|
||||
$this->addFlashMessage(
|
||||
'Sie müssen Geographie oder Wirtschaft und Recht auswählen',
|
||||
$messageTitle = null,
|
||||
$severity = \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR,
|
||||
$storeInSession = TRUE
|
||||
);
|
||||
$isError = true;
|
||||
}
|
||||
if ($this->request->hasArgument('vorbelegung_ku_mu') && isset($this->faecher[$this->request->getArgument('vorbelegung_ku_mu')])) {
|
||||
$data['step3']['vorbelegung_ku_mu'] = $this->request->getArgument('vorbelegung_ku_mu');
|
||||
} else {
|
||||
$this->addFlashMessage(
|
||||
'Sie müssen Musik oder Kunst auswählen',
|
||||
$messageTitle = null,
|
||||
$severity = \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR,
|
||||
$storeInSession = TRUE
|
||||
);
|
||||
$isError = true;
|
||||
}
|
||||
if ($isError) {
|
||||
$this->view->assign('request', $this->request->getArguments());
|
||||
} else {
|
||||
$this->sessionHandler->writeToSession($data, $this->sessionKey);
|
||||
$this->redirect('step4'); exit;
|
||||
}
|
||||
} else {
|
||||
$this->view->assign('request', $data['step3']);
|
||||
}
|
||||
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($data);
|
||||
|
||||
if (!isset($data['step1']['fs_ne_spt'])) { // Auswahl nw2_fs2_inf bilden
|
||||
// Auswahl der Faecher
|
||||
$auswahl2 = $fsAuswahl;
|
||||
if (isset($data['step1']['fs_spt'])) {
|
||||
$auswahl2[$data['step1']['fs_spt']] = $this->faecher[$data['step1']['fs_spt']]['name'];
|
||||
}
|
||||
$auswahl2 = array_merge($auswahl2, array('b' => $this->faecher['b']['name'], 'c' => $this->faecher['c']['name'], 'ph' => $this->faecher['ph']['name']));
|
||||
if ($data['step1']['gym_art'] == 'ntg') {
|
||||
$auswahl2['inf'] = $this->faecher['inf']['name'];
|
||||
}
|
||||
|
||||
$nw2Faecher = []; // Daten fuer die nw2_fs2_inf-Faecher (fuer die Faerbung der SelectBox z.B.)
|
||||
foreach ($auswahl2 as $kuerzel => $fach) {
|
||||
$nw2Faecher[$kuerzel] = $this->faecher[$kuerzel];
|
||||
}
|
||||
$this->view->assign('auswahl2', $auswahl2);
|
||||
$this->view->assign('nw2Faecher', $nw2Faecher);
|
||||
$this->view->assign('nw2FaecherJson', json_encode($nw2Faecher));
|
||||
}
|
||||
|
||||
$this->view->assign('data', $data);
|
||||
$this->view->assign('fsAuswahl', $fsAuswahl);
|
||||
}
|
||||
|
||||
function step4Action() {
|
||||
$data = $this->sessionHandler->restoreFromSession($this->sessionKey);
|
||||
if ($data == null || $data['step1']['gym_art'] == null) {
|
||||
$this->redirect('step1'); exit;
|
||||
}
|
||||
|
||||
$wSeminarFaecher = $this->getWSeminarFaecher();
|
||||
$pSeminarFaecher = $this->getPSeminarFaecher($data['step1']['gym_art']);
|
||||
if ($this->request->getMethod() == 'POST') {
|
||||
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($this->request->getArguments());exit;
|
||||
if ($this->request->hasArgument('vorbelegung_seminar_w') && isset($wSeminarFaecher[$this->request->getArgument('vorbelegung_seminar_w')])) {
|
||||
$data['step4']['vorbelegung_seminar_w'] = $this->request->getArgument('vorbelegung_seminar_w');
|
||||
} else {
|
||||
$this->addFlashMessage(
|
||||
'Sie müssen ein W-Seminarfach auswählen',
|
||||
$messageTitle = null,
|
||||
$severity = \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR,
|
||||
$storeInSession = TRUE
|
||||
);
|
||||
$isError = true;
|
||||
}
|
||||
|
||||
if ($this->request->hasArgument('vorbelegung_seminar_p') && isset($pSeminarFaecher[$this->request->getArgument('vorbelegung_seminar_p')])) {
|
||||
$data['step4']['vorbelegung_seminar_p'] = $this->request->getArgument('vorbelegung_seminar_p');
|
||||
} else {
|
||||
$this->addFlashMessage(
|
||||
'Sie müssen ein P-Seminarfach auswählen',
|
||||
$messageTitle = null,
|
||||
$severity = \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR,
|
||||
$storeInSession = TRUE
|
||||
);
|
||||
$isError = true;
|
||||
}
|
||||
if ($isError) {
|
||||
$this->view->assign('request', $this->request->getArguments());
|
||||
} else {
|
||||
$this->sessionHandler->writeToSession($data, $this->sessionKey);
|
||||
$this->redirect('step5'); exit;
|
||||
}
|
||||
}
|
||||
|
||||
$wOptions = array();
|
||||
foreach ($wSeminarFaecher as $kuerzel => $fach) {
|
||||
$wOptions[$kuerzel] = $fach['name'];
|
||||
}
|
||||
$this->view->assign('wSeminarOptions', $wOptions);
|
||||
$this->view->assign('wSeminarFaecherJson', json_encode($wSeminarFaecher));
|
||||
$pOptions = array();
|
||||
foreach ($pSeminarFaecher as $kuerzel => $fach) {
|
||||
$pOptions[$kuerzel] = $fach['name'];
|
||||
}
|
||||
$this->view->assign('pSeminarOptions', $pOptions);
|
||||
$this->view->assign('pSeminarFaecherJson', json_encode($pSeminarFaecher));
|
||||
$this->view->assign('data', $data);
|
||||
}
|
||||
|
||||
function step5Action() {
|
||||
$data = $this->sessionHandler->restoreFromSession($this->sessionKey);
|
||||
if ($data == null || $data['step1']['gym_art'] == null) {
|
||||
$this->redirect('step1'); exit;
|
||||
}
|
||||
|
||||
// Fremdsprachenauswahl
|
||||
$fsAuswahl = array(
|
||||
$data['step1']['fs1'] => $this->faecher[$data['step1']['fs1']]['name']
|
||||
);
|
||||
if (isset($data['step1']['fs2'])) {
|
||||
$fsAuswahl[$data['step1']['fs2']] = $this->faecher[$data['step1']['fs2']]['name'];
|
||||
}
|
||||
if (isset($data['step1']['fs3'])) {
|
||||
$fsAuswahl[$data['step1']['fs3']] = $this->faecher[$data['step1']['fs3']]['name'];
|
||||
}
|
||||
|
||||
if (!isset($data['step1']['fs_ne_spt'])) {
|
||||
// Auswahl der Faecher
|
||||
$auswahl2 = $fsAuswahl;
|
||||
if (isset($data['step1']['fs_spt'])) {
|
||||
$auswahl2[$data['step1']['fs_spt']] = $this->faecher[$data['step1']['fs_spt']]['name'];
|
||||
}
|
||||
$auswahl2 = array_merge($auswahl2, array('b' => $this->faecher['b']['name'], 'c' => $this->faecher['c']['name'], 'ph' => $this->faecher['ph']['name']));
|
||||
if ($data['step1']['gym_art'] == 'ntg') {
|
||||
$auswahl2['inf'] = $this->faecher['inf']['name'];
|
||||
}
|
||||
$this->view->assign('auswahl2', $auswahl2);
|
||||
}
|
||||
|
||||
$wSeminarFaecher = $this->getWSeminarFaecher();
|
||||
$wSeminarOptions = array();
|
||||
foreach ($wSeminarFaecher as $kuerzel => $fach) {
|
||||
$wSeminarOptions[$kuerzel] = $fach['name'];
|
||||
}
|
||||
$pSeminarFaecher = $this->getPSeminarFaecher($data['step1']['gym_art']);
|
||||
$pSeminarOptions = array();
|
||||
foreach ($pSeminarFaecher as $kuerzel => $fach) {
|
||||
$pSeminarOptions[$kuerzel] = $fach['name'];
|
||||
}
|
||||
|
||||
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($data['step1']['gym_art']);
|
||||
if ($data['step1']['gym_art'] == 'wsgs') {
|
||||
$this->faecher['swa']['isProfilfach'] = true;
|
||||
}
|
||||
if ($data['step1']['gym_art'] == 'wsgw') {
|
||||
$this->faecher['win']['isProfilfach'] = true;
|
||||
}
|
||||
|
||||
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($this->faecher);exit;
|
||||
|
||||
$this->view->assign('data', $data);
|
||||
$this->view->assign('fsAuswahl', $fsAuswahl);
|
||||
$this->view->assign('faecher', $this->faecher);
|
||||
$this->view->assign('wSeminarOptions', $wSeminarOptions);
|
||||
$this->view->assign('pSeminarOptions', $pSeminarOptions);
|
||||
$this->view->assign('faecherJson', json_encode($this->faecher));
|
||||
}
|
||||
|
||||
public function pdfAction()
|
||||
{
|
||||
$data = $this->sessionHandler->restoreFromSession($this->sessionKey);
|
||||
if ($data == null || $data['step1']['gym_art'] == null) {
|
||||
$this->redirect('step1'); exit;
|
||||
}
|
||||
|
||||
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($this->request->getArguments());exit;
|
||||
|
||||
$extKey = $this->request->getControllerExtensionKey();
|
||||
|
||||
$pdf = new Pdf('P', 'cm', 'A4', true, 'UTF-8', false);
|
||||
// $pdf = new Pdf(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:if_oberstufenplaner/Resources/Public/pdf/maxim.pdf'));
|
||||
$pdf->configureFonts('typo3conf/ext/' . $extKey . '/Classes/PDF/Fonts/');
|
||||
$pdf->SetPrintHeader(true);
|
||||
$pdf->SetPrintFooter(true);
|
||||
$pdf->SetMargins(0, 0, 5);
|
||||
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($this->request->getArgument('faecher'));exit;
|
||||
// add a page
|
||||
$pdf->AddPage();
|
||||
|
||||
// $pdf->Image($GLOBALS['TSFE']->baseUrl . 'fileadmin/templates/img/wappen_weiss.jpg', 5, 5 , 4, 4, 'JPG', '', '', false, 72); // Angaben in cm
|
||||
//
|
||||
$pdf->pdfDrawFaecherTitel('Pflichtfächer:');
|
||||
//
|
||||
if ($this->request->hasArgument('faecher') && is_array($this->request->getArgument('faecher'))) {
|
||||
$faecherPost = (array)$this->request->getArgument('faecher');
|
||||
if ($this->request->hasArgument('profilfaecher') && is_array($this->request->getArgument('profilfaecher'))) {
|
||||
$profilfaecherPost = (array)$this->request->getArgument('profilfaecher');
|
||||
} else {
|
||||
$profilfaecherPost = [];
|
||||
}
|
||||
if ($this->request->hasArgument('xfaecher') && is_array($this->request->getArgument('xfaecher'))) {
|
||||
$xfaecherPost = (array)$this->request->getArgument('xfaecher');
|
||||
} else {
|
||||
$xfaecherPost = [];
|
||||
}
|
||||
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($xfaecherPost);exit;
|
||||
|
||||
foreach ($faecherPost as $fieldName => $fachKuerzel) {
|
||||
if (isset($this->faecher[$fachKuerzel])) {
|
||||
if (
|
||||
$fachKuerzel == 'g_sk' && $data['step2']['g_sk_trennung'] == true ||
|
||||
($fachKuerzel == 'g' || $fachKuerzel == 'sk') && $data['step2']['g_sk_trennung'] == false
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fach = $this->fachFromStep5Post($fieldName, $fachKuerzel);
|
||||
$pdf->pdfDrawFachLine($fach);
|
||||
}
|
||||
}
|
||||
|
||||
$pdf->pdfDrawFaecherTitel('Seminare:');
|
||||
|
||||
// Seminare
|
||||
foreach (['seminar_w', 'seminar_p'] as $fieldName) {
|
||||
$fachKuerzel = $this->request->getArgument($fieldName);
|
||||
if (isset($this->faecher[$fachKuerzel])) {
|
||||
$fach = $this->fachFromStep5Post($fieldName, $fachKuerzel);
|
||||
$pdf->pdfDrawFachLine($fach);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($profilfaecherPost) > 0 || count($xfaecherPost) > 0) {
|
||||
$pdf->pdfDrawFaecherTitel('Profilfächer:');
|
||||
|
||||
foreach ($profilfaecherPost as $fieldName => $fachKuerzel) {
|
||||
if (isset($this->faecher[$fachKuerzel])) {
|
||||
$fach = $this->fachFromStep5Post($fieldName, $fachKuerzel);
|
||||
$pdf->pdfDrawFachLine($fach);
|
||||
}
|
||||
}
|
||||
foreach ($xfaecherPost as $fieldName => $fachKuerzel) {
|
||||
if (isset($this->faecher[$fachKuerzel])) {
|
||||
$fach = $this->fachFromStep5Post($fieldName, $fachKuerzel);
|
||||
$pdf->pdfDrawFachLine($fach);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pdf->Output('Planer_test.pdf', 'I');exit;
|
||||
}
|
||||
|
||||
public function schuleAutosuggestionAction() {
|
||||
if (!$this->request->hasArgument('query') || empty($this->request->getArgument('query'))) {
|
||||
echo '[]';exit;
|
||||
}
|
||||
$list = $this->schuleRepository->searchBy($this->request->getArgument('query'), 10);
|
||||
$out = [];
|
||||
/** @var Schule $row */
|
||||
foreach ($list as $row) {
|
||||
$out[] = ['uid' => $row->getUid(), 'name' => $row->getName()];
|
||||
}
|
||||
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($list);exit;
|
||||
echo json_encode($out);exit;
|
||||
}
|
||||
|
||||
public function schuleAutosuggestionSelectedAction() {
|
||||
if (!$this->request->hasArgument('schule') || empty($this->request->getArgument('schule'))) {
|
||||
echo '[]';exit;
|
||||
}
|
||||
$list = $this->schuleRepository->findTypenBySchulnummer($this->request->getArgument('schule'));
|
||||
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($list);exit;
|
||||
echo json_encode($list);exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $fieldName
|
||||
* @param $fachKuerzel
|
||||
* @return Fach
|
||||
*/
|
||||
protected function fachFromStep5Post($fieldName, $fachKuerzel) {
|
||||
|
||||
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($this->request);exit;
|
||||
|
||||
$pruefungenPost = (array)$this->request->getArgument('pruefung');
|
||||
$halbjlstPost = (array)$this->request->getArgument('halbjahre');
|
||||
$wst11Post = (array)$this->request->getArgument('wochenstunden_11');
|
||||
$wst12Post = (array)$this->request->getArgument('wochenstunden_12');
|
||||
$jwstPost = (array)$this->request->getArgument('jahreswochenstunden');
|
||||
|
||||
$fach = new Fach();
|
||||
$fach->setName($this->faecher[$fachKuerzel]['name'])
|
||||
->setTyp($this->faecher[$fachKuerzel]['typ'])
|
||||
->setRgbColor($this->faecher[$fachKuerzel]['farbe']);
|
||||
if (isset($pruefungenPost[$fieldName])) {
|
||||
$fach->setPruefung($pruefungenPost[$fieldName]);
|
||||
}
|
||||
if (isset($halbjlstPost[$fieldName])) {
|
||||
$fach->setHalbjahresleistungen($halbjlstPost[$fieldName]);
|
||||
}
|
||||
if (isset($wst11Post[$fieldName])) {
|
||||
$fach->setWochenStunden11($wst11Post[$fieldName]);
|
||||
}
|
||||
if (isset($wst12Post[$fieldName])) {
|
||||
$fach->setWochenStunden12($wst12Post[$fieldName]);
|
||||
}
|
||||
if (isset($jwstPost[$fieldName])) {
|
||||
$fach->setJahreswochenstunden($jwstPost[$fieldName]);
|
||||
}
|
||||
return $fach;
|
||||
}
|
||||
|
||||
public function getWSeminarFaecher() {
|
||||
$seminarFaecher = array();
|
||||
foreach($this->faecher as $kuerzel => $fach) {
|
||||
if (isset($fach['isSeminar']) && $fach['isSeminar'] == true) {
|
||||
$seminarFaecher[$kuerzel] = $fach;
|
||||
}
|
||||
}
|
||||
return $seminarFaecher;
|
||||
}
|
||||
|
||||
public function getPSeminarFaecher($gymArt) {
|
||||
$seminarFaecher = array();
|
||||
foreach($this->faecher as $kuerzel => $fach) {
|
||||
if (isset($fach['isSeminar']) && $fach['isSeminar'] == true ||
|
||||
($gymArt == 'wsgw' && isset($fach['isWsgwSeminar']) && $fach['isWsgwSeminar'] == true) ||
|
||||
($gymArt == 'wsgs' && isset($fach['isWsgsSeminar']) && $fach['isWsgsSeminar'] == true)) {
|
||||
$seminarFaecher[$kuerzel] = $fach;
|
||||
}
|
||||
}
|
||||
return $seminarFaecher;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param SessionHandler $sessionHandler
|
||||
*/
|
||||
public function injectSessionHandler(SessionHandler $sessionHandler) {
|
||||
$this->sessionHandler = $sessionHandler;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user