From 8300910b587ffc17fd774de9e2d29e38450f94f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Ho=CC=88=C3=9Fl?= Date: Sat, 16 Sep 2023 14:16:40 +0200 Subject: [PATCH] Plugin: enhancements --- plugins/egp/LayoutHooks.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/plugins/egp/LayoutHooks.php b/plugins/egp/LayoutHooks.php index e29edd8b6f..5e7bc30876 100644 --- a/plugins/egp/LayoutHooks.php +++ b/plugins/egp/LayoutHooks.php @@ -163,6 +163,24 @@ public function getStdNavbarHeader(string $before): string } } + if ($consultation && $consultation->getSettings()->documentPage) { + $adminUrl = UrlHelper::createUrl(['/pages/documents']); + $adminTitle = \Yii::t('base', 'menu_documents'); + $out .= '
  • ' . Html::a($adminTitle, $adminUrl, ['id' => 'documentsLink', 'aria-label' => $adminTitle]) . '
  • '; + } + + if ($consultation && $consultation->getSettings()->hasSpeechLists && $consultation->getSettings()->speechPage) { + $adminUrl = UrlHelper::createUrl(['/consultation/speech']); + $adminTitle = \Yii::t('base', 'menu_speech_list'); + $out .= '
  • ' . Html::a($adminTitle, $adminUrl, ['id' => 'speechLink', 'aria-label' => $adminTitle]) . '
  • '; + } + + if ($consultation && $consultation->getSettings()->votingPage) { + $adminUrl = UrlHelper::createUrl(['/consultation/votings']); + $adminTitle = \Yii::t('base', 'menu_votings'); + $out .= '
  • ' . Html::a($adminTitle, $adminUrl, ['id' => 'votingsLink', 'aria-label' => $adminTitle]) . '
  • '; + } + if (!User::getCurrentUser()) { if (get_class($controller) === UserController::class) { $backUrl = UrlHelper::createUrl('/consultation/index'); @@ -210,7 +228,7 @@ public function getStdNavbarHeader(string $before): string public function getMotionViewData(array $motionData, Motion $motion): array { foreach ($motionData as $i => $data) { - if ($motionData[$i]['title'] === \Yii::t('motion', 'initiators_1') || $motionData[$i]['title'] === \Yii::t('motion', 'initiators_x')) { + if ($data['title'] === \Yii::t('motion', 'initiators_1') || $data['title'] === \Yii::t('motion', 'initiators_x')) { $motionData[$i]['title'] = 'Party'; $initiators = $motion->getInitiators(); $motionData[$i]['content'] = ''; @@ -226,7 +244,7 @@ public function getMotionViewData(array $motionData, Motion $motion): array public function getAmendmentViewData(array $amendmentData, Amendment $amendment): array { foreach ($amendmentData as $i => $data) { - if ($amendmentData[$i]['title'] === \Yii::t('motion', 'initiators_1') || $amendmentData[$i]['title'] === \Yii::t('motion', 'initiators_x')) { + if ($data['title'] === \Yii::t('motion', 'initiators_1') || $data['title'] === \Yii::t('motion', 'initiators_x')) { $amendmentData[$i]['title'] = 'Party'; $initiators = $amendment->getInitiators(); $amendmentData[$i]['content'] = '';