1 | <?php namespace Mascame\Artificer\Http\Controllers; |
||
16 | class BaseController extends Controller |
||
17 | { |
||
18 | |||
19 | public $fields; |
||
20 | public $data; |
||
21 | public $options; |
||
22 | |||
23 | public static $routes; |
||
24 | |||
25 | public $theme; |
||
26 | public $standalone; |
||
27 | public $menu = array(); |
||
28 | protected $master_layout = null; |
||
29 | |||
30 | /** |
||
31 | * @var Model |
||
32 | */ |
||
33 | public $modelObject = null; |
||
34 | |||
35 | |||
36 | public function __construct() |
||
37 | { |
||
38 | $this->theme = AdminOption::get('theme') . '::'; |
||
39 | $this->master_layout = 'base'; |
||
40 | |||
41 | // Todo: Do Sth with this |
||
42 | if (UserController::check() || true) { |
||
43 | $this->options = AdminOption::all(); |
||
44 | |||
45 | $this->modelObject = Artificer::getModel(); |
||
46 | |||
47 | if ($this->isStandAlone()) { |
||
48 | $this->master_layout = 'standalone'; |
||
49 | $this->standalone = true; |
||
50 | } |
||
51 | |||
52 | $this->shareMainViewData(); |
||
53 | } |
||
54 | } |
||
55 | |||
56 | protected function shareMainViewData() |
||
66 | |||
67 | /** |
||
68 | * @return bool |
||
69 | */ |
||
70 | public function isStandAlone() |
||
74 | |||
75 | /** |
||
76 | * @return array |
||
77 | */ |
||
78 | public function getMenu() |
||
79 | { |
||
80 | if ( ! empty($this->menu)) return $this->menu; |
||
81 | |||
82 | $menu = AdminOption::get('menu'); |
||
83 | |||
84 | foreach ($menu as $key => $menuItem) { |
||
85 | // Todo: Permit is absolete or not? |
||
86 | if (Permit\MenuPermit::access($key) || true) { |
||
87 | $this->menu[] = $menuItem; |
||
88 | } |
||
89 | } |
||
90 | |||
91 | return $this->menu; |
||
92 | } |
||
93 | |||
94 | /** |
||
95 | * @param string $view |
||
96 | */ |
||
97 | public function getView($view) |
||
101 | |||
102 | /** |
||
103 | * @return string |
||
104 | */ |
||
105 | public static function assets() |
||
115 | |||
116 | |||
117 | } |