This commit is contained in:
Naomi Aro 2013-07-18 01:37:39 -04:00
parent 29c8570ade
commit ec44b81f6a
5 changed files with 93 additions and 93 deletions

View file

@ -118,17 +118,17 @@ class PlayouthistoryController extends Zend_Controller_Action
unset($this->view->form);
}
public function editListItemAction()
{
$file_id = $this->_getParam('id');
$historyService = new Application_Service_HistoryService();
$form = $historyService->makeHistoryFileForm($file_id);
$this->view->form = $form;
$this->view->dialog = $this->view->render('form/edit-history-file.phtml');
unset($this->view->form);
public function editListItemAction()
{
$file_id = $this->_getParam('id');
$historyService = new Application_Service_HistoryService();
$form = $historyService->makeHistoryFileForm($file_id);
$this->view->form = $form;
$this->view->dialog = $this->view->render('form/edit-history-file.phtml');
unset($this->view->form);
}
public function updateAggregateItemAction()

View file

@ -16,8 +16,8 @@ class Application_Form_EditHistoryFile extends Zend_Form
$file_id = new Zend_Form_Element_Hidden('his_file_id');
$file_id->setValidators(array(
new Zend_Validate_Int()
$file_id->setValidators(array(
new Zend_Validate_Int()
));
$this->addElement($file_id);

View file

@ -66,42 +66,42 @@ class Application_Model_Datatables
if (isset($data['advSearch']) && $data['advSearch'] === 'true') {
$librarySetting =
Application_Model_Preference::getCurrentLibraryTableColumnMap();
//$displayColumns[] = 'owner';
// map that maps original column position to db name
$current2dbname = array();
// array of search terms
$orig2searchTerm = array();
foreach ($data as $key => $d) {
if (strstr($key, "mDataProp_")) {
list($dump, $index) = explode("_", $key);
$current2dbname[$index] = $d;
} elseif (strstr($key, "sSearch_")) {
list($dump, $index) = explode("_", $key);
$orig2searchTerm[$index] = $d;
}
}
// map that maps dbname to searchTerm
$dbname2searchTerm = array();
foreach ($current2dbname as $currentPos => $dbname) {
$new_index = $librarySetting($currentPos);
// TODO : Fix this retarded hack later. Just a band aid for
// now at least we print some warnings so that we don't
// forget about this -- cc-4462
if ( array_key_exists($new_index, $orig2searchTerm) ) {
$dbname2searchTerm[$dbname] = $orig2searchTerm[$new_index];
} else {
Logging::warn("Trying to reorder to unknown index
printing as much debugging as possible...");
$debug = array(
'$new_index' => $new_index,
'$currentPos' => $currentPos,
'$orig2searchTerm' => $orig2searchTerm);
Logging::warn($debug);
}
$librarySetting =
Application_Model_Preference::getCurrentLibraryTableColumnMap();
//$displayColumns[] = 'owner';
// map that maps original column position to db name
$current2dbname = array();
// array of search terms
$orig2searchTerm = array();
foreach ($data as $key => $d) {
if (strstr($key, "mDataProp_")) {
list($dump, $index) = explode("_", $key);
$current2dbname[$index] = $d;
} elseif (strstr($key, "sSearch_")) {
list($dump, $index) = explode("_", $key);
$orig2searchTerm[$index] = $d;
}
}
// map that maps dbname to searchTerm
$dbname2searchTerm = array();
foreach ($current2dbname as $currentPos => $dbname) {
$new_index = $librarySetting($currentPos);
// TODO : Fix this retarded hack later. Just a band aid for
// now at least we print some warnings so that we don't
// forget about this -- cc-4462
if ( array_key_exists($new_index, $orig2searchTerm) ) {
$dbname2searchTerm[$dbname] = $orig2searchTerm[$new_index];
} else {
Logging::warn("Trying to reorder to unknown index
printing as much debugging as possible...");
$debug = array(
'$new_index' => $new_index,
'$currentPos' => $currentPos,
'$orig2searchTerm' => $orig2searchTerm);
Logging::warn($debug);
}
}
$advancedWhere = self::buildWhereClauseForAdvancedSearch($dbname2searchTerm);
@ -170,9 +170,9 @@ class Application_Model_Datatables
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby;
}
//limit the results returned.
if ($displayLength !== -1) {
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
//limit the results returned.
if ($displayLength !== -1) {
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
}
try {

View file

@ -779,15 +779,15 @@ SQL;
$row['id'] = intval($row['id']);
//taken from Datatables.php, needs to be cleaned up there.
if (isset($r['ftype'])) {
if ($r['ftype'] == 'playlist') {
$pl = new Application_Model_Playlist($r['id']);
$r['length'] = $pl->getLength();
} elseif ($r['ftype'] == "block") {
$bl = new Application_Model_Block($r['id']);
$r['bl_type'] = $bl->isStatic() ? 'static' : 'dynamic';
$r['length'] = $bl->getLength();
}
if (isset($r['ftype'])) {
if ($r['ftype'] == 'playlist') {
$pl = new Application_Model_Playlist($r['id']);
$r['length'] = $pl->getLength();
} elseif ($r['ftype'] == "block") {
$bl = new Application_Model_Block($r['id']);
$r['bl_type'] = $bl->isStatic() ? 'static' : 'dynamic';
$r['length'] = $bl->getLength();
}
}
if ($row['ftype'] === "audioclip") {

View file

@ -39,29 +39,29 @@ class Application_Service_HistoryService
public function getListView($startDT, $endDT, $opts)
{
$this->translateColumns($opts);
$select = array (
"file.track_title as title",
"file.artist_name as artist",
"playout.starts",
"playout.ends",
"playout.history_id"
);
$start = $startDT->format("Y-m-d H:i:s");
$end = $endDT->format("Y-m-d H:i:s");
$historyTable = "(
$this->translateColumns($opts);
$select = array (
"file.track_title as title",
"file.artist_name as artist",
"playout.starts",
"playout.ends",
"playout.history_id"
);
$start = $startDT->format("Y-m-d H:i:s");
$end = $endDT->format("Y-m-d H:i:s");
$historyTable = "(
select history.starts as starts, history.ends as ends,
history.id as history_id, history.file_id as file_id
from cc_playout_history as history
where history.starts >= '{$start}' and history.starts < '{$end}'
) AS playout
left join cc_files as file on (file.id = playout.file_id)";
$results = Application_Model_Datatables::findEntries($this->con, $select, $historyTable, $opts, "history");
history.id as history_id, history.file_id as file_id
from cc_playout_history as history
where history.starts >= '{$start}' and history.starts < '{$end}'
) AS playout
left join cc_files as file on (file.id = playout.file_id)";
$results = Application_Model_Datatables::findEntries($this->con, $select, $historyTable, $opts, "history");
return $results;
}
@ -157,7 +157,7 @@ class Application_Service_HistoryService
/* id is an id in cc_files */
public function makeHistoryFileForm($id) {
try {
$form = new Application_Form_EditHistoryFile();
@ -165,17 +165,17 @@ class Application_Service_HistoryService
$md = $file->getDbColMetadata();
$form->populate(array(
'his_file_id' => $id,
'his_file_title' => $md[MDATA_KEY_TITLE],
'his_file_creator' => $md[MDATA_KEY_CREATOR],
'his_file_composer' => $md[MDATA_KEY_COMPOSER],
'his_file_id' => $id,
'his_file_title' => $md[MDATA_KEY_TITLE],
'his_file_creator' => $md[MDATA_KEY_CREATOR],
'his_file_composer' => $md[MDATA_KEY_COMPOSER],
'his_file_copyright' => $md[MDATA_KEY_COPYRIGHT]
));
return $form;
}
catch (Exception $e) {
Logging::debug($e);
return $form;
}
catch (Exception $e) {
Logging::debug($e);
}
}
@ -203,7 +203,7 @@ class Application_Service_HistoryService
MDATA_KEY_COMPOSER => $data['his_file_composer'],
MDATA_KEY_COPYRIGHT => $data['his_file_copyright']
);
$file->setDbColMetadata($md);
}