Egorka
6 years ago
11 changed files with 139 additions and 57 deletions
@ -0,0 +1,26 @@ |
|||||||
|
<?php |
||||||
|
/** |
||||||
|
* Created by Error202 |
||||||
|
* Date: 13.08.2018 |
||||||
|
*/ |
||||||
|
|
||||||
|
namespace backend\widgets; |
||||||
|
|
||||||
|
|
||||||
|
use yii\base\Widget; |
||||||
|
|
||||||
|
class NotificationCountWidget extends Widget |
||||||
|
{ |
||||||
|
public function run() |
||||||
|
{ |
||||||
|
$count = 0; |
||||||
|
foreach (\Yii::$app->params['notifications'] as $notification) { |
||||||
|
$count += $notification['count']; |
||||||
|
} |
||||||
|
|
||||||
|
return $this->render('notification-count', [ |
||||||
|
'notifications' => \Yii::$app->params['notifications'], |
||||||
|
'count' => $count, |
||||||
|
]); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,38 @@ |
|||||||
|
<?php |
||||||
|
/** |
||||||
|
* Created by Error202 |
||||||
|
* Date: 13.08.2018 |
||||||
|
*/ |
||||||
|
|
||||||
|
use yii\helpers\Url; |
||||||
|
|
||||||
|
/** |
||||||
|
* @var $this \yii\web\View |
||||||
|
* @var $notifications array |
||||||
|
* @var $count integer |
||||||
|
*/ |
||||||
|
|
||||||
|
?> |
||||||
|
|
||||||
|
<li class="dropdown notifications-menu"> |
||||||
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> |
||||||
|
<i class="fa fa-bell-o"></i> |
||||||
|
<span class="label label-warning"><?= $count ?></span>
|
||||||
|
</a> |
||||||
|
<ul class="dropdown-menu"> |
||||||
|
<li class="header"><?= Yii::t('main', 'You have {count} notifications', ['count' => $count]) ?></li>
|
||||||
|
<li> |
||||||
|
<ul class="menu"> |
||||||
|
<?php foreach ($notifications as $notification): ?> |
||||||
|
<li> |
||||||
|
<a href="<?= Url::to([$notification['url']]) ?>">
|
||||||
|
<i class="fa fa-<?= $notification['icon'] ?> text-<?= $notification['color'] ?>"></i> <?= Yii::t($notification['message_file'], $notification['message'], ['count' => $notification['count']]) ?> |
||||||
|
</a> |
||||||
|
</li> |
||||||
|
<?php endforeach; ?> |
||||||
|
</ul> |
||||||
|
</li> |
||||||
|
<!-- <li class="footer"><a href="#">View all</a></li> --> |
||||||
|
</ul> |
||||||
|
</li> |
||||||
|
|
@ -0,0 +1,20 @@ |
|||||||
|
<?php |
||||||
|
/** |
||||||
|
* Created by Error202 |
||||||
|
* Date: 27.07.2018 |
||||||
|
*/ |
||||||
|
|
||||||
|
namespace common\modules\forms\entities\queries; |
||||||
|
|
||||||
|
use common\modules\forms\entities\FormMessage; |
||||||
|
use yii\db\ActiveQuery; |
||||||
|
|
||||||
|
class FormMessageQuery extends ActiveQuery |
||||||
|
{ |
||||||
|
public function unread() |
||||||
|
{ |
||||||
|
return $this->andWhere([ |
||||||
|
'new' => FormMessage::STATUS_NEW, |
||||||
|
]); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue