SystemSettings   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
c 0
b 0
f 0
dl 0
loc 32
rs 10
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A body() 0 23 4
A access() 0 3 1
1
<?php
2
3
namespace Epesi\Core\System;
4
5
use Epesi\Core\System\Modules\ModuleView;
6
use Epesi\Core\System\Integration\Joints\SystemSettingsJoint;
7
use Illuminate\Support\Facades\Auth;
8
9
class SystemSettings extends ModuleView
10
{
11
	protected $label = 'System Administration';
12
	
13
	public static function access()
14
	{
15
		return Auth::user()->can('modify system settings');
16
	}
17
	
18
	public function body()
19
	{
20
		$layout = \atk4\ui\View::addTo($this)->addStyle('max-width:1200px;margin:auto;');
21
		\atk4\ui\Header::addTo($layout, [__($this->label)]);
22
		$segment = \atk4\ui\View::addTo($layout, ['ui' => 'segment']);
23
24
		$sections = [];
25
		/**
26
		 * @var SystemSettingsJoint $joint
27
		 */
28
		foreach (SystemSettingsJoint::collect() as $joint) {
29
			$sections[$joint->section()][$joint->label()] = $joint;
30
		}
31
32
		ksort($sections);
33
		
34
		foreach ($sections as $sectionName => $sectionJoints) {
35
			\atk4\ui\Header::addTo($segment, [$sectionName]);
36
			
37
			ksort($sectionJoints);
38
			
39
			foreach ($sectionJoints as $joint) {
40
				$segment->add($joint->button());
41
			}
42
		}
43
	}
44
}
45