crlf
This commit is contained in:
parent
e047c2f71d
commit
590837a357
2 changed files with 66 additions and 66 deletions
|
@ -257,7 +257,7 @@ class PlayouthistoryController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
$templateType = $this->_getParam('type', null);
|
$templateType = $this->_getParam('type', null);
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$params = $request->getPost();
|
$params = $request->getPost();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -292,22 +292,22 @@ class Application_Service_HistoryService
|
||||||
$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");
|
||||||
|
|
||||||
$paramMap["starts"] = $start;
|
$paramMap["starts"] = $start;
|
||||||
$paramMap["ends"] = $end;
|
$paramMap["ends"] = $end;
|
||||||
|
|
||||||
$template = $this->getConfiguredFileTemplate();
|
$template = $this->getConfiguredFileTemplate();
|
||||||
$fields = $template["fields"];
|
$fields = $template["fields"];
|
||||||
$required = $this->mandatoryFileFields();
|
$required = $this->mandatoryFileFields();
|
||||||
|
|
||||||
foreach ($fields as $index=>$field) {
|
foreach ($fields as $index=>$field) {
|
||||||
|
|
||||||
$key = $field["name"];
|
$key = $field["name"];
|
||||||
|
|
||||||
if (in_array($field["name"], $required)) {
|
if (in_array($field["name"], $required)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$select[] = "summary.{$key}";
|
$select[] = "summary.{$key}";
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileSummaryTable = "((
|
$fileSummaryTable = "((
|
||||||
|
@ -324,69 +324,69 @@ class Application_Service_HistoryService
|
||||||
" FROM {$fileSummaryTable}";
|
" FROM {$fileSummaryTable}";
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
//need to count the total rows to tell Datatables.
|
//need to count the total rows to tell Datatables.
|
||||||
$stmt = $this->con->prepare($mainSqlQuery);
|
$stmt = $this->con->prepare($mainSqlQuery);
|
||||||
foreach ($paramMap as $param => $v) {
|
foreach ($paramMap as $param => $v) {
|
||||||
$stmt->bindValue($param, $v);
|
$stmt->bindValue($param, $v);
|
||||||
}
|
|
||||||
|
|
||||||
if ($stmt->execute()) {
|
|
||||||
$totalRows = $stmt->rowCount();
|
|
||||||
Logging::info("Total Rows {$totalRows}");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$msg = implode(',', $stmt->errorInfo());
|
|
||||||
Logging::info($msg);
|
|
||||||
throw new Exception("Error: $msg");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
if ($stmt->execute()) {
|
||||||
//Using Datatables parameters to sort the data.
|
$totalRows = $stmt->rowCount();
|
||||||
|
Logging::info("Total Rows {$totalRows}");
|
||||||
$numOrderColumns = $opts["iSortingCols"];
|
}
|
||||||
$orderBys = array();
|
else {
|
||||||
|
$msg = implode(',', $stmt->errorInfo());
|
||||||
for ($i = 0; $i < $numOrderColumns; $i++) {
|
Logging::info($msg);
|
||||||
|
throw new Exception("Error: $msg");
|
||||||
$colNum = $opts["iSortCol_".$i];
|
}
|
||||||
$key = $opts["mDataProp_".$colNum];
|
|
||||||
$sortDir = $opts["sSortDir_".$i];
|
//------------------------------------------------------------------------
|
||||||
|
//Using Datatables parameters to sort the data.
|
||||||
$orderBys[] = "summary.{$key} {$sortDir}";
|
|
||||||
}
|
$numOrderColumns = $opts["iSortingCols"];
|
||||||
|
$orderBys = array();
|
||||||
if ($numOrderColumns > 0) {
|
|
||||||
|
for ($i = 0; $i < $numOrderColumns; $i++) {
|
||||||
$orders = join(", ", $orderBys);
|
|
||||||
|
$colNum = $opts["iSortCol_".$i];
|
||||||
$mainSqlQuery.=
|
$key = $opts["mDataProp_".$colNum];
|
||||||
" ORDER BY {$orders}";
|
$sortDir = $opts["sSortDir_".$i];
|
||||||
|
|
||||||
|
$orderBys[] = "summary.{$key} {$sortDir}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($numOrderColumns > 0) {
|
||||||
|
|
||||||
|
$orders = join(", ", $orderBys);
|
||||||
|
|
||||||
|
$mainSqlQuery.=
|
||||||
|
" ORDER BY {$orders}";
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
//using datatables params to add limits/offsets
|
//using datatables params to add limits/offsets
|
||||||
$displayLength = intval($opts["iDisplayLength"]);
|
$displayLength = intval($opts["iDisplayLength"]);
|
||||||
if ($displayLength !== -1) {
|
if ($displayLength !== -1) {
|
||||||
$mainSqlQuery.=
|
$mainSqlQuery.=
|
||||||
" OFFSET :offset LIMIT :limit";
|
" OFFSET :offset LIMIT :limit";
|
||||||
|
|
||||||
$paramMap["offset"] = $opts["iDisplayStart"];
|
$paramMap["offset"] = $opts["iDisplayStart"];
|
||||||
$paramMap["limit"] = $displayLength;
|
$paramMap["limit"] = $displayLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = $this->con->prepare($mainSqlQuery);
|
$stmt = $this->con->prepare($mainSqlQuery);
|
||||||
foreach ($paramMap as $param => $v) {
|
foreach ($paramMap as $param => $v) {
|
||||||
$stmt->bindValue($param, $v);
|
$stmt->bindValue($param, $v);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
if ($stmt->execute()) {
|
if ($stmt->execute()) {
|
||||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$msg = implode(',', $stmt->errorInfo());
|
$msg = implode(',', $stmt->errorInfo());
|
||||||
Logging::info($msg);
|
Logging::info($msg);
|
||||||
throw new Exception("Error: $msg");
|
throw new Exception("Error: $msg");
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue