CC-5450 : Refactor Media Management (Classes/DB) in Airtime
fixing some search issues
This commit is contained in:
parent
aebea96aec
commit
3ee0d9ccb7
|
@ -640,15 +640,19 @@ class Application_Service_MediaService
|
|||
|
||||
if (isset($from) && preg_match_all('/(\d{4}-\d{2}-\d{2})/', $from)) {
|
||||
$name = "adv_{$col}_from";
|
||||
$cond = "{$col} >= ?";
|
||||
$query->condition($name, $cond, $from);
|
||||
$cond = "{$col} >= ?";
|
||||
|
||||
$date = Application_Common_DateHelper::UserTimezoneStringToUTCString($from);
|
||||
$query->condition($name, $cond, $date);
|
||||
$num++;
|
||||
}
|
||||
|
||||
if (isset($to) && preg_match_all('/(\d{4}-\d{2}-\d{2})/', $to)) {
|
||||
$name = "adv_{$col}_to";
|
||||
$cond = "{$col} <= ?";
|
||||
$query->condition($name, $cond, $to);
|
||||
|
||||
$date = Application_Common_DateHelper::UserTimezoneStringToUTCString($to);
|
||||
$query->condition($name, $cond, $date);
|
||||
$num++;
|
||||
}
|
||||
|
||||
|
|
|
@ -124,6 +124,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
function setUpAdvancedSearch(columns, type) {
|
||||
var i, len,
|
||||
prop,
|
||||
selector = "#advanced_search_"+type,
|
||||
$div = $(selector),
|
||||
col,
|
||||
|
@ -139,11 +140,13 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
if (col.bSearchable) {
|
||||
|
||||
prop = col.mDataProp.split(".").pop();
|
||||
|
||||
config = {
|
||||
index: i,
|
||||
display: col.bVisible,
|
||||
title: col.sTitle,
|
||||
id: "adv-search-"+col.mDataProp
|
||||
id: "adv-search-" + prop
|
||||
};
|
||||
|
||||
field = createAdvancedSearchField(config);
|
||||
|
@ -175,31 +178,11 @@ var AIRTIME = (function(AIRTIME) {
|
|||
$column.hide();
|
||||
}
|
||||
}
|
||||
|
||||
function orderSearchConfig(oTable, searchConfig, aOrder) {
|
||||
var orderedSearchConfig = [];
|
||||
|
||||
if (aOrder === undefined) {
|
||||
orderedSearchConfig = searchConfig;
|
||||
}
|
||||
else {
|
||||
for (i = 0, len = aOrder.length; i < len; i++) {
|
||||
orderedSearchConfig.push(searchConfig[aOrder[i]]);
|
||||
}
|
||||
}
|
||||
|
||||
oTable.columnFilter({
|
||||
aoColumns: orderedSearchConfig,
|
||||
sPlaceHolder: "head:before",
|
||||
bUseColVis: false
|
||||
});
|
||||
}
|
||||
|
||||
function createDatatable(config) {
|
||||
var key = "datatables-"+config.type+"-aoColumns",
|
||||
columns = JSON.parse(localStorage.getItem(key)),
|
||||
abVisible,
|
||||
aOrder,
|
||||
i, len,
|
||||
searchConfig;
|
||||
|
||||
|
@ -276,8 +259,6 @@ var AIRTIME = (function(AIRTIME) {
|
|||
//abVisible indices belong to the original column order.
|
||||
//use to fix up advanced search.
|
||||
abVisible = oData.abVisCols;
|
||||
//use to set the advance search config.
|
||||
aOrder = oData.ColReorder;
|
||||
|
||||
oData.iEnd = parseInt(oData.iEnd, 10);
|
||||
oData.iLength = parseInt(oData.iLength, 10);
|
||||
|
@ -324,7 +305,10 @@ var AIRTIME = (function(AIRTIME) {
|
|||
setAdvancedSearchColumnDisplay(i, abVisible[i]);
|
||||
}
|
||||
|
||||
orderSearchConfig(table, searchConfig);//, aOrder);
|
||||
table.columnFilter({
|
||||
aoColumns: searchConfig,
|
||||
sPlaceHolder: "head:before"
|
||||
});
|
||||
|
||||
table.fnSetFilteringDelay(350);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue