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


PHP SMWQueryProcessor::addThisPrintout方法代码示例

本文整理汇总了PHP中SMWQueryProcessor::addThisPrintout方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWQueryProcessor::addThisPrintout方法的具体用法?PHP SMWQueryProcessor::addThisPrintout怎么用?PHP SMWQueryProcessor::addThisPrintout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SMWQueryProcessor的用法示例。


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

示例1: getQuery

	/**
	 * 
	 * @return SMWQuery
	 */
	protected function getQuery( $queryString, array $printouts ) {
		SMWQueryProcessor::addThisPrintout( $printouts, $this->parameters );
		
		return SMWQueryProcessor::createQuery(
			$queryString,
			SMWQueryProcessor::getProcessedParams( $this->parameters, $printouts ),
			SMWQueryProcessor::SPECIAL_PAGE,
			'',
			$printouts
		);
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:15,代码来源:ApiSMWQuery.php

示例2: getResults

 protected function getResults($input)
 {
     $query = "[[Collection::" . $input . "]]|?Expression|?Language";
     $rawParams = explode('|', $query);
     list($queryString, $parameters, $printouts) = SMWQueryProcessor::getComponentsFromFunctionParams($rawParams, false);
     SMWQueryProcessor::addThisPrintout($printouts, $parameters);
     $smwQuery = SMWQueryProcessor::createQuery($queryString, SMWQueryProcessor::getProcessedParams($parameters, $printouts), SMWQueryProcessor::SPECIAL_PAGE, '', $printouts);
     $smwQuery->setUnboundLimit(50000);
     $smwQueryResult = smwfGetStore()->getQueryResult($smwQuery);
     $results = $smwQueryResult->toArray()['results'];
     $modified_results = array();
     foreach (array_keys($results) as $key) {
         $short_key = explode("#", $key)[0];
         $lang = $results[$key]['printouts']['Language'][0];
         $langs[$lang] = null;
         $expression = explode(":", $results[$key]['printouts']['Expression'][0]['fulltext'])[1];
         $modified_results[$short_key][$lang][] = $expression;
     }
     return array('data' => $modified_results, 'langs' => array_keys($langs));
 }
开发者ID:albbas,项目名称:Collection,代码行数:20,代码来源:Collection.php

示例3: execute

 /**
  * Executes the query.
  *
  * This method can be called once $queryString, $parameters, $printOuts
  * are set either by using the setQueryString(), setParams() and
  * setPrintOuts() followed by extractParameters(), or one of the static
  * factory methods such as makeForInfoLink() or makeForUI().
  *
  * Errors, if any can be accessed from hasError() and getErrors().
  */
 public function execute()
 {
     $errors = array();
     if ($this->queryString !== '') {
         // FIXME: this is a hack
         SMWQueryProcessor::addThisPrintout($this->printOuts, $this->parameters);
         $params = SMWQueryProcessor::getProcessedParams($this->parameters, $this->printOuts);
         $this->parameters['format'] = $params['format'];
         $this->params = $params;
         $query = SMWQueryProcessor::createQuery($this->queryString, $params, SMWQueryProcessor::SPECIAL_PAGE, $this->parameters['format'], $this->printOuts);
         $res = smwfGetStore()->getQueryResult($query);
         $this->queryResult = $res;
         $errors = array_merge($errors, $res->getErrors());
         if (!empty($errors)) {
             $this->errorsOccured = true;
             $this->errors = array_merge($errors, $this->errors);
         }
         // BEGIN: Try to be smart for rss/ical if no description/title is given and we have a concept query
         if ($this->parameters['format'] == 'rss') {
             $descKey = 'rssdescription';
             $titleKey = 'rsstitle';
         } elseif ($this->parameters['format'] == 'icalendar') {
             $descKey = 'icalendardescription';
             $titleKey = 'icalendartitle';
         } else {
             $descKey = false;
         }
         if ($descKey && $query->getDescription() instanceof SMWConceptDescription && (!isset($this->parameters[$descKey]) || !isset($this->parameters[$titleKey]))) {
             $concept = $query->getDescription()->getConcept();
             if (!isset($this->parameters[$titleKey])) {
                 $this->parameters[$titleKey] = $concept->getText();
             }
             if (!isset($this->parameters[$descKey])) {
                 // / @bug The current SMWStore will never return SMWConceptValue (an SMWDataValue) here; it might return SMWDIConcept (an SMWDataItem)
                 $dv = end(smwfGetStore()->getPropertyValues(SMWWikiPageValue::makePageFromTitle($concept), new SMWDIProperty('_CONC')));
                 if ($dv instanceof SMWConceptValue) {
                     $this->parameters[$descKey] = $dv->getDocu();
                 }
             }
         }
         // END: Try to be smart for rss/ical if no description/title is given and we have a concept query
         /*
          * If parameters have been passed in the infolink-style and the
          * mimie-type of format is defined, generate the export, instead of
          * showing more html.
          */
         $printer = SMWQueryProcessor::getResultPrinter($this->parameters['format'], SMWQueryProcessor::SPECIAL_PAGE);
         $resultMime = $printer->getMimeType($res);
         if ($this->context == self::WIKI_LINK && $resultMime != false) {
             global $wgOut;
             $result = $printer->getResult($res, $this->parameters, SMW_OUTPUT_FILE);
             $resultName = $printer->getFileName($res);
             $wgOut->disable();
             header("Content-type: {$resultMime}; charset=UTF-8");
             if ($resultName !== false) {
                 header("content-disposition: attachment; filename={$resultName}");
             }
             echo $result;
         }
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:71,代码来源:SMW_QueryUIHelper.php

示例4: makeHTMLResult

 /**
  * TODO: document
  */
 protected function makeHTMLResult()
 {
     global $wgOut;
     // TODO: hold into account $smwgAutocompleteInSpecialAsk
     $wgOut->addModules('ext.smw.ask');
     $result = '';
     $result_mime = false;
     // output in MW Special page as usual
     // build parameter strings for URLs, based on current settings
     $urlArgs['q'] = $this->m_querystring;
     $tmp_parray = array();
     foreach ($this->m_params as $key => $value) {
         if (!in_array($key, array('sort', 'order', 'limit', 'offset', 'title'))) {
             $tmp_parray[$key] = $value;
         }
     }
     $urlArgs['p'] = SMWInfolink::encodeParameters($tmp_parray);
     $printoutstring = '';
     /**
      * @var SMWPrintRequest $printout
      */
     foreach ($this->m_printouts as $printout) {
         $printoutstring .= $printout->getSerialisation() . "\n";
     }
     if ($printoutstring !== '') {
         $urlArgs['po'] = $printoutstring;
     }
     if (array_key_exists('sort', $this->m_params)) {
         $urlArgs['sort'] = $this->m_params['sort'];
     }
     if (array_key_exists('order', $this->m_params)) {
         $urlArgs['order'] = $this->m_params['order'];
     }
     if ($this->m_querystring !== '') {
         // FIXME: this is a hack
         SMWQueryProcessor::addThisPrintout($this->m_printouts, $this->m_params);
         $params = SMWQueryProcessor::getProcessedParams($this->m_params, $this->m_printouts);
         $this->m_params['format'] = $params['format']->getValue();
         $this->params = $params;
         $queryobj = SMWQueryProcessor::createQuery($this->m_querystring, $params, SMWQueryProcessor::SPECIAL_PAGE, $this->m_params['format'], $this->m_printouts);
         /**
          * @var SMWQueryResult $res
          */
         // Determine query results
         $res = $params['source']->getValue()->getQueryResult($queryobj);
         // Try to be smart for rss/ical if no description/title is given and we have a concept query:
         if ($this->m_params['format'] == 'rss') {
             $desckey = 'rssdescription';
             $titlekey = 'rsstitle';
         } elseif ($this->m_params['format'] == 'icalendar') {
             $desckey = 'icalendardescription';
             $titlekey = 'icalendartitle';
         } else {
             $desckey = false;
         }
         if ($desckey && $queryobj->getDescription() instanceof SMWConceptDescription && (!isset($this->m_params[$desckey]) || !isset($this->m_params[$titlekey]))) {
             $concept = $queryobj->getDescription()->getConcept();
             if (!isset($this->m_params[$titlekey])) {
                 $this->m_params[$titlekey] = $concept->getText();
             }
             if (!isset($this->m_params[$desckey])) {
                 // / @bug The current SMWStore will never return SMWConceptValue (an SMWDataValue) here; it might return SMWDIConcept (an SMWDataItem)
                 $dv = end(smwfGetStore()->getPropertyValues(SMWWikiPageValue::makePageFromTitle($concept), new SMWDIProperty('_CONC')));
                 if ($dv instanceof SMWConceptValue) {
                     $this->m_params[$desckey] = $dv->getDocu();
                 }
             }
         }
         $printer = SMWQueryProcessor::getResultPrinter($this->m_params['format'], SMWQueryProcessor::SPECIAL_PAGE);
         global $wgRequest;
         $hidequery = $wgRequest->getVal('eq') == 'no';
         if (!$printer->isExportFormat()) {
             if ($res->getCount() > 0) {
                 if ($this->m_editquery) {
                     $urlArgs['eq'] = 'yes';
                 } elseif ($hidequery) {
                     $urlArgs['eq'] = 'no';
                 }
                 $navigation = $this->getNavigationBar($res, $urlArgs);
                 $result .= '<div style="text-align: center;">' . "\n" . $navigation . "\n</div>\n";
                 $query_result = $printer->getResult($res, $params, SMW_OUTPUT_HTML);
                 if (is_array($query_result)) {
                     $result .= $query_result[0];
                 } else {
                     $result .= $query_result;
                 }
                 $result .= '<div style="text-align: center;">' . "\n" . $navigation . "\n</div>\n";
             } else {
                 $result = '<div style="text-align: center;">' . wfMessage('smw_result_noresults')->escaped() . '</div>';
             }
         }
     }
     if (isset($printer) && $printer->isExportFormat()) {
         $wgOut->disable();
         /**
          * @var SMWIExportPrinter $printer
          */
//.........这里部分代码省略.........
开发者ID:Tjorriemorrie,项目名称:app,代码行数:101,代码来源:SMW_SpecialAsk.php

示例5: getQueryResults

 /**
  * This function returns to results of a certain query
  * This functions is part of the extension Semantic Tasks by Steren Giannini & Ryan Lane
  * released under GNU GPLv2 (or later)
  * http://www.mediawiki.org/wiki/Extension:Semantic_Tasks
  * @param $query_string String : the query
  * @param $properties_to_display array(String): array of property names to display
  * @param $display_title Boolean : add the page title in the result
  * @return TODO
  */
 static function getQueryResults($query_string, $properties_to_display, $display_title)
 {
     // We use the Semantic MediaWiki Processor
     // $smwgIP is defined by Semantic MediaWiki, and we don't allow
     // this file to be sourced unless Semantic MediaWiki is included.
     global $smwgIP;
     include_once $smwgIP . "/includes/query/SMW_QueryProcessor.php";
     $params = array();
     $inline = true;
     $printlabel = "";
     $printouts = array();
     // add the page name to the printouts
     if ($display_title) {
         if (version_compare(SMW_VERSION, '1.7', '>')) {
             SMWQueryProcessor::addThisPrintout($printouts, $params);
         } else {
             $to_push = new SMWPrintRequest(SMWPrintRequest::PRINT_THIS, $printlabel);
             array_push($printouts, $to_push);
         }
     }
     // Push the properties to display in the printout array.
     foreach ($properties_to_display as $property) {
         if (class_exists('SMWPropertyValue')) {
             // SMW 1.4
             $to_push = new SMWPrintRequest(SMWPrintRequest::PRINT_PROP, $property, SMWPropertyValue::makeUserProperty($property));
         } else {
             $to_push = new SMWPrintRequest(SMWPrintRequest::PRINT_PROP, $property, Title::newFromText($property, SMW_NS_PROPERTY));
         }
         array_push($printouts, $to_push);
     }
     if (version_compare(SMW_VERSION, '1.6.1', '>')) {
         $params = SMWQueryProcessor::getProcessedParams($params, $printouts);
         $format = null;
     } else {
         $format = 'auto';
     }
     $query = SMWQueryProcessor::createQuery($query_string, $params, $inline, $format, $printouts);
     $results = smwfGetStore()->getQueryResult($query);
     return $results;
 }
开发者ID:ATCARES,项目名称:TaskManagement,代码行数:50,代码来源:TaskManagementUtils.php

示例6: getAllPagesForQuery

 /**
  * returns an array of pages that are result of the semantic query
  * @param $rawQueryString string - the query string like [[Category:Trees]][[age::>1000]]
  * @return array of SMWDIWikiPage objects representing the result
  */
 public static function getAllPagesForQuery($rawQuery)
 {
     $rawQueryArray = array($rawQuery);
     SMWQueryProcessor::processFunctionParams($rawQueryArray, $queryString, $processedParams, $printouts);
     SMWQueryProcessor::addThisPrintout($printouts, $processedParams);
     $processedParams = SMWQueryProcessor::getProcessedParams($processedParams, $printouts);
     $queryObj = SMWQueryProcessor::createQuery($queryString, $processedParams, SMWQueryProcessor::SPECIAL_PAGE, '', $printouts);
     $res = smwfGetStore()->getQueryResult($queryObj);
     $pages = $res->getResults();
     return $pages;
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:16,代码来源:SF_Utils.php

示例7: getNearbyResults

 /**
  * Returns all results that have a value near to the searched for value
  * on the property, ordered, and sorted by ending with the smallest one.
  *
  * @param[in] $count int  How many entities have the exact same value on the property?
  * @param[in] $greater bool  Should the values be bigger? Set false for smaller values
  *
  * @return array of array of SMWWikiPageValue, SMWDataValue with the first being the entity, and the second the value
  */
 private function getNearbyResults($count, $greater = true)
 {
     $options = new SMWRequestOptions();
     $options->limit = $this->limit + 1;
     $options->sort = true;
     // Note: printrequests change the caption of properties they get (they expect properties to be given to them)
     // Since we want to continue using the property for our purposes, we give a clone to the print request.
     $printrequest = new SMWPrintRequest(SMWPrintRequest::PRINT_PROP, '', clone $this->property);
     $params = array();
     $params['format'] = 'ul';
     $params['sort'] = $this->propertystring;
     $params['order'] = 'DESC';
     if ($greater) {
         $params['order'] = 'ASC';
     }
     $cmp = '<';
     if ($greater) {
         $cmp = '>';
     }
     $querystring = '[[' . $this->propertystring . '::' . $cmp . $this->valuestring . ']]';
     $printouts = array($printrequest);
     SMWQueryProcessor::addThisPrintout($printouts, $params);
     $params = SMWQueryProcessor::getProcessedParams($params, $printouts);
     $queryobj = SMWQueryProcessor::createQuery($querystring, $params, SMWQueryProcessor::SPECIAL_PAGE, 'ul', $printouts);
     $queryobj->querymode = SMWQuery::MODE_INSTANCES;
     $queryobj->setLimit($this->limit);
     $queryobj->setOffset($count);
     $results = smwfGetStore()->getQueryResult($queryobj);
     /* array of SMWResultArray */
     $result = $results->getNext();
     $ret = array();
     while ($result) {
         $r = array($result[0]->getNextDataValue());
         if (array_key_exists(1, $result)) {
             $r[] = $result[1]->getNextDataValue();
         }
         $ret[] = $r;
         $result = $results->getNext();
     }
     if (!$greater) {
         $ret = array_reverse($ret);
     }
     return $ret;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:53,代码来源:SMW_SpecialSearchByProperty.php

示例8: getQueryResultFromQueryString

	/**
	 * @param $querystring
	 * @param array $params
	 * @param $extraprintouts
	 * @param $outputmode
	 * @param $context
	 * 
	 * @return SMWQueryResult
	 */
	protected static function getQueryResultFromQueryString( $querystring, array $params, $extraprintouts, $outputmode, $context = SMWQueryProcessor::INLINE_QUERY ) {
		wfProfileIn( 'SCQQueryProcessor::getQueryResultFromQueryString' );
		
		if ( version_compare( SMW_VERSION, '1.6.1', '>' ) ) {
			SMWQueryProcessor::addThisPrintout( $extraprintouts, $params );
			$params = self::getProcessedParams( $params, $extraprintouts, false );
		}
		
		$query = self::createQuery( $querystring, $params, $context, null, $extraprintouts );
		$query_result = smwfGetStore()->getQueryResult( $query );
		
		foreach ( $query_result->getResults() as $wiki_page ) {
			$wiki_page->display_options = $params;
		}

		wfProfileOut( 'SCQQueryProcessor::getQueryResultFromQueryString' );
		
		return $query_result;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:28,代码来源:SCQ_QueryProcessor.php

示例9: outputResults

 /**
  * Format and output report results using the given information plus
  * OutputPage
  *
  * @param OutputPage $out OutputPage to print to
  * @param Skin $skin User skin to use
  * @param Database $dbr Database (read) connection to use
  * @param int $res Result pointer
  * @param int $num Number of available result rows
  * @param int $offset Paging offset
  */
 protected function outputResults($out, $skin, $dbr, $res, $num, $offset)
 {
     global $wgContLang;
     $all_display_params = SDUtils::getDisplayParamsForCategory($this->category);
     $querystring = null;
     $printouts = $params = array();
     // only one set of params is handled for now
     if (count($all_display_params) > 0) {
         $display_params = array_map('trim', $all_display_params[0]);
         SMWQueryProcessor::processFunctionParams($display_params, $querystring, $params, $printouts);
     }
     if (!empty($querystring)) {
         $query = SMWQueryProcessor::createQuery($querystring, $params);
     } else {
         $query = new SMWQuery();
     }
     if (!array_key_exists('format', $params)) {
         $params['format'] = 'category';
     }
     if (array_key_exists('mainlabel', $params)) {
         $mainlabel = $params['mainlabel'];
     } else {
         $mainlabel = '';
     }
     $r = $this->addSemanticResultWrapper($dbr, $res, $num, $query, $mainlabel, $printouts);
     $printer = SMWQueryProcessor::getResultPrinter($params['format'], SMWQueryProcessor::SPECIAL_PAGE, $r);
     if (version_compare(SMW_VERSION, '1.6.1', '>')) {
         SMWQueryProcessor::addThisPrintout($printouts, $params);
         $params = SMWQueryProcessor::getProcessedParams($params, $printouts);
     }
     $prresult = $printer->getResult($r, $params, SMW_OUTPUT_HTML);
     $prtext = is_array($prresult) ? $prresult[0] : $prresult;
     SMWOutputs::commitToOutputPage($out);
     // Crappy hack to get the contents of SMWOutputs::$mHeadItems,
     // which may have been set in the result printer, and dump into
     // headItems of $out.
     // How else can we do this?
     global $wgParser;
     SMWOutputs::commitToParser($wgParser);
     if (!is_null($wgParser->mOutput)) {
         // getHeadItems() was added in MW 1.16
         if (method_exists($wgParser->getOutput(), 'getHeadItems')) {
             $headItems = $wgParser->getOutput()->getHeadItems();
         } else {
             $headItems = $wgParser->getOutput()->mHeadItems;
         }
         foreach ($headItems as $key => $item) {
             $out->addHeadItem($key, $item);
         }
         // Force one more parser function, so links appear.
         $wgParser->replaceLinkHolders($prtext);
     }
     $html = array();
     $html[] = $prtext;
     if (!$this->listoutput) {
         $html[] = $this->closeList();
     }
     $html = $this->listoutput ? $wgContLang->listToText($html) : implode('', $html);
     $out->addHTML($html);
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:71,代码来源:SD_BrowseData.php

示例10: makeHTMLResult

 /**
  * TODO: document
  */
 protected function makeHTMLResult()
 {
     global $wgOut;
     // TODO: hold into account $smwgAutocompleteInSpecialAsk
     $result = '';
     $res = null;
     $htmlContentBuilder = new HtmlContentBuilder();
     // build parameter strings for URLs, based on current settings
     $urlArgs['q'] = $this->m_querystring;
     $tmp_parray = array();
     foreach ($this->m_params as $key => $value) {
         if (!in_array($key, array('sort', 'order', 'limit', 'offset', 'title'))) {
             $tmp_parray[$key] = $value;
         }
     }
     $urlArgs['p'] = SMWInfolink::encodeParameters($tmp_parray);
     $printoutstring = '';
     $duration = 0;
     $navigation = '';
     $queryobj = null;
     /**
      * @var PrintRequest $printout
      */
     foreach ($this->m_printouts as $printout) {
         $printoutstring .= $printout->getSerialisation(true) . "\n";
     }
     if ($printoutstring !== '') {
         $urlArgs['po'] = $printoutstring;
     }
     if (array_key_exists('sort', $this->m_params)) {
         $urlArgs['sort'] = $this->m_params['sort'];
     }
     if (array_key_exists('order', $this->m_params)) {
         $urlArgs['order'] = $this->m_params['order'];
     }
     if ($this->getRequest()->getCheck('bTitle')) {
         $urlArgs['bTitle'] = $this->getRequest()->getVal('bTitle');
         $urlArgs['bMsg'] = $this->getRequest()->getVal('bMsg');
     }
     if ($this->m_querystring !== '') {
         // FIXME: this is a hack
         SMWQueryProcessor::addThisPrintout($this->m_printouts, $this->m_params);
         $params = SMWQueryProcessor::getProcessedParams($this->m_params, $this->m_printouts);
         $this->m_params['format'] = $params['format']->getValue();
         $this->params = $params;
         $queryobj = SMWQueryProcessor::createQuery($this->m_querystring, $params, SMWQueryProcessor::SPECIAL_PAGE, $this->m_params['format'], $this->m_printouts);
         /**
          * @var SMWQueryResult $res
          */
         // Determine query results
         $duration = microtime(true);
         $res = $this->getStoreFromParams($params)->getQueryResult($queryobj);
         $duration = number_format(microtime(true) - $duration, 4, '.', '');
         // Try to be smart for rss/ical if no description/title is given and we have a concept query:
         if ($this->m_params['format'] == 'rss') {
             $desckey = 'rssdescription';
             $titlekey = 'rsstitle';
         } elseif ($this->m_params['format'] == 'icalendar') {
             $desckey = 'icalendardescription';
             $titlekey = 'icalendartitle';
         } else {
             $desckey = false;
         }
         if ($desckey && $queryobj->getDescription() instanceof SMWConceptDescription && (!isset($this->m_params[$desckey]) || !isset($this->m_params[$titlekey]))) {
             $concept = $queryobj->getDescription()->getConcept();
             if (!isset($this->m_params[$titlekey])) {
                 $this->m_params[$titlekey] = $concept->getText();
             }
             if (!isset($this->m_params[$desckey])) {
                 // / @bug The current SMWStore will never return SMWConceptValue (an SMWDataValue) here; it might return SMWDIConcept (an SMWDataItem)
                 $dv = end(\SMW\StoreFactory::getStore()->getPropertyValues(SMWWikiPageValue::makePageFromTitle($concept), new SMW\DIProperty('_CONC')));
                 if ($dv instanceof SMWConceptValue) {
                     $this->m_params[$desckey] = $dv->getDocu();
                 }
             }
         }
         $printer = SMWQueryProcessor::getResultPrinter($this->m_params['format'], SMWQueryProcessor::SPECIAL_PAGE);
         $printer->setShowErrors(false);
         global $wgRequest;
         $hidequery = $wgRequest->getVal('eq') == 'no';
         if (!$printer->isExportFormat()) {
             if ($res->getCount() > 0) {
                 if ($this->m_editquery) {
                     $urlArgs['eq'] = 'yes';
                 } elseif ($hidequery) {
                     $urlArgs['eq'] = 'no';
                 }
                 $navigation = $this->getNavigationBar($res, $urlArgs);
                 $query_result = $printer->getResult($res, $params, SMW_OUTPUT_HTML);
                 if (is_array($query_result)) {
                     $result .= $query_result[0];
                 } else {
                     $result .= $query_result;
                 }
             } else {
                 $result = Html::element('div', array('class' => 'smw-callout smw-callout-info'), wfMessage('smw_result_noresults')->escaped());
             }
//.........这里部分代码省略.........
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:101,代码来源:SMW_SpecialAsk.php

示例11: makeHTMLResult

	/**
	 * TODO: document
	 */
	protected function makeHTMLResult() {
		global $wgOut, $smwgAutocompleteInSpecialAsk;

		$delete_msg = wfMsg( 'delete' );

		// Javascript code for the dynamic parts of the page
		$javascript_text = <<<END
<script type="text/javascript">
function updateOtherOptions(strURL) {
	jQuery.ajax({ url: strURL, context: document.body, success: function(data){
		jQuery("#other_options").html(data);
	}});
}

// code for handling adding and removing the "sort" inputs
var num_elements = {$this->m_num_sort_values};

function addInstance(starter_div_id, main_div_id) {
	var starter_div = document.getElementById(starter_div_id);
	var main_div = document.getElementById(main_div_id);

	//Create the new instance
	var new_div = starter_div.cloneNode(true);
	var div_id = 'sort_div_' + num_elements;
	new_div.className = 'multipleTemplate';
	new_div.id = div_id;
	new_div.style.display = 'block';

	var children = new_div.getElementsByTagName('*');
	var x;
	for (x = 0; x < children.length; x++) {
		if (children[x].name)
			children[x].name = children[x].name.replace(/_num/, '[' + num_elements + ']');
	}

	//Create 'delete' link
	var remove_button = document.createElement('span');
	remove_button.innerHTML = '[<a href="javascript:removeInstance(\'sort_div_' + num_elements + '\')">{$delete_msg}</a>]';
	new_div.appendChild(remove_button);

	//Add the new instance
	main_div.appendChild(new_div);
	num_elements++;
}

function removeInstance(div_id) {
	var olddiv = document.getElementById(div_id);
	var parent = olddiv.parentNode;
	parent.removeChild(olddiv);
}
</script>

END;

		$wgOut->addScript( $javascript_text );

		if ( $smwgAutocompleteInSpecialAsk ) {
			self::addAutocompletionJavascriptAndCSS();
		}

		$result = '';
		$result_mime = false; // output in MW Special page as usual

		// build parameter strings for URLs, based on current settings
		$urlArgs['q'] = $this->m_querystring;

		$tmp_parray = array();
		foreach ( $this->m_params as $key => $value ) {
			if ( !in_array( $key, array( 'sort', 'order', 'limit', 'offset', 'title' ) ) ) {
				$tmp_parray[$key] = $value;
			}
		}

		$urlArgs['p'] = SMWInfolink::encodeParameters( $tmp_parray );
		$printoutstring = '';

		foreach ( $this->m_printouts as /* SMWPrintRequest */ $printout ) {
			$printoutstring .= $printout->getSerialisation() . "\n";
		}

		if ( $printoutstring !== '' ) $urlArgs['po'] = $printoutstring;
		if ( array_key_exists( 'sort', $this->m_params ) )  $urlArgs['sort'] = $this->m_params['sort'];
		if ( array_key_exists( 'order', $this->m_params ) ) $urlArgs['order'] = $this->m_params['order'];

		if ( $this->m_querystring !== '' ) {
			// FIXME: this is a hack
			SMWQueryProcessor::addThisPrintout( $this->m_printouts, $this->m_params );
			$params = SMWQueryProcessor::getProcessedParams( $this->m_params, $this->m_printouts );
			$this->m_params['format'] = $params['format'];

			$queryobj = SMWQueryProcessor::createQuery(
				$this->m_querystring,
				$params,
				SMWQueryProcessor::SPECIAL_PAGE ,
				$this->m_params['format'],
				$this->m_printouts
			);
//.........这里部分代码省略.........
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:101,代码来源:SMW_SpecialAsk.php


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