IM-733 Create Development timetable for Airtime Development
IM-777 Database structure for new History Feature dos2unix fix
This commit is contained in:
parent
e63518f2da
commit
1abbe85d6d
|
@ -70,7 +70,7 @@ class PlayouthistoryController extends Zend_Controller_Action
|
||||||
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
||||||
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
||||||
|
|
||||||
$historyService = new Application_Service_HistoryService();
|
$historyService = new Application_Service_HistoryService();
|
||||||
$r = $historyService->getItems($startsDT, $endsDT, $params);
|
$r = $historyService->getItems($startsDT, $endsDT, $params);
|
||||||
|
|
||||||
$this->view->sEcho = $r["sEcho"];
|
$this->view->sEcho = $r["sEcho"];
|
||||||
|
|
|
@ -7,13 +7,13 @@ class Application_Service_HistoryService
|
||||||
private $con;
|
private $con;
|
||||||
private $timezone;
|
private $timezone;
|
||||||
|
|
||||||
private $mDataPropMap = array(
|
private $mDataPropMap = array(
|
||||||
"artist" => "artist_name",
|
"artist" => "artist_name",
|
||||||
"title" => "track_title",
|
"title" => "track_title",
|
||||||
"played" => "played",
|
"played" => "played",
|
||||||
"length" => "length",
|
"length" => "length",
|
||||||
"composer" => "composer",
|
"composer" => "composer",
|
||||||
"copyright" => "copyright",
|
"copyright" => "copyright",
|
||||||
);
|
);
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
@ -22,50 +22,50 @@ class Application_Service_HistoryService
|
||||||
$this->timezone = date_default_timezone_get();
|
$this->timezone = date_default_timezone_get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* map front end mDataProp labels to proper column names for searching etc.
|
* map front end mDataProp labels to proper column names for searching etc.
|
||||||
*/
|
*/
|
||||||
private function translateColumns($opts)
|
private function translateColumns($opts)
|
||||||
{
|
{
|
||||||
for ($i = 0; $i < $opts["iColumns"]; $i++) {
|
for ($i = 0; $i < $opts["iColumns"]; $i++) {
|
||||||
|
|
||||||
$opts["mDataProp_{$i}"] = $this->mDataPropMap[$opts["mDataProp_{$i}"]];
|
$opts["mDataProp_{$i}"] = $this->mDataPropMap[$opts["mDataProp_{$i}"]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getItems($startDT, $endDT, $opts)
|
public function getItems($startDT, $endDT, $opts)
|
||||||
{
|
{
|
||||||
$this->translateColumns($opts);
|
$this->translateColumns($opts);
|
||||||
|
|
||||||
$select = array(
|
$select = array(
|
||||||
"file.track_title as title",
|
"file.track_title as title",
|
||||||
"file.artist_name as artist",
|
"file.artist_name as artist",
|
||||||
"playout.played",
|
"playout.played",
|
||||||
"playout.file_id",
|
"playout.file_id",
|
||||||
"file.composer",
|
"file.composer",
|
||||||
"file.copyright",
|
"file.copyright",
|
||||||
"file.length"
|
"file.length"
|
||||||
);
|
);
|
||||||
|
|
||||||
$start = $startDT->format("Y-m-d H:i:s");
|
$start = $startDT->format("Y-m-d H:i:s");
|
||||||
$end = $endDT->format("Y-m-d H:i:s");
|
$end = $endDT->format("Y-m-d H:i:s");
|
||||||
|
|
||||||
$historyTable = "(
|
$historyTable = "(
|
||||||
select count(history.file_id) as played, history.file_id as file_id
|
select count(history.file_id) as played, history.file_id as file_id
|
||||||
from cc_playout_history as history
|
from cc_playout_history as history
|
||||||
where history.starts >= '{$start}' and history.starts < '{$end}'
|
where history.starts >= '{$start}' and history.starts < '{$end}'
|
||||||
group by history.file_id
|
group by history.file_id
|
||||||
) AS playout
|
) AS playout
|
||||||
left join cc_files as file on (file.id = playout.file_id)";
|
left join cc_files as file on (file.id = playout.file_id)";
|
||||||
|
|
||||||
$results = Application_Model_Datatables::findEntries($this->con, $select, $historyTable, $opts, "history");
|
$results = Application_Model_Datatables::findEntries($this->con, $select, $historyTable, $opts, "history");
|
||||||
|
|
||||||
foreach ($results["history"] as &$row) {
|
foreach ($results["history"] as &$row) {
|
||||||
$formatter = new LengthFormatter($row['length']);
|
$formatter = new LengthFormatter($row['length']);
|
||||||
$row['length'] = $formatter->format();
|
$row['length'] = $formatter->format();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function insertPlayedItem($schedId) {
|
public function insertPlayedItem($schedId) {
|
||||||
|
|
Loading…
Reference in New Issue