function printPeddlerPermit(&$transObj, $additional_info = NULL) { $permit = $transObj->getPermit(); $owner = $transObj->getOwnerInfo(); // header $header_template = $this->m_strTemplatesPath . "ped/header.html"; // footer $footer_template = $this->m_strTemplatesPath . "ped/footer.html"; // item 1 -> onwer info $infoPath = $this->m_strTemplatesPath . "ped/ped_info.html"; $strContent = constructTemplate($infoPath, $owner->getData()); $strContent = constructTemplate($strContent, $permit->getData(), false); // create template header $strHeader = constructTemplate($header_template, $additional_info); // create template footer $strFooter = constructTemplate($footer_template, $additional_info); $strContent = str_replace("[REPORTS_HEADER]", $strHeader, $strContent); $strContent = str_replace("[REPORTS_FOOTER]", $strFooter, $strContent); echo $strContent; }
function createReport($additional_info = NULL) { // loop through all the records of the query to build the result list record $strRecords = ""; $i = 0; foreach ($this->m_queryResult as $key => $value) { $tmpRec = constructTemplate($this->m_reportTemplatePath . $this->m_reportData["template_record"], $value) . "\n"; $strRecords[] = $tmpRec; if ($i == 0) { foreach ($value as $addKey => $addValue) { $additional_info[$addKey] = $addValue; } $i++; } } // create template header $strHeader = constructTemplate($this->m_reportTemplatePath . $this->m_reportData["template_header"], $additional_info); // create template footer $strFooter = constructTemplate($this->m_reportTemplatePath . $this->m_reportData["template_footer"], $additional_info); // build report body $strContent = constructTemplate($this->m_reportTemplatePath . $this->m_reportData["template_body"], $additional_info); $strContent = str_replace("[REPORTS_HEADER]", $strHeader, $strContent); $strContent = str_replace("[REPORTS_FOOTER]", $strFooter, $strContent); $strContent = str_replace("[RECORDS]", join("\n", $strRecords), $strContent); return $strContent; }