This commit is contained in:
Naomi 2013-08-02 16:16:04 -04:00
parent e047c2f71d
commit 590837a357
2 changed files with 66 additions and 66 deletions

View File

@ -257,7 +257,7 @@ class PlayouthistoryController extends Zend_Controller_Action
{
$templateType = $this->_getParam('type', null);
$request = $this->getRequest();
$request = $this->getRequest();
$params = $request->getPost();
try {

View File

@ -292,22 +292,22 @@ class Application_Service_HistoryService
$start = $startDT->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;
$template = $this->getConfiguredFileTemplate();
$fields = $template["fields"];
$template = $this->getConfiguredFileTemplate();
$fields = $template["fields"];
$required = $this->mandatoryFileFields();
foreach ($fields as $index=>$field) {
foreach ($fields as $index=>$field) {
$key = $field["name"];
if (in_array($field["name"], $required)) {
continue;
if (in_array($field["name"], $required)) {
continue;
}
$select[] = "summary.{$key}";
$select[] = "summary.{$key}";
}
$fileSummaryTable = "((
@ -324,69 +324,69 @@ class Application_Service_HistoryService
" FROM {$fileSummaryTable}";
//-------------------------------------------------------------------------
//need to count the total rows to tell Datatables.
$stmt = $this->con->prepare($mainSqlQuery);
foreach ($paramMap as $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");
//need to count the total rows to tell Datatables.
$stmt = $this->con->prepare($mainSqlQuery);
foreach ($paramMap as $param => $v) {
$stmt->bindValue($param, $v);
}
//------------------------------------------------------------------------
//Using Datatables parameters to sort the data.
$numOrderColumns = $opts["iSortingCols"];
$orderBys = array();
for ($i = 0; $i < $numOrderColumns; $i++) {
$colNum = $opts["iSortCol_".$i];
$key = $opts["mDataProp_".$colNum];
$sortDir = $opts["sSortDir_".$i];
$orderBys[] = "summary.{$key} {$sortDir}";
}
if ($numOrderColumns > 0) {
$orders = join(", ", $orderBys);
$mainSqlQuery.=
" ORDER BY {$orders}";
if ($stmt->execute()) {
$totalRows = $stmt->rowCount();
Logging::info("Total Rows {$totalRows}");
}
else {
$msg = implode(',', $stmt->errorInfo());
Logging::info($msg);
throw new Exception("Error: $msg");
}
//------------------------------------------------------------------------
//Using Datatables parameters to sort the data.
$numOrderColumns = $opts["iSortingCols"];
$orderBys = array();
for ($i = 0; $i < $numOrderColumns; $i++) {
$colNum = $opts["iSortCol_".$i];
$key = $opts["mDataProp_".$colNum];
$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
$displayLength = intval($opts["iDisplayLength"]);
if ($displayLength !== -1) {
$mainSqlQuery.=
" OFFSET :offset LIMIT :limit";
$paramMap["offset"] = $opts["iDisplayStart"];
$paramMap["limit"] = $displayLength;
}
$stmt = $this->con->prepare($mainSqlQuery);
foreach ($paramMap as $param => $v) {
$stmt->bindValue($param, $v);
}
$rows = array();
if ($stmt->execute()) {
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
}
else {
$msg = implode(',', $stmt->errorInfo());
Logging::info($msg);
throw new Exception("Error: $msg");
$displayLength = intval($opts["iDisplayLength"]);
if ($displayLength !== -1) {
$mainSqlQuery.=
" OFFSET :offset LIMIT :limit";
$paramMap["offset"] = $opts["iDisplayStart"];
$paramMap["limit"] = $displayLength;
}
$stmt = $this->con->prepare($mainSqlQuery);
foreach ($paramMap as $param => $v) {
$stmt->bindValue($param, $v);
}
$rows = array();
if ($stmt->execute()) {
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
}
else {
$msg = implode(',', $stmt->errorInfo());
Logging::info($msg);
throw new Exception("Error: $msg");
}
//-----------------------------------------------------------------