Elgg  Version 4.3
admin.php
Go to the documentation of this file.
1 <?php
9 
10 // Make sure the 'site' css isn't loaded
11 elgg_unregister_external_file('css', 'elgg');
12 
13 if (elgg_view_exists('elgg/admin.js')) {
14  elgg_deprecated_notice('No longer rely on the presence of the generic elgg/admin.js. Include your own AMD js module.', '4.3');
15 
16  elgg_require_js('elgg/admin');
17 }
18 
19 $segments = explode('/', trim(elgg_extract('segments', $vars, ''), '/'));
20 
21 // default to dashboard
22 if (!isset($segments[0]) || empty($segments[0])) {
23  $segments = ['dashboard'];
24 }
25 
26 $title = elgg_echo("admin:{$segments[0]}");
27 if (count($segments) > 1) {
28  $title .= ' : ' . elgg_echo('admin:' . implode(':', $segments));
29 }
30 
31 $view = 'admin/' . implode('/', $segments);
33  'page' => $segments,
34 ]);
35 
36 if (empty($content)) {
37  throw new PageNotFoundException(elgg_echo('admin:unknown_section'));
38 }
39 
40 // build page
41 $body = elgg_view_layout('admin', [
42  'title' => $title,
43  'content' => $content,
44  'filter_id' => 'admin',
45 ]);
46 
47 // draw page
48 echo elgg_view_page($title, $body, 'admin');
elgg_view_exists($view, $viewtype= '', $recurse=true)
Returns whether the specified view exists.
Definition: views.php:152
$body
Definition: admin.php:37
elgg_deprecated_notice(string $msg, string $dep_version)
Log a notice about deprecated use of a function, view, etc.
Definition: deprecation.php:52
if(!isset($segments[0])||empty($segments[0])) $title
Definition: admin.php:26
elgg_unregister_external_file(string $type, string $name)
Unregister an external file.
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
elgg_view_page($title, $body, $page_shell= 'default', $vars=[])
Assembles and outputs a full page.
Definition: views.php:262
if(count($segments) > 1) $view
Definition: admin.php:31
$vars['breadcrumbs']
Definition: admin.php:18
if(elgg_view_exists('elgg/admin.js')) $segments
Definition: admin.php:19
Thrown when page is not accessible.
elgg_require_js($name)
Request that Elgg load an AMD module onto the page.
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:547
elgg_view_layout($layout_name, $vars=[])
Displays a layout with optional parameters.
Definition: views.php:380
$content
Definition: admin.php:32
elgg echo
Translates a string.
Definition: deprecated.js:530
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:179