forked from IlchCMS/Ilch-2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Group.php
48 lines (38 loc) · 1.7 KB
/
Group.php
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
45
46
47
48
<?php
/**
* @copyright Ilch 2.0
* @package ilch
*/
namespace Modules\War\Controllers;
use Modules\War\Mappers\Group as GroupMapper;
use Modules\War\Mappers\War as WarMapper;
class Group extends \Ilch\Controller\Frontend
{
public function indexAction()
{
$this->getLayout()->getHmenu()
->add($this->getTranslator()->trans('menuWarList'), array('controller' => 'index', 'action' => 'index'))
->add($this->getTranslator()->trans('menuGroupList'), array('action' => 'index'));
$groupMapper = new GroupMapper();
$pagination = new \Ilch\Pagination();
$pagination->setPage($this->getRequest()->getParam('page'));
$this->getView()->set('groups', $groupMapper->getGroupList($pagination));
$this->getView()->set('pagination', $pagination);
}
public function showAction()
{
$groupMapper = new GroupMapper();
$warMapper = new WarMapper();
$pagination = new \Ilch\Pagination();
$id = $this->getRequest()->getParam('id');
$group = $groupMapper->getGroupById($id);
$pagination->setPage($this->getRequest()->getParam('page'));
$this->getLayout()->getHmenu()
->add($this->getTranslator()->trans('menuWarList'), array('controller' => 'index', 'action' => 'index'))
->add($this->getTranslator()->trans('menuGroupList'), array('action' => 'index'))
->add($group->getGroupName(), array('action' => 'show', 'id' => $this->getRequest()->getParam('id')));
$this->getView()->set('group', $group);
$this->getView()->set('war', $warMapper->getWarsByWhere('group ='.$id, $pagination));
$this->getView()->set('pagination', $pagination);
}
}