|
@@ -1534,6 +1534,97 @@ class TCEMainHook
|
|
|
}
|
|
}
|
|
|
$subs[] = $sub;
|
|
$subs[] = $sub;
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case "mrm_be_cm_extra_infosbox_prefilled":
|
|
|
|
|
+ $type = "typo3_extrainfosbox_prefilled";
|
|
|
|
|
+ $open = $flex["isInitialyOpen"] == "0" ? true : false;
|
|
|
|
|
+ $headline = $flex['headline'];
|
|
|
|
|
+ $elements = [];
|
|
|
|
|
+
|
|
|
|
|
+ $sub = $this->createContentElement(
|
|
|
|
|
+ $type,
|
|
|
|
|
+ array("open" => $open, "noAutoOpen" => $flex["noAutoOpen"] == 1),
|
|
|
|
|
+ array("headline" => $flex["headline"])
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ if ($flex["image"] == "1") {
|
|
|
|
|
+ $props = $this->processImagesTTContent($dbReference, "mrm_be_cm_contentimage")[0];
|
|
|
|
|
+ $props["type"] = "typo3_content";
|
|
|
|
|
+ $sub["subElements"][] = $this->createContentElement("image", $props);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ switch ($flex["icon"]) {
|
|
|
|
|
+ case "1":
|
|
|
|
|
+ $sub["attributes"]["icon"] = "stadtinfo_basics";
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "2":
|
|
|
|
|
+ $sub["attributes"]["icon"] = "geschichte";
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "3":
|
|
|
|
|
+ $sub["attributes"]["icon"] = "kultur_freizeit";
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "4":
|
|
|
|
|
+ $sub["attributes"]["icon"] = "besonderheiten";
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "5":
|
|
|
|
|
+ $sub["attributes"]["icon"] = "kosten_geld";
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "6":
|
|
|
|
|
+ $sub["attributes"]["icon"] = "hochschulen";
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "7":
|
|
|
|
|
+ $sub["attributes"]["icon"] = "studieren";
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $cleaned = [];
|
|
|
|
|
+ $keys = ["healine", "image", "icon", "isInitialyOpen", "noAutoOpen"];
|
|
|
|
|
+
|
|
|
|
|
+ foreach ($keys as $k) {
|
|
|
|
|
+ unset($k);
|
|
|
|
|
+ }
|
|
|
|
|
+ foreach ($flex as $key => $val) {
|
|
|
|
|
+ if (strpos($key, 'headline') != false) {
|
|
|
|
|
+ $new_value = str_replace('headline', '', $key);
|
|
|
|
|
+ if (array_key_exists($new_value, $cleaned)) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $cleaned[$new_value]['headline'] = $val;
|
|
|
|
|
+ }
|
|
|
|
|
+ } elseif (strpos($key, 'text') != false) {
|
|
|
|
|
+ $new_value = str_replace('text', '', $key);
|
|
|
|
|
+ if (!array_key_exists($new_value, $cleaned)) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $cleaned[$new_value]['text'] = $val;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ elseif (strpos($key, 'url') != false) {
|
|
|
|
|
+ $new_value = str_replace('url', '', $key);
|
|
|
|
|
+ if (!array_key_exists($new_value, $cleaned)) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $cleaned[$new_value]['url'] = $val;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ foreach($cleaned as $k => $val) {
|
|
|
|
|
+ foreach($val as $field) {
|
|
|
|
|
+ if(empty($field)) unset($cleaned[$k]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ foreach($cleaned as $key => $value) {
|
|
|
|
|
+ $box = $this->createContentElement("boxwrapper");
|
|
|
|
|
+ $box["subElements"] = array_merge($box["subElements"], $this->checkText($value['headline'], $dbReference, $processedData, "h3"));
|
|
|
|
|
+ $box["subElements"] = array_merge($box["subElements"], $this->checkText($value['text'], $dbReference, $processedData, "typo3_paragraph"));
|
|
|
|
|
+ $box["subElements"] = array_merge($box["subElements"], $this->checkText($value['url'], $dbReference, $processedData, "link"));
|
|
|
|
|
+ $elements[] = $box;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $sub["subElements"] = array_merge($sub["subElements"], $elements);
|
|
|
|
|
+ $subs[] = $sub;
|
|
|
|
|
+ break;
|
|
|
case "mrm_be_cm_foldout":
|
|
case "mrm_be_cm_foldout":
|
|
|
$sub = $this->createContentElement("typo3_foldout", array("open" => $flex["isInitialyOpen"] == "1", "noAutoOpen" => $flex["noAutoOpen"] == "1"), array("headline" => $flex["headline"]), array());
|
|
$sub = $this->createContentElement("typo3_foldout", array("open" => $flex["isInitialyOpen"] == "1", "noAutoOpen" => $flex["noAutoOpen"] == "1"), array("headline" => $flex["headline"]), array());
|
|
|
|
|
|
|
@@ -1805,130 +1896,130 @@ class TCEMainHook
|
|
|
|
|
|
|
|
case "mrm_be_cm_interviewantwort":
|
|
case "mrm_be_cm_interviewantwort":
|
|
|
$props['lang'] = $flex['lang'] ?? '';
|
|
$props['lang'] = $flex['lang'] ?? '';
|
|
|
- $subs[] = $this->createContentElement("interviewantwort", $props, array("interviewee" => trim($flex['interviewee']),"answer" => trim($flex['answer'])));
|
|
|
|
|
|
|
+ $subs[] = $this->createContentElement("interviewantwort", $props, array("interviewee" => trim($flex['interviewee']), "answer" => trim($flex['answer'])));
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
- case "mrm_be_cm_foldout_h3":
|
|
|
|
|
- $sub = $this->createContentElement("typo3_foldout_h3", array("open" => $flex["isInitialyOpen"] == "1", "noAutoOpen" => $flex["noAutoOpen"] == "1"), array("headline" => $flex["headline"]), array());
|
|
|
|
|
-
|
|
|
|
|
- if ($flex["image"] == "1") {
|
|
|
|
|
- $props = $this->processImagesTTContent($dbReference, "mrm_be_cm_contentimage")[0];
|
|
|
|
|
- $props["type"] = "typo3_content";
|
|
|
|
|
- $sub["subElements"][] = $this->createContentElement("image", $props);
|
|
|
|
|
- } else {
|
|
|
|
|
- switch ($flex["icon"]) {
|
|
|
|
|
- case "1":
|
|
|
|
|
- $sub["attributes"]["icon"] = "stadtinfo_basics";
|
|
|
|
|
- break;
|
|
|
|
|
- case "2":
|
|
|
|
|
- $sub["attributes"]["icon"] = "geschichte";
|
|
|
|
|
- break;
|
|
|
|
|
- case "3":
|
|
|
|
|
- $sub["attributes"]["icon"] = "kultur_freizeit";
|
|
|
|
|
- break;
|
|
|
|
|
- case "4":
|
|
|
|
|
- $sub["attributes"]["icon"] = "besonderheiten";
|
|
|
|
|
- break;
|
|
|
|
|
- case "5":
|
|
|
|
|
- $sub["attributes"]["icon"] = "kosten_geld";
|
|
|
|
|
- break;
|
|
|
|
|
- case "6":
|
|
|
|
|
- $sub["attributes"]["icon"] = "hochschulen";
|
|
|
|
|
- break;
|
|
|
|
|
- case "7":
|
|
|
|
|
- $sub["attributes"]["icon"] = "studieren";
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ case "mrm_be_cm_foldout_h3":
|
|
|
|
|
+ $sub = $this->createContentElement("typo3_foldout_h3", array("open" => $flex["isInitialyOpen"] == "1", "noAutoOpen" => $flex["noAutoOpen"] == "1"), array("headline" => $flex["headline"]), array());
|
|
|
|
|
+
|
|
|
|
|
+ if ($flex["image"] == "1") {
|
|
|
|
|
+ $props = $this->processImagesTTContent($dbReference, "mrm_be_cm_contentimage")[0];
|
|
|
|
|
+ $props["type"] = "typo3_content";
|
|
|
|
|
+ $sub["subElements"][] = $this->createContentElement("image", $props);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ switch ($flex["icon"]) {
|
|
|
|
|
+ case "1":
|
|
|
|
|
+ $sub["attributes"]["icon"] = "stadtinfo_basics";
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "2":
|
|
|
|
|
+ $sub["attributes"]["icon"] = "geschichte";
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "3":
|
|
|
|
|
+ $sub["attributes"]["icon"] = "kultur_freizeit";
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "4":
|
|
|
|
|
+ $sub["attributes"]["icon"] = "besonderheiten";
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "5":
|
|
|
|
|
+ $sub["attributes"]["icon"] = "kosten_geld";
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "6":
|
|
|
|
|
+ $sub["attributes"]["icon"] = "hochschulen";
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "7":
|
|
|
|
|
+ $sub["attributes"]["icon"] = "studieren";
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- if ($flex["dynamicComponents"] && sizeof($flex["dynamicComponents"]) > 0)
|
|
|
|
|
- foreach ($flex["dynamicComponents"] as $comp) {
|
|
|
|
|
- $stype = array_keys($comp['settings'])[0];
|
|
|
|
|
- $elements = $this->checkText($comp['settings'][$stype][$stype], $dbReference, $processedData, $stype == "paragraph" ? "typo3_paragraph" : ($stype == "headline" ? "h4" : $stype));
|
|
|
|
|
- $sub["subElements"] = array_merge($sub["subElements"], $elements);
|
|
|
|
|
- }
|
|
|
|
|
- $subs[] = $sub;
|
|
|
|
|
- break;
|
|
|
|
|
- case "mrm_be_cm_quiz_direct":
|
|
|
|
|
- //print_r($flex); die();
|
|
|
|
|
- $s = $this->createContentElement(
|
|
|
|
|
- "quizdirect",
|
|
|
|
|
- array(
|
|
|
|
|
- "labels" => array(
|
|
|
|
|
- "startbutton" => $flex["startbuttontext"],
|
|
|
|
|
- "submitbutton" => $flex["submitbuttontext"],
|
|
|
|
|
- "nextbutton" => $flex["nextbuttontext"],
|
|
|
|
|
- "lastbutton" => $flex["lastbuttontext"],
|
|
|
|
|
- "question" => $flex["question"],
|
|
|
|
|
- "repeatbutton" => $flex["repeatbuttontext"],
|
|
|
|
|
- "qsuccess" => $flex["questionsuccesstext"],
|
|
|
|
|
- "qfail" => $flex["questionfailtext"],
|
|
|
|
|
- ),
|
|
|
|
|
- "resultscreen" => array(
|
|
|
|
|
- "headingTop" => $flex["resultheadingtop"],
|
|
|
|
|
- "headingSub" => $flex["resultheadingsub"],
|
|
|
|
|
- "validation" => $flex["validationstr"],
|
|
|
|
|
- "end" => $flex["thanks"]
|
|
|
|
|
- ),
|
|
|
|
|
- "isRestartAble" => $flex["isRestartAble"] == 1 || $flex["isRestartAble"] == "1",
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($flex["dynamicComponents"] && sizeof($flex["dynamicComponents"]) > 0)
|
|
|
|
|
+ foreach ($flex["dynamicComponents"] as $comp) {
|
|
|
|
|
+ $stype = array_keys($comp['settings'])[0];
|
|
|
|
|
+ $elements = $this->checkText($comp['settings'][$stype][$stype], $dbReference, $processedData, $stype == "paragraph" ? "typo3_paragraph" : ($stype == "headline" ? "h4" : $stype));
|
|
|
|
|
+ $sub["subElements"] = array_merge($sub["subElements"], $elements);
|
|
|
|
|
+ }
|
|
|
|
|
+ $subs[] = $sub;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "mrm_be_cm_quiz_direct":
|
|
|
|
|
+ //print_r($flex); die();
|
|
|
|
|
+ $s = $this->createContentElement(
|
|
|
|
|
+ "quizdirect",
|
|
|
|
|
+ array(
|
|
|
|
|
+ "labels" => array(
|
|
|
|
|
+ "startbutton" => $flex["startbuttontext"],
|
|
|
|
|
+ "submitbutton" => $flex["submitbuttontext"],
|
|
|
|
|
+ "nextbutton" => $flex["nextbuttontext"],
|
|
|
|
|
+ "lastbutton" => $flex["lastbuttontext"],
|
|
|
|
|
+ "question" => $flex["question"],
|
|
|
|
|
+ "repeatbutton" => $flex["repeatbuttontext"],
|
|
|
|
|
+ "qsuccess" => $flex["questionsuccesstext"],
|
|
|
|
|
+ "qfail" => $flex["questionfailtext"],
|
|
|
|
|
+ ),
|
|
|
|
|
+ "resultscreen" => array(
|
|
|
|
|
+ "headingTop" => $flex["resultheadingtop"],
|
|
|
|
|
+ "headingSub" => $flex["resultheadingsub"],
|
|
|
|
|
+ "validation" => $flex["validationstr"],
|
|
|
|
|
+ "end" => $flex["thanks"]
|
|
|
|
|
+ ),
|
|
|
|
|
+ "isRestartAble" => $flex["isRestartAble"] == 1 || $flex["isRestartAble"] == "1",
|
|
|
|
|
+ ),
|
|
|
|
|
+ array(
|
|
|
|
|
+ "items" => array_values(array_map(function ($v) {
|
|
|
|
|
+ $questionType = null;
|
|
|
|
|
+ $quest = $v['settings']['question'];
|
|
|
|
|
+ if (!isset($quest)) {
|
|
|
|
|
+ $quest = $v['settings']['question_multi'];
|
|
|
|
|
+ $questionType = "multi";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isset($quest["additional_text"]) && $quest["additional_text"] != "") {
|
|
|
|
|
+ $quest["text"] = $quest["text"] . " (" . $quest["additional_text"] . ")";
|
|
|
|
|
+ unset($quest["additional_text"]);
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($questionType) $quest["type"] = $questionType;
|
|
|
|
|
+ unset($quest["rightanswer"]);
|
|
|
|
|
+ if (isset($quest['solutionText'])) $solution = $quest['solutionText'];
|
|
|
|
|
+ unset($quest['solutionText']);
|
|
|
|
|
+ $i = 0;
|
|
|
|
|
+ $quest["answers"] = array();
|
|
|
|
|
+ while (1) {
|
|
|
|
|
+ $i++;
|
|
|
|
|
+ if (!isset($quest["answertext" . $i])) break;
|
|
|
|
|
+ if ($quest["answertext" . $i] === "") continue;
|
|
|
|
|
+ $quest["answers"][] = array("text" => $quest["answertext" . $i], "points" => (int)$quest["answerpoints" . $i]);
|
|
|
|
|
+ unset($quest["answertext" . $i]);
|
|
|
|
|
+ unset($quest["answerpoints" . $i]);
|
|
|
|
|
+ }
|
|
|
|
|
+ $quest["solution"] = $solution;
|
|
|
|
|
+
|
|
|
|
|
+ return $quest;
|
|
|
|
|
+ }, $flex["dynamicComponents"])),
|
|
|
|
|
+
|
|
|
|
|
+ "validation" => array(
|
|
|
|
|
+ "maxPoints" => (int)$flex["maxpoints"],
|
|
|
|
|
+ "averagePoints" => $this->createContentElement("injection", array("type" => "quiz-averagePoints")),
|
|
|
|
|
+ "alreadyReachedPoints" => $this->createContentElement("injection", array("type" => "quiz-alreadyReachedPoints")),
|
|
|
|
|
+
|
|
|
|
|
+ "items" => ($flex["dynamicComponents2"] == 0) ? [] : array_map(
|
|
|
|
|
+ function ($i) {
|
|
|
|
|
+ if (empty($i["validationText"])) $i["validationText"] = "";
|
|
|
|
|
+ else $i["validationText"] = $this->checkTextForInternalLinks($i["validationText"], $dbReference, $processedData);
|
|
|
|
|
+ return $i;
|
|
|
|
|
+ },
|
|
|
|
|
+ array_filter(array_values(array_map(function ($v) {
|
|
|
|
|
+ return $v['settings']['validation'];
|
|
|
|
|
+ }, $flex["dynamicComponents2"])), function ($x) {
|
|
|
|
|
+ return $x != null;
|
|
|
|
|
+ })
|
|
|
),
|
|
),
|
|
|
- array(
|
|
|
|
|
- "items" => array_values(array_map(function ($v) {
|
|
|
|
|
- $questionType = null;
|
|
|
|
|
- $quest = $v['settings']['question'];
|
|
|
|
|
- if (!isset($quest)) {
|
|
|
|
|
- $quest = $v['settings']['question_multi'];
|
|
|
|
|
- $questionType = "multi";
|
|
|
|
|
- }
|
|
|
|
|
- if (isset($quest["additional_text"]) && $quest["additional_text"] != "") {
|
|
|
|
|
- $quest["text"] = $quest["text"] . " (" . $quest["additional_text"] . ")";
|
|
|
|
|
- unset($quest["additional_text"]);
|
|
|
|
|
- }
|
|
|
|
|
- if ($questionType) $quest["type"] = $questionType;
|
|
|
|
|
- unset($quest["rightanswer"]);
|
|
|
|
|
- if(isset($quest['solutionText'])) $solution = $quest['solutionText'];
|
|
|
|
|
- unset($quest['solutionText']);
|
|
|
|
|
- $i = 0;
|
|
|
|
|
- $quest["answers"] = array();
|
|
|
|
|
- while (1) {
|
|
|
|
|
- $i++;
|
|
|
|
|
- if (!isset($quest["answertext" . $i])) break;
|
|
|
|
|
- if ($quest["answertext" . $i] === "") continue;
|
|
|
|
|
- $quest["answers"][] = array("text" => $quest["answertext" . $i], "points" => (int)$quest["answerpoints" . $i]);
|
|
|
|
|
- unset($quest["answertext" . $i]);
|
|
|
|
|
- unset($quest["answerpoints" . $i]);
|
|
|
|
|
- }
|
|
|
|
|
- $quest["solution"] = $solution;
|
|
|
|
|
-
|
|
|
|
|
- return $quest;
|
|
|
|
|
- }, $flex["dynamicComponents"])),
|
|
|
|
|
-
|
|
|
|
|
- "validation" => array(
|
|
|
|
|
- "maxPoints" => (int)$flex["maxpoints"],
|
|
|
|
|
- "averagePoints" => $this->createContentElement("injection", array("type" => "quiz-averagePoints")),
|
|
|
|
|
- "alreadyReachedPoints" => $this->createContentElement("injection", array("type" => "quiz-alreadyReachedPoints")),
|
|
|
|
|
-
|
|
|
|
|
- "items" => ($flex["dynamicComponents2"] == 0) ? [] : array_map(
|
|
|
|
|
- function ($i) {
|
|
|
|
|
- if(empty($i["validationText"])) $i["validationText"] = "";
|
|
|
|
|
- else $i["validationText"] = $this->checkTextForInternalLinks($i["validationText"], $dbReference, $processedData);
|
|
|
|
|
- return $i;
|
|
|
|
|
- },
|
|
|
|
|
- array_filter(array_values(array_map(function ($v) {
|
|
|
|
|
- return $v['settings']['validation'];
|
|
|
|
|
- }, $flex["dynamicComponents2"])), function ($x) {
|
|
|
|
|
- return $x != null;
|
|
|
|
|
- })
|
|
|
|
|
- ),
|
|
|
|
|
-
|
|
|
|
|
- ),
|
|
|
|
|
- )
|
|
|
|
|
- );
|
|
|
|
|
- $processedData["injections"][] = "quiz-averagePoints";
|
|
|
|
|
- $processedData["injections"][] = "quiz-alreadyReachedPoints";
|
|
|
|
|
- $subs[] = $s;
|
|
|
|
|
- $processedData["status"]["hasQuiz"] = true;
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
|
|
+ );
|
|
|
|
|
+ $processedData["injections"][] = "quiz-averagePoints";
|
|
|
|
|
+ $processedData["injections"][] = "quiz-alreadyReachedPoints";
|
|
|
|
|
+ $subs[] = $s;
|
|
|
|
|
+ $processedData["status"]["hasQuiz"] = true;
|
|
|
|
|
+ break;
|
|
|
|
|
|
|
|
default:
|
|
default:
|
|
|
$this->log("MISSING PROCESSDATA 4 " . $dbReference['CType']);
|
|
$this->log("MISSING PROCESSDATA 4 " . $dbReference['CType']);
|