clrf
This commit is contained in:
parent
29c8570ade
commit
ec44b81f6a
5 changed files with 93 additions and 93 deletions
|
@ -118,17 +118,17 @@ class PlayouthistoryController extends Zend_Controller_Action
|
||||||
unset($this->view->form);
|
unset($this->view->form);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editListItemAction()
|
public function editListItemAction()
|
||||||
{
|
{
|
||||||
$file_id = $this->_getParam('id');
|
$file_id = $this->_getParam('id');
|
||||||
|
|
||||||
$historyService = new Application_Service_HistoryService();
|
$historyService = new Application_Service_HistoryService();
|
||||||
$form = $historyService->makeHistoryFileForm($file_id);
|
$form = $historyService->makeHistoryFileForm($file_id);
|
||||||
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
$this->view->dialog = $this->view->render('form/edit-history-file.phtml');
|
$this->view->dialog = $this->view->render('form/edit-history-file.phtml');
|
||||||
|
|
||||||
unset($this->view->form);
|
unset($this->view->form);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateAggregateItemAction()
|
public function updateAggregateItemAction()
|
||||||
|
|
|
@ -16,8 +16,8 @@ class Application_Form_EditHistoryFile extends Zend_Form
|
||||||
|
|
||||||
|
|
||||||
$file_id = new Zend_Form_Element_Hidden('his_file_id');
|
$file_id = new Zend_Form_Element_Hidden('his_file_id');
|
||||||
$file_id->setValidators(array(
|
$file_id->setValidators(array(
|
||||||
new Zend_Validate_Int()
|
new Zend_Validate_Int()
|
||||||
));
|
));
|
||||||
$this->addElement($file_id);
|
$this->addElement($file_id);
|
||||||
|
|
||||||
|
|
|
@ -66,42 +66,42 @@ class Application_Model_Datatables
|
||||||
|
|
||||||
if (isset($data['advSearch']) && $data['advSearch'] === 'true') {
|
if (isset($data['advSearch']) && $data['advSearch'] === 'true') {
|
||||||
|
|
||||||
$librarySetting =
|
$librarySetting =
|
||||||
Application_Model_Preference::getCurrentLibraryTableColumnMap();
|
Application_Model_Preference::getCurrentLibraryTableColumnMap();
|
||||||
//$displayColumns[] = 'owner';
|
//$displayColumns[] = 'owner';
|
||||||
|
|
||||||
// map that maps original column position to db name
|
// map that maps original column position to db name
|
||||||
$current2dbname = array();
|
$current2dbname = array();
|
||||||
// array of search terms
|
// array of search terms
|
||||||
$orig2searchTerm = array();
|
$orig2searchTerm = array();
|
||||||
foreach ($data as $key => $d) {
|
foreach ($data as $key => $d) {
|
||||||
if (strstr($key, "mDataProp_")) {
|
if (strstr($key, "mDataProp_")) {
|
||||||
list($dump, $index) = explode("_", $key);
|
list($dump, $index) = explode("_", $key);
|
||||||
$current2dbname[$index] = $d;
|
$current2dbname[$index] = $d;
|
||||||
} elseif (strstr($key, "sSearch_")) {
|
} elseif (strstr($key, "sSearch_")) {
|
||||||
list($dump, $index) = explode("_", $key);
|
list($dump, $index) = explode("_", $key);
|
||||||
$orig2searchTerm[$index] = $d;
|
$orig2searchTerm[$index] = $d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// map that maps dbname to searchTerm
|
// map that maps dbname to searchTerm
|
||||||
$dbname2searchTerm = array();
|
$dbname2searchTerm = array();
|
||||||
foreach ($current2dbname as $currentPos => $dbname) {
|
foreach ($current2dbname as $currentPos => $dbname) {
|
||||||
$new_index = $librarySetting($currentPos);
|
$new_index = $librarySetting($currentPos);
|
||||||
// TODO : Fix this retarded hack later. Just a band aid for
|
// TODO : Fix this retarded hack later. Just a band aid for
|
||||||
// now at least we print some warnings so that we don't
|
// now at least we print some warnings so that we don't
|
||||||
// forget about this -- cc-4462
|
// forget about this -- cc-4462
|
||||||
if ( array_key_exists($new_index, $orig2searchTerm) ) {
|
if ( array_key_exists($new_index, $orig2searchTerm) ) {
|
||||||
$dbname2searchTerm[$dbname] = $orig2searchTerm[$new_index];
|
$dbname2searchTerm[$dbname] = $orig2searchTerm[$new_index];
|
||||||
} else {
|
} else {
|
||||||
Logging::warn("Trying to reorder to unknown index
|
Logging::warn("Trying to reorder to unknown index
|
||||||
printing as much debugging as possible...");
|
printing as much debugging as possible...");
|
||||||
$debug = array(
|
$debug = array(
|
||||||
'$new_index' => $new_index,
|
'$new_index' => $new_index,
|
||||||
'$currentPos' => $currentPos,
|
'$currentPos' => $currentPos,
|
||||||
'$orig2searchTerm' => $orig2searchTerm);
|
'$orig2searchTerm' => $orig2searchTerm);
|
||||||
Logging::warn($debug);
|
Logging::warn($debug);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$advancedWhere = self::buildWhereClauseForAdvancedSearch($dbname2searchTerm);
|
$advancedWhere = self::buildWhereClauseForAdvancedSearch($dbname2searchTerm);
|
||||||
|
@ -170,9 +170,9 @@ class Application_Model_Datatables
|
||||||
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby;
|
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby;
|
||||||
}
|
}
|
||||||
|
|
||||||
//limit the results returned.
|
//limit the results returned.
|
||||||
if ($displayLength !== -1) {
|
if ($displayLength !== -1) {
|
||||||
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
|
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -779,15 +779,15 @@ SQL;
|
||||||
$row['id'] = intval($row['id']);
|
$row['id'] = intval($row['id']);
|
||||||
|
|
||||||
//taken from Datatables.php, needs to be cleaned up there.
|
//taken from Datatables.php, needs to be cleaned up there.
|
||||||
if (isset($r['ftype'])) {
|
if (isset($r['ftype'])) {
|
||||||
if ($r['ftype'] == 'playlist') {
|
if ($r['ftype'] == 'playlist') {
|
||||||
$pl = new Application_Model_Playlist($r['id']);
|
$pl = new Application_Model_Playlist($r['id']);
|
||||||
$r['length'] = $pl->getLength();
|
$r['length'] = $pl->getLength();
|
||||||
} elseif ($r['ftype'] == "block") {
|
} elseif ($r['ftype'] == "block") {
|
||||||
$bl = new Application_Model_Block($r['id']);
|
$bl = new Application_Model_Block($r['id']);
|
||||||
$r['bl_type'] = $bl->isStatic() ? 'static' : 'dynamic';
|
$r['bl_type'] = $bl->isStatic() ? 'static' : 'dynamic';
|
||||||
$r['length'] = $bl->getLength();
|
$r['length'] = $bl->getLength();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['ftype'] === "audioclip") {
|
if ($row['ftype'] === "audioclip") {
|
||||||
|
|
|
@ -39,29 +39,29 @@ class Application_Service_HistoryService
|
||||||
|
|
||||||
public function getListView($startDT, $endDT, $opts)
|
public function getListView($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.starts",
|
"playout.starts",
|
||||||
"playout.ends",
|
"playout.ends",
|
||||||
"playout.history_id"
|
"playout.history_id"
|
||||||
);
|
);
|
||||||
|
|
||||||
$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 history.starts as starts, history.ends as ends,
|
select history.starts as starts, history.ends as ends,
|
||||||
history.id as history_id, history.file_id as file_id
|
history.id as history_id, 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}'
|
||||||
) 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");
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ class Application_Service_HistoryService
|
||||||
|
|
||||||
/* id is an id in cc_files */
|
/* id is an id in cc_files */
|
||||||
public function makeHistoryFileForm($id) {
|
public function makeHistoryFileForm($id) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$form = new Application_Form_EditHistoryFile();
|
$form = new Application_Form_EditHistoryFile();
|
||||||
|
|
||||||
|
@ -165,17 +165,17 @@ class Application_Service_HistoryService
|
||||||
$md = $file->getDbColMetadata();
|
$md = $file->getDbColMetadata();
|
||||||
|
|
||||||
$form->populate(array(
|
$form->populate(array(
|
||||||
'his_file_id' => $id,
|
'his_file_id' => $id,
|
||||||
'his_file_title' => $md[MDATA_KEY_TITLE],
|
'his_file_title' => $md[MDATA_KEY_TITLE],
|
||||||
'his_file_creator' => $md[MDATA_KEY_CREATOR],
|
'his_file_creator' => $md[MDATA_KEY_CREATOR],
|
||||||
'his_file_composer' => $md[MDATA_KEY_COMPOSER],
|
'his_file_composer' => $md[MDATA_KEY_COMPOSER],
|
||||||
'his_file_copyright' => $md[MDATA_KEY_COPYRIGHT]
|
'his_file_copyright' => $md[MDATA_KEY_COPYRIGHT]
|
||||||
));
|
));
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
Logging::debug($e);
|
Logging::debug($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ class Application_Service_HistoryService
|
||||||
MDATA_KEY_COMPOSER => $data['his_file_composer'],
|
MDATA_KEY_COMPOSER => $data['his_file_composer'],
|
||||||
MDATA_KEY_COPYRIGHT => $data['his_file_copyright']
|
MDATA_KEY_COPYRIGHT => $data['his_file_copyright']
|
||||||
);
|
);
|
||||||
|
|
||||||
$file->setDbColMetadata($md);
|
$file->setDbColMetadata($md);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue