Final bits to the schedule maintenance section

This commit is contained in:
laf
2015-04-19 20:23:34 +01:00
parent 5540994f8b
commit deda8c2ab0
6 changed files with 340 additions and 166 deletions

View File

@@ -32,7 +32,7 @@ if (empty($total)) {
}
if (!isset($sort) || empty($sort)) {
$sort = '`S`.`title` ASC ';
$sort = '`S`.`start` DESC ';
}
$sql .= " ORDER BY $sort";
@@ -49,10 +49,18 @@ if ($rowCount != -1) {
$sql = "SELECT `S`.`schedule_id`, DATE_FORMAT(`S`.`start`, '%D %b %Y %T') AS `start`, DATE_FORMAT(`S`.`end`, '%D %b %Y %T') AS `end`, `S`.`title` $sql";
foreach (dbFetchRows($sql,$param) as $schedule) {
$status = 0;
if ($schedule['end'] < date('dS M Y H:i::s')) {
$status = 1;
}
if (date('dS M Y H:i::s') >= $schedule['start'] && date('dS M Y H:i::s') < $schedule['end']) {
$status = 2;
}
$response[] = array('title'=>$schedule['title'],
'start'=>$schedule['start'],
'end'=>$schedule['end'],
'id'=>$schedule['schedule_id']);
'id'=>$schedule['schedule_id'],
'status'=>$status);
}
$output = array('current'=>$current,'rowCount'=>$rowCount,'rows'=>$response,'total'=>$total);