From a46350a1927eb2de370234a371f46a216d87a606 Mon Sep 17 00:00:00 2001
From: David Siegfried <david.siegfried@uni-vechta.de>
Date: Mon, 10 Oct 2022 09:36:03 +0000
Subject: [PATCH] add docblocks, closes #1649

Closes #1649

Merge request studip/studip!1060
---
 app/views/activityfeed/configuration.php |  7 +++++++
 app/views/start/_widget.php              | 16 +++++++++++++---
 app/views/start/add.php                  |  6 ++++++
 app/views/start/edit_defaults.php        | 10 +++++++++-
 app/views/start/edit_mail_address.php    |  7 +++++++
 app/views/start/index.php                |  6 ++++++
 app/views/study_area/tree.php            | 13 +++++++++++--
 app/views/studygroup/browse.php          | 20 ++++++++++++++++++--
 app/views/terms/index.php                |  9 +++++++++
 app/views/tfa/index.php                  |  6 ++++++
 app/views/tfa/setup.php                  |  5 +++++
 app/views/tour/admin_conflicts.php       | 10 +++++++++-
 app/views/tour/admin_details.php         | 16 ++++++++++++++--
 app/views/tour/admin_overview.php        | 12 +++++++++++-
 app/views/tour/edit_step.php             | 20 +++++++++++++-------
 app/views/tour/import.php                |  8 +++++++-
 app/views/web_migrate/index.php          | 12 ++++++++++++
 app/views/wiki/change_courseperms.php    |  7 +++++++
 app/views/wiki/change_page_config.php    |  8 ++++++++
 app/views/wiki/create.php                |  6 ++++++
 app/views/wiki/import.php                | 12 ++++++++++++
 app/views/wiki/info.php                  | 11 +++++++++++
 22 files changed, 207 insertions(+), 20 deletions(-)

diff --git a/app/views/activityfeed/configuration.php b/app/views/activityfeed/configuration.php
index 945f109fe4c..ceb87eb2180 100644
--- a/app/views/activityfeed/configuration.php
+++ b/app/views/activityfeed/configuration.php
@@ -1,3 +1,10 @@
+<?php
+/**
+ * @var ActivityfeedController $controller
+ * @var array $modules
+ * @var array $context_translations
+ */
+?>
 <div id="activityEdit">
     <form id="configure_activity" action="<?= $controller->link_for('activityfeed/save') ?>" method="post" class="default" data-dialog>
         <h1><?= _("Anzuzeigende Bereiche:") ?></h1>
diff --git a/app/views/start/_widget.php b/app/views/start/_widget.php
index 13a365cc65d..f343a892e78 100644
--- a/app/views/start/_widget.php
+++ b/app/views/start/_widget.php
@@ -1,3 +1,13 @@
+<?php
+/**
+ * @var StartController $controller
+ * @var StudIPPlugin $widget
+ * @var string $admin_title
+ * @var string $content_for_layout
+ * @var Navigation[]|null $icons
+ * @var string|null $admin_url
+ */
+?>
 <div class="ui-widget_head widget-header" id="widget-<?= $widget->widget_id ?>">
     <span class="header-options">
         <? if (isset($icons)): ?>
@@ -18,16 +28,16 @@
 
         <? if (isset($admin_url)): ?>
             <a href="<?= URLHelper::getLink($admin_url) ?>">
-                <?= Icon::create('admin', 'clickable', ['title' => $admin_title])->asImg() ?>
+                <?= Icon::create('admin', Icon::ROLE_CLICKABLE, ['title' => htmlReady($admin_title)]) ?>
             </a>
         <? endif ?>
 
         <a href="<?= $controller->url_for('start/delete/' . $widget->widget_id) ?>">
-            <?= Icon::create('decline', 'clickable', ['title' => _('Entfernen')])->asImg() ?>
+            <?= Icon::create('decline', Icon::ROLE_CLICKABLE, ['title' => _('Entfernen')]) ?>
         </a>
     </span>
     <span id="widgetName<?= $widget->widget_id ?>" class="widget-title">
-        <?= htmlReady(isset($title) ? $title : $widget->getPluginName()) ?>
+        <?= htmlReady($title ?? $widget->getPluginName()) ?>
     </span>
 </div>
 <div id="wid<?=$widget->widget_id?>">
diff --git a/app/views/start/add.php b/app/views/start/add.php
index f53607a437b..8b68e059e92 100644
--- a/app/views/start/add.php
+++ b/app/views/start/add.php
@@ -1,3 +1,9 @@
+<?php
+/**
+ * @var StartController $controller
+ * @var StudIPPlugin[] $widgets
+ */
+?>
 <form action="<?= $controller->url_for('start/add') ?>" method="post" class="default">
     <input type="hidden" name="studip_ticket" value="<?= get_ticket() ?>">
     <input type="hidden" name="position" value="0">
diff --git a/app/views/start/edit_defaults.php b/app/views/start/edit_defaults.php
index 1ea3e4b6807..c9773c9fe1d 100644
--- a/app/views/start/edit_defaults.php
+++ b/app/views/start/edit_defaults.php
@@ -1,3 +1,11 @@
+<?php
+/**
+ * @var array $initial_widgets
+ * @var StudIPPlugin[] $widgets
+ * @var bool $restricted
+ * @var string $permission
+ */
+?>
 <div class="edit-widgetcontainer">
     <div class="start-widgetcontainer">
         <ul class="portal-widget-list">
@@ -55,4 +63,4 @@
         STUDIP.startpage.init_edit('<?= $permission ?>');
     })
 }(jQuery));
-</script>
\ No newline at end of file
+</script>
diff --git a/app/views/start/edit_mail_address.php b/app/views/start/edit_mail_address.php
index 00ff0b7320f..47f9a7ff02c 100644
--- a/app/views/start/edit_mail_address.php
+++ b/app/views/start/edit_mail_address.php
@@ -1,3 +1,10 @@
+<?php
+/**
+ * @var StartController $controller
+ * @var string $email
+ * @var bool $restricted
+ */
+?>
 <form method="post" class="default" action="<?=$controller->url_for('start/change_mail_address')?>" data-dialog="size=auto">
     <?= CSRFProtection::tokenTag()?>
     <fieldset>
diff --git a/app/views/start/index.php b/app/views/start/index.php
index 8ec9ea07da6..e742031034b 100644
--- a/app/views/start/index.php
+++ b/app/views/start/index.php
@@ -1,3 +1,9 @@
+<?php
+/**
+ * @var array $left
+ * @var array $right
+ */
+?>
 <h1 class="sr-only">
     <? if ($GLOBALS['perm']->have_perm('root')) :?>
         <?= _("Startseite für Root bei Stud.IP")?>
diff --git a/app/views/study_area/tree.php b/app/views/study_area/tree.php
index e1f2557194e..79778bbea40 100644
--- a/app/views/study_area/tree.php
+++ b/app/views/study_area/tree.php
@@ -1,3 +1,12 @@
+<?php
+/**
+ * @var StudipStudyArea $node
+ * @var string $open
+ * @var int $layer
+ * @var array $dont_open
+ * @var string $compulsory
+ */
+?>
 <li>
 <? if ($node->id !== 'root' && $node->required_children): ?>
     <input id='<?= htmlReady($node->id) ?>' type='checkbox' <?= $open && !in_array($layer, $dont_open) ? 'checked' : ''?>>
@@ -15,8 +24,8 @@
 <? if ($node->required_children): ?>
     <ul>
     <? foreach ($node->required_children as $child): ?>
-        <?= $this->render_partial('study_area/tree.php', ['node' => $child, 'open' => $open, 'layer' => $layer + 1]) ?>
+        <?= $this->render_partial('study_area/tree.php', ['node' => $child, 'open' => $open, 'layer' => ((int)$layer + 1)]) ?>
     <? endforeach; ?>
     </ul>
 <? endif; ?>
-</li>
\ No newline at end of file
+</li>
diff --git a/app/views/studygroup/browse.php b/app/views/studygroup/browse.php
index 93ec0475351..6d0ebc4a3de 100644
--- a/app/views/studygroup/browse.php
+++ b/app/views/studygroup/browse.php
@@ -1,3 +1,19 @@
+<?php
+/**
+ * @var StudygroupController $controller
+ * @var int $anzahl
+ * @var string $sort_type
+ * @var string $sort_order
+ * @var string $q
+ * @var string $closed
+ * @var array $groups
+ * @var User $user
+ * @var int $entries_per_page
+ * @var int $page
+ * @var string $sort
+ */
+?>
+
 <?= $this->render_partial("course/studygroup/_feedback") ?>
 
 <?php
@@ -51,7 +67,7 @@ $headers = [
                             <?= htmlready($group['Name']) ?>
                             <?= $group['visible'] ? '' : "[" . _('versteckt') . "]" ?>
                             <? if ($group['admission_prelim'] == 1) { ?>
-                                <?= Icon::create('lock-locked', 'inactive', ['title' => _('Mitgliedschaft muss beantragt werden')]) ?>
+                                <?= Icon::create('lock-locked', Icon::ROLE_INACTIVE, ['title' => _('Mitgliedschaft muss beantragt werden')]) ?>
                             <? } ?>
                         </a>
                 </td>
@@ -74,7 +90,7 @@ $headers = [
                 </td>
                 <td align="center">
                     <? if ($is_member) : ?>
-                        <?= Icon::create('person', 'inactive', ['title' => _('Sie sind Mitglied in dieser Gruppe')])->asImg() ?>
+                        <?= Icon::create('person', Icon::ROLE_INACTIVE, ['title' => _('Sie sind Mitglied in dieser Gruppe')])->asImg() ?>
                     <? endif; ?>
                 </td>
             </tr>
diff --git a/app/views/terms/index.php b/app/views/terms/index.php
index 03ebf095683..69d116169d7 100644
--- a/app/views/terms/index.php
+++ b/app/views/terms/index.php
@@ -1,3 +1,12 @@
+<?php
+/**
+ * @var TermsController $controller
+ * @var string $return_to
+ * @var string $redirect_token
+ * @var string $denial_message
+ * @var string $compulsory
+ */
+?>
 <form action="<?= $controller->link_for('terms', compact('return_to', 'redirect_token')) ?>" method="post">
     <?= CSRFProtection::tokenTag()?>
     <? if ($denial_message): ?>
diff --git a/app/views/tfa/index.php b/app/views/tfa/index.php
index 79053476818..25ab9533a15 100644
--- a/app/views/tfa/index.php
+++ b/app/views/tfa/index.php
@@ -1,3 +1,9 @@
+<?php
+/**
+ * @var TFASecret $secret
+ * @var TfaController $controller
+ */
+?>
 <p>
     <?= _('Zwei-Faktor-Authentifizierung ist aktiviert') ?>:
     <?= $secret->type == 'app' ? _('Authenticator-App') : _('E-Mail') ?>
diff --git a/app/views/tfa/setup.php b/app/views/tfa/setup.php
index 5c605597ec2..62278dd2b5f 100644
--- a/app/views/tfa/setup.php
+++ b/app/views/tfa/setup.php
@@ -1,3 +1,8 @@
+<?php
+/**
+ * @var TfaController $controller
+ */
+?>
 <form class="default" action="<?= $controller->create() ?>" method="post">
     <?= CSRFProtection::tokenTag() ?>
 
diff --git a/app/views/tour/admin_conflicts.php b/app/views/tour/admin_conflicts.php
index 129ef66ba07..6634dc601d9 100644
--- a/app/views/tour/admin_conflicts.php
+++ b/app/views/tour/admin_conflicts.php
@@ -1,5 +1,13 @@
-<? use Studip\LinkButton; ?>
+<?php
+/**
+ * @var TourController $controller
+ * @var array $conflicts
+ * @var array $diff_fields
+ * @var array $diff_step_fields
+ */
 
+use Studip\LinkButton;
+?>
 <h1><?= _('Versions-Konflikte der Touren') ?></h1>
 <form action="<?= $controller->url_for('tour/admin_conflicts') ?>" id="admin_tour_form" method="post">
     <?= CSRFProtection::tokenTag(); ?>
diff --git a/app/views/tour/admin_details.php b/app/views/tour/admin_details.php
index 7c7bcdb55ad..3fbde8b1707 100644
--- a/app/views/tour/admin_details.php
+++ b/app/views/tour/admin_details.php
@@ -1,4 +1,16 @@
-<? use Studip\Button, Studip\LinkButton; ?>
+<?php
+/**
+ * @var string $delete_question
+ * @var TourController $controller
+ * @var HelpTour $tour
+ * @var HelpTourAudience $audience
+ * @var string $tour_startpage
+ * @var string $tour_id
+ */
+
+use Studip\Button, Studip\LinkButton;
+?>
+
 <?= $delete_question ?>
 
 <form class="default" action="<?= $controller->url_for('tour/save/' . $tour->tour_id) ?>" method="post">
@@ -182,7 +194,7 @@ if (count($tour->steps)) {
     $widget->addLink(
         _('Schritt hinzufügen'),
         $controller->url_for('tour/edit_step/' . $tour->tour_id . '/' . (count($tour->steps) + 1) . '/new'),
-        Icon::create('add', 'clickable'),
+        Icon::create('add'),
         ['data-dialog' => 'size=auto;reload-on-close']
     );
     $sidebar->addWidget($widget);
diff --git a/app/views/tour/admin_overview.php b/app/views/tour/admin_overview.php
index 7e5880d9e6c..ed689683475 100644
--- a/app/views/tour/admin_overview.php
+++ b/app/views/tour/admin_overview.php
@@ -1,4 +1,14 @@
-<? use Studip\Button, Studip\LinkButton; ?>
+<?php
+/**
+ * @var string $delete_question
+ * @var TourController $controller
+ * @var string $tour_searchterm
+ * @var string $filter_text
+ * @var HelpTour[] $tours
+ */
+
+use Studip\Button;
+?>
 <?= $delete_question ?>
 
 <form action="<?= $controller->url_for('tour/admin_overview') ?>" id="admin_tour_form" method="post" class="default">
diff --git a/app/views/tour/edit_step.php b/app/views/tour/edit_step.php
index 4c0cfb8df69..199500534a5 100644
--- a/app/views/tour/edit_step.php
+++ b/app/views/tour/edit_step.php
@@ -1,18 +1,24 @@
-<? use Studip\Button, Studip\LinkButton; ?>
+<?php
+/**
+ * @var TourController $controller
+ * @var string $tour_id
+ * @var HelpTourStep $step
+ * @var string $mode
+ * @var string $force_route
+ * @var bool $via_ajax
+ */
+
+use Studip\Button, Studip\LinkButton;
+?>
 
 <div id="edit_tour_step" class="edit_tour_step">
-    <? if (Request::isXhr()) : ?>
-        <? foreach (PageLayout::getMessages() as $msg) : ?>
-            <?= $msg ?>
-        <? endforeach ?>
-    <? endif ?>
     <form id="edit_tour_form" class="default"
           action="<?= $controller->url_for('tour/edit_step/' . $tour_id . '/' . $step->step . '/save') ?>"
           method="post">
         <?= CSRFProtection::tokenTag(); ?>
         <fieldset>
             <input type="hidden" name="tour_step_nr" value="<?= $step->step ?>">
-            <input type="hidden" name="tour_step_editmode" value="<?= $mode ?>">
+            <input type="hidden" name="tour_step_editmode" value="<?= htmlReady($mode) ?>">
             <legend><?= sprintf(_('Schritt %s'), $step->step) ?></legend>
             <label>
                 <?= _('Titel') ?>
diff --git a/app/views/tour/import.php b/app/views/tour/import.php
index 57681a102e2..1481cbc41e7 100644
--- a/app/views/tour/import.php
+++ b/app/views/tour/import.php
@@ -1,4 +1,10 @@
-<? use Studip\Button, Studip\LinkButton; ?>
+<?php
+/**
+ * @var TourController $controller
+ * @var array $tourdata
+ * @var array $metadata
+ */
+?>
 <form class="default" enctype="multipart/form-data" action="<?= $controller->link_for('tour/import') ?>" method="post">
     <?= CSRFProtection::tokenTag(); ?>
 
diff --git a/app/views/web_migrate/index.php b/app/views/web_migrate/index.php
index 5de26791c10..b26b90c5981 100644
--- a/app/views/web_migrate/index.php
+++ b/app/views/web_migrate/index.php
@@ -1,3 +1,15 @@
+<?php
+/**
+ * @var Migration[] $migrations
+ * @var WebMigrateController $controller
+ * @var string $target
+ * @var string $branch
+ * @var Migrator $migrator
+ * @var int $offset
+ * @var array $backlinks
+ * @var array $descendants
+ */
+?>
 <? if (count($migrations) === 0): ?>
     <?= MessageBox::info(_('Ihr System befindet sich auf dem aktuellen Stand.'))->hideClose() ?>
 <? else: ?>
diff --git a/app/views/wiki/change_courseperms.php b/app/views/wiki/change_courseperms.php
index 4f59fe61a1c..b0d274287cd 100644
--- a/app/views/wiki/change_courseperms.php
+++ b/app/views/wiki/change_courseperms.php
@@ -1,3 +1,10 @@
+<?php
+/**
+ * @var WikiController $controller
+ * @var bool $restricted
+ * @var string $keyword
+ */
+?>
 <form action="<?= $controller->link_for('wiki/store_courseperms', compact('keyword')) ?>" method="post" class="default">
     <?= CSRFProtection::tokenTag() ?>
 
diff --git a/app/views/wiki/change_page_config.php b/app/views/wiki/change_page_config.php
index 84b99f126ac..e121c207549 100644
--- a/app/views/wiki/change_page_config.php
+++ b/app/views/wiki/change_page_config.php
@@ -1,3 +1,11 @@
+<?php
+/**
+ * @var WikiController $controller
+ * @var WikiPageConfig $config
+ * @var array $validKeywords
+ * @var string $keyword
+ */
+?>
 <form action="<?= $controller->link_for('wiki/store_page_config', compact('keyword')) ?>" method="post" class="default" id="wiki-config">
     <?= CSRFProtection::tokenTag() ?>
 
diff --git a/app/views/wiki/create.php b/app/views/wiki/create.php
index 927d1f98670..09df6ee9db1 100644
--- a/app/views/wiki/create.php
+++ b/app/views/wiki/create.php
@@ -1,3 +1,9 @@
+<?php
+/**
+ * @var string $keyword
+ * @var string[] $wiki_page_names
+ */
+?>
 <p>
     <?= _('Hier können Sie eine neue Wiki-Seite erstellen.') ?>
     <br />
diff --git a/app/views/wiki/import.php b/app/views/wiki/import.php
index b95f8761672..1fd39c9076d 100644
--- a/app/views/wiki/import.php
+++ b/app/views/wiki/import.php
@@ -1,3 +1,15 @@
+<?php
+/**
+ * @var bool $show_wiki_page_form
+ * @var WikiController $controller
+ * @var Course $course
+ * @var bool $success
+ * @var bool $bad_course_search
+ * @var QuickSearch $course_search
+ * @var Course $selected_course
+ * @var array $wiki_pages
+ */
+?>
 <form class="default" method="post"
       name="wiki_import_form"
       data-dialog="size=auto;<?= $show_wiki_page_form ? 'reload-on-close' : '' ?>"
diff --git a/app/views/wiki/info.php b/app/views/wiki/info.php
index 54f9e862831..356ccdc19f5 100644
--- a/app/views/wiki/info.php
+++ b/app/views/wiki/info.php
@@ -1,3 +1,14 @@
+<?php
+/**
+ * @var string $keyword
+ * @var WikiPage $last_page
+ * @var WikiPage $first_page
+ * @var User $first_user
+ * @var User $last_user
+ * @var array $backlinks
+ * @var WikiPage[] $descendants
+ */
+?>
 <h1>
     <?= $keyword === 'WikiWikiWeb' ? _("Wiki-Startseite") : htmlReady($keyword) ?>
 </h1>
-- 
GitLab