[r1]: kohaReports / trunk / summerReadingClubReport / summerReadingClubReport.php  Maximize  Restore  History

Download this file

270 lines (246 with data), 6.8 kB

  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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
<?php
## Copyright 2006 Kyle Hall
## This file is part of koha-tools.
## koha-tools is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
## koha-tools is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
## You should have received a copy of the GNU General Public License
## along with koha-tools; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#Summer Reading Club Reports
#Input: $date - start date of summer reading club, $length - length of reading club in weeks
include_once("classes/MySQLConnectionFactory.class.php");
include_once("classes/KohaReports_SummerReadingClubReport.class.php");
include_once("classes/PHP_Timer.class.php");
$timer = new PHP_timer;
$timer->start();
$mySqlConnection = new MySQLConnectionFactory;
$mySqlConnection->create();
$startDate = $HTTP_GET_VARS['startYear'] . $HTTP_GET_VARS['startMonth'] . $HTTP_GET_VARS['startDay'];
$endDate = $HTTP_GET_VARS['endYear'] . $HTTP_GET_VARS['endMonth'] . $HTTP_GET_VARS['endDay'];
$myReport = new KohaReports_SummerReadingClubReport($startDate, $endDate);
?>
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title></title>
</head>
<body>
<h2>Meadville Public Library Summer Reading Club Report</h2>
<table>
<tr>
<td>Start Date</td>
<td><?php echo $HTTP_GET_VARS['startMonth'] . '/' . $HTTP_GET_VARS['startDay'] . '/' . $startDate = $HTTP_GET_VARS['startYear'] ?></td>
</tr>
<tr>
<td>End Date</td>
<td><?php echo $HTTP_GET_VARS['endMonth'] . '/' . $HTTP_GET_VARS['endDay'] . '/' . $startDate = $HTTP_GET_VARS['endYear'] ?></td>
</tr>
<br>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">Members<br>
</td>
<td style="vertical-align: top;">Children<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">Total members<br>
</td>
<td style="vertical-align: top;"><?php echo $myReport->getTotalMembersCount() ?><br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">Active Members*<br>
</td>
<td style="vertical-align: top;"><?php echo $myReport->getActiveMembersCount() ?><br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">Books Read<br>
</td>
<td style="vertical-align: top;"><?php echo $myReport->getTotalBooksRead() ?><br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">Average books/child<br>
</td>
<td style="vertical-align: top;"><?php echo $myReport->getAverageBooksRead() ?><br>
</td>
</tr>
<tr>
<td colspan="2" rowspan="1" style="vertical-align: top;">* of the
children who pregistered, <?php echo $myReport->getInactiveMembersCount() ?> never participated.<br>
</td>
</tr>
</tbody>
</table>
<br>
<table border=1>
<tr>
<th colspan="2" rowspan="1" style="vertical-align: top;">Breakdown of Members by Grade Level</th>
</tr>
<tr>
<th>Grade</th>
<th># of Children</th>
</tr>
<?php
$gradesArray = array('P', 'K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', 'O', 'Total');
$breakdownArray = $myReport->getBreakdownOfMembersByGradeLevel();
foreach($gradesArray as $thisGrade){
echo "<tr>";
echo "<td>" . $thisGrade . "</td>";
echo "<td>" . $breakdownArray[$thisGrade] . "</td>";
echo "</tr>";
}
?>
</table>
<br>
<table border=1>
<tr>
<th colspan="4">Breakdown of Activity by Grade Level</th>
</tr>
<tr>
<th>Grade</th>
<th>Active</th>
<th>Inactive</th>
<th>Total</th>
</tr>
<?php
$gradesArray = array('P', 'K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', 'O', 'Total');
$breakdownArray = $myReport->getActivityByGradeLevel();
foreach($gradesArray as $thisGrade){
echo "<tr>";
echo "<td>" . $thisGrade . "</td>";
echo "<td>" . $breakdownArray[$thisGrade]['Active'] . "</td>";
echo "<td>" . $breakdownArray[$thisGrade]['Inactive'] . "</td>";
echo "<td>" . $breakdownArray[$thisGrade]['Total'] . "</td>";
echo "</tr>";
}
?>
</table>
<br>
<table border=1>
<tr>
<th colspan="4">Breakdown of Activity by Year of Birth</th>
</tr>
<tr>
<th>Year</th>
<th>Active</th>
<th>Inactive</th>
<th>Total</th>
</tr>
<?php
$yearsArray = $myReport->getYears();
$yearsArray[] = 'Total';
$breakdownArray = $myReport->getActivitybyYearOfBirth();
foreach($yearsArray as $thisYear){
echo "<tr>";
echo "<td>" . $thisYear . "</td>";
echo "<td>" . $breakdownArray[$thisYear]['Active'] . "</td>";
echo "<td>" . $breakdownArray[$thisYear]['Inactive'] . "</td>";
echo "<td>" . $breakdownArray[$thisYear]['Total'] . "</td>";
echo "</tr>";
}
?>
</table>
<br>
<table border=1>
<tr>
<th colspan="9" rowspan="1" style="vertical-align: top;">Number of Books Read By Grade</th>
</tr>
<tr>
<th>Grade</th>
<th>0</th>
<th>1-9</th>
<th>10-19</th>
<th>20-39</th>
<th>40-59</th>
<th>60-79</th>
<th>80+</th>
<th>Total</th>
</tr>
<?php
$numberArray = array('0', '1-9', '10-19', '20-39', '40-59', '60-79', '80+', 'Total');
$breakdownArray = $myReport->getActivityByNumberOfBooksReadByGrade();
foreach($gradesArray as $thisGrade){
echo "<tr>";
echo "<td>" . $thisGrade . "</td>";
foreach($numberArray as $thisNumber){
echo "<td>" . $breakdownArray[$thisGrade][$thisNumber] . "</td>";
}
echo "</tr>";
}
?>
</table>
<br>
<table border=1>
<tr>
<th colspan="9">Number of Books Read By Year of Birth</th>
</tr>
<tr>
<th>Year</th>
<th>0</th>
<th>1-9</th>
<th>10-19</th>
<th>20-39</th>
<th>40-59</th>
<th>60-79</th>
<th>80+</th>
<th>Total</th>
</tr>
<?php
$numberArray = array('0', '1-9', '10-19', '20-39', '40-59', '60-79', '80+', 'Total');
$breakdownArray = $myReport->getActivityByNumberOfBooksReadByYearOfBirth();
foreach($yearsArray as $thisYear){
echo "<tr>";
echo "<td>" . $thisYear . "</td>";
foreach($numberArray as $thisNumber){
echo "<td>" . $breakdownArray[$thisYear][$thisNumber] . "</td>";
}
echo "</tr>";
}
?>
</table>
<?php
$timer->stop();
$timer->showtime();
function print_pr($object){
echo "<pre>";
print_r($object);
echo "</pre>";
}
function convert2dArrayToTable($array){
echo "<table>";
echo "<tbody>";
foreach($array as $key => $data){
echo "<tr>";
echo "<td>" . $key . "</td>";
echo "<td>" . $data . "</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
}
function convert3dArrayToTable($array){
echo "<table>";
echo "<tbody>";
foreach($array as $key => $data){
echo "<tr>";
echo "<td>" . $key . "</td>";
foreach($data as $subkey => $subdata){
echo "<td>" . $subdata . "</td>";
}
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
}
?>

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks