示例#1
0
 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);
 }
示例#2
0
 public function showAction()
 {
     $warMapper = new WarMapper();
     $gameMapper = new GameMapper();
     $groupMapper = new GroupMapper();
     $enemyMapper = new EnemyMapper();
     $war = $warMapper->getWarById($this->getRequest()->getParam('id'));
     $this->getView()->set('games', $gameMapper->getGamesByWarId($this->getRequest()->getParam('id')));
     $group = $groupMapper->getGroupById($war->getWarGroup());
     $enemy = $enemyMapper->getEnemyById($war->getWarEnemy());
     $this->getLayout()->getHmenu()->add($this->getTranslator()->trans('menuWarList'), array('action' => 'index'))->add($group->getGroupName(), array('controller' => 'group', 'action' => 'show', 'id' => $group->getId()))->add($this->getTranslator()->trans('warPlay'), array('action' => 'show', 'id' => $this->getRequest()->getParam('id')));
     $this->getView()->set('group', $group);
     $this->getView()->set('enemy', $enemy);
     $this->getView()->set('war', $war);
 }
示例#3
0
 public function treatAction()
 {
     $groupMapper = new GroupMapper();
     $userGroupMapper = new UserGroupMapper();
     if ($this->getRequest()->getParam('id')) {
         $this->getLayout()->getAdminHmenu()->add($this->getTranslator()->trans('manageGroups'), array('action' => 'index'))->add($this->getTranslator()->trans('treatGroup'), array('action' => 'treat'));
         $groups = $groupMapper->getGroupById($this->getRequest()->getParam('id'));
         $this->getView()->set('groups', $groups);
     } else {
         $this->getLayout()->getAdminHmenu()->add($this->getTranslator()->trans('manageGroups'), array('action' => 'index'))->add($this->getTranslator()->trans('manageNewGroup'), array('action' => 'treat'));
     }
     $userGroupList = $userGroupMapper->getGroupList();
     $this->getView()->set('userGroupList', $userGroupList);
     if ($this->getRequest()->isPost()) {
         $groupModel = new GroupModel();
         if ($this->getRequest()->getParam('id')) {
             $groupModel->setId($this->getRequest()->getParam('id'));
         }
         $groupName = trim($this->getRequest()->getPost('groupName'));
         $groupTag = trim($this->getRequest()->getPost('groupTag'));
         $groupImage = trim($this->getRequest()->getPost('groupImage'));
         $groupMember = $this->getRequest()->getPost('userGroup');
         if (empty($groupName)) {
             $this->addMessage('missingGroupName', 'danger');
         } elseif (empty($groupImage)) {
             $this->addMessage('missingGroupImage', 'danger');
         } elseif (empty($groupMember)) {
             $this->addMessage('missingGroupMember', 'danger');
         } elseif (empty($groupTag)) {
             $this->addMessage('missingGroupTag', 'danger');
         } else {
             $groupModel->setGroupMember($groupMember);
             $groupModel->setGroupName($groupName);
             $groupModel->setGroupTag($groupTag);
             $groupModel->setGroupImage($groupImage);
             $groupMapper->save($groupModel);
             $this->addMessage('saveSuccess');
             $this->redirect(array('action' => 'index'));
         }
     }
 }