Initial commit

This commit is contained in:
2018-04-02 08:07:38 +02:00
commit 7330c1ed3e
2054 changed files with 405203 additions and 0 deletions

View File

@@ -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;
}
}

View File

@@ -0,0 +1,199 @@
<?php
namespace Internetfabrik\IfOberstufenplaner\Domain\Model;
class Fach
{
/**
* @var string
*/
protected $name;
/**
* @var string
*/
protected $typ;
/**
* @var int
*/
protected $wochenStunden11;
/**
* @var int
*/
protected $wochenStunden12;
/**
* @var int
*/
protected $jahreswochenstunden;
/**
* @var int
*/
protected $halbjahresleistungen;
/**
* @var string
*/
protected $pruefung = null;
/**
* @var string
*/
protected $rgbColor;
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
* @return Fach
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function getTyp()
{
return $this->typ;
}
/**
* @param string $typ
* @return Fach
*/
public function setTyp($typ)
{
$this->typ = $typ;
return $this;
}
/**
* @return int
*/
public function getWochenStunden11()
{
return $this->wochenStunden11;
}
/**
* @param int $wochenStunden11
* @return Fach
*/
public function setWochenStunden11($wochenStunden11)
{
$this->wochenStunden11 = $wochenStunden11;
return $this;
}
/**
* @return int
*/
public function getWochenStunden12()
{
return $this->wochenStunden12;
}
/**
* @param int $wochenStunden12
* @return Fach
*/
public function setWochenStunden12($wochenStunden12)
{
$this->wochenStunden12 = $wochenStunden12;
return $this;
}
/**
* @return int
*/
public function getJahreswochenstunden()
{
return $this->jahreswochenstunden;
}
/**
* @param int $jahreswochenstunden
* @return Fach
*/
public function setJahreswochenstunden($jahreswochenstunden)
{
$this->jahreswochenstunden = $jahreswochenstunden;
return $this;
}
/**
* @return int
*/
public function getHalbjahresleistungen()
{
return $this->halbjahresleistungen;
}
/**
* @param int $halbjahresleistungen
* @return Fach
*/
public function setHalbjahresleistungen($halbjahresleistungen)
{
$this->halbjahresleistungen = $halbjahresleistungen;
return $this;
}
/**
* @return string
*/
public function getPruefung()
{
return $this->pruefung;
}
/**
* @param string $pruefung
* @return Fach
*/
public function setPruefung($pruefung)
{
$this->pruefung = $pruefung;
return $this;
}
/**
* @return string
*/
public function getRgbColor()
{
return $this->rgbColor;
}
/**
* @param string $rgbColor
* @return Fach
*/
public function setRgbColor($rgbColor)
{
if ($rgbColor == 'gelb') {
$rgbColor = array(255, 193, 7);
} elseif ($rgbColor == 'gruen') {
$rgbColor = array(75, 175, 79);
} elseif ($rgbColor == 'blau') {
$rgbColor = array(0, 142, 205);
} elseif ($rgbColor == 'orange') {
$rgbColor = array(255, 87, 34);
}
$this->rgbColor = $rgbColor;
return $this;
}
}

View File

@@ -0,0 +1,104 @@
<?php
namespace Internetfabrik\IfOberstufenplaner\Domain\Model;
class Schule extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* name
*
* @var string
*/
protected $name;
/**
* name2
*
* @var string
*/
protected $name2;
/**
* comments
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Internetfabrik\IfOberstufenplaner\Domain\Model\SchuleRef>
* @cascade remove
* @lazy
*/
protected $refs = NULL;
/**
* __construct
*/
public function __construct() {
//Do not remove the next line: It would break the functionality
$this->initStorageObjects();
}
/**
* Initializes all ObjectStorage properties
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*
* @return void
*/
protected function initStorageObjects() {
$this->refs = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
* @return Schule
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function getName2()
{
return $this->name2;
}
/**
* @param string $name2
* @return Schule
*/
public function setName2($name2)
{
$this->name2 = $name2;
return $this;
}
/**
* Returns the refs
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Internetfabrik\IfOberstufenplaner\Domain\Model\SchuleRef> $refs
*/
public function getRefs() {
return $this->refs;
}
/**
* Sets the refs
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Internetfabrik\IfOberstufenplaner\Domain\Model\SchuleRef> $refs
* @return void
*/
public function setComments(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $refs) {
$this->refs = $refs;
}
}

View File

@@ -0,0 +1,68 @@
<?php
namespace Internetfabrik\IfOberstufenplaner\Domain\Repository;
/***************************************************************
*
* Copyright notice
*
* (c) 2015 Johann Gammel <support@jcmedia.de>, JC Media Internetagentur GmbH
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* The repository for Entries
*/
class SchuleRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
/**
* @param string $searchText
* @param int $limit
* @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
*/
public function searchBy($searchText, $limit = -1) {
$query = $this->createQuery();
$query->matching(
$query->logicalOr(
$query->like('uid', '%'.$searchText.'%'),
$query->like('name', '%'.$searchText.'%')
)
);
if ($limit != -1) {
$query->setLimit($limit);
}
return $query->execute();
}
public function findTypenBySchulnummer($nummer) {
$query = $this->createQuery();
$query->statement("SELECT typ.* FROM tx_ifoberstufenplaner_domain_model_schuletyp typ
LEFT JOIN tx_ifoberstufenplaner_domain_model_schuleref ref
ON typ.Schulgliederung=ref.SchulGl
WHERE ref.GLSchnr = ".intval($nummer)/*,
[$nummer]*/
);
// $query->setLimit(99);
// $query->getQuerySettings()->setReturnRawQueryResult(TRUE);
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($query);exit;
return $query->execute(true);
}
}

View File

@@ -0,0 +1,146 @@
<?php
namespace Internetfabrik\IfOberstufenplaner\PDF;
use HeikoHardt\HhdevFpdi\Fpdi;
use Internetfabrik\IfOberstufenplaner\Domain\Model\Fach;
use TYPO3\CMS\Core\Utility\GeneralUtility;
include_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('t3_tcpdf').'/tcpdf/tcpdf.php');
include_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('t3_tcpdf').'/tcpdf/tcpdf_import.php');
//include_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('hhdev_fpdi').'/Classes/fpdi.php');
/**
* Class Pdf
* @package Internetfabrik\IfOberstufenplaner\PDF
* @{@inheritdoc}
*/
class Pdf extends \TCPDF {
protected $customFonts = array();
protected $extFontPath;
protected $cellmarginLeft = 2;
protected $currentX = 0;
protected $currentY = 5;
protected $lineHeight = 0.6;
protected $marginX = 0.075;
protected $marginY = 0.075;
protected $nameCellWidth = 6;
protected $dataCellWidth = 2;
protected $tableTitleFontSize = 8;
protected $tableCellFontSize = 10;
protected $footerText = 'Der Fächerplaner versucht, Ihre Auswahl durch Hinweise und automatische Eingrenzung der Auwahlmöglichkeiten bestmöglich zu unterstützen. Trotzdem kann keine Garantie übernommen werden, dass die von Ihnen getroffene Wahl zulässig oder an Ihrer Schule möglich ist. Er ersetzt nicht die schulspezifische Information bzw. die Regelungen in der Schulordnung für die Gymnasien in Bayern (GSO).
Bitte beachten Sie, dass keine Schule in der Lage ist, alle Fächer des Wahlpflicht- bzw. des Profilbereichs anzubieten. Auch das Seminarangebot orientiert sich an den Möglichkeiten bzw. den Schwerpunktsetzungen des einzelnen Gymnasiums. Die Schulen treffen daher eine Auswahl, stellen diese zur Wahl und richten die durch ausreichendes Wahlinteresse gesicherten Kurse und Seminare ein.
Bei Fragen hilft Ihnen der Oberstufenkoordinator Ihrer Schule gerne weiter.';
//// public function __construct($orientation='P', $unit='mm', $format='A4', $unicode=true, $encoding='UTF-8', $diskcache=false, $pdfa=false)
// public function __construct($file)
// {
// parent::__construct();
////// $pageCount = $this->setSourceFile(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:if_oberstufenplaner/Resources/Public/pdf/maxim.pdf'));
////// $tplIdx = $this->importPage(1);
////// $this->addPage();
////// $this->useTemplate($tplIdx, 10, 10, 90);
//// parent::__construct(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:if_oberstufenplaner/Resources/Public/pdf/maxim.pdf'));
//// $this->importPDF($file);
// }
public function configureFonts($extFontPath) {
$this->customFonts['openSansRegularFont'] = \TCPDF_FONTS::addTTFfont(GeneralUtility::getFileAbsFileName($extFontPath.'OpenSans-Regular.ttf'));
}
public function getCustomFont($name) {
if (isset($this->customFonts[$name])) {
return $this->customFonts[$name];
}
throw new \Exception('Font '.$name.' not found');
}
public function pdfDrawFaecherTitel($title) {
$this->SetFont($this->getCustomFont('openSansRegularFont'), '', $this->tableTitleFontSize);
$this->currentX = 0;
$this->SetTextColor(0, 0, 0);
$this->SetFillColor(255, 255, 255);
$this->setCellMargins($this->cellmarginLeft);
$this->MultiCell($this->nameCellWidth, $this->lineHeight*2, $title, 0, 'L', false, 0, $this->currentX, $this->currentY);
$this->currentX += ($this->nameCellWidth + $this->marginX);
$this->MultiCell($this->dataCellWidth*2+$this->marginX, $this->lineHeight, 'Wochenstunden', 0, 'C', false, 0, $this->currentX, $this->currentY);
$this->MultiCell($this->dataCellWidth+$this->marginX, $this->lineHeight, '11', 0, 'C', false, 0, $this->currentX, $this->currentY+($this->lineHeight+$this->marginY));
$this->MultiCell($this->dataCellWidth+$this->marginX, $this->lineHeight, '12', 0, 'C', false, 0, ($this->currentX+$this->dataCellWidth+$this->marginX), ($this->currentY+($this->lineHeight+$this->marginY)));
$this->currentX += ($this->dataCellWidth + $this->marginX)*2;
$this->MultiCell($this->dataCellWidth, $this->lineHeight*2, "Jahres-\nWochenstd.", 0, 'C', false, 0, $this->currentX, $this->currentY);
$this->currentX += ($this->dataCellWidth + $this->marginX);
$this->MultiCell($this->dataCellWidth, $this->lineHeight*2, "Einbringung\nHalbjahre", 0, 'C', false, 0, $this->currentX, $this->currentY);
$this->currentX += ($this->dataCellWidth + $this->marginX);
$this->MultiCell($this->dataCellWidth, $this->lineHeight*2, "Abitur-\nPrüfungsfach", 0, 'C', false, 0, $this->currentX, $this->currentY);
$this->currentY += ($this->lineHeight+$this->marginY)*2;
$this->SetY($this->currentY);
}
public function pdfDrawFachLine(Fach $fach) {
$this->SetFont($this->getCustomFont('openSansRegularFont'), '', $this->tableCellFontSize);
$this->currentX = 0;
$this->SetTextColor(0, 0, 0);
// list($col1, $col2, $col3) = $fach->getRgbColor();
// $this->SetFillColor($col1, $col2, $col3);
$fillColor1 = array(217, 217, 217);
$fillColor2 = array(238, 238, 238);
$this->setCellMargins($this->cellmarginLeft);
$this->SetX($this->currentX);
$this->SetY($this->currentY);
$this->SetFillColor($fillColor1[0], $fillColor1[1], $fillColor1[2]);
$this->Cell($this->nameCellWidth, $this->lineHeight, $fach->getName(), 0, 0, 'L', true);
$this->currentX += ($this->nameCellWidth + $this->marginX); $this->setX($this->currentX);
$this->SetFillColor($fillColor2[0], $fillColor2[1], $fillColor2[2]);
$this->Cell($this->dataCellWidth, $this->lineHeight, $fach->getWochenStunden11(), 0, 0, 'C', true);
$this->currentX += ($this->dataCellWidth + $this->marginX); $this->setX($this->currentX);
$this->Cell($this->dataCellWidth, $this->lineHeight, $fach->getWochenStunden12(), 0, 0, 'C', true);
$this->currentX += ($this->dataCellWidth + $this->marginX); $this->setX($this->currentX);
$this->Cell($this->dataCellWidth, $this->lineHeight, $fach->getJahreswochenstunden(), 0, 0, 'C', true);
$this->currentX += ($this->dataCellWidth + $this->marginX); $this->setX($this->currentX);
$this->Cell($this->dataCellWidth, $this->lineHeight, $fach->getHalbjahresleistungen(), 0, 0, 'C', true);
$this->currentX += ($this->dataCellWidth + $this->marginX); $this->setX($this->currentX);
$this->Cell($this->dataCellWidth, $this->lineHeight, strtoupper($fach->getPruefung()), 0, 0, 'C', true);
$this->currentY += ($this->lineHeight+$this->marginY);
$this->SetY($this->currentY);
}
function Header() {
if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1') {
$this->Image(PATH_site . 'fileadmin/templates/faecherplaner/img/wappen-ministerium.png', 3, 1, 16, 2.11, 'PNG', '', '', true); // Angaben in cm
// $this->Image($GLOBALS['TSFE']->baseUrl . 'fileadmin/templates/faecherplaner/img/wappen-ministerium.png', 3, 0, 16, 2.11, 'PNG', '', '', true); // Angaben in cm
} else {
// $this->Image($GLOBALS['TSFE']->baseUrl . 'fileadmin/templates/img/wappen-ministerium.png', 3, 1, 16, 2.11, 'PNG', '', '', true); // Angaben in cm
$this->Image(PATH_site . 'fileadmin/templates/img/wappen-ministerium.png', 3, 1, 16, 2.11, 'PNG', '', '', true); // Angaben in cm
}
}
function Footer() {
$lineHeight = 0.4;
$footerHeight = 3.8;
//left
$this->SetXY(1.25, -$footerHeight);
$this->SetTextColor(0, 0, 0);
$this->SetFont($this->getCustomFont('openSansRegularFont'),'',8);
$this->MultiCell(21-(1.25*2), $lineHeight, $this->footerText, 0, 'L', false, 0); $this->SetX(1.25);
// $this->MultiCell(20, $lineHeight, $this->footerText, 0, 1, 'L', false); $this->SetX(1.25);
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace Internetfabrik\IfOberstufenplaner\Service;
class SessionHandler implements \TYPO3\CMS\Core\SingletonInterface {
private $prefixKey = 'if_oberstufenplaner_';
/**
* Returns the object stored in the user´s PHP session
* @return Object the stored object
*/
public function restoreFromSession($key) {
$sessionData = $GLOBALS['TSFE']->fe_user->getKey('ses', $this->prefixKey . $key);
return unserialize($sessionData);
}
/**
* Writes an object into the PHP session
* @param $object
* @param string
* @return SessionHandler this
*/
public function writeToSession($object, $key) {
$sessionData = serialize($object);
$GLOBALS['TSFE']->fe_user->setKey('ses', $this->prefixKey . $key, $sessionData);
$GLOBALS['TSFE']->fe_user->storeSessionData();
return $this;
}
/**
* Cleans up the session: removes the stored object from the PHP session
* @return SessionHandler this
*/
public function cleanUpSession($key) {
$GLOBALS['TSFE']->fe_user->setKey('ses', $this->prefixKey . $key, NULL);
$GLOBALS['TSFE']->fe_user->storeSessionData();
return $this;
}
public function setPrefixKey($prefixKey) {
$this->prefixKey = $prefixKey;
}
}
?>

View File

@@ -0,0 +1,23 @@
<?php
namespace Internetfabrik\IfOberstufenplaner\ViewHelpers;
class DispViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
/**
* @param $obj object Object
* @param $prop string Property
* @return mixed
*/
public function render($obj,$prop) {
if (is_object($obj)) {
return $obj->$prop;
} elseif (is_array($obj)) {
if (array_key_exists($prop, $obj)) {
return $obj[$prop];
}
}
return NULL;
}
}