-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
170 lines (145 loc) · 5.37 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?php
session_start();
include ("config.php");
require ("andwherePDO.class.php");
include ("scripts.php");
if (DEBUG === true) {
error_reporting(E_WARN);
ini_set("display_errors", true);
var_dump($_REQUEST);
print "<p></p>".PHP_EOL;
}
if (isset($_REQUEST['set_init'])) {
$_SESSION['current_init'] = $_REQUEST['set_init'];
}
if (! isset($ui_theme)) { $ui_theme="pepper-grinder"; }
?>
<html>
<head>
<title>Suma Session Manager</title>
<style>
form { display: inline }
.highlight { background-color: yellow }
</style>
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.js">
</script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/themes/<?php echo $ui_theme;?>/jquery-ui.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css" type="text/css" />
<script type="text/javascript">
$(document).ready(function() {
$('#tabs').tabs();
$('#initiative-selector').change(function() {
var init = $(this).val();
window.location.replace('?set_init='+init);
});
$( "#dp-text").click(function() {
$('#datepicker').datepicker('show');
});
$( "#datepicker" ).datepicker({
showOn: "button",
<?php
if ($prevent_datepicker_future || ! isset($prevent_datepicker_future)) {
?>
maxDate: new Date,
<?php
}
?>
buttonImageOnly: true,
buttonText: " ",
dateFormat: "yy-mm-dd",
altField: '#date-search',
onSelect: function() {
$('#date-select-form').submit();
}
});
$('tr').mousedown(function() {
$(this).parent().children().removeClass('highlight');
$(this).addClass('highlight');
});
$('.adjust-time').click(function() {
var row=$(this).closest('tr');
// var id=$(this).closest('tr').children().first().text();
var id=row.children().first().text();
var transaction=row.children(':nth-child(5)').text();
});
$('#suma-day-link').click(function() {
var link = $(this).data('url');
window.open(link, "SumaReport");
});
});
</script>
</head>
<body>
<div id="wrapper">
<div id="content">
<h1>Suma Session Manager</h1>
<?php
$result = CheckInstall();
$installation_problem = $result['installation_problem'];
if (isset($result['errors'])) { print $result['errors']; }
if (! $installation_problem) {
if (isset($default_init) &! isset ($_SESSION['current_init'])) {
$_SESSION['current_init'] = $default_init;
}
print(SelectInitiative($_SESSION['current_init']));
$offset = (isset($_REQUEST['offset']) ? $_REQUEST['offset'] : 0);
if ($_REQUEST['action'] == "move_session") {
MoveSession($_REQUEST['session_id'], $_REQUEST['transaction_id'], $_REQUEST['time_shift']);
print '<hr>';
}
if ($_REQUEST['action'] == "delete_session") {
DeleteUndelete("delete",$_REQUEST['session_id']);
print '<hr>';
}
elseif ($_REQUEST['action'] == "undelete_session") {
DeleteUndelete("undelete",$_REQUEST['session_id']);
print '<hr>';
}
if (isset($_REQUEST['date_search'])) {
// $and_where = "AND `start` LIKE '".$_REQUEST['date_search']."%'";
$and_where = new AndWherePDO();
$and_where->AddCondition('start',$_REQUEST['date_search'].'%','LIKE');
}
}
?>
<div id="tabs">
<ul>
<?php
if (! $installation_problem) {
print'<li><a href="#tabs-sessions">Sessions</a></li>'.PHP_EOL;
if (in_array($_SESSION['current_init'], $one_per_hour_inits)) {
print '<li><a href="#tabs-multi">Hours with Multiple Sessions</a></li>'.PHP_EOL;
}
}
?>
<li><a href="#tabs-readme">Documentation</a></li>
</ul>
<?php
if (! $installation_problem) {
print '<div id="tabs-sessions">'.PHP_EOL;
ShowEntries ($_SESSION['current_init'], $offset, $entries_per_page, $and_where, $_REQUEST['hour_focus']);
print '</div><!--id=tabs-sessions-->'.PHP_EOL;
if (in_array($_SESSION['current_init'], $one_per_hour_inits)) {
print ' <div id="tabs-multi">'.PHP_EOL;
ShowMultiHours($_SESSION['current_init']);
print ' </div><!--id=tabs-multi-->'.PHP_EOL;
}
} //end if no installation problem
//print README file in Documentation Tab
print '<div id="tabs-readme">'.PHP_EOL;
$file = file_get_contents("README.md");
// crop the first line out so we can use customized header
$lines = explode("\n", $file);
$file = implode("\n", array_slice($lines, 2));
print (RenderMarkdown($file));
print '</div><!--id=readme-->'.PHP_EOL;
print ' </div><!--id=tabs-->'.PHP_EOL;
print "</div><!--id=content-->\n";
print '<div id="footer">';
include("license.php");
print "</div><!--id=footer-->\n";
print "</div><!--id=wrapper-->\n";
?>
</body>