parent
c0006f1461
commit
7e5e9e9d89
|
@ -18,32 +18,32 @@ class PlayouthistoryController extends Zend_Controller_Action
|
|||
->addActionContext('update-file-item', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
|
||||
private function getStartEnd()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
|
||||
$userTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
|
||||
$utcTimezone = new DateTimeZone("UTC");
|
||||
$utcNow = new DateTime("now", $utcTimezone);
|
||||
|
||||
|
||||
$start = $request->getParam("start");
|
||||
$end = $request->getParam("end");
|
||||
|
||||
|
||||
if (empty($start) || empty($end)) {
|
||||
$startsDT = clone $utcNow;
|
||||
$startsDT->sub(new DateInterval("P1D"));
|
||||
$endsDT = clone $utcNow;
|
||||
}
|
||||
else {
|
||||
|
||||
|
||||
try {
|
||||
$startsDT = new DateTime($start, $userTimezone);
|
||||
$startsDT->setTimezone($utcTimezone);
|
||||
|
||||
|
||||
$endsDT = new DateTime($end, $userTimezone);
|
||||
$endsDT->setTimezone($utcTimezone);
|
||||
|
||||
|
||||
if ($startsDT > $endsDT) {
|
||||
throw new Exception("start greater than end");
|
||||
}
|
||||
|
@ -51,14 +51,14 @@ class PlayouthistoryController extends Zend_Controller_Action
|
|||
catch (Exception $e) {
|
||||
Logging::info($e);
|
||||
Logging::info($e->getMessage());
|
||||
|
||||
|
||||
$startsDT = clone $utcNow;
|
||||
$startsDT->sub(new DateInterval("P1D"));
|
||||
$endsDT = clone $utcNow;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return array($startsDT, $endsDT);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ class PlayouthistoryController extends Zend_Controller_Action
|
|||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
|
||||
list($startsDT, $endsDT) = $this->getStartEnd();
|
||||
|
||||
|
||||
$userTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
|
||||
$startsDT->setTimezone($userTimezone);
|
||||
$endsDT->setTimezone($userTimezone);
|
||||
|
@ -87,7 +87,6 @@ class PlayouthistoryController extends Zend_Controller_Action
|
|||
$this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools-2.1.5/js/ZeroClipboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools-2.1.5/js/TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
|
@ -120,7 +119,7 @@ class PlayouthistoryController extends Zend_Controller_Action
|
|||
$request = $this->getRequest();
|
||||
$params = $request->getParams();
|
||||
$instance = $request->getParam("instance_id", null);
|
||||
|
||||
|
||||
list($startsDT, $endsDT) = $this->getStartEnd();
|
||||
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
|
@ -143,12 +142,12 @@ class PlayouthistoryController extends Zend_Controller_Action
|
|||
$request = $this->getRequest();
|
||||
$params = $request->getParams();
|
||||
$instance = $request->getParam("instance_id", null);
|
||||
|
||||
|
||||
list($startsDT, $endsDT) = $this->getStartEnd();
|
||||
|
||||
|
||||
$limit = intval($params["iDisplayLength"]);
|
||||
$offset = intval($params["iDisplayStart"]);
|
||||
|
||||
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$r = $historyService->getPlayedItemData($startsDT, $endsDT, $instance, $offset, $limit);
|
||||
|
||||
|
@ -169,7 +168,7 @@ class PlayouthistoryController extends Zend_Controller_Action
|
|||
$request = $this->getRequest();
|
||||
$params = $request->getParams();
|
||||
$instance = $request->getParam("instance_id", null);
|
||||
|
||||
|
||||
list($startsDT, $endsDT) = $this->getStartEnd();
|
||||
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
|
|
Loading…
Reference in New Issue