This repository has been archived by the owner on Apr 4, 2022. It is now read-only.
forked from etsy/opsweekly
-
Notifications
You must be signed in to change notification settings - Fork 1
/
meeting.php
162 lines (146 loc) · 6.38 KB
/
meeting.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
<?php
include_once("phplib/base.php");
if (isset($_GET['week'])) {
if(is_numeric($_GET['week'])) {
$_POST['date'] = date("r", $_GET['week']);
} else {
die("Wat?");
}
}
$time_requested = getOrSetRequestedDate();
$my_username = getUsername();
$start_end = getWeekRange($time_requested);
$start_ts = $start_end[0];
$end_ts = $start_end[1];
$oncall_period = getOnCallWeekRange($time_requested);
$oncall_start = $oncall_period[0];
$oncall_end = $oncall_period[1];
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ||
$_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$permalink = "{$protocol}{$_SERVER['SERVER_NAME']}/meeting.php?week={$start_ts}";
$page_title = getTeamName() . " Weekly Updates - Meeting View";
include_once('phplib/header.php');
include_once('phplib/nav.php');
?>
<script>
function setDateToLastWeek() {
$.post("meeting.php", { date: '<?php echo date("r", strtotime("1 week ago")) ?>' }, function() { window.location.href = 'meeting.php'} );
}
</script>
<div class="container">
<h1><?php echo getTeamName()?> Meeting For Week Ending <?php echo date("l jS F Y", $end_ts ) ?></h1>
<div class="row">
<div class="span12">
<?php
if ($end_ts > time() ) {
?>
<div class="alert alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<h4>Warning!</h4>
You're hosting a meeting for a week that hasn't ended yet. You probably want to host the meeting for last weeks data instead. <a href="javascript:setDateToLastWeek()">Click here to do that</a>.
</div>
<?php
} else {
?>
<div class="alert alert-block alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
<h4>Welcome to the Weekly <?php echo getTeamName()?> Meeting</h4>
Below is a compilation of all the things that happened for the selected week. Notes can be written below and they will be saved with that week's data for future reference. <br />
</div>
<?php
}
?>
<div class="pull-right"><div class="btn-group"><a class="btn" role="button" data-toggle="modal" href="#permalink-modal"><i class="icon-bookmark"></i> Permalink</a></div></div>
<?php
if($results = checkForPreviousMeetingNotes( generateMeetingNotesID($start_ts, $end_ts) )) {
$previous_timestamp = $results['timestamp'];
$previous_user = $results['user'];
$previous_report = $results['notes'];
echo "<h2>Meeting Notes <small>taken by {$previous_user} at the " . getTeamName() . " Meeting held on " . date("l jS F Y", $previous_timestamp);
} else {
echo "<h2>Meeting Notes <small>you are taking at the " . getTeamName() . " Meeting today (" . date("l jS F Y") . ")";
$previous_report = null;
}
?>
</small></h2>
<form action="<?php echo $ROOT_URL; ?>/add_meeting_notes.php" method="POST" id="weekly-notes">
<textarea class="textarea span12" name="weeklynotes" placeholder="Enter Meeting Notes, e.g. Hiring, Launches, Corp IT information" style="height: 200px">
<?php echo $previous_report ?>
</textarea>
<script>
$('.textarea').wysihtml5({"image": false, "color": false});
</script>
<input type="hidden" name="range_start" value="<?php echo $start_ts ?>">
<input type="hidden" name="range_end" value="<?php echo $end_ts ?>">
<button class="btn btn-primary" type="submit">Save Meeting Notes</button>
</form>
<?php
if (getTeamConfig('oncall')) {
?>
<h2>On Call Report
<?php
if($results = getOnCallReportForWeek($oncall_start, $oncall_end)) {
echo "<small> for week " . date("l jS F Y", $oncall_start) . " - " . date("l jS F Y", $oncall_end);
echo " compiled by " . guessPersonOnCall($oncall_start, $oncall_end) . "</small></h2>";
?>
<table class="table table-striped table-bordered table-hover" id="oncall-table" style='font-size: 90%'>
<thead>
<tr>
<th>Date/Time</th><th>Host</th><th>Service</th><th>Output</th><th>State</th>
</tr>
</thead>
<tbody>
<?php
foreach ($results as $n) {
echo formatOnCallRowForPrint($n);
}
echo "</tbody></table>";
} else {
echo "</h2>";
echo insertNotify("critical", "Uh-oh! There has been no weekly report filed for this week yet!");
}
?>
<div id="oncall-stats">Loading report...</div>
<script>
$.post("./generate_report.php", { type: 'week', date: '<?php echo $time_requested ?>' }).done(function(data) {
$('#oncall-stats').html(data);
});
</script>
<?php } ?>
<h2>Weekly Updates</h2>
<?php
if(!$updates = getGenericWeeklyReportsForWeek($start_ts, $end_ts)) {
echo insertNotify("error", "No Weekly Updates have been entered yet this week");
} else {
foreach ($updates as $update) {
echo formatWeeklyReportForPrint($update);
}
}
?>
<h2>Fin</h2>
<p>You have reached the end of the meeting report! </p>
<button class="btn btn-primary" onClick="$('#weekly-notes').submit()">Save Meeting Notes</button>
<a class="btn btn-success" href="<?php echo $ROOT_URL; ?>/index.php"><i class="icon-white icon-home"></i> Home</a>
<br />
<br />
</div>
</div>
</form>
</div>
<!-- Modal for permalink -->
<div id="permalink-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Permalink to this meeting</h3>
</div>
<div class="modal-body">
<p>To link other people to this meeting, use the following URL:</p>
<pre><a href="<?php echo $permalink; ?>"></a><?php echo $permalink ?></pre>
</div>
<div class="modal-footer">
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
<?php include_once('phplib/footer.php'); ?>
</body>
</html>