/** * Sets config variables for the application. */ public function setup() { $xml = new XmlContent(); $params = $xml->getContent(UTILS_PATH . '/Setup/config.xml'); $setup = $params[APPLICATION_ENVIRONMENT]; define('APPLICATION_SERVER', $setup['server']); define('APPLICATION_USERNAME', $setup['username']); define('APPLICATION_PASSWORD', $setup['password']); define('APPLICATION_MYSQL_DB', $setup['db']); if ($setup['errors'] != 0) { error_reporting(E_ALL); ini_set('display_errors', 1); } }
function parse(&$text, $end_regexps = array('$')) { $regexps = $this->_regexps; // $end_re takes precedence: "favor reduce over shift" array_unshift($regexps, $end_regexps[0]); //array_push($regexps, $end_regexps[0]); $regexps = new RegexpSet($regexps); $input = $text; $output = new XmlContent(); $match = $regexps->match($input); while ($match) { if ($match->regexp_ind == 0) { // No start pattern found before end pattern. // We're all done! if (isset($markup) and is_object($markup) and isa($markup, 'Markup_plugin')) { $current =& $output->_content[count($output->_content) - 1]; $current->setTightness(true, true); } $output->pushContent($match->prematch); $text = $match->postmatch; return $output; } $markup = $this->_markup[$match->regexp_ind - 1]; $body = $this->_parse_markup_body($markup, $match->match, $match->postmatch, $end_regexps); if (!$body) { // Couldn't match balanced expression. // Ignore and look for next matching start regexp. $match = $regexps->nextMatch($input, $match); continue; } // Matched markup. Eat input, push output. // FIXME: combine adjacent strings. if (isa($markup, 'SimpleMarkup')) { $current = $markup->markup($match->match); } else { $current = $markup->markup($match->match, $body); } $input = $match->postmatch; if (isset($markup) and is_object($markup) and isa($markup, 'Markup_plugin')) { $current->setTightness(true, true); } $output->pushContent($match->prematch, $current); $match = $regexps->match($input); } // No pattern matched, not even the end pattern. // Parse fails. return false; }
function asXML() { if ($this->isEmpty()) { $xml = $this->emptyTag(); } else { $xml = $this->startTag(); // FIXME: The next two lines could be removed for efficiency if (!$this->hasInlineContent()) { $xml .= "\n"; } $xml .= XmlContent::asXML(); $xml .= "</{$this->_tag}>"; } if (!$this->isInlineElement()) { $xml .= "\n"; } return $xml; }
function _quote($heading) { if (TOC_FULL_SYNTAX) { $theading = TransformInline($heading); if ($theading) { return preg_quote($theading->asXML(), "/"); } else { return XmlContent::_quote(preg_quote($heading, "/")); } } else { return XmlContent::_quote(preg_quote($heading, "/")); } }
/** * Print Jasper */ public function printJasper($left = 0, $top = 0, $subreport = false) { $return = new XmlReturn(); if (!$subreport) { $return->content = XmlContent::headerReportContent($this->jasper); } else { $return->content = XmlContent::headerSubReportContent($this->jasper); } $topTemp = 0; if ($this->dbResult) { //gettingVars $this->variables = $this->getVariables(); $return->top += $top; //getting the itens from columnHeader`s band: if ($this->jasper->columnHeader) { $band = $this->getItensFromBand($this->jasper->columnHeader->band, $this->dbResult[0], $left, $return->top); $return->content .= $band->content; if ($band->top > $this->jasper->columnHeader->band->height) { $return->top += $band->top; } else { $return->top += $this->jasper->columnHeader->band->height; } } //getting the itens from title`s band: if ($this->jasper->title) { $band = $this->getItensFromBand($this->jasper->title->band, $this->dbResult[0], $left, $return->top); $return->content .= $band->content; if ($band->top > $this->jasper->title->band->height) { $return->top += $band->top; } else { $return->top += $this->jasper->title->band->height; } } $topTemp = $return->top; //getting the itens from detail`s band: if ($this->jasper->detail) { foreach ($this->dbResult as $row) { $band = $this->getItensFromBand($this->jasper->detail->band, $row, $left, $topTemp); $return->content .= $band->content; if ($band->top > $this->jasper->detail->band->height) { $topTemp += $band->top; } else { $topTemp += $this->jasper->detail->band->height; } } } //getting the itens from columnFooter`s band: if ($this->jasper->columnFooter) { $band = $this->getItensFromBand($this->jasper->columnFooter->band, $this->dbResult[0], $left, $topTemp); $return->content .= $band->content; if ($band->top > $this->jasper->columnFooter->band->height) { $return->top += $band->top; } else { $return->top += $this->jasper->columnFooter->band->height; } } //getting the itens from background's band: if ($this->jasper->background) { $band = $this->getItensFromBand($this->jasper->background->band, $this->dbResult[0], $left, $top, $topTemp - $top); $return->content .= $band->content; } } else { //getting the itens from noData`s band: if ($this->jasper->noData) { $band = $this->getItensFromBand($this->jasper->noData->band, null, $left, $top); $return->content .= $band->content; if ($band->top > $this->jasper->noData->band->height) { $return->top += $band->top; } else { $return->top += $this->jasper->noData->band->height; } } if ($this->jasper->columnHeader) { $band = $this->getItensFromBand($this->jasper->columnHeader->band, null, $left, $return->top); $return->content .= $band->content; if ($band->top > $this->jasper->columnHeader->band->height) { $return->top += $band->top; } else { $return->top += $this->jasper->columnHeader->band->height; } } //getting the itens from title`s band: if ($this->jasper->title) { $band = $this->getItensFromBand($this->jasper->title->band, null, $left, $return->top); $return->content .= $band->content; if ($band->top > $this->jasper->title->band->height) { $return->top += $band->top; } else { $return->top += $this->jasper->title->band->height; } } $topTemp = $return->top; //getting the itens from detail`s band: if ($this->jasper->detail) { $band = $this->getItensFromBand($this->jasper->detail->band, null, $left, $return->top); $return->content .= $band->content; if ($band->top > $this->jasper->detail->band->height) { $return->top += $band->top; } else { $return->top += $this->jasper->detail->band->height; } } //getting the itens from columnFooter`s band: if ($this->jasper->columnFooter) { $band = $this->getItensFromBand($this->jasper->columnFooter->band, null, $left, $topTemp); $return->content .= $band->content; if ($band->top > $this->jasper->columnFooter->band->height) { $return->top += $band->top; } else { $return->top += $this->jasper->columnFooter->band->height; } } //getting the itens from background's band: if ($this->jasper->background) { $band = $this->getItensFromBand($this->jasper->background->band, null, $left, $top, $topTemp - $top); $return->content .= $band->content; } } if (!$subreport) { $return->content .= XmlContent::footerReportContent($this->jasper); } else { $return->content .= XmlContent::footerSubReportContent($this->jasper); } if (!$subreport) { $this->generatePdf($return->content); } else { $return->top = $topTemp - $top; $return->variables = $this->variables; return $return; } }