This repository has been archived on 2024-06-26. You can view files and clone it, but cannot push or open issues or pull requests.
sakura/app/Controllers/Settings/Controller.php

66 lines
1.8 KiB
PHP
Raw Normal View History

<?php
/**
* Holds the base settings controller.
* @package Sakura
*/
namespace Sakura\Controllers\Settings;
use Sakura\Controllers\Controller as BaseController;
2016-08-07 14:10:27 +00:00
use Sakura\CurrentSession;
2016-04-01 21:44:31 +00:00
use Sakura\Template;
/**
* Base controller (which other controllers should extend on).
* @package Sakura
* @author Julian van de Groep <me@flash.moe>
*/
class Controller extends BaseController
{
2016-08-05 02:35:37 +00:00
/**
* Constructor.
*/
public function __construct()
{
2016-08-02 20:35:12 +00:00
Template::vars(['navigation' => $this->navigation()]);
}
2016-08-05 02:35:37 +00:00
/**
* Generates the navigation.
* @return array
*/
2016-03-31 20:03:25 +00:00
public function navigation()
{
$nav = [];
2016-08-02 20:35:12 +00:00
// Account
if (CurrentSession::$user->perms->changeProfile) {
2016-09-08 21:32:33 +00:00
$nav["Account"]["Profile"] = route('settings.account.profile');
2016-08-02 20:35:12 +00:00
}
$nav["Account"]["Details"] = route('settings.account.details');
if (CurrentSession::$user->perms->manageRanks) {
2016-09-08 21:32:33 +00:00
$nav["Account"]["Ranks"] = route('settings.account.ranks');
2016-03-31 20:03:25 +00:00
}
if (CurrentSession::$user->perms->changeUserpage) {
$nav["Account"]["Userpage"] = route('settings.account.userpage');
2016-03-31 20:03:25 +00:00
}
if (CurrentSession::$user->perms->changeSignature) {
$nav["Account"]["Signature"] = route('settings.account.signature');
}
// Friends
if (CurrentSession::$user->perms->manageFriends) {
$nav["Friends"]["Listing"] = route('settings.friends.listing');
$nav["Friends"]["Requests"] = route('settings.friends.requests');
2016-03-31 20:03:25 +00:00
}
// Advanced
$nav["Advanced"]["Sessions"] = route('settings.advanced.sessions');
if (CurrentSession::$user->perms->deactivateAccount) {
2016-09-08 21:32:33 +00:00
$nav["Advanced"]["Deactivate"] = route('settings.advanced.deactivate');
2016-03-31 20:03:25 +00:00
}
return $nav;
}
}