当前位置: 首页>>代码示例>>PHP>>正文


PHP SMWQueryResult类代码示例

本文整理汇总了PHP中SMWQueryResult的典型用法代码示例。如果您正苦于以下问题:PHP SMWQueryResult类的具体用法?PHP SMWQueryResult怎么用?PHP SMWQueryResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SMWQueryResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getResultText

 protected function getResultText(SMWQueryResult $res, $outputmode)
 {
     global $wgSitename;
     $result = '';
     if ($outputmode == SMW_OUTPUT_FILE) {
         // make file
         if ($this->m_title == '') {
             $this->m_title = $wgSitename;
         }
         $items = array();
         while ($row = $res->getNext()) {
             $items[] = $this->getItemForResultRow($row)->text();
         }
         $result = implode('', $items);
     } else {
         // just make link to export
         if ($this->getSearchLabel($outputmode)) {
             $label = $this->getSearchLabel($outputmode);
         } else {
             $label = wfMessage('srf_bibtex_link')->inContentLanguage()->text();
         }
         $link = $res->getQueryLink($label);
         $link->setParameter('bibtex', 'format');
         if ($this->getSearchLabel(SMW_OUTPUT_WIKI) != '') {
             $link->setParameter($this->getSearchLabel(SMW_OUTPUT_WIKI), 'searchlabel');
         }
         $result .= $link->getText($outputmode, $this->mLinker);
         $this->isHTML = $outputmode == SMW_OUTPUT_HTML;
         // yes, our code can be viewed as HTML if requested, no more parsing needed
     }
     return $result;
 }
开发者ID:cicalese,项目名称:SemanticResultFormats,代码行数:32,代码来源:SRF_BibTeX.php

示例2: getResultText

 protected function getResultText(SMWQueryResult $res, $outputmode)
 {
     $this->isHTML = true;
     $t = "";
     $n = "";
     // if there is only one column in the results then stop right away
     if ($res->getColumnCount() == 1) {
         return "";
     }
     // print all result rows
     $first = true;
     $max = 0;
     // the biggest value. needed for scaling
     while ($row = $res->getNext()) {
         $name = $row[0]->getNextDataValue()->getShortWikiText();
         foreach ($row as $field) {
             while (($object = $field->getNextDataValue()) !== false) {
                 // use numeric sortkey
                 if ($object->isNumeric()) {
                     $nr = $object->getDataItem()->getSortKey();
                     $max = max($max, $nr);
                     if ($first) {
                         $first = false;
                         $t .= $nr;
                         $n = $name;
                     } else {
                         $t = $nr . ',' . $t;
                         $n = $name . '|' . $n;
                     }
                 }
             }
         }
     }
     return '<img src="http://chart.apis.google.com/chart?cht=p3&chs=' . $this->m_width . 'x' . $this->m_height . '&chds=0,' . $max . '&chd=t:' . $t . '&chl=' . $n . '" width="' . $this->m_width . '" height="' . $this->m_height . '"  />';
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:35,代码来源:SRF_GooglePie.php

示例3: addQueryResult

	protected function addQueryResult( SMWQueryResult $queryResult ) {
		$serialized = $queryResult->serializeToArray();
		$result = $this->getResult();

		$result->setIndexedTagName( $serialized['results'], 'result' );
		$result->setIndexedTagName( $serialized['printrequests'], 'printrequest' );
		
		foreach ( $serialized['results'] as $subjectName => $subject ) {
			if ( is_array( $subject ) && array_key_exists( 'printouts', $subject ) ) {
				foreach ( $subject['printouts'] as $property => $values ) {
					if ( is_array( $values ) ) {
						$result->setIndexedTagName( $serialized['results'][$subjectName]['printouts'][$property], 'value' );
					}
				}
			}
		}
		
		$result->addValue( null, 'query', $serialized );
		
		if ( $queryResult->hasFurtherResults() ) {
			// TODO: obtain continuation data from store
			$result->disableSizeCheck();
			$result->addValue( null, 'query-continue', 0 );
			$result->enableSizeCheck();
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:26,代码来源:ApiSMWQuery.php

示例4: getResultData

 /**
  * Return relevant data set
  *
  * @param SMWQueryResult $res
  * @param $outputMode
  *
  * @return array
  */
 protected function getResultData(SMWQueryResult $res, $outputMode)
 {
     // Init
     $properties = array();
     $excludeProperties = explode($this->params['sep'], $this->params['exclude']);
     // Options used when retrieving data from the store
     $reqOptions = new SMWRequestOptions();
     $reqOptions->sort = true;
     $reqOptions->limit = $this->params['limit'];
     foreach ($res->getResults() as $key => $page) {
         // Find properties assigned to selected subject page
         foreach ($res->getStore()->getInProperties($page, $reqOptions) as $property) {
             $propertyLabel = $property->getLabel();
             // Exclude property from result set
             if (in_array($propertyLabel, $excludeProperties)) {
                 continue;
             }
             // NOTE There could be thousands of incoming links for one property,
             // counting the length of an array is inefficient but we don't want
             // to implement any native db select outside of smw core and rather
             // would like to see a counting method available but to counter
             // any potential inefficiencies we curb the selection by using
             // SMWRequestOptions -> limit as boundary
             $count = count($res->getStore()->getPropertySubjects($property, $page, $reqOptions));
             // Limit ouput by threshold
             if ($this->params['min'] <= $count) {
                 $properties[$propertyLabel] = $count;
             }
         }
     }
     return $properties;
 }
开发者ID:cicalese,项目名称:SemanticResultFormats,代码行数:40,代码来源:SRF_Incoming.php

示例5: getResultData

 /**
  * Returns an array with the numerical data
  *
  * @since 1.8
  *
  * @param SMWQueryResult $result
  * @param $outputMode
  *
  * @return array
  */
 protected function getResultData(SMWQueryResult $res, $outputMode)
 {
     $data = array();
     $data['series'] = array();
     while ($row = $res->getNext()) {
         // Loop over their fields (properties)
         $label = '';
         $i = 0;
         foreach ($row as $field) {
             $i++;
             $rowNumbers = array();
             // Grouping by subject (page object) or property
             if ($this->params['group'] === 'subject') {
                 $groupedBy = $field->getResultSubject()->getTitle()->getText();
             } else {
                 $groupedBy = $field->getPrintRequest()->getLabel();
             }
             // Property label
             $property = $field->getPrintRequest()->getLabel();
             // First column property typeid
             $i == 1 ? $data['fcolumntypeid'] = $field->getPrintRequest()->getTypeID() : '';
             // Loop over all values for the property.
             while (($object = $field->getNextDataValue()) !== false) {
                 if ($object->getDataItem()->getDIType() == SMWDataItem::TYPE_NUMBER) {
                     $number = $object->getNumber();
                     // Checking against the row and in case the first column is a numeric
                     // value it is handled as label with the remaining steps continue to work
                     // as it were a text label
                     // The first column container will not be part of the series container
                     if ($i == 1) {
                         $label = $number;
                         continue;
                     }
                     if ($label !== '' && $number >= $this->params['min']) {
                         // Reference array summarize all items per row
                         $rowNumbers += array('subject' => $label, 'value' => $number, 'property' => $property);
                         // Store plain numbers for simpler handling
                         $data['series'][$groupedBy][] = $number;
                     }
                 } elseif ($object->getDataItem()->getDIType() == SMWDataItem::TYPE_TIME) {
                     $label = $object->getShortWikiText();
                 } else {
                     $label = $object->getWikiValue();
                 }
             }
             // Only for array's with numbers
             if (count($rowNumbers) > 0) {
                 // For cases where mainlabel=- we assume that the subject should not be
                 // used as identifier and therefore we try to match the groupby
                 // with the first available text label
                 if ($this->params['mainlabel'] == '-' && $this->params['group'] === 'subject') {
                     $data[$this->params['group']][$label][] = $rowNumbers;
                 } else {
                     $data[$this->params['group']][$groupedBy][] = $rowNumbers;
                 }
             }
         }
     }
     return $data;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:70,代码来源:SRF_jqPlotSeries.php

示例6: addQueryResult

 protected function addQueryResult(SMWQueryResult $queryResult)
 {
     $serialized = $queryResult->serializeToArray();
     $result = $this->getResult();
     $result->setIndexedTagName($serialized['results'], 'result');
     $result->setIndexedTagName($serialized['printrequests'], 'printrequest');
     foreach ($serialized['results'] as $subjectName => $subject) {
         if (is_array($subject) && array_key_exists('printouts', $subject)) {
             foreach ($subject['printouts'] as $property => $values) {
                 if (is_array($values)) {
                     $result->setIndexedTagName($serialized['results'][$subjectName]['printouts'][$property], 'value');
                 }
             }
         }
     }
     $output = array();
     header("Content-type: Application/JSON");
     foreach ($serialized['results'] as $r) {
         $common = count($r['printouts']['Has common name']) > 0 ? $r['printouts']['Has common name'][0]['fulltext'] : '';
         $taxo = count($r['printouts']['Is taxonomy type']) > 0 ? $r['printouts']['Is taxonomy type'][0]['fulltext'] : '';
         $output[$r['fulltext']] = array('taxonomy' => $taxo, 'common' => $common);
     }
     echo json_encode($output);
     exit;
 }
开发者ID:seedbank,项目名称:extension,代码行数:25,代码来源:api.php

示例7: getResultText

 /**
  * Return serialised results in specified format.
  * Implemented by subclasses.
  */
 protected function getResultText(SMWQueryResult $res, $outputmode)
 {
     $html = '';
     $id = uniqid();
     // build an array of article IDs contained in the result set
     $objects = array();
     foreach ($res->getResults() as $key => $object) {
         $objects[] = array($object->getTitle()->getArticleId());
         $html .= $key . ': ' . $object->getSerialization() . "<br>\n";
     }
     // build an array of data about the printrequests
     $printrequests = array();
     foreach ($res->getPrintRequests() as $key => $printrequest) {
         $data = $printrequest->getData();
         if ($data instanceof SMWPropertyValue) {
             $name = $data->getDataItem()->getKey();
         } else {
             $name = null;
         }
         $printrequests[] = array($printrequest->getMode(), $printrequest->getLabel(), $name, $printrequest->getOutputFormat(), $printrequest->getParameters());
     }
     // write out results and query params into JS arrays
     // Define the srf_filtered_values array
     SMWOutputs::requireScript('srf_slideshow', Html::inlineScript('srf_slideshow = {};'));
     SMWOutputs::requireScript('srf_slideshow' . $id, Html::inlineScript('srf_slideshow["' . $id . '"] = ' . json_encode(array($objects, $this->params['template'], $this->params['delay'] * 1000, $this->params['height'], $this->params['width'], $this->params['nav controls'], $this->params['effect'], json_encode($printrequests))) . ';'));
     SMWOutputs::requireResource('ext.srf.slideshow');
     if ($this->params['nav controls']) {
         SMWOutputs::requireResource('jquery.ui.slider');
     }
     return Html::element('div', array('id' => $id, 'class' => 'srf-slideshow ' . $id . ' ' . $this->params['class']));
 }
开发者ID:cicalese,项目名称:SemanticResultFormats,代码行数:35,代码来源:SRF_SlideShow.php

示例8: getResultText

 protected function getResultText(SMWQueryResult $res, $outputmode)
 {
     if ($outputmode == SMW_OUTPUT_FILE) {
         // make RDF file
         $serializer = $this->syntax == 'turtle' ? new SMWTurtleSerializer() : new SMWRDFXMLSerializer();
         $serializer->startSerialization();
         $serializer->serializeExpData(SMWExporter::getOntologyExpData(''));
         while ($row = $res->getNext()) {
             $subjectDi = reset($row)->getResultSubject();
             $data = SMWExporter::makeExportDataForSubject($subjectDi);
             foreach ($row as $resultarray) {
                 $printreq = $resultarray->getPrintRequest();
                 $property = null;
                 switch ($printreq->getMode()) {
                     case SMWPrintRequest::PRINT_PROP:
                         $property = $printreq->getData()->getDataItem();
                         break;
                     case SMWPrintRequest::PRINT_CATS:
                         $property = new SMWDIProperty('_TYPE');
                         break;
                     case SMWPrintRequest::PRINT_CCAT:
                         // not serialised right now
                         break;
                     case SMWPrintRequest::PRINT_THIS:
                         // ignored here (object is always included in export)
                         break;
                 }
                 if (!is_null($property)) {
                     SMWExporter::addPropertyValues($property, $resultarray->getContent(), $data, $subjectDi);
                 }
             }
             $serializer->serializeExpData($data);
         }
         $serializer->finishSerialization();
         return $serializer->flushContent();
     } else {
         // just make link to feed
         if ($this->getSearchLabel($outputmode)) {
             $label = $this->getSearchLabel($outputmode);
         } else {
             $label = wfMsgForContent('smw_rdf_link');
         }
         $link = $res->getQueryLink($label);
         $link->setParameter('rdf', 'format');
         $link->setParameter($this->syntax, 'syntax');
         if (array_key_exists('limit', $this->params)) {
             $link->setParameter($this->params['limit'], 'limit');
         } else {
             // use a reasonable default limit
             $link->setParameter(100, 'limit');
         }
         $this->isHTML = $outputmode == SMW_OUTPUT_HTML;
         // yes, our code can be viewed as HTML if requested, no more parsing needed
         return $link->getText($outputmode, $this->mLinker);
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:56,代码来源:SMW_QP_RDF.php

示例9: getNumbers

 /**
  * Gets a list of all numbers.
  * 
  * @since 1.6
  * 
  * @param SMWQueryResult $res
  * 
  * @return array
  */
 protected function getNumbers(SMWQueryResult $res)
 {
     $numbers = array();
     while ($row = $res->getNext()) {
         foreach ($row as $resultArray) {
             foreach ($resultArray->getContent() as $dataItem) {
                 self::addNumbersForDataItem($dataItem, $numbers);
             }
         }
     }
     return $numbers;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:21,代码来源:SRF_Math.php

示例10: getResultText

 protected function getResultText(SMWQueryResult $res, $outputmode)
 {
     $result = '';
     if ($outputmode == SMW_OUTPUT_FILE) {
         // make CSV file
         $csv = fopen('php://temp', 'r+');
         if ($this->mShowHeaders) {
             $header_items = array();
             foreach ($res->getPrintRequests() as $pr) {
                 $header_items[] = $pr->getLabel();
             }
             fputcsv($csv, $header_items, $this->m_sep);
         }
         while ($row = $res->getNext()) {
             $row_items = array();
             foreach ($row as $field) {
                 $growing = array();
                 while (($object = $field->getNextDataValue()) !== false) {
                     $growing[] = Sanitizer::decodeCharReferences($object->getWikiValue());
                 }
                 $row_items[] = implode(',', $growing);
             }
             fputcsv($csv, $row_items, $this->m_sep);
         }
         rewind($csv);
         $result .= stream_get_contents($csv);
     } else {
         // just make link to feed
         if ($this->getSearchLabel($outputmode)) {
             $label = $this->getSearchLabel($outputmode);
         } else {
             $label = wfMsgForContent('smw_csv_link');
         }
         $link = $res->getQueryLink($label);
         $link->setParameter('csv', 'format');
         $link->setParameter($this->m_sep, 'sep');
         if (array_key_exists('mainlabel', $this->params) && $this->params['mainlabel'] !== false) {
             $link->setParameter($this->params['mainlabel'], 'mainlabel');
         }
         $link->setParameter($this->mShowHeaders ? 'show' : 'hide', 'headers');
         if (array_key_exists('limit', $this->params)) {
             $link->setParameter($this->params['limit'], 'limit');
         } else {
             // use a reasonable default limit
             $link->setParameter(100, 'limit');
         }
         $result .= $link->getText($outputmode, $this->mLinker);
         $this->isHTML = $outputmode == SMW_OUTPUT_HTML;
         // yes, our code can be viewed as HTML if requested, no more parsing needed
     }
     return $result;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:52,代码来源:SMW_QP_CSV.php

示例11: getResultText

 protected function getResultText(SMWQueryResult $res, $outputmode)
 {
     $result = '';
     $columnClasses = array();
     if ($this->mShowHeaders != SMW_HEADERS_HIDE) {
         // building headers
         $headers = array();
         foreach ($res->getPrintRequests() as $pr) {
             $attribs = array();
             $columnClass = str_replace(array(' ', '_'), '-', $pr->getText(SMW_OUTPUT_WIKI));
             $attribs['class'] = $columnClass;
             // Also add this to the array of classes, for
             // use in displaying each row.
             $columnClasses[] = $columnClass;
             $text = $pr->getText($outputmode, $this->mShowHeaders == SMW_HEADERS_PLAIN ? null : $this->mLinker);
             $headers[] = Html::rawElement('th', $attribs, $text === '' ? '&nbsp;' : $text);
         }
         $headers = '<tr>' . implode("\n", $headers) . '</tr>';
         if ($outputmode == SMW_OUTPUT_HTML) {
             $headers = '<thead>' . $headers . '</thead>';
         }
         $headers = "\n{$headers}\n";
         $result .= $headers;
     }
     $tableRows = array();
     $rowNum = 1;
     while ($subject = $res->getNext()) {
         $tableRows[] = $this->getRowForSubject($subject, $outputmode, $columnClasses, $rowNum++);
     }
     $tableRows = implode("\n", $tableRows);
     if ($outputmode == SMW_OUTPUT_HTML) {
         $tableRows = '<tbody>' . $tableRows . '</tbody>';
     }
     $result .= $tableRows;
     // print further results footer
     if ($this->linkFurtherResults($res)) {
         $link = $res->getQueryLink();
         if ($this->getSearchLabel($outputmode)) {
             $link->setCaption($this->getSearchLabel($outputmode));
         }
         $result .= "\t<tr class=\"smwfooter\"><td class=\"sortbottom\" colspan=\"" . $res->getColumnCount() . '"> ' . $link->getText($outputmode, $this->mLinker) . "</td></tr>\n";
     }
     // Put the <table> tag around the whole thing
     $tableAttrs = array('class' => $this->mHTMLClass);
     if ($this->mFormat == 'broadtable') {
         $tableAttrs['width'] = '100%';
     }
     $result = Xml::tags('table', $tableAttrs, $result);
     $this->isHTML = $outputmode == SMW_OUTPUT_HTML;
     // yes, our code can be viewed as HTML if requested, no more parsing needed
     return $result;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:52,代码来源:SMW_QP_Table.php

示例12: getSortKeys

 /**
  * Returns an array with sortkeys for dates pointing to their source DataItems.
  *
  * @param SMWQueryResult $res
  *
  * @return array
  */
 protected function getSortKeys(SMWQueryResult $res)
 {
     $seconds = array();
     while ($row = $res->getNext()) {
         foreach ($row as $resultArray) {
             foreach ($resultArray->getContent() as $dataItem) {
                 if ($dataItem->getDIType() === SMWDataItem::TYPE_TIME) {
                     $seconds[$dataItem->getSortKey()] = $dataItem;
                 }
             }
         }
     }
     return $seconds;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:21,代码来源:SRF_Time.php

示例13: getAggregatedTimeSeries

 /**
  * Returns an array with numerical data
  *
  * @since 1.8
  *
  * @param SMWQueryResult $result
  * @param $outputMode
  *
  * @return array
  */
 protected function getAggregatedTimeSeries(SMWQueryResult $result, $outputMode)
 {
     $values = array();
     $aggregatedValues = array();
     while ($row = $result->getNext()) {
         // Objects (pages)
         $timeStamp = '';
         $value = '';
         $series = array();
         foreach ($row as $field) {
             $value = array();
             $sum = array();
             $rowSum = array();
             // Group by subject (page object)  or property
             if ($this->params['group'] == 'subject') {
                 $group = $field->getResultSubject()->getTitle()->getText();
             } else {
                 $group = $field->getPrintRequest()->getLabel();
             }
             while (($dataValue = $field->getNextDataValue()) !== false) {
                 // Data values
                 // Find the timestamp
                 if ($dataValue->getDataItem()->getDIType() == SMWDataItem::TYPE_TIME) {
                     // We work with a timestamp, we have to use intval because DataItem
                     // returns a string but we want a numeric representation of the timestamp
                     $timeStamp = intval($dataValue->getDataItem()->getMwTimestamp());
                 }
                 // Find the values (numbers only)
                 if ($dataValue->getDataItem()->getDIType() == SMWDataItem::TYPE_NUMBER) {
                     $sum[] = $dataValue->getNumber();
                 }
             }
             // Aggegate individual values into a sum
             $rowSum = array_sum($sum);
             // Check the sum and threshold/min
             if ($timeStamp !== '' && $rowSum == true && $rowSum >= $this->params['min']) {
                 $series[$group] = array($timeStamp, $rowSum);
             }
         }
         $values[] = $series;
     }
     // Re-assign values according to their group
     foreach ($values as $key => $value) {
         foreach ($values[$key] as $row => $rowvalue) {
             $aggregatedValues[$row][] = $rowvalue;
         }
     }
     return $aggregatedValues;
 }
开发者ID:cicalese,项目名称:SemanticResultFormats,代码行数:59,代码来源:SRF_Timeseries.php

示例14: getTags

 /**
  * Returns an array with the tags (keys) and the number of times they occur (values).
  *
  * @since 1.5.3
  *
  * @param SMWQueryResult $results
  * @param $outputmode
  *
  * @return array
  */
 protected function getTags(SMWQueryResult $results, $outputmode)
 {
     $tags = array();
     $excludetags = explode(';', $this->params['excludetags']);
     while ($row = $results->getNext()) {
         // Objects (pages)
         for ($i = 0, $n = count($row); $i < $n; $i++) {
             // SMWResultArray for a sinlge property
             /**
              * @var SMWDataValue $dataValue
              */
             while (($dataValue = $row[$i]->getNextDataValue()) !== false) {
                 // Data values
                 $isSubject = $row[$i]->getPrintRequest()->getMode() == SMWPrintRequest::PRINT_THIS;
                 // If the main object should not be included, skip it.
                 if ($i == 0 && !$this->params['includesubject'] && $isSubject) {
                     continue;
                 }
                 // Get the HTML for the tag content. Pages are linked, other stuff is just plaintext.
                 if ($dataValue->getTypeID() == '_wpg') {
                     $value = $dataValue->getTitle()->getText();
                     $html = $dataValue->getLongText($outputmode, $this->getLinker($isSubject));
                 } else {
                     $html = $dataValue->getShortText($outputmode, $this->getLinker(false));
                     $value = $html;
                 }
                 // Exclude tags from result set
                 if (in_array($value, $excludetags)) {
                     continue;
                 }
                 // Replace content with template inclusion
                 $html = $this->params['template'] !== '' ? $this->addTemplateOutput($value, $rownum) : $html;
                 if (!array_key_exists($value, $tags)) {
                     $tags[$value] = 0;
                     $this->tagsHtml[$value] = $html;
                     // Store the HTML separetely, so sorting can be done easily.
                 }
                 $tags[$value]++;
             }
         }
     }
     foreach ($tags as $name => $count) {
         if ($count < $this->params['mincount']) {
             unset($tags[$name]);
         }
     }
     return $tags;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:58,代码来源:SRF_TagCloud.php

示例15: getResultText

	protected function getResultText( SMWQueryResult $res, $outputmode ) {
		$this->isHTML = true;

		$t = "";
		$n = "";

		// if there is only one column in the results then stop right away
		if ($res->getColumnCount() == 1) return "";

		// print all result rows
		$first = true;
		$count = 0; // How many bars will they be? Needed to calculate the height of the image
		$max = 0; // the biggest value. needed for scaling
		
		while ( $row = $res->getNext() ) {
			$name = $row[0]->getNextDataValue()->getShortWikiText();
			foreach ( $row as $field ) {
				while ( ( $object = $field->getNextDataValue() ) !== false ) {
					
					// use numeric sortkey
					if ( $object->isNumeric() ) {
						$nr = $object->getDataItem()->getSortKey();

						$count++;
						$max = max( $max, $nr );

						if ( $first ) {
							$first = false;
							$t .= $nr;
							$n = $name;
						} else {
							$t = $nr . ',' . $t;
							$n .= '|' . $name; // yes, this is correct, it needs to be the other way
						}
					}
				}
			}
		}
		
		$barwidth = 20; // width of each bar
		$bardistance = 4; // distance between two bars
		$height = $count * ( $barwidth + $bardistance ) + 15; // calculates the height of the image
		
		return 	'<img src="http://chart.apis.google.com/chart?cht=bhs&chbh=' . $barwidth . ',' . $bardistance . '&chs=' . $this->m_width . 'x' . $height . '&chds=0,' . $max . '&chd=t:' . $t . '&chxt=y&chxl=0:|' . $n . '" width="' . $this->m_width . '" height="' . $height . '" />';

	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:46,代码来源:SRF_GoogleBar.php


注:本文中的SMWQueryResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。