diff --git a/app/controllers/course/admission.php b/app/controllers/course/admission.php index 8b91dca46e27aa141e76cdf4ea6360c7631e2df8..a4d838306554a985121ed98a0c2fb9dabbe1382a 100644 --- a/app/controllers/course/admission.php +++ b/app/controllers/course/admission.php @@ -107,7 +107,7 @@ class Course_AdmissionController extends AuthenticatedController } } $lockdata = LockRules::getObjectRule($this->course_id); - if ($lockdata['description'] && LockRules::CheckLockRulePermission($this->course_id)) { + if (!empty($lockdata['description']) && LockRules::CheckLockRulePermission($this->course_id)) { PageLayout::postInfo(formatLinks($lockdata['description'])); } } diff --git a/app/controllers/course/room_requests.php b/app/controllers/course/room_requests.php index 9a469489f39fd75194164462443828fee64bf277..95163634c00d7222ef71cc35802cc9289e82fbf1 100644 --- a/app/controllers/course/room_requests.php +++ b/app/controllers/course/room_requests.php @@ -577,7 +577,7 @@ class Course_RoomRequestsController extends AuthenticatedController $this->request_id = $request_id; $session_data = &$this->getRequestSessionData($this->request_id); - + $this->max_preparation_time = Config::get()->RESOURCES_MAX_PREPARATION_TIME; $this->loadData($session_data, 3); $this->request = RoomRequest::find($this->request_id); diff --git a/app/controllers/questionnaire.php b/app/controllers/questionnaire.php index dd115218cfe1164f96e8da4243743f16add2b6b3..3daf79f63831918df493ffa3bc67180315da97e9 100644 --- a/app/controllers/questionnaire.php +++ b/app/controllers/questionnaire.php @@ -106,8 +106,8 @@ class QuestionnaireController extends AuthenticatedController ? (strtotime($questionnaire_data['startdate']) ?: time()) : null; $questionnaire_data['stopdate'] = strtotime($questionnaire_data['stopdate']) ?: null; - $questionnaire_data['copyable'] = (int) $questionnaire_data['copyable']; - $questionnaire_data['anonymous'] = (int) $questionnaire_data['anonymous']; + $questionnaire_data['copyable'] = (int)($questionnaire_data['copyable'] ?? 0); + $questionnaire_data['anonymous'] = (int)($questionnaire_data['anonymous'] ?? 0); $questionnaire_data['editanswers'] = $questionnaire_data['anonymous'] ? 0 : (int) $questionnaire_data['editanswers']; if ($this->questionnaire->isNew()) { $questionnaire_data['visible'] = ($questionnaire_data['startdate'] <= time() && (!$questionnaire_data['stopdate'] || $questionnaire_data['stopdate'] >= time())) ? 1 : 0; @@ -167,6 +167,8 @@ class QuestionnaireController extends AuthenticatedController if (Request::isAjax()) { $this->questionnaire->restore(); $this->questionnaire->resetRelation("assignments"); + $this->range_type = Request::get('range_type'); + $this->range_id = Request::get('range_id'); $output = [ 'questionnaire_id' => $this->questionnaire->getId(), 'overview_html' => $this->render_template_as_string("questionnaire/_overview_questionnaire.php"), diff --git a/app/views/course/timesrooms/editStack.php b/app/views/course/timesrooms/editStack.php index bd1a5cabcb67522a96c22b7c9de296eba852378d..f6a12f136104e04b75d534097893f972a9e308b1 100644 --- a/app/views/course/timesrooms/editStack.php +++ b/app/views/course/timesrooms/editStack.php @@ -1,142 +1,142 @@ -<form method="post" action="<?= $controller->url_for('course/timesrooms/saveStack/' . $cycle_id, $linkAttributes) ?>" - class="default collapsable" data-dialog="size=big"> - <?= CSRFProtection::tokenTag()?> - <input type="hidden" name="method" value="edit"> - <input type="hidden" name="checked_dates" value="<?= implode(',', $checked_dates) ?>"> - - <fieldset> - <legend><?= _('Raumangaben') ?></legend> - <? if (Config::get()->RESOURCES_ENABLE && (!empty($room_search) || !empty($selectable_rooms))): ?> - <section> - <input type="radio" name="action" value="room" - id="room"> - <label style="display: inline-block; width: 50%; vertical-align: middle"> - <? if (!empty($room_search)) : ?> - <?= $room_search - ->setAttributes(['onFocus' => "jQuery('input[type=radio][name=action][value=room]').prop('checked', 'checked')"]) - ->render() ?> - <? else : ?> - <select name="room_id" style="display: inline-block; width: 50%;" onFocus="jQuery('input[type=radio][name=action][value=room]').prop('checked', 'checked')"> - <option value="0">-- <?= _('Raum auswählen') ?> --</option> - <? foreach ($selectable_rooms as $room): ?> - <option value="<?= htmlReady($room->id)?>"> - <?= htmlReady($room->name) ?> - </option> - <? endforeach ?> - </select> - <? endif ?> - <? if (!$only_bookable_rooms) : ?> - <? - $input_attr = [ - 'class' => 'text-bottom', - 'style' => 'margin-left: 0.2em; margin-top: 0.6em;', - 'name' => 'only_bookable_rooms', - 'value' => '1', - 'title' => _('Nur buchbare Räume anzeigen') - ]; - if (Request::isDialog()) { - $input_attr['data-dialog'] = 'size=big'; - } - ?> - <?= Icon::create('room-request')->asInput(20, $input_attr) ?> - <? endif ?> - <div> - <?= _('Rüstzeit (in Minuten)') ?> - <input type="number" name="preparation_time" - class="preparation-time" - value="<?= htmlReady($preparation_time) ?>" - min="0" max="<?= htmlReady($max_preparation_time) ?>"> - </div> - </label> - </section> - - <? $placerholder = _('Freie Ortsangabe (keine Raumbuchung):') ?> - <? else : ?> - <? $placerholder = _('Freie Ortsangabe:') ?> - <? endif ?> - <section> - <input type="radio" name="action" value="freetext"> - <label style="display: inline;"> - <input type="text" name="freeRoomText" style="display: inline-block; width: 50%;" value="<?= $tpl['freeRoomText'] ?>" - placeholder="<?= $placerholder ?>" - onFocus="jQuery('input[type=radio][name=action][value=freetext]').prop('checked', 'checked')"> - </label> - </section> - <? if (Config::get()->RESOURCES_ENABLE) : ?> - <label> - <input type="radio" name="action" value="noroom" style="display:inline"> - <?= _('Kein Raum') ?> - </label> - <? endif ?> - - <label> - <input type="radio" name="action" value="nochange" checked="checked"> - <?= _('Keine Änderungen an den Raumangaben vornehmen') ?> - </label> - </fieldset> - - <fieldset class="collapsed"> - <legend><?= _('Terminangaben') ?></legend> - <label> - <?= _('Art') ?> - <select name="course_type" id="course_type"> - <option value=""><?= _('-- Keine Änderung --') ?></option> - <? foreach ($GLOBALS['TERMIN_TYP'] as $id => $value) : ?> - <option value="<?= $id ?>"><?= htmlReady($value['name']) ?></option> - <? endforeach ?> - </select> - </label> - </fieldset> - - <fieldset class="collapsed"> - <legend><?= _('Durchführende Lehrende') ?></legend> - <label> - <select name="related_persons_action" id="related_persons_action"> - <option value="">-- <?= _('Aktion auswählen') ?> --</option> - <option value="add">...<?= _('hinzufügen') ?></option> - <option value="delete">...<?= _('entfernen') ?></option> - </select> - </label> - - <? if (!empty($teachers)) : ?> - <select name="related_persons[]" id="related_persons" multiple> - <? foreach ($teachers as $teacher) : ?> - <option value="<?= htmlReady($teacher['user_id']) ?>"> - <?= htmlReady($teacher['fullname']) ?> - </option> - <? endforeach ?> - </select> - <? endif ?> - </fieldset> - - <? if (count($gruppen)) : ?> - <fieldset class="collapsed"> - <legend><?= _('Beteiligte Gruppen') ?></legend> - <label> - <select name="related_groups_action" id="related_groups_action"> - <option value="">-- <?= _('Aktion auswählen') ?> --</option> - <option value="add">...<?= _('hinzufügen') ?></option> - <option value="delete">...<?= _('entfernen') ?></option> - </select> - </label> - - <select id="related_groups" name="related_groups[]" multiple> - <? foreach ($gruppen as $gruppe) : ?> - <option value="<?= htmlReady($gruppe->statusgruppe_id) ?>"><?= htmlReady($gruppe->name) ?></option> - <? endforeach ?> - </select> - </fieldset> - <? endif ?> - - - <footer data-dialog-button> - <?= Studip\Button::createAccept(_('Änderungen speichern'), 'save') ?> - <? if (Request::int('fromDialog')) : ?> - <?= Studip\LinkButton::create( - _('Zurück zur Übersicht'), - $controller->url_for('course/timesrooms/index'), - ['data-dialog' => 'size=big'] - ) ?> - <? endif ?> - </footer> -</form> +<form method="post" action="<?= $controller->url_for('course/timesrooms/saveStack/' . $cycle_id, $linkAttributes) ?>" + class="default collapsable" data-dialog="size=big"> + <?= CSRFProtection::tokenTag()?> + <input type="hidden" name="method" value="edit"> + <input type="hidden" name="checked_dates" value="<?= implode(',', $checked_dates) ?>"> + + <fieldset> + <legend><?= _('Raumangaben') ?></legend> + <? if (Config::get()->RESOURCES_ENABLE && (!empty($room_search) || !empty($selectable_rooms))): ?> + <section> + <input type="radio" name="action" value="room" + id="room"> + <label style="display: inline-block; width: 50%; vertical-align: middle"> + <? if (!empty($room_search)) : ?> + <?= $room_search + ->setAttributes(['onFocus' => "jQuery('input[type=radio][name=action][value=room]').prop('checked', 'checked')"]) + ->render() ?> + <? else : ?> + <select name="room_id" style="display: inline-block; width: 50%;" onFocus="jQuery('input[type=radio][name=action][value=room]').prop('checked', 'checked')"> + <option value="0">-- <?= _('Raum auswählen') ?> --</option> + <? foreach ($selectable_rooms as $room): ?> + <option value="<?= htmlReady($room->id)?>"> + <?= htmlReady($room->name) ?> + </option> + <? endforeach ?> + </select> + <? endif ?> + <? if (!$only_bookable_rooms) : ?> + <? + $input_attr = [ + 'class' => 'text-bottom', + 'style' => 'margin-left: 0.2em; margin-top: 0.6em;', + 'name' => 'only_bookable_rooms', + 'value' => '1', + 'title' => _('Nur buchbare Räume anzeigen') + ]; + if (Request::isDialog()) { + $input_attr['data-dialog'] = 'size=big'; + } + ?> + <?= Icon::create('room-request')->asInput(20, $input_attr) ?> + <? endif ?> + <div> + <?= _('Rüstzeit (in Minuten)') ?> + <input type="number" name="preparation_time" + class="preparation-time" + value="<?= htmlReady($preparation_time) ?>" + min="0" max="<?= htmlReady($max_preparation_time) ?>"> + </div> + </label> + </section> + + <? $placerholder = _('Freie Ortsangabe (keine Raumbuchung):') ?> + <? else : ?> + <? $placerholder = _('Freie Ortsangabe:') ?> + <? endif ?> + <section> + <input type="radio" name="action" value="freetext"> + <label style="display: inline;"> + <input type="text" name="freeRoomText" style="display: inline-block; width: 50%;" value="<?= htmlReady($tpl['freeRoomText'] ?? '') ?>" + placeholder="<?= $placerholder ?>" + onFocus="jQuery('input[type=radio][name=action][value=freetext]').prop('checked', 'checked')"> + </label> + </section> + <? if (Config::get()->RESOURCES_ENABLE) : ?> + <label> + <input type="radio" name="action" value="noroom" style="display:inline"> + <?= _('Kein Raum') ?> + </label> + <? endif ?> + + <label> + <input type="radio" name="action" value="nochange" checked="checked"> + <?= _('Keine Änderungen an den Raumangaben vornehmen') ?> + </label> + </fieldset> + + <fieldset class="collapsed"> + <legend><?= _('Terminangaben') ?></legend> + <label> + <?= _('Art') ?> + <select name="course_type" id="course_type"> + <option value=""><?= _('-- Keine Änderung --') ?></option> + <? foreach ($GLOBALS['TERMIN_TYP'] as $id => $value) : ?> + <option value="<?= $id ?>"><?= htmlReady($value['name']) ?></option> + <? endforeach ?> + </select> + </label> + </fieldset> + + <fieldset class="collapsed"> + <legend><?= _('Durchführende Lehrende') ?></legend> + <label> + <select name="related_persons_action" id="related_persons_action"> + <option value="">-- <?= _('Aktion auswählen') ?> --</option> + <option value="add">...<?= _('hinzufügen') ?></option> + <option value="delete">...<?= _('entfernen') ?></option> + </select> + </label> + + <? if (!empty($teachers)) : ?> + <select name="related_persons[]" id="related_persons" multiple> + <? foreach ($teachers as $teacher) : ?> + <option value="<?= htmlReady($teacher['user_id']) ?>"> + <?= htmlReady($teacher['fullname']) ?> + </option> + <? endforeach ?> + </select> + <? endif ?> + </fieldset> + + <? if (count($gruppen)) : ?> + <fieldset class="collapsed"> + <legend><?= _('Beteiligte Gruppen') ?></legend> + <label> + <select name="related_groups_action" id="related_groups_action"> + <option value="">-- <?= _('Aktion auswählen') ?> --</option> + <option value="add">...<?= _('hinzufügen') ?></option> + <option value="delete">...<?= _('entfernen') ?></option> + </select> + </label> + + <select id="related_groups" name="related_groups[]" multiple> + <? foreach ($gruppen as $gruppe) : ?> + <option value="<?= htmlReady($gruppe->statusgruppe_id) ?>"><?= htmlReady($gruppe->name) ?></option> + <? endforeach ?> + </select> + </fieldset> + <? endif ?> + + + <footer data-dialog-button> + <?= Studip\Button::createAccept(_('Änderungen speichern'), 'save') ?> + <? if (Request::int('fromDialog')) : ?> + <?= Studip\LinkButton::create( + _('Zurück zur Übersicht'), + $controller->url_for('course/timesrooms/index'), + ['data-dialog' => 'size=big'] + ) ?> + <? endif ?> + </footer> +</form> diff --git a/app/views/questionnaire/_widget_questionnaire.php b/app/views/questionnaire/_widget_questionnaire.php index 111fed926c1781827eff8a977f1e008a48c20e11..22ecf7252cf58ff385e7129389cf744de4429827 100644 --- a/app/views/questionnaire/_widget_questionnaire.php +++ b/app/views/questionnaire/_widget_questionnaire.php @@ -1,4 +1,4 @@ -<article class="studip toggle <?= ContentBoxHelper::classes($questionnaire->id, $is_new) ?> widget_questionnaire_<?= $questionnaire->getId() ?>" data-questionnaire_id="<?= htmlReady($questionnaire->getId()) ?>"> +<article class="studip toggle <?= ContentBoxHelper::classes($questionnaire->id, $is_new ?? false) ?> widget_questionnaire_<?= $questionnaire->getId() ?>" data-questionnaire_id="<?= htmlReady($questionnaire->getId()) ?>"> <header> <h1> <a href="<?= ContentBoxHelper::switchhref($questionnaire->id, ['contentbox_type' => 'vote']) ?>"> diff --git a/app/views/questionnaire/overview.php b/app/views/questionnaire/overview.php index d3f33c811bc1db8ffd5d2c5a3ca846004cae3938..8529d09e8f2af544bfc4a2159d27211a132ac518 100644 --- a/app/views/questionnaire/overview.php +++ b/app/views/questionnaire/overview.php @@ -15,7 +15,7 @@ <tbody> <? if (count($questionnaires)) : ?> <? foreach ($questionnaires as $questionnaire) : ?> - <?= $this->render_partial('questionnaire/_overview_questionnaire.php', compact('questionnaire')) ?> + <?= $this->render_partial('questionnaire/_overview_questionnaire.php', compact('questionnaire', 'range_type')) ?> <? endforeach ?> <? else : ?> <tr class="noquestionnaires"> diff --git a/app/views/questionnaire/question_types/freetext/freetext_edit.php b/app/views/questionnaire/question_types/freetext/freetext_edit.php index 1b9a0442743f9efa49f769dd90dd2b7d23c7ab82..e9be20da09b448784b695875b9de90172d905a84 100644 --- a/app/views/questionnaire/question_types/freetext/freetext_edit.php +++ b/app/views/questionnaire/question_types/freetext/freetext_edit.php @@ -6,7 +6,7 @@ <textarea name="questions[<?= $vote->getId() ?>][description]" class="size-l wysiwyg" placeholder="<?= _('Erzählen Sie uns ...') ?>" - ><?= wysiwygReady($etask->description) ?></textarea> + ><?= wysiwygReady($etask ? $etask->description : '') ?></textarea> </label> <input type="hidden" name="questions[<?= $vote->getId() ?>][options][mandatory]" value="0"> diff --git a/app/views/questionnaire/question_types/test/test_edit.php b/app/views/questionnaire/question_types/test/test_edit.php index 644e4f40b3d9ac782c95ac03250ed2d7f717fc82..f013fb3f22acda44a15de2e7631f9f22e3e3c519 100644 --- a/app/views/questionnaire/question_types/test/test_edit.php +++ b/app/views/questionnaire/question_types/test/test_edit.php @@ -19,7 +19,7 @@ [ 'vote' => $vote, 'answer' => [], - 'index' => $index + 1, + 'index' => ($index ?? 0) + 1, 'forcecorrect' => empty($etask->task['answers']) ] ); ?> diff --git a/lib/classes/Seminar.class.php b/lib/classes/Seminar.class.php index 84985e224a6de037a6287be54be51692bfeada57..4190def3c18ff02233721d8e48f0f3bad5288ade 100644 --- a/lib/classes/Seminar.class.php +++ b/lib/classes/Seminar.class.php @@ -1139,9 +1139,8 @@ class Seminar { $stat = $this->getStatOfNotBookedRooms($cycle_id); $pattern = '%s , %s, %s-%s <br />'; - if (($stat['open'] > 0) && ($stat['open'] == $stat['all'])) { - $return = ''; - } else if ($stat['open'] > 0) { + $return = ''; + if ($stat['open'] > 0 && $stat['open'] !== $stat['all']) { $return = _('Folgende Termine haben keine Raumbuchung:') . '<br />'; foreach ($stat['open_rooms'] as $aSingleDate) { diff --git a/lib/evaluation/classes/Evaluation.class.php b/lib/evaluation/classes/Evaluation.class.php index 56227f81533f428f0fc40938dbfb514258dd5d1b..5f269a78212d3ffdd130debcdfc68a60aa19eba8 100644 --- a/lib/evaluation/classes/Evaluation.class.php +++ b/lib/evaluation/classes/Evaluation.class.php @@ -362,7 +362,7 @@ class Evaluation extends EvaluationObject implements PrivacyObject $temp = []; while ($oldRangeID = $this->getNextRangeID()) { if ($oldRangeID != $rangeID) { - array_push($temp, $oldRangeID); + $temp[] = $oldRangeID; } } $this->rangeID = $temp; @@ -386,7 +386,7 @@ class Evaluation extends EvaluationObject implements PrivacyObject */ public function addRangeID($rangeID) { - array_push($this->rangeID, $rangeID); + $this->rangeID[] = $rangeID; $this->numberRanges++; } diff --git a/lib/evaluation/classes/EvaluationAnswer.class.php b/lib/evaluation/classes/EvaluationAnswer.class.php index ac42aef31793c0a0d0d26bb7a20ea67bdb687b38..0116e3b46311475891e63adfcd6dd555f77f3b37 100644 --- a/lib/evaluation/classes/EvaluationAnswer.class.php +++ b/lib/evaluation/classes/EvaluationAnswer.class.php @@ -144,7 +144,6 @@ class EvaluationAnswer extends EvaluationObject public function setRows($rows) { $this->rows = $rows; - return; } /** diff --git a/lib/evaluation/classes/EvaluationObject.class.php b/lib/evaluation/classes/EvaluationObject.class.php index fc91102997d432b471fb7c1379d2d9c6f957b116..e42dfb0e1c924561d6786ce9918751b222009f58 100644 --- a/lib/evaluation/classes/EvaluationObject.class.php +++ b/lib/evaluation/classes/EvaluationObject.class.php @@ -318,11 +318,13 @@ class EvaluationObject extends StudipObject { $this->childNum = 0; return $child; } - return NULL; + $ret = null; + return $ret; } else { if ($this->numberChildren > 0) $this->numberChildren--; - return array_pop ($this->childObjects); + $ret = array_pop ($this->childObjects); + return $ret; } } @@ -334,7 +336,8 @@ class EvaluationObject extends StudipObject { function &getNextChild () { if ($this->childNum >= $this->numberChildren) { $this->childNum = 0; - return NULL; + $ret = null; + return $ret; } return $this->childObjects[$this->childNum++]; } @@ -510,6 +513,7 @@ class EvaluationObject extends StudipObject { echo "Position: ".$this->getPosition ()."<br>"; echo "Untergruppen: ".$this->getNumberChildren ()."<br>"; echo "</td></tr>"; + $i = 0; while ($child = $this->getNextChild ()) { echo "<tr><td>"; $i++; diff --git a/lib/evaluation/classes/EvaluationTree.class.php b/lib/evaluation/classes/EvaluationTree.class.php index f2225c62cd343dbd3e23bdd95dfd66f88c50f048..a369d692a3360fef1de92788563f2b480fd90aac 100644 --- a/lib/evaluation/classes/EvaluationTree.class.php +++ b/lib/evaluation/classes/EvaluationTree.class.php @@ -149,11 +149,12 @@ class EvaluationTree extends TreeAbstract { } function &getGroupObject($item_id, $renew = false){ - if (is_object($this->tree_data[$item_id]['object'])){ + if (isset($this->tree_data[$item_id]['object']) && is_object($this->tree_data[$item_id]['object'])) { if ($renew) $this->recursiveInit(new EvaluationGroup($item_id,null,$this->load_mode)); return $this->tree_data[$item_id]['object']; } else { - return new EvaluationGroup($item_id,null,$this->load_mode); + $evalGroup = new EvaluationGroup($item_id, null, $this->load_mode); + return $evalGroup; } } diff --git a/lib/evaluation/classes/EvaluationTreeEditView.class.php b/lib/evaluation/classes/EvaluationTreeEditView.class.php index 4cac71571c1db3432b951a5593d4dab558908d21..b4aa5debf47da63bb49e4021dea4492a73123c20 100644 --- a/lib/evaluation/classes/EvaluationTreeEditView.class.php +++ b/lib/evaluation/classes/EvaluationTreeEditView.class.php @@ -61,19 +61,6 @@ define('NO_QUESTION_GROUP_TITLE', _('*Fragenblock*')); * @access private */ define('NO_TEMPLATE', _('*unbekannt*')); - -/** - * @const NEW_EVALUATION_TITLE title of a new question block - * @access public - */ -define('NEW_EVALUATION_TITLE', _('Neue Evaluation')); - -/** - * @const FIRST_ARRANGMENT_BLOCK_TITLE title of a new arrangment block - * @access public - */ -define('FIRST_ARRANGMENT_BLOCK_TITLE', _('Erster Gruppierungsblock')); - /** * @const NEW_ARRANGMENT_BLOCK_TITLE title of a new arrangment block * @access private @@ -453,7 +440,7 @@ class EvaluationTreeEditView $parentID = $group->getParentID(); $mode = $this->getInstance($parentID); - + $items2 = []; if ($mode == ROOT_BLOCK) { $eval = new Evaluation ($this->evalID, NULL, EVAL_LOAD_FIRST_CHILDREN); @@ -947,10 +934,11 @@ class EvaluationTreeEditView $this->tree->tree_data[$itemID]['name'], 0, 60)); $head .= "</a>"; - if ($template) + if (!empty($template)) $head .= $template; } - + $moveItem = []; + $moveItemIsParent = 0; if ($itemID == ROOT_BLOCK) $itemID2 = $this->evalID; else @@ -1032,9 +1020,9 @@ class EvaluationTreeEditView */ function getItemMessage($itemID, $colspan = 1) { - if ($this->msg[$itemID]) { + if (!empty($this->msg[$itemID])) { $msg = explode("§", $this->msg[$itemID]); - + $details = []; if ($msg[0] == 'msg') { $msg[0] = 'success'; } @@ -1102,7 +1090,7 @@ class EvaluationTreeEditView */ function parseCommand() { - + $exec_func = ''; if (Request::option('cmd') || Request::optionArray('cmd')) { # extract the command from Request (array) =========================== # @@ -1112,7 +1100,7 @@ class EvaluationTreeEditView $exec_func = "execCommand" . Request::option('cmd'); } else { - + $found = 0; # extract the command from the template-site ========================= # foreach ($_REQUEST as $key => $value) { if (preg_match("/template_(.*)_#(.*)_button?/", $key, $command)) { @@ -1129,10 +1117,12 @@ class EvaluationTreeEditView } - if ($command[1] == "create_question_answers") - $exec_func = "execCommandQuestionAnswersCreate"; - else - $exec_func = "execCommand" . $command[1]; + if (isset($command[1])) { + if ($command[1] == "create_question_answers") + $exec_func = "execCommandQuestionAnswersCreate"; + else + $exec_func = "execCommand" . $command[1]; + } # ==================== END: extract the command from the template-site # } @@ -1191,7 +1181,7 @@ class EvaluationTreeEditView $this->tree->eval->save(); - if ($this->tree->eval->isError) { + if (!empty($this->tree->eval->isError)) { return MessageBox::error(_("Fehler beim Einlesen (root-item)")); } $this->msg[$this->itemID] = "msg§" @@ -1205,7 +1195,7 @@ class EvaluationTreeEditView $group->setTitle($title); $group->setText($text); $group->save(); - if ($group->isError) { + if (!empty($group->isError)) { return MessageBox::error(_("Fehler beim Einlesen (Block)")); } $this->msg[$this->itemID] = "msg§" @@ -1245,16 +1235,22 @@ class EvaluationTreeEditView } - if ($group->isError) { + if (!empty($group->isError)) { return MessageBox::error("Fehler beim Einlesen (Fragenblock)"); - } - if ($this->msg[$this->itemID]) + } + if (!isset($this->msg[$this->itemID])) { + $this->msg[$this->itemID] = ''; + } + if (!empty($this->msg[$this->itemID])) $this->msg[$this->itemID] .= "<br>" . _("Veränderungen wurden gespeichert."); else $this->msg[$this->itemID] .= "msg§" . _("Veränderungen wurden gespeichert."); - if ($msg) { + if (!empty($msg)) { + if (!isset($this->msg[$this->itemID])) { + $this->msg[$this->itemID] = ''; + } $this->msg[$this->itemID] = $this->msg[$this->itemID] . "<br>" . $msg; } break; @@ -1278,8 +1274,6 @@ class EvaluationTreeEditView */ function execCommandAssertDeleteItem() { - - $group = &$this->tree->getGroupObject($this->itemID); if ($group->getChildType() == "EvaluationQuestion") $numberofchildren = $group->getNumberChildren(); @@ -1354,7 +1348,7 @@ class EvaluationTreeEditView $group->delete(); - if ($group->isError) { + if (!empty($group->isError)) { return MessageBox::error(_("Fehler beim Löschen eines Block.")); } @@ -1399,7 +1393,7 @@ class EvaluationTreeEditView if ($mode == ROOT_BLOCK) { $this->tree->eval->addChild($group); $this->tree->eval->save(); - if ($this->tree->eval->isError) { + if (!empty($this->tree->eval->isError)) { return MessageBox::error(_("Fehler beim Anlegen eines neuen Blocks.")); } $this->msg[$this->itemID] = "msg§" @@ -1408,7 +1402,7 @@ class EvaluationTreeEditView $parentgroup = &$this->tree->getGroupObject($this->itemID); $parentgroup->addChild($group); $parentgroup->save(); - if ($parentgroup->isError) { + if (!empty($parentgroup->isError)) { return MessageBox::error(_("Fehler beim Anlegen eines neuen Blocks.")); } $this->msg[$this->itemID] = "msg§" @@ -1443,7 +1437,7 @@ class EvaluationTreeEditView if ($mode == ROOT_BLOCK) { $this->tree->eval->addChild($group); $this->tree->eval->save(); - if ($this->tree->eval->isError) { + if (!empty($this->tree->eval->isError)) { return MessageBox::error(_("Fehler beim Anlegen eines neuen Blocks.")); } $this->msg[$this->itemID] = "msg§" @@ -1453,7 +1447,7 @@ class EvaluationTreeEditView $parentgroup =& $this->tree->getGroupObject($this->itemID); $parentgroup->addChild($group); $parentgroup->save(); - if ($parentgroup->isError) { + if (!empty($parentgroup->isError)) { return MessageBox::error(_("Fehler beim Anlegen eines neuen Blocks.")); } if (Request::option("templateID") != "") @@ -1486,7 +1480,7 @@ class EvaluationTreeEditView $group->setTemplateID(Request::option("templateID")); $group->save(); - if ($group->isError) { + if (!empty($group->isError)) { return MessageBox::error(_("Fehler beim Zuordnen eines Templates.")); } @@ -1578,7 +1572,7 @@ class EvaluationTreeEditView $newquestion->setText(""); $qgroup->addChild($newquestion); $qgroup->save(); - if ($qgroup->isError) { + if (!empty($qgroup->isError)) { return MessageBox::error(_("Fehler beim Anlegen neuer Fragen.")); } } @@ -1847,7 +1841,7 @@ class EvaluationTreeEditView $grouptodelete = $this->tree->eval->getChild($move_group->getObjectID()); $grouptodelete->delete(); $this->tree->eval->save(); - if ($this->tree->eval->isError) + if (!empty($this->tree->eval->isError)) return MessageBox::error(_("Fehler beim Verschieben eines Blocks.")); } else { @@ -1857,13 +1851,13 @@ class EvaluationTreeEditView $oldparentgroup->save(); } - if ($this->tree->eval->isError) + if (!empty($this->tree->eval->isError)) return MessageBox::error(_("Fehler beim Verschieben eines Blocks.")); - if ($move_group->isError) + if (!empty($move_group->isError)) return MessageBox::error(_("Fehler beim Verschieben eines Blocks.")); - if ($newgroup->isError) + if (!empty($newgroup->isError)) return MessageBox::error(_("Fehler beim Verschieben eines Blocks.")); - if ($grouptodelete->isError) + if (!empty($grouptodelete->isError)) return MessageBox::error(_("Fehler beim Verschieben eines Blocks.")); $this->msg[$this->itemID] = "msg§" @@ -1885,7 +1879,7 @@ class EvaluationTreeEditView $grouptodelete = $this->tree->eval->getChild($move_group->getObjectID()); $grouptodelete->delete(); $this->tree->eval->save(); - if ($this->tree->eval->isError) + if (!empty($this->tree->eval->isError)) return MessageBox::error(_("Fehler beim Verschieben eines Blocks.")); } else { @@ -1893,7 +1887,7 @@ class EvaluationTreeEditView $grouptodelete = $oldparentgroup->getChild($move_group->getObjectID()); $grouptodelete->delete(); $oldparentgroup->save(); - if ($oldparentgroup->isError) + if (!empty($oldparentgroup->isError)) return MessageBox::error(_("Fehler beim Verschieben eines Blocks.")); } $newgroup = $move_group->duplicate(); @@ -1902,13 +1896,13 @@ class EvaluationTreeEditView $group->save(); - if ($group->isError) + if (!empty($group->isError)) return MessageBox::error(_("Fehler beim Verschieben eines Blocks.")); - if ($move_group->isError) + if (!empty($move_group->isError)) return MessageBox::error(_("Fehler beim Verschieben eines Blocks.")); - if ($newgroup->isError) + if (!empty($newgroup->isError)) return MessageBox::error(_("Fehler beim Verschieben eines Blocks.")); - if ($grouptodelete->isError) + if (!empty($grouptodelete->isError)) return MessageBox::error(_("Fehler beim Verschieben eines Blocks.")); @@ -1955,15 +1949,15 @@ class EvaluationTreeEditView $oldparent->save(); - if ($group->isError) + if (!empty($group->isError)) return MessageBox::error(_("Fehler beim Verschieben eines Blocks.")); - if ($move_group->isError) + if (!empty($move_group->isError)) return MessageBox::error(_("Fehler beim Verschieben eines Blocks.")); - if ($newgroup->isError) + if (!empty($newgroup->isError)) return MessageBox::error(_("Fehler beim Verschieben eines Blocks.")); - if ($grouptodelete->isError) + if (!empty($grouptodelete->isError)) return MessageBox::error(_("Fehler beim Verschieben eines Blocks.")); - if ($oldparent->isError) + if (!empty($oldparent->isError)) return MessageBox::error(_("Fehler beim Verschieben eines Blocks.")); $this->msg[$this->itemID] = "msg§" @@ -2117,7 +2111,7 @@ class EvaluationTreeEditView $child && $child->getTitle() == FIRST_ARRANGMENT_BLOCK_TITLE && $child->getChildren() == NULL && - $child->getText == "") { + isset($child->getText) && $child->getText == "") { $a_content = LinkButton::createCancel(_('Abbrechen'), URLHelper::getURL(EVAL_FILE_ADMIN . "?evalID=") . $this->tree->eval->getObjectID() . "&abort_creation_button=1", @@ -2655,7 +2649,7 @@ class EvaluationTreeEditView if (preg_match("/template_(.*)_button?/", $key, $command)) break; } - if (preg_match("/(.*)_#(.*)/", $command[1], $command_parts)) + if (isset($command[1]) && preg_match("/(.*)_#(.*)/", $command[1], $command_parts)) $questionID = $command_parts[2]; else $questionID = Request::submitted('template_save2_button') ? "" : Request::get("template_id"); @@ -3253,10 +3247,10 @@ class EvaluationTreeEditView $object->setPosition($newposition); $object->save(); - if ($swapitem->isError) { + if (!empty($swapitem->isError)) { return MessageBox::error(_("Fehler beim verschieben.")); } - if ($object->isError) { + if (!empty($object->isError)) { return MessageBox::error(_("Fehler beim verschieben.")); } } diff --git a/lib/evaluation/classes/EvaluationTreeShowUser.class.php b/lib/evaluation/classes/EvaluationTreeShowUser.class.php index 7ae88f8bef1401ff1191decfad01aaa04b026836..e999cb5620669c09b19258b8c11b29cc11f1b8f2 100644 --- a/lib/evaluation/classes/EvaluationTreeShowUser.class.php +++ b/lib/evaluation/classes/EvaluationTreeShowUser.class.php @@ -179,6 +179,7 @@ class EvaluationTreeShowUser echo "<td align=\"left\" width=\"100%\" valign=\"bottom\" class=\"content_body\" style=\"padding:1px;\">\n"; $parent_id = $group_id; + $chapter_num = ''; while ($parent_id != "root") { $chapter_num = ($this->tree->tree_data[$parent_id]['priority'] + 1) . "." . $chapter_num; $parent_id = $this->tree->tree_data[$parent_id]['parent_id']; @@ -217,6 +218,7 @@ class EvaluationTreeShowUser $group_id = $group->getObjectID(); $parent_id = $group_id; + $level_output = ''; while ($this->tree->tree_data[$parent_id]['parent_id'] != $this->start_item_id) { $parent_id = $this->tree->tree_data[$parent_id]['parent_id']; @@ -328,7 +330,7 @@ class EvaluationTreeShowUser : ""; $html = ''; - + $cellWidth = null; /* Skala (one row question) ---------------------------------------- */ if ($question->getType() == EVALQUESTION_TYPE_LIKERT || $question->getType() == EVALQUESTION_TYPE_POL) { @@ -411,7 +413,7 @@ class EvaluationTreeShowUser ? " border-bottom: $answerBorder;" : ""); $answers = Request::getArray('answers'); - $checked = $answers[$question->getObjectID()] == $answer->getObjectID() ? "checked" : ""; + $checked = isset($answers[$question->getObjectID()]) && $answers[$question->getObjectID()] == $answer->getObjectID() ? "checked" : ""; $html .= " <td align=\"center\" style=\"border-left: $answerBorder; $extraStyle;\" " . "width=\"" . $cellWidth . "%\">"; @@ -483,7 +485,7 @@ class EvaluationTreeShowUser "<td colspan=\"2\">" . "<input type=\"text\"" . " name=\"freetexts[" . $question->getObjectID() . "]\"" . - " value=\"" . htmlReady($freetexts[$question->getObjectID()]) . "\" size=\"60\">" . + " value=\"" . htmlReady(isset($freetexts[$question->getObjectID()]) ? $freetexts[$question->getObjectID()] : '') . "\" size=\"60\">" . "</td>\n"; /* multiple row input field (textarea) */ @@ -493,7 +495,7 @@ class EvaluationTreeShowUser "<textarea" . " name=\"freetexts[" . $question->getObjectID() . "]\"" . " cols=\"60\" rows=\"" . $answer->getRows() . "\">" . - htmlReady($freetexts[$question->getObjectID()]) . + htmlReady(isset($freetexts[$question->getObjectID()]) ? $freetexts[$question->getObjectID()] : '') . "</textarea>" . "</td>\n"; } /* show normal answer ------------- */ @@ -501,7 +503,7 @@ class EvaluationTreeShowUser $answers = Request::getArray('answers'); /* see if it must be checked */ if ($type == "radio") - $checked = $answers[$question->getObjectID()] == $answer->getObjectID() + $checked = isset($answers[$question->getObjectID()]) && $answers[$question->getObjectID()] == $answer->getObjectID() ? "checked" : ""; else diff --git a/lib/evaluation/classes/HTMLempty.class.php b/lib/evaluation/classes/HTMLempty.class.php index 4ca95456e9303c03ae7dd9b06c707f082f4b0d6a..574816f24fe8dff87c28a88553864b6887897bd0 100644 --- a/lib/evaluation/classes/HTMLempty.class.php +++ b/lib/evaluation/classes/HTMLempty.class.php @@ -135,6 +135,9 @@ class HTMLempty */ public function addString($string) { + if (is_array($string)) { + $string = implode(' ', $string); + } $this->_string .= " " . $string; } diff --git a/lib/evaluation/evaluation.config.php b/lib/evaluation/evaluation.config.php index 63b1aab7b369c78aece01be8958127b05672bf3d..e9d46db0aebb32eafa172958813038d5e9a07c7e 100644 --- a/lib/evaluation/evaluation.config.php +++ b/lib/evaluation/evaluation.config.php @@ -49,6 +49,9 @@ define ("QUOTED", 1); define ("UNQUOTED", 0); define ("EVAL_MIN_SEARCHLEN", 3); define ("EVAL_MAX_TEMPLATENAMELEN", 22); +define("NEW_EVALUATION_TITLE", _("Neue Evaluation")); +define('FIRST_ARRANGMENT_BLOCK_TITLE', _('Erster Gruppierungsblock')); +define('EVAL_ROOT_TAG', "[R]"); /* -------------------------------------------------- end: general constants */ /* Path constants ---------------------------------------------------------- */ diff --git a/lib/evaluation/evaluation_admin_edit.inc.php b/lib/evaluation/evaluation_admin_edit.inc.php index 4d9764bf04e012295d5408a5446bd5aaf72a219e..39def65bfb6ba45386a7f42b92b4d53a55bada53 100644 --- a/lib/evaluation/evaluation_admin_edit.inc.php +++ b/lib/evaluation/evaluation_admin_edit.inc.php @@ -47,22 +47,6 @@ require_once 'lib/evaluation/evaluation.config.php'; require_once EVAL_LIB_EDIT; require_once EVAL_FILE_EDIT_TREEVIEW; -# ====================================================== end: including files # - -# define constancs ========================================================== # - -/** - * @const NEW_EVALUATION_TITLE title of a new question block - * @access public - */ -define("NEW_EVALUATION_TITLE", _("Neue Evaluation")); - -/** - * @const FIRST_ARRANGMENT_BLOCK_TITLE title of a new arrangment block - * @access public - */ -define("FIRST_ARRANGMENT_BLOCK_TITLE", _("Erster Gruppierungsblock")); - # ====================================================== end: define constancs # $debug = "<pre class=\"steelgroup6\" style=\"font-size:10pt\">" @@ -141,7 +125,7 @@ if (Request::option("rangeID")) { # EVTAU: employees of the vote-team against urlhacking ====================== # -$eval = new Evaluation($evalID, NULL, EVAL_LOAD_NO_CHILDREN); +$eval = new Evaluation($evalID ?? '', NULL, EVAL_LOAD_NO_CHILDREN); // someone has voted if ($eval->hasVoted()) { @@ -185,13 +169,13 @@ if ($authorID != $user->id) { # Print Error MSG and end Site ============================================= # -if ($error_msgs) { +if (!empty($error_msgs)) { $back_button = (" ") . "<a href=\"" . URLHelper::getLink('admin_evaluation.php?page=overview&rangeID=' . Request::option('rangeID')) . "\">" . _("Zur Evaluations-Verwaltung") . "</a>"; - + $errors = ''; if (is_array($error_msgs)) { foreach ($error_msgs as $error_msg) { $errors .= $error_msg . "<br>"; @@ -214,7 +198,7 @@ $templateSite = include(EVAL_FILE_TEMPLATE); # Creating the Tree ======================================================== # -$EditTree = new EvaluationTreeEditView($itemID, $evalID); +$EditTree = new EvaluationTreeEditView($itemID, $evalID ?? null); # Send messages to the tree ================================================ # diff --git a/lib/evaluation/evaluation_admin_overview.lib.php b/lib/evaluation/evaluation_admin_overview.lib.php index 54f3f46f48480615ab10ad1282e9767af2f440df..add53c23b5e7ffa5dda1b7efff571d040608f93a 100644 --- a/lib/evaluation/evaluation_admin_overview.lib.php +++ b/lib/evaluation/evaluation_admin_overview.lib.php @@ -205,7 +205,7 @@ class EvalOverview $numberOfVotes = EvaluationDB::getNumberOfVotes($evalID); $no_permissons = EvaluationObjectDB::getEvalUserRangesWithNoPermission($eval); - + $no_buttons = 0; if ($eval->getAuthor() != $GLOBALS['user']->id && $no_permissons) $no_buttons = 1; @@ -409,7 +409,7 @@ class EvalOverview $td->addAttr("nowrap", "nowrap"); $td->addAttr("style", "white-space:nowrap"); #if (is_object($content[$i])) - $td->addContent(($content[$i] ? $content[$i] : " ")); + $td->addContent(($content[$i] ?? " ")); #$td->addHTMLContent ( ($content[$i] ? $content[$i] : "-") ); # filter out not needed datacells if ($state == "user_template" && @@ -445,22 +445,6 @@ class EvalOverview $style = ($number % 2) ? "table_row_odd" : "table_row_even"; - $startDate = $eval->getStartdate() == NULL ? " " : date("d.m.Y", $eval->getStartdate()); - - $stopDate = $eval->getRealStopdate() == NULL ? " " : date("d.m.Y", $eval->getRealStopdate()); - - switch ($state) { - - case EVAL_STATE_NEW: - break; - - case EVAL_STATE_ACTIVE: - break; - - case EVAL_STATE_STOPPED: - break; - } - $form = new HTML("form"); $form->addAttr("name", "settingsForm"); $form->addAttr("action", URLHelper::getLink("?rangeID=" . @@ -789,14 +773,16 @@ class EvalOverview } if (!($GLOBALS['perm']->have_studip_perm("tutor", $showrangeID)) && $GLOBALS['user']->id != $showrangeID && - !(Deputy::isEditActivated()() && Deputy::isDeputy($GLOBALS['user']->id, $showrangeID, true))) { - return $this->createSafeguard("ausruf", sprintf(_("Sie haben keinen Zugriff auf diesen Bereich."))); + !(Deputy::isEditActivated() && Deputy::isDeputy($GLOBALS['user']->id, $showrangeID, true))) { + return $this->createSafeguard("ausruf", _("Sie haben keinen Zugriff auf diesen Bereich.")); } $evalDB = new EvaluationDB; $evalChanged = NULL; $safeguard = " "; - + $startDate = NULL; + $stopDate = NULL; + $timeSpan = NULL; /* Actions without any permissions ---------------------------------- */ switch ($evalAction) { case "search_template": @@ -1297,8 +1283,7 @@ class EvalOverview $return["option"] = DISCARD_OPENID; $eval->save(); if ($eval->isError()) { - $safeguard = $this->createSafeguard("ausruf", _("Fehler beim Aushängen einer Evaluationen aus allen Bereichen auf die Sie Zugriff haben.") . EvalCommon::createErrorReport($newEval)); - return $safeguard; + return $this->createSafeguard("ausruf", _("Fehler beim Aushängen einer Evaluationen aus allen Bereichen auf die Sie Zugriff haben.") . EvalCommon::createErrorReport($newEval)); } return $return; } @@ -1331,7 +1316,7 @@ class EvalOverview $eval->setTimeSpan($timeSpan); if (($stopDate != NULL && $stopDate <= time() - 1) || - ($timeSpan != NULL && $eval->getStartdate() != NULL && $eval->getStartdate() + $timeSpan <= time() - 1)) { + ($timeSpan != NULL && $eval->getStartdate() != NULL && ((int)$eval->getStartdate() + (int)$timeSpan) <= time() - 1)) { $message .= $message ? "<br>" : " "; $message .= _("Die Evaluation wurde beendet."); } @@ -1368,8 +1353,7 @@ class EvalOverview $search = Request::get("search"); if (EvaluationObjectDB::getGlobalPerm(YES) < 31) { - $safeguard = $this->createSafeguard("ausruf", _("Sie besitzen keine Berechtigung eine Suche durchzuführen.")); - return $safeguard; + return $this->createSafeguard("ausruf", _("Sie besitzen keine Berechtigung eine Suche durchzuführen.")); } $results = $evalDB->search_range($search); @@ -1401,7 +1385,7 @@ class EvalOverview } } - if ($abort_creation != true) + if (!$abort_creation) break; # continue abort_creation @@ -1433,7 +1417,7 @@ class EvalOverview /* ------------------------------------------------------ end: send SMS */ // the current range has been removed from the eval - if ($current_range_removed) { + if (!empty($current_range_removed)) { $return["msg"] = $safeguard; $return["option"] = DISCARD_OPENID; return $return; @@ -1475,7 +1459,9 @@ class EvalOverview if ($referer) { $linkreferer = "&referer=" . $referer; } - + $request = NO; + $value1 = ''; + $value2 = ''; if ($mode == "delete_request") { $value1 = "delete_confirmed"; $value2 = "delete_aborted"; @@ -1879,12 +1865,14 @@ class EvalOverview // display search_results if ($results) { foreach ($results as $k => $v) { - foreach ($range_types as $type_key => $type_value) { - if ($v["type"] == $type_key) { - $ranges["$type_key"][] = ["id" => $k, "name" => $v["name"]]; + if (!empty($range_types)) { + foreach ($range_types as $type_key => $type_value) { + if ($v["type"] == $type_key) { + $ranges["$type_key"][] = ["id" => $k, "name" => $v["name"]]; + } } + reset($range_types); } - reset($range_types); } $table_s = new HTML("table"); @@ -1894,119 +1882,121 @@ class EvalOverview $table_s->addAttr("cellpadding", "0"); $table_s->addAttr("width", "100%"); - foreach ($range_types as $type_key => $type_value) { + if (!empty($range_types)) { + foreach ($range_types as $type_key => $type_value) { - // Überschriften - $tr_s = new HTML("tr"); + // Überschriften + $tr_s = new HTML("tr"); - // Typ - $td_s = new HTML("td"); - $td_s->addAttr("colspan", "1"); - $td_s->addAttr("class", "$style"); - $td_s->addAttr("height", "22"); - $td_s->addAttr("style", "vertical-align:bottom;"); - $b_s = new HTML("b"); - $b_s->addHTMLContent(" "); - $b_s->addContent($type_value . ":"); - $td_s->addContent($b_s); - $tr_s->addContent($td_s); - - // link - $td_s = new HTML("td"); - $td_s->addAttr("class", "$style"); - $td_s->addAttr("height", "22"); - $td_s->addAttr("align", "center"); - $td_s->addAttr("style", "vertical-align:bottom;"); - $b_s = new HTML("b"); - $b_s->addContent(_("einhängen")); - $td_s->addContent($b_s); - $tr_s->addContent($td_s); - - // kopie - $td_s = new HTML("td"); - $td_s->addAttr("class", "$style"); - $td_s->addAttr("height", "22"); - $td_s->addAttr("align", "center"); - $td_s->addAttr("style", "vertical-align:bottom;"); - $b_s = new HTML("b"); - $b_s->addContent(_("kopieren")); - $td_s->addContent($b_s); - $tr_s->addContent($td_s); - - $table_s->addContent($tr_s); + // Typ + $td_s = new HTML("td"); + $td_s->addAttr("colspan", "1"); + $td_s->addAttr("class", "$style"); + $td_s->addAttr("height", "22"); + $td_s->addAttr("style", "vertical-align:bottom;"); + $b_s = new HTML("b"); + $b_s->addHTMLContent(" "); + $b_s->addContent($type_value . ":"); + $td_s->addContent($b_s); + $tr_s->addContent($td_s); - $counter = 0; + // link + $td_s = new HTML("td"); + $td_s->addAttr("class", "$style"); + $td_s->addAttr("height", "22"); + $td_s->addAttr("align", "center"); + $td_s->addAttr("style", "vertical-align:bottom;"); + $b_s = new HTML("b"); + $b_s->addContent(_("einhängen")); + $td_s->addContent($b_s); + $tr_s->addContent($td_s); - if ($ranges["$type_key"]) { - foreach ($ranges["$type_key"] as $range) { + // kopie + $td_s = new HTML("td"); + $td_s->addAttr("class", "$style"); + $td_s->addAttr("height", "22"); + $td_s->addAttr("align", "center"); + $td_s->addAttr("style", "vertical-align:bottom;"); + $b_s = new HTML("b"); + $b_s->addContent(_("kopieren")); + $td_s->addContent($b_s); + $tr_s->addContent($td_s); - if ($counter == 0) - $displayclass = "content_body"; - elseif (($counter % 2) == 0) - $displayclass = "table_row_even"; - else - $displayclass = "table_row_odd"; + $table_s->addContent($tr_s); - $tr_s = new HTML("tr"); + $counter = 0; - // name - $td_s = new HTML("td"); - $td_s->addHTMLContent(" "); - $td_s->addHTMLContent(htmlready($range["name"])); - $tr_s->addContent($td_s); + if (!empty($ranges[$type_key])) { + foreach ($ranges["$type_key"] as $range) { - // if the rangeID is a username, convert it to the userID - $new_rangeID = (get_userid($range['id'])) ? get_userid($range['id']) : $range['id']; + if ($counter == 0) + $displayclass = "content_body"; + elseif (($counter % 2) == 0) + $displayclass = "table_row_even"; + else + $displayclass = "table_row_odd"; + + $tr_s = new HTML("tr"); + + // name + $td_s = new HTML("td"); + $td_s->addHTMLContent(" "); + $td_s->addHTMLContent(htmlready($range["name"])); + $tr_s->addContent($td_s); - if (!in_array($new_rangeID, $rangeIDs)) { + // if the rangeID is a username, convert it to the userID + $new_rangeID = (get_userid($range['id'])) ? get_userid($range['id']) : $range['id']; + + if (!in_array($new_rangeID, $rangeIDs)) { + + // link + $td_s = new HTML("td"); + $td_s->addAttr("align", "center"); + $input = new HTMLempty("input"); + $input->addAttr("type", "checkbox"); + $input->addAttr("name", "link_range[{$range['id']}]"); + $input->addAttr("value", "1"); + $td_s->addContent($input); + $tr_s->addContent($td_s); + } else { + + // no link + $td_s = new HTML("td"); + $td_s->addAttr("align", "center"); + $td_s->addAttr("colspan", "1"); + $input = new HTMLempty("input"); + $td_s->addContent(_("Die Evaluation ist bereits diesem Bereich zugeordnet.")); + $tr_s->addContent($td_s); + } - // link + // copy $td_s = new HTML("td"); $td_s->addAttr("align", "center"); $input = new HTMLempty("input"); $input->addAttr("type", "checkbox"); - $input->addAttr("name", "link_range[{$range['id']}]"); + $input->addAttr("name", "copy_range[{$range['id']}]"); $input->addAttr("value", "1"); $td_s->addContent($input); $tr_s->addContent($td_s); - } else { - // no link - $td_s = new HTML("td"); - $td_s->addAttr("align", "center"); - $td_s->addAttr("colspan", "1"); - $input = new HTMLempty("input"); - $td_s->addContent(_("Die Evaluation ist bereits diesem Bereich zugeordnet.")); - $tr_s->addContent($td_s); + $table_s->addContent($tr_s); + $counter++; } - - // copy + } elseif ($globalperm == "root" || $globalperm == "admin") { + $tr_s = new HTML("tr"); $td_s = new HTML("td"); - $td_s->addAttr("align", "center"); - $input = new HTMLempty("input"); - $input->addAttr("type", "checkbox"); - $input->addAttr("name", "copy_range[{$range['id']}]"); - $input->addAttr("value", "1"); - $td_s->addContent($input); + $td_s->addAttr("class", "content_body"); + $td_s->addAttr("colspan", "4"); + $td_s->addHTMLContent(" "); + $td_s->addContent(_("Es wurden keine Ergebnisse aus diesem Bereich gefunden.")); $tr_s->addContent($td_s); - $table_s->addContent($tr_s); - $counter++; } - } elseif ($globalperm == "root" || $globalperm == "admin") { - $tr_s = new HTML("tr"); - $td_s = new HTML("td"); - $td_s->addAttr("class", "content_body"); - $td_s->addAttr("colspan", "4"); - $td_s->addHTMLContent(" "); - $td_s->addContent(_("Es wurden keine Ergebnisse aus diesem Bereich gefunden.")); - $tr_s->addContent($td_s); - $table_s->addContent($tr_s); + reset($ranges); } - reset($ranges); } } - if ($showsearchresults) { + if (!empty($showsearchresults)) { $tr = new HTML("tr"); $td = new HTML("td"); $td->addAttr("colspan", "2"); @@ -2066,7 +2056,7 @@ class EvalOverview if ($globalperm == "dozent" || $globalperm == "autor" || $search) $showsearchresults = 1; - + $range_types = []; if ($globalperm == "admin") $range_types = [ "user" => _("Benutzer"), @@ -2144,7 +2134,7 @@ class EvalOverview $counter = 0; - if ($ranges["$type_key"]) { + if (!empty($ranges[$type_key])) { foreach ($ranges["$type_key"] as $range) { if ($counter == 0) @@ -2198,7 +2188,7 @@ class EvalOverview } } - return $table->createContent(); + return !empty($table) ? $table->createContent() : ''; } /** diff --git a/lib/evaluation/evaluation_admin_template.inc.php b/lib/evaluation/evaluation_admin_template.inc.php index 57fdee0f85e2abf0afe96b6eb0c69e332ca1064f..79969476117681fb43fd40a70e1d2645b2fee39b 100644 --- a/lib/evaluation/evaluation_admin_template.inc.php +++ b/lib/evaluation/evaluation_admin_template.inc.php @@ -58,7 +58,7 @@ $lib = new EvalTemplateGUI(); #error_reporting( E_ALL ); /* Set variables ----------------------------------------------------------- */ -$rangeID = ($rangeID) ? $rangeID : Context::getId(); +$rangeID = $rangeID ?? Context::getId(); if (empty ($rangeID)) { $rangeID = $user->id; @@ -71,14 +71,14 @@ if (EvaluationObjectDB::getGlobalPerm() === 'root') { $myuserid = $user->id; } -if (!$parentID) { +if (empty($parentID)) { $parentID = Request::option('parentID'); } -$template_name = Request::get('template_name', $template_name); -$template_type = Request::get('template_type') ? Request::get('template_type') : $template_type; -$template_multiple = Request::get('template_multiple', $template_multiple); +$template_name = Request::get('template_name', $template_name ?? null); +$template_type = Request::get('template_type', $template_type ?? null); +$template_multiple = Request::get('template_multiple', $template_multiple ?? null); $template_answers = Request::getArray('template_answers'); -$template_add_num_answers = Request::get('template_add_num_answers') ? Request::get('template_add_num_answers') : $template_add_num_answers; +$template_add_num_answers = Request::int('template_add_num_answers', $template_add_num_answers ?? 0); if (empty($template_answers)) { if (mb_strstr($command, "edit")) for ($i = 0; $i < 5; $i++) @@ -86,7 +86,7 @@ if (empty($template_answers)) { else $template_answers = []; } -if (!$template_id) { +if (empty($template_id)) { $template_id = Request::option('template_id'); } @@ -100,7 +100,7 @@ if (Request::option('onthefly') && ($command == "delete" || $command == "add_ans $question->setText(trim($template_name), YES); $question->setType($template_type); $question->setParentID($parentID); - $question->setPosition($template_position); + $question->setPosition($template_position ?? ''); while ($answerrem = $question->getChild()) { $id = $answerrem->getObjectID(); $answerrem->delete(); @@ -254,7 +254,7 @@ switch ($command) { break; } } - if ($template_residual && empty ($template_residual_text)) { + if (!empty($template_residual) && empty($template_residual_text)) { $report = MessageBox::error(_("Geben Sie eine Ausweichantwort ein oder deaktivieren Sie diese.")); $command = "continue_edit"; break; @@ -272,9 +272,11 @@ switch ($command) { $template_answers = ""; break; case "save2": - $question->save(); - if ($question->isError()) { - $report = MessageBox::error(_("Fehler beim Speichern.")); + if ($question) { + $question->save(); + if ($question->isError()) { + $report = MessageBox::error(_("Fehler beim Speichern.")); + } } $command = ""; $template_answers = ""; @@ -340,20 +342,16 @@ if (!$command || $command == "back") { switch ($typ) { case EVALQUESTION_TYPE_POL: - array_push($arrayOfPolTemplates, - [$questionload->getObjectID(), $text]); + $arrayOfPolTemplates[] = [$questionload->getObjectID(), $text]; break; case EVALQUESTION_TYPE_LIKERT: - array_push($arrayOfSkalaTemplates, - [$questionload->getObjectID(), $text]); + $arrayOfSkalaTemplates[] = [$questionload->getObjectID(), $text]; break; case EVALQUESTION_TYPE_MC: if ($answer->isFreetext()) { - array_push($arrayOfFreeTemplates, - [$questionload->getObjectID(), $text]); + $arrayOfFreeTemplates[] = [$questionload->getObjectID(), $text]; } else { - array_push($arrayOfNormalTemplates, - [$questionload->getObjectID(), $text]); + $arrayOfNormalTemplates[] = [$questionload->getObjectID(), $text]; } break; } @@ -361,7 +359,7 @@ if (!$command || $command == "back") { } /* report messages ---------------------------------------------------- */ - $td->cont($report); + $td->cont($report ?? ''); $td->cont($lib->createSelections($arrayOfPolTemplates, $arrayOfSkalaTemplates, @@ -371,12 +369,12 @@ if (!$command || $command == "back") { } else { $form = new HTM("form"); - $form->attr("action", URLHelper::getLink("?page=edit&evalID=" . $evalID)); + $form->attr("action", URLHelper::getLink("?page=edit&evalID=" . $evalID ?? '')); $form->attr("method", "post"); $form->html(CSRFProtection::tokenTag()); $form->cont(Button::create(_('zurück'), 'template_back_button', ['title' => _('Zurück zur Auswahl')])); $td->cont($form); - + $report = ''; /* on the fly info message -------------------------------------------- */ if ($command == "create_question_answers" || Request::option('onthefly')) { $report = MessageBox::info(sprintf(_("Weisen Sie der links %sausgewählten%s Frage hier Antworten zu:"), @@ -481,10 +479,8 @@ if ($command) { /*$template_type überprüfen------------------------------------------*/ switch (Request::option('template_type')) { /* --------------------------------------------------------------- */ - case EVALQUESTION_TYPE_POL: - $td->cont($lib->createTemplateForm($question)); - break; case EVALQUESTION_TYPE_LIKERT: + case EVALQUESTION_TYPE_POL: $td->cont($lib->createTemplateForm($question)); break; case EVALQUESTION_TYPE_MC: @@ -502,8 +498,7 @@ if ($command) { } if (preg_match("/(.*)_#(.*)/", $command[1], $command_parts)) $questionID = $command_parts[2]; - $question = new EvaluationQuestion ($questionID, - NULL, EVAL_LOAD_ALL_CHILDREN); + $question = new EvaluationQuestion ($questionID ?? '', NULL, EVAL_LOAD_ALL_CHILDREN); if ($question->getNumberChildren() == 0) { $question->setType(EVALQUESTION_TYPE_MC); @@ -563,7 +558,7 @@ function save1($myuserid) $mineexists = 0; /*Existiert Question/Template schon?*/ $qdb = new EvaluationQuestionDB(); - if (!$template_id) { + if (empty($template_id)) { $template_id = Request::option("template_id"); } if ($qdb->exists($template_id)) { @@ -611,7 +606,7 @@ function save1($myuserid) $text = $template_answers[$i]['text']; $answerID = $template_answers[$i]['answer_id']; $answer = new EvaluationAnswer(); - if (!$foreign) + if (empty($foreign)) $answer->setObjectID($answerID); $answer->setText(trim($text), YES); $question->addChild($answer); @@ -646,7 +641,7 @@ function save1($myuserid) $question->addChild($answer); } - if (!$overwrite) { + if (empty($overwrite)) { $db = new EvaluationQuestionDB(); $lib = new EvalTemplateGUI(); $lib->setUniqueName($question, $db, $myuserid, YES); @@ -658,14 +653,3 @@ function save1($myuserid) return $question; } - -# Define constants ========================================================== # -/** - * @const EVAL_ROOT_TAG Specifies the string for taging root templates - * @access public - */ -define('EVAL_ROOT_TAG', "[R]"); -# ===================================================== end: define constants # - - -?> diff --git a/lib/evaluation/evaluation_admin_template.lib.php b/lib/evaluation/evaluation_admin_template.lib.php index 26e5ae693c3ab749f51b1209d414bf57d0ae8aff..4cbf727bb5c88f9d0b24cb07584f4aac333d9c34 100644 --- a/lib/evaluation/evaluation_admin_template.lib.php +++ b/lib/evaluation/evaluation_admin_template.lib.php @@ -579,7 +579,7 @@ class EvalTemplateGUI $isResidual = YES; } - if ($lastone != -1 && $i == ($question->getNumberChildren() - 1)) { + if (isset($lastone) && $lastone != -1 && $i == ($question->getNumberChildren() - 1)) { $form->cont(_("Beschriftung letzte Antwort")); $lastone = YES; $input = new HTMpty("input"); @@ -591,7 +591,7 @@ class EvalTemplateGUI $input = new HTMpty("input"); $input->attr("type", "hidden"); $input->attr("name", "template_answers[1][answer_id]"); - $input->attr("value", $oldid); + $input->attr("value", $oldid ?? ''); $form->cont($input); } } @@ -603,6 +603,7 @@ class EvalTemplateGUI $select->attr("name", "template_add_num_answers"); $select->attr("size", "1"); $select->attr("style", "vertical-align:middle;"); + $res = 0; if ($isResidual == YES) { $res = 1; } @@ -702,7 +703,7 @@ class EvalTemplateGUI $radio->attr("name", "template_residual"); $radio->attr("value", YES); - $value = $isResidual ? "checked" : "unchecked"; + $value = !empty($isResidual) ? "checked" : "unchecked"; $radio->attr($value); $form->cont($radio); @@ -712,8 +713,8 @@ class EvalTemplateGUI $input = new HTMpty("input"); $input->attr("type", "text"); $input->attr("name", "template_residual_text"); - if ($isResidual) - $input->attr("value", $residualAnswer->getText()); + if (!empty($isResidual)) + $input->attr("value", !empty($residualAnswer) ? $residualAnswer->getText() : ''); else $input->attr("value", ""); $input->attr("size", 22); @@ -735,7 +736,7 @@ class EvalTemplateGUI $input = new HTMpty("input"); $input->attr("type", "hidden"); $input->attr("name", "template_residual_id"); - $input->attr("value", $residualAnswer->getObjectID); + $input->attr("value", !empty($residualAnswer) ? $residualAnswer->getObjectID() : ''); $form->cont($input); /*end: residual - kategorie -------------------- */ } @@ -773,11 +774,11 @@ class EvalTemplateGUI $td->cont($input); $tr->cont($td); - if ($showDelete) { + if (!empty($showDelete)) { $td = new HTM("td"); $td->attr("class", "content_body"); $td->attr("align", "center"); - $td->cont($input2); + $td->cont($input2 ?? ''); $tr->cont($td); } @@ -908,11 +909,11 @@ class EvalTemplateGUI $td->cont($input); $tr->cont($td); - if ($showDelete) { + if (!empty($showDelete)) { $td = new HTM("td"); $td->attr("class", "content_body"); $td->attr("align", "center"); - $td->cont($input2); + $td->cont($input2 ?? ''); $tr->cont($td); } $table->cont($tr); @@ -1048,7 +1049,7 @@ class EvalTemplateGUI break; } - $return_command = $command[1]; + $return_command = $command[1] ?? ''; // extract the command if theres a questionID in the commandname if (preg_match("/(.*)_#(.*)/", $return_command, $new_command)) @@ -1095,14 +1096,6 @@ class EvalTemplateGUI } -# Define constants ========================================================== # -/** - * @const EVAL_ROOT_TAG Specifies the string for taging root templates - * @access public - */ -define('EVAL_ROOT_TAG', "[R]"); -# ===================================================== end: define constants # - # Include all required files ================================================ # require_once 'lib/evaluation/evaluation.config.php'; require_once HTML; diff --git a/lib/evaluation/evaluation_show.lib.php b/lib/evaluation/evaluation_show.lib.php index 164ad11de8d85d6312c08ed03a4eb4c9c35a7c5c..40701fb787b5fe36fa7fc456c0395dc9cbea640b 100644 --- a/lib/evaluation/evaluation_show.lib.php +++ b/lib/evaluation/evaluation_show.lib.php @@ -89,22 +89,22 @@ class EvalShow $message = new HTML('div'); $message->_content = [(string)EvalShow::getStopdateText( $eval, $voted)]; $table2->cont($message); - + if(!$voted && $GLOBALS["mandatories"] != 0) { $message = new HTML('div'); $message->_content = [(string)sprintf(_("Mit %s gekennzeichnete Fragen müssen beantwortet werden."), "<b><span class=\"eval_error\">**</span></b>")]; $table2->cont($message); } - - + + $td->cont( $table2 ); $tr->cont( $td ); return $tr; } - + /** * createEvaluation: generate the evaluation itself (questions and answers) @@ -191,16 +191,16 @@ class EvalShow $html .= sprintf (_("Es haben insgesamt <b>%s</b> Personen teilgenommen"), $number); else $html .= $voted - ? sprintf (_("Sie waren die einzige Person die teilgenommen hat")) - : sprintf (_("Es hat insgesamt <b>eine</b> Person teilgenommen")); + ? _("Sie waren die einzige Person die teilgenommen hat") + : _("Es hat insgesamt <b>eine</b> Person teilgenommen"); } else { if ($number != 1) $html .= sprintf (_("Es haben bisher <b>%s</b> Personen teilgenommen"), $number); else $html .= $voted - ? sprintf (_("Sie waren bisher der/die einzige Person die teilgenommen hat")) - : sprintf (_("Es hat bisher <b>eine</b> Person teilgenommen")); + ? _("Sie waren bisher der/die einzige Person die teilgenommen hat") + : _("Es hat bisher <b>eine</b> Person teilgenommen"); } /* ---------------------------------------------------------------------- */ @@ -271,7 +271,6 @@ class EvalShow * @returns a table row */ function createEvaluationFooter( $eval, $voted, $isPreview ) { - global $auth; if( $isPreview ) $voted = YES; @@ -365,45 +364,39 @@ class EvalShow } function createEditButton ($eval) { - $button = LinkButton::create(_('Bearbeiten'), - URLHelper::getURL(EVAL_FILE_ADMIN."?page=edit&evalID=".$eval->getObjectID()), - ['title' => _('Evaluation bearbeiten.')]); - return $button; + return LinkButton::create(_('Bearbeiten'), + URLHelper::getURL(EVAL_FILE_ADMIN."?page=edit&evalID=".$eval->getObjectID()), + ['title' => _('Evaluation bearbeiten.')]); } function createOverviewButton ($rangeID, $evalID) { - $button = LinkButton::create(_('Bearbeiten'), - URLHelper::getURL(EVAL_FILE_ADMIN."?rangeID=".$rangeID."&openID=".$evalID."#open"), - ['title' => _('Evaluationsverwaltung.')]); - return $button; + return LinkButton::create(_('Bearbeiten'), + URLHelper::getURL(EVAL_FILE_ADMIN."?rangeID=".$rangeID."&openID=".$evalID."#open"), + ['title' => _('Evaluationsverwaltung.')]); } function createDeleteButton ($eval) { - $button = LinkButton::create(_('Löschen'), - URLHelper::getURL(EVAL_FILE_ADMIN."?evalAction=delete_request&evalID=".$eval->getObjectID ()), - ['title' => _('Evaluation löschen.')]); - return $button; + return LinkButton::create(_('Löschen'), + URLHelper::getURL(EVAL_FILE_ADMIN."?evalAction=delete_request&evalID=".$eval->getObjectID ()), + ['title' => _('Evaluation löschen.')]); } function createStopButton ($eval) { - $button = LinkButton::createCancel(_('Stop'), - URLHelper::getURL(EVAL_FILE_ADMIN."?evalAction=stop&evalID=".$eval->getObjectID ()), - ['title' => _('Evaluation stoppen.')]); - return $button; + return LinkButton::createCancel(_('Stop'), + URLHelper::getURL(EVAL_FILE_ADMIN."?evalAction=stop&evalID=".$eval->getObjectID ()), + ['title' => _('Evaluation stoppen.')]); } function createContinueButton ($eval) { - $button = LinkButton::create(_('Fortsetzen'), - URLHelper::getURL(EVAL_FILE_ADMIN."?evalAction=continue&evalID=".$eval->getObjectID ()), - ['title' => _('Evaluation fortsetzen')]); - return $button; + return LinkButton::create(_('Fortsetzen'), + URLHelper::getURL(EVAL_FILE_ADMIN."?evalAction=continue&evalID=".$eval->getObjectID ()), + ['title' => _('Evaluation fortsetzen')]); } function createExportButton ($eval) { - $button = LinkButton::create(_('Export'), - URLHelper::getURL(EVAL_FILE_ADMIN."?evalAction=export_request&evalID=".$eval->getObjectID ()), - ['title' => _('Evaluation exportieren.')]); - return $button; + return LinkButton::create(_('Export'), + URLHelper::getURL(EVAL_FILE_ADMIN."?evalAction=export_request&evalID=".$eval->getObjectID ()), + ['title' => _('Evaluation exportieren.')]); } function createReportButton($eval) { diff --git a/public/eval_summary.php b/public/eval_summary.php index a7b774c52f59a66244e8881be49c60ad10f4a25b..676723ec5ddf8fdb4b5953e8376dd31dc5bf6abd 100644 --- a/public/eval_summary.php +++ b/public/eval_summary.php @@ -156,7 +156,11 @@ function do_graph($data, $evalquestion_id) ); if(!empty($data)) { - $max_x = max(array_map('next',$data)); + $_data = []; + array_walk($data, function($d) use (&$_data) { + $_data[] = next($d); + }); + $max_x = max($_data); $graph->SetPlotAreaWorld(NULL, 0); // y-achse bei 0 starten $graph->SetPrecisionY(0); //anzahl kommastellen y-achse $graph->SetYTickIncrement($max_x < 10 ? 1 : round($max_x/10)); @@ -400,7 +404,7 @@ function groups($parent_id) if ($group['child_type'] == 'EvaluationQuestion') { echo " <tr><td class=\"blank\" colspan=\"2\">\n"; - echo "<table border=\"". ($group_type=="normal" || $ausgabeformat==1 ? "0" : "1") ."\" width=\"100%\" cellspacing=\"0\">\n"; + echo "<table border=\"". (!empty($group_type) && $group_type=="normal" || $ausgabeformat==1 ? "0" : "1") ."\" width=\"100%\" cellspacing=\"0\">\n"; $local_question_counter = 0; $answer_arr = []; @@ -415,7 +419,7 @@ function groups($parent_id) $local_question_counter += 1; - if (do_template("show_questions") && $group_type=="normal") { + if (do_template('show_questions') && !empty($group_type) && $group_type === 'normal') { echo " <tr><td class=\"blank\" colspan=\"2\">\n"; echo " <b>".$global_counter.".".$local_counter.".".$local_question_counter.". ".formatReady($question['text'])."</b></font>\n"; echo " </td></tr>\n"; @@ -434,7 +438,7 @@ function groups($parent_id) } $questions_statement->closeCursor(); - if (!($freetype) && $group_type=="table") { + if (!$freetype && !empty($group_type) && $group_type === 'table') { $antworten_angezeigt = FALSE; $i = 0; $has_residual = 0; @@ -558,7 +562,7 @@ if ($evaluation = $statement->fetch(PDO::FETCH_ASSOC)) { echo "<td class=\"".($ausgabeformat==1 ? "table_header_bold" : "blank" )."\" align=\"RIGHT\">".($ausgabeformat==1 ? "<a href=\"eval_summary_export.php?eval_id=".$eval_id."\" TARGET=\"_blank\"><font color=\"WHITE\">"._("PDF-Export")."</font></a><b> | </b><a href=\"".URLHelper::getLink('?eval_id='.$eval_id.'&ausgabeformat=2')."\" TARGET=\"_blank\"><font color=\"WHITE\">"._("Druckansicht")."</font></a> <a href=\"eval_config.php?eval_id=".$eval_id."\">" . Icon::create('arr_2right', 'info_alt', ['title' => _('Auswertung konfigurieren')])->asImg() . "</a>" : "" ) ." </td>\n"; echo "</tr>\n"; echo "<tr><td class=\"blank\" colspan=\"2\" align=\"left\"> </td></tr>\n"; - echo "<tr><td class=\"blank\" colspan=\"2\" align=\"left\"><font size=\"+1\"><b> ".formatReady($evaluation['title'])."</b></font></td>\n"; + echo "<tr><td class=\"blank\" colspan=\"2\" align=\"left\"><font size=\"+1\"><b> ".formatReady($evaluation['title'] ?? '')."</b></font></td>\n"; echo "<tr><td class=\"blank\" colspan=\"2\" align=\"left\"> "; echo _("Diese Evaluation ist folgenden Bereichen zugeordnet:"); echo '<ul>'; diff --git a/templates/dates/seminar_html_roomplanning.php b/templates/dates/seminar_html_roomplanning.php index 60beec2311b88293167e7e1a680b364ddee29711..50f3fdf88aeb27b48e5b95b5573d77f1fa2bc2a7 100644 --- a/templates/dates/seminar_html_roomplanning.php +++ b/templates/dates/seminar_html_roomplanning.php @@ -44,6 +44,8 @@ if (!empty($dates['regular']['turnus_data']) || !empty($dates['irregular'])) : echo implode(", <br>", $output); $freetext_rooms = []; + $irregular_rooms = []; + $irregular = []; if (is_array($dates['irregular'])): foreach ($dates['irregular'] as $date) : @@ -52,9 +54,15 @@ if (!empty($dates['regular']['turnus_data']) || !empty($dates['irregular'])) : } $irregular[] = $date; $irregular_strings[] = $date['tostring']; - if ($date['resource_id']) : + if (!empty($date['resource_id'])) : + if (!isset($irregular_rooms[$date['resource_id']])) : + $irregular_rooms[$date['resource_id']] = 0; + endif; $irregular_rooms[$date['resource_id']]++; - elseif ($date['raum']) : + elseif (!empty($date['raum'])) : + if (!isset($freetext_rooms['('. $date['raum'] .')'])) : + $freetext_rooms['('. $date['raum'] .')'] = 0; + endif; $freetext_rooms['('. $date['raum'] .')']++; endif; endforeach; @@ -69,9 +77,9 @@ if (!empty($dates['regular']['turnus_data']) || !empty($dates['irregular'])) : if (empty($with_past_intervals) && $date->end_time < $now) { continue; } - echo $date['tostring']; + echo $date['tostring'] ?? ''; - if ($show_room && $date['resource_id']) : + if ($show_room && !empty($date['resource_id'])) : echo ', '. _('Ort:') . ' '; $room_obj = Room::find($date['resource_id']); echo '<a href="' . $room_obj->getActionLink('show') . '" target="_blank">' @@ -81,7 +89,7 @@ if (!empty($dates['regular']['turnus_data']) || !empty($dates['irregular'])) : endforeach; else : echo _("Termine am") . implode(', ', shrink_dates($irregular)); - if (is_array($rooms) && count($rooms) > 0) : + if (count($rooms) > 0) : if (count($rooms) > 3) : $rooms = array_slice($rooms, count($rooms) - 3, count($rooms)); endif;