class MenuAdminModule extends AdminModule { public function __construct() { $this->name = t('Menu'); $this->image = CoOrg::staticFile('images/menu.png', 'menu'); $this->priority = 2; } } class MenuAdminTab { public function __construct() { $this->name = t('Manage menus'); $this->url = CoOrg::createURL(array('admin', 'menu')); $this->priority = 1; } public function isAllowed($user) { return Acl::isAllowed($user->username, 'admin-menu-edit'); } } Admin::registerModule('MenuAdminModule'); Admin::registerTab('MenuAdminTab', 'MenuAdminModule'); ?>
class UserAdminModule extends AdminModule { public function __construct() { $this->name = t('Users'); $this->image = CoOrg::staticFile('images/user.png', 'user-admin'); $this->priority = 2; } } class UserAdminTab { public function __construct() { $this->name = t('Manage users'); $this->url = CoOrg::createURL('admin/user'); $this->priority = 1; } public function isAllowed($user) { return Acl::isAllowed($user->username, 'admin-user'); } } Admin::registerModule('UserAdminModule'); Admin::registerTab('UserAdminTab', 'UserAdminModule'); ?>
} class TabMockP1DeniedAdminTab { public function __construct() { $this->name = 'Denied'; $this->url = ''; $this->priority = 1; } public function isAllowed() { return false; } } Admin::registerModule('MockP1DeniedModule'); Admin::registerTab('TabMockP1DeniedAdminTab', 'MockP1DeniedModule'); class AdminTest extends CoOrgModelTest { const dataset = 'admin.dataset.xml'; public function testModels() { $s = new UserSession('dvorak', 'dvorak'); $s->save(); $modules = Admin::modules(); $this->assertEquals(7, count($modules)); $this->assertEquals('AA BB CC P1', $modules[0]->name); $this->assertEquals('Site Configuration', $modules[1]->name); $this->assertEquals('AA BB CC', $modules[2]->name);
class SiteAdminModule extends AdminModule { public function __construct() { $this->name = t('Site Configuration'); $this->priority = 1; $this->image = CoOrg::staticFile('images/system.png', 'admin'); } } class GeneralConfigurationAdminTab { public function __construct() { $this->url = CoOrg::createURL('admin/system'); $this->priority = 1; $this->name = t('General Configuration'); } public function isAllowed($user) { return Acl::isAllowed($user->username, 'admin'); } } Admin::registerModule('SiteAdminModule'); Admin::registerTab('GeneralConfigurationAdminTab', 'SiteAdminModule'); ?>
$this->url = CoOrg::createURL(array('admin/blog')); $this->priority = 2; } public function isAllowed($user) { return Acl::isAllowed($user->username, 'blog-writer'); } } class BlogCommentsModerateAdminTab { public function __construct() { $this->name = t('blog|Moderate comments'); $this->url = CoOrg::createURL(array('admin/blog/comment')); $this->priority = 3; } public function isAllowed($user) { return Acl::isAllowed($user->username, 'blog-moderator'); } } Admin::registerModule('BlogAdminModule'); Admin::registerTab('BlogConfigureAdminTab', 'BlogAdminModule'); Admin::registerTab('BlogManageAdminTab', 'BlogAdminModule'); Admin::registerTab('BlogCommentsModerateAdminTab', 'BlogAdminModule'); ?>
* CoOrg is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoOrg 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 Affero General Public License for more details. * You should have received a copy of the GNU Affero General Public License * along with CoOrg. If not, see <http://www.gnu.org/licenses/>. */ class MollomAdminTab { public function __construct() { $this->name = t('Mollom'); $this->priority = 3; $this->url = CoOrg::createURL('admin/mollom'); } public function isAllowed($user) { return Acl::isAllowed($user->username, 'admin-advanced'); } } Admin::registerTab('MollomAdminTab', 'SiteAdminModule');
$this->url = CoOrg::createURL('admin/page'); $this->priority = 1; } public function isAllowed($user) { return Acl::isAllowed($user->username, 'admin-page-edit'); } } class CreatePageAdminTab { public function __construct() { $this->name = t('Create page'); $this->url = CoOrg::createURL('admin/page/create'); $this->priority = 2; } public function isAllowed($user) { return Acl::isAllowed($user->username, 'admin-page-edit'); } } Admin::registerModule('PageAdminModule'); Admin::registerTab('ManagePagesAdminTab', 'PageAdminModule'); Admin::registerTab('CreatePageAdminTab', 'PageAdminModule'); ?>