From bd89198ec86e5e5fff67bc338f204b3ecf91888c Mon Sep 17 00:00:00 2001 From: David Siegfried <david.siegfried@uni-vechta.de> Date: Tue, 7 Mar 2023 16:20:29 +0000 Subject: [PATCH] prevent php-warnings, closes #2280 Closes #2280 Merge request studip/studip!1506 --- app/controllers/course/wizard.php | 5 ++++- app/views/course/wizard/step.php | 2 +- app/views/course/wizard/steps/studyareas/_node.php | 2 +- app/views/course/wizard/summary.php | 2 +- lib/classes/coursewizardsteps/StudyAreasWizardStep.php | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/controllers/course/wizard.php b/app/controllers/course/wizard.php index fed36cc1a34..a348b9f11c3 100644 --- a/app/controllers/course/wizard.php +++ b/app/controllers/course/wizard.php @@ -108,6 +108,8 @@ class Course_WizardController extends AuthenticatedController */ public function process_action($step_number, $temp_id) { + $stop = false; + $next_step = 0; $this->temp_id = $temp_id; // Get request data and store it in session. $iterator = Request::getInstance()->getIterator(); @@ -230,7 +232,7 @@ class Course_WizardController extends AuthenticatedController } if (!$stop) { // We are after the last step -> all done, show summary. - if ($next_step >= sizeof($this->steps)) { + if ($next_step >= count($this->steps)) { $this->redirect($this->url_for('course/wizard/summary', $next_step, $temp_id)); // Redirect to next step. } else { @@ -246,6 +248,7 @@ class Course_WizardController extends AuthenticatedController { $this->stepnumber = $stepnumber; $this->temp_id = $temp_id; + $this->source_course = null; if (!$this->getValues()) { PageLayout::postError(_('Ihre Session ist abgelaufen, bitte erneut anfangen.')); $this->redirect('course/wizard'); diff --git a/app/views/course/wizard/step.php b/app/views/course/wizard/step.php index 6d6e6faeb87..0fe1dfcdb09 100644 --- a/app/views/course/wizard/step.php +++ b/app/views/course/wizard/step.php @@ -16,7 +16,7 @@ <footer data-dialog-button> <input type="hidden" name="step" value="<?= $stepnumber ?>"> - <? if (!$first_step): ?> + <? if (empty($first_step)): ?> <?= Studip\Button::create( _('Zurück'), 'back', diff --git a/app/views/course/wizard/steps/studyareas/_node.php b/app/views/course/wizard/steps/studyareas/_node.php index 00238a436ea..b29f564a0b3 100644 --- a/app/views/course/wizard/steps/studyareas/_node.php +++ b/app/views/course/wizard/steps/studyareas/_node.php @@ -1,7 +1,7 @@ <?php if (empty($search_result) || in_array($node->id, $search_result)) : ?> <li class="sem-tree-<?= htmlReady($node->id) ?> keep-node" data-id="<?= $node->id ?>"> <?php if ($node->isAssignable()) : ?> - <?= Icon::create('arr_2left', 'sort')->asInput(["name" => 'assign['.$node->id.']', "onclick" => "return STUDIP.CourseWizard.assignNode('".$node->id."')", "class" => in_array($node->id,$values['studyareas']?:[])?'hidden-no-js':'', "style" => in_array($node->id,$values['studyareas']?:[])?'display:none':false]) ?> + <?= Icon::create('arr_2left', 'sort')->asInput(["name" => 'assign['.$node->id.']', "onclick" => "return STUDIP.CourseWizard.assignNode('".$node->id."')", "class" => in_array($node->id, $values['studyareas'] ??[])?'hidden-no-js':'', "style" => in_array($node->id, $values['studyareas'] ?? [])?'display:none':false]) ?> <?php endif ?> <?php if ($node->hasChildren()) : ?> <input type="checkbox" id="<?= htmlReady($node->id) ?>"<?= (in_array($node->id, $open_nodes) && $node->parent_id != $values['open_node']) ? ' checked="checked"' : '' ?>/> diff --git a/app/views/course/wizard/summary.php b/app/views/course/wizard/summary.php index 57ca726d17d..423ad18350c 100644 --- a/app/views/course/wizard/summary.php +++ b/app/views/course/wizard/summary.php @@ -40,7 +40,7 @@ </fieldset> <footer data-dialog-button> - <? if ($_SESSION['coursewizard'][$this->temp_id]['batchcreate']) : ?> + <? if (isset($_SESSION['coursewizard'][$this->temp_id]['batchcreate'])) : ?> <? foreach ($_SESSION['coursewizard'][$this->temp_id]['batchcreate'] as $key => $value) : ?> <input type="hidden" name="batchcreate[<?= $key ?>]" value="<?= $value ?>"> <? endforeach ?> diff --git a/lib/classes/coursewizardsteps/StudyAreasWizardStep.php b/lib/classes/coursewizardsteps/StudyAreasWizardStep.php index 668a54e0928..f81ce41c7aa 100644 --- a/lib/classes/coursewizardsteps/StudyAreasWizardStep.php +++ b/lib/classes/coursewizardsteps/StudyAreasWizardStep.php @@ -143,7 +143,7 @@ class StudyAreasWizardStep implements CourseWizardStep $values = $values[get_class($this)]; $ok = true; $errors = []; - if (!$values['studyareas']) { + if (empty($values['studyareas'])) { $ok = false; $errors[] = _('Die Veranstaltung muss mindestens einem Studienbereich zugeordnet sein.'); } -- GitLab