Skip to content

Commit 2a756b8

Browse files
committed
Revert "Terms API"
This reverts commit 23116a4.
1 parent 23116a4 commit 2a756b8

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

src/Classes/ServiceAPI/MyRadio_Term.php

+6-13
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ public function __construct($term_id) {
4040
$this->descr = $result['descr'] . date(" Y", strtotime($this->start_date));
4141
$this->num_weeks = (int) $result['weeks'];
4242
$this->week_names = json_decode($result['week_names']);
43-
if ($this->week_names == null) {
44-
$this->week_names = [];
45-
}
4643

4744
}
4845

@@ -83,13 +80,9 @@ public static function addTerm($start, $descr, $num_weeks)
8380
*/
8481
public static function getAllTerms($currentOnly = false)
8582
{
86-
if ($currentOnly == "false") {
87-
$currentOnly = false;
88-
}
89-
90-
$query = 'SELECT termid, EXTRACT(EPOCH FROM start) AS start FROM terms ';
91-
$query .= $currentOnly ? 'WHERE start <= now() AND finish > now() ' : '';
92-
$query .= 'ORDER BY start ASC';
83+
$query = 'SELECT termid, EXTRACT(EPOCH FROM start) AS start FROM terms WHERE ';
84+
$query .= $currentOnly ? 'start <= now() AND ' : '';
85+
$query .= 'finish > now() ORDER BY start ASC';
9386
$result = self::$db->fetchAll($query);
9487

9588
$terms = [];
@@ -209,10 +202,10 @@ public static function getTermForm()
209202
public function toDataSource($mixins = []) {
210203
return [
211204
"term_id" => $this->getID(),
212-
"start" => $this->getTermStartDate(),
213-
"descr" => $this->getTermDescr(),
205+
"descr" => $this->getTermDescr(),
214206
"num_weeks" => $this->getTermWeeks(),
215-
"week_names" => $this->getTermWeekNames()
207+
"week_names" => $this->getTermWeekNames(),
208+
"start" => $this->getTermStartDate()
216209
];
217210
}
218211
}

src/Public/js/myradio.scheduler.termlist.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
$(".twig-datatable").dataTable({
22
"aaSorting": [[2, "desc"]],
33
"aoColumns": [
4-
//term_id
4+
//termid
55
{
66
"bVisible": false
77
},

0 commit comments

Comments
 (0)