This repository has been archived by the owner on Dec 4, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#814: Create admin group controller with index and edit actions.
- Loading branch information
1 parent
6719828
commit 636e5c6
Showing
5 changed files
with
112 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
/** | ||
* FluxBB - fast, light, user-friendly PHP forum software | ||
* Copyright (C) 2008-2012 FluxBB.org | ||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public license for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* @category FluxBB | ||
* @package Core | ||
* @copyright Copyright (c) 2008-2012 FluxBB (http://fluxbb.org) | ||
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License | ||
*/ | ||
|
||
namespace FluxBB\Controllers\Admin; | ||
|
||
use App; | ||
use View; | ||
use FluxBB\Models\GroupRepositoryInterface; | ||
|
||
class Groups extends Base | ||
{ | ||
|
||
/** | ||
* The groups repository | ||
* | ||
* @var GroupRepositoryInterface | ||
*/ | ||
protected $groups; | ||
|
||
|
||
public function __construct(GroupRepositoryInterface $groups) | ||
{ | ||
$this->groups = $groups; | ||
} | ||
|
||
public function get_index() | ||
{ | ||
$groups = $this->groups->getHierarchy(); | ||
|
||
return View::make('fluxbb::admin.groups.index') | ||
->with('groups', $groups); | ||
} | ||
|
||
public function get_edit($id) | ||
{ | ||
$group = $this->groups->find($id); | ||
$perms = $this->groups->getPermissions($id); | ||
|
||
if (is_null($group)) | ||
{ | ||
App::abort(404); | ||
} | ||
|
||
return View::make('fluxbb::admin.groups.edit') | ||
->with('group', $group) | ||
->with('perms', $perms); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@extends('fluxbb::admin.layout.main') | ||
|
||
@section('main') | ||
|
||
<h1>ADMIN groups</h1> | ||
|
||
{{ $group->title }} | ||
|
||
<h3>Permissions</h3> | ||
|
||
<ul> | ||
@foreach ($perms as $permission) | ||
<li>{{ $permission }}</li> | ||
@endforeach | ||
</ul> | ||
|
||
@stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@extends('fluxbb::admin.layout.main') | ||
|
||
@section('main') | ||
|
||
<h1>ADMIN groups</h1> | ||
|
||
@foreach ($groups as $group) | ||
<p><a href="{{ route('admin_groups_edit', array('id' => $group->id)) }}">{{ $group->title }}</a></p> | ||
@endforeach | ||
|
||
@stop |