protected function getResultText($res, $outputmode) {
		global $wgParser;

		$dataArray = array();
		while ( $row = $res->getNext() ) {
			$values = array();
			foreach ($row as $i => $field) {
				while ( ($object = $field->getNextObject()) !== false ) {
					if ($object->getTypeID() == '_dat') {
						$values[] = SRFCalendar::formatDateStr($object);
					} elseif ($object->getTypeID() == '_wpg') { // use shorter "LongText" for wikipage
						$values[] = $object->getLongText($outputmode, null);
					} else {
						$values[] = $object->getShortText($outputmode, null);
					}
				}
			}
			$dataArray[] = $values;
		}
		$pParser = new PlottersParser();
		$pParser->setData( $dataArray );
		$pParser->parseArguments( $this->params );

		$pPlotter = new Plotters( $pParser, $wgParser );

		$pPlotter->checkForErrors();
		if ( $pPlotter->hasErrors() ) {
			$results = $pPlotter->getErrors();
		} else {
			$results = $pPlotter->toHTML();
		}
		if (is_null($wgParser->getTitle()))
			return $results;
		else   
			return array($results, 'noparse' => 'true', 'isHTML' => 'true');
	}
Esempio n. 2
0
function initPlotters( $input, $argv, &$parser ) {
	$pParser = new PlottersParser( $input, $argv );
	$pPlotter = new Plotters( $pParser, $parser );

	$pPlotter->checkForErrors();
	if ( $pPlotter->hasErrors() ) {
		return $pPlotter->getErrors();
	} else {
		return $pPlotter->toHTML();
	}
}