-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.php
74 lines (55 loc) · 1.33 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
namespace slc;
// Ensure core directory is defined
if (!defined('PHPWS_SOURCE_DIR')) {
include '../../config/core/404.html';
exit();
}
$defines_file = PHPWS_SOURCE_DIR.'mod/slc/inc/defines.php';
if(is_file($defines_file)){
require_once $defines_file;
}
// Ensure login
\Current_User::requireLogin();
\PHPWS_Core::requireInc('slc', 'functions.php');
\Layout::addStyle('slc');
// Javascript
javascript('jquery_ui');
\javascriptMod('slc', 'json');
$context = new CommandContext();
$content = '';
// Extract the action from the context
if ($context->has('action'))
{
$action = $context->get('action');
$af = AJAXFactory::get();
$af->loadCall($action);
$af->execute();
\NQ::close();
echo json_encode($af->result()); // To be left on the page for consumption
exit(); // Kill it
}
else
{
// No AJAX found; do nothing
$action = 'None';
}
// Extract the view from the context
if ($context->has('view'))
{
$view = $context->get('view');
}
else
{
$view = 'Main';
}
$nv = new \slc\NotificationView();
$notifications = $nv->display();
\Layout::add($notifications);
// Get content from view
$view = ViewFactory::getView($view);
$content = $view->display($context);
\Layout::add($content);
// Add the top bar
$navLinks = new \slc\views\NavLinks();
\Layout::plug($navLinks->display(), 'NAV_LINKS');