Enh: Added footer navigation - FooterMenu widget

This commit is contained in:
Lucas Bartholemy 2018-05-14 11:57:21 +02:00
parent 28d5b0b3c9
commit 7fe9a1586e
6 changed files with 175 additions and 0 deletions

View File

@ -7,6 +7,7 @@ HumHub Change Log
- Fix #3108: Fixed cronjob examples with leading zero (acs-ferreira)
- Fix: Memory leak in activity mail summary processor cron
- Fix: With enabled guest mode BaseAccountController does not redirect to login page
- Enh: Added footer navigation - FooterMenu widget
1.2.5 (April 11, 2018)

View File

@ -0,0 +1,69 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2018 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\widgets;
/**
* FooterMenu displays a footer navigation for pages e.g. Imprint
*
* @since 1.2.6
* @author Luke
*/
class FooterMenu extends BaseMenu
{
const LOCATION_LOGIN = 'login';
const LOCATION_SIDEBAR = 'sidebar';
const LOCATION_FULL_PAGE = 'full';
const LOCATION_EMAIL = 'mail';
/**
* @var string location of footer menu (e.g. login, mail, sidebar)
*/
public $location = 'full';
/**
* @inheritdoc
*/
public $template = 'footerNavigation';
/**
* @inheritdoc
*/
public $id = 'footer-menu-nav';
/**
* @inheritdoc
*/
public function init()
{
if ($this->location === static::LOCATION_LOGIN) {
$this->template = 'footerNavigation_login';
} elseif ($this->location === static::LOCATION_SIDEBAR) {
$this->template = 'footerNavigation_sidebar';
} elseif ($this->location === static::LOCATION_EMAIL) {
$this->template = 'footerNavigation_email';
}
parent::init();
}
/**
* @inheritdoc
*/
public function run()
{
$this->trigger(self::EVENT_RUN);
return $this->render($this->template, [
'items' => $this->getItems(),
'location' => $this->location,
'numItems' => count($this->getItems())
]);
}
}

View File

@ -0,0 +1,22 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2018 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
use yii\helpers\Html;
?>
<?php if ($numItems > 0): ?>
<div class="text-center" style="filter:opacity(.6);font-size:12px">
<small>
<?php foreach ($items as $item): ?>
<?= Html::a($item['label'], $item['url']); ?>&nbsp;&middot;&nbsp;
<?php endforeach; ?>
Powered by <?= Html::a('HumHub', 'https://humhub.org'); ?>&nbsp;
</small>
</div>
<br/>
<?php endif; ?>

View File

@ -0,0 +1,28 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2018 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
use yii\helpers\Html;
$i = 0;
?>
<center>
<div class="text text-center powered">
<?php if ($numItems > 0): ?>
<?php foreach ($items as $item): ?>
<?= Html::a($item['label'], $item['url'], ['style' => 'text-decoration: none; color: '.$this->theme->variable('text-color-soft2', '#aeaeae').';']); ?>
<?php if (++$i !== $numItems): ?>
&nbsp;&middot;&nbsp;
<?php endif; ?>
<?php endforeach; ?>
<br/>
<br/>
<?php endif; ?>
</div>
</center>

View File

@ -0,0 +1,26 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2018 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
use yii\helpers\Html;
$i = 0;
?>
<div class="text text-center powered">
<?php if ($numItems > 0): ?>
<?php foreach ($items as $item): ?>
<?= Html::a($item['label'], $item['url']); ?>
<?php if (++$i !== $numItems): ?>
&nbsp;&middot;&nbsp;
<?php endif; ?>
<?php endforeach; ?>
<br/><br/>
<?php endif; ?>
Powered by <?= Html::a('HumHub', 'https://humhub.org'); ?>&nbsp;
</div>

View File

@ -0,0 +1,29 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2018 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
use yii\helpers\Html;
$i = 0;
?>
<?php if ($numItems > 0): ?>
<div style="filter:opacity(.6);font-size:12px">
<small>
<?php foreach ($items as $item): ?>
<?= Html::a($item['label'], $item['url']); ?>
<?php if (++$i !== $numItems): ?>
&nbsp;&middot;&nbsp;
<?php endif; ?>
<?php endforeach; ?>
&middot; Powered&nbsp;by&nbsp;<?= Html::a('HumHub', 'https://humhub.org'); ?>&nbsp;
</small>
</div>
<br />
<?php endif; ?>