GroupMenu.php
781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace frontend\modules\news\widgets\GroupMenu;
use frontend\modules\news\models\Group;
/**
* Class GroupMenu
*
* @package frontend\modules\news\widgets\LatestNews
* @author FilamentV <vortex.filament@gmail.com>
* @copyright (c), Thread
*/
class GroupMenu extends \thread\app\base\widgets\Widget
{
public $limit = 10;
/**
* @var null
*/
protected $items = null;
/**
*
*/
public function init()
{
parent::init();
$this->items = Group::find()->addOrderBy(['title' => SORT_ASC])->all();
}
/**
*
*/
public function run()
{
if ($this->items != null) {
return $this->render('index', [
'groups' => $this->items
]);
}
}
}