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


PHP SMWQueryResult::hasFurtherResults方法代码示例

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


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

示例1: 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

示例2: hasFurtherResults

 /**
  * Would there be more query results that were not shown due to a limit?
  *
  * @return boolean
  */
 public function hasFurtherResults()
 {
     if (!is_null($this->queryResult)) {
         // The queryResult may not be set
         return $this->queryResult->hasFurtherResults();
     } else {
         return false;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:14,代码来源:SMW_QueryUIHelper.php

示例3: addQueryResult

 /**
  * Add the query result to the API output.
  *
  * @since 1.6.2
  *
  * @param SMWQueryResult $queryResult
  */
 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()) {
         $result->disableSizeCheck();
         // TODO: right now this returns an offset that we can use for continuation, just like done
         // in other places in SMW. However, this is not efficient, so we should change this at some point.
         $result->addValue(null, 'query-continue-offset', $this->parameters['offset']->getValue() + $queryResult->getCount());
         $result->enableSizeCheck();
     }
 }
开发者ID:nischayn22,项目名称:SemanticMediawiki,代码行数:31,代码来源:ApiSMWQuery.php

示例4: getNavigationBar

 /**
  * Build the navigation for some given query result, reuse url-tail parameters.
  *
  * @param SMWQueryResult $res
  * @param array $urlArgs
  *
  * @return string
  */
 protected function getNavigationBar(SMWQueryResult $res, array $urlArgs)
 {
     global $smwgQMaxInlineLimit, $wgLang;
     $offset = $this->m_params['offset'];
     $limit = $this->params['limit']->getValue();
     // Prepare navigation bar.
     if ($offset > 0) {
         $navigation = Html::element('a', array('href' => SpecialPage::getSafeTitleFor('Ask')->getLocalURL(array('offset' => max(0, $offset - $limit), 'limit' => $limit) + $urlArgs), 'rel' => 'nofollow'), wfMessage('smw_result_prev')->text());
     } else {
         $navigation = wfMessage('smw_result_prev')->text();
     }
     // @todo FIXME: i18n: Patchwork text.
     $navigation .= '&#160;&#160;&#160;&#160; <b>' . wfMessage('smw_result_results')->text() . ' ' . $wgLang->formatNum($offset + 1) . ' &#150; ' . $wgLang->formatNum($offset + $res->getCount()) . '</b>&#160;&#160;&#160;&#160;';
     if ($res->hasFurtherResults()) {
         $navigation .= Html::element('a', array('href' => SpecialPage::getSafeTitleFor('Ask')->getLocalURL(array('offset' => $offset + $limit, 'limit' => $limit) + $urlArgs), 'rel' => 'nofollow'), wfMessage('smw_result_next')->text());
     } else {
         $navigation .= wfMessage('smw_result_next')->text();
     }
     $first = true;
     foreach (array(20, 50, 100, 250, 500) as $l) {
         if ($l > $smwgQMaxInlineLimit) {
             break;
         }
         if ($first) {
             $navigation .= '&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;(';
             $first = false;
         } else {
             $navigation .= ' | ';
         }
         if ($limit != $l) {
             $navigation .= Html::element('a', array('href' => SpecialPage::getSafeTitleFor('Ask')->getLocalURL(array('offset' => $offset, 'limit' => $l) + $urlArgs), 'rel' => 'nofollow'), $l);
         } else {
             $navigation .= '<b>' . $l . '</b>';
         }
     }
     $navigation .= ')';
     return $navigation;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:46,代码来源:SMW_SpecialAsk.php

示例5: getQueryResult

 public function getQueryResult(SMWQuery $query, $force = false, $cacheThis = true)
 {
     //get title of article in which query was executed
     //or set title to false if query was executed somehow else
     global $wgParser;
     $title = false;
     if ($wgParser && $wgParser->getTitle()) {
         $title = $wgParser->getTitle();
     }
     $defaultStore = smwfGetStore();
     // update the semdata object for this title, respectively
     // the query management annotations
     if ($title !== false && $cacheThis) {
         SMWQRCQueryManagementHandler::getInstance()->storeQueryMetadata($title, $query);
     }
     //delegate query processing to the responsible store
     if ($query instanceof SMWSPARQLQuery) {
         $store = $defaultStore;
     } else {
         global $smwgBaseStore;
         $store = new $smwgBaseStore();
     }
     $queryData = $this->getQueryData($query);
     // execute the query if no valid cache entry is available, if force was
     // set to true (e.g. by the update process) or if the query is executed because
     // of an edit or a purge action
     if ($force || !$this->isReadAccess() || !$this->hasValidCacheEntry($queryData)) {
         $queryResult = $store->doGetQueryResult($query);
         if ($cacheThis) {
             //add the serialized query result to the database
             $qrcStore = SMWQRCStore::getInstance()->getDB();
             $queryId = SMWQRCQueryManagementHandler::getInstance()->getQueryId($query);
             $lastUpdate = time();
             $dirty = false;
             if ($queryData) {
                 //results for this query already have been stored in the cache
                 if ($force) {
                     //this query result update was not triggered by a Wiki user action
                     $accessFrequency = SMWQRCPriorityCalculator::getInstance()->computeNewAccessFrequency($queryData['accessFrequency']);
                     $invalidationFrequency = SMWQRCPriorityCalculator::getInstance()->computeNewInvalidationFrequency($queryData['invalidationFrequency']);
                 } else {
                     $accessFrequency = $queryData['accessFrequency'] + 1;
                     $invalidationFrequency = $queryData['invalidationFrequency'] + 1;
                 }
                 $priority = 0;
                 $qrcStore->updateQueryData($queryId, serialize($queryResult), $lastUpdate, $accessFrequency, $invalidationFrequency, $dirty, $priority);
             } else {
                 $priority = 0;
                 $qrcStore->addQueryData($queryId, serialize($queryResult), $lastUpdate, 1, 0, $dirty, $priority);
             }
         }
     } else {
         $qrcStore = SMWQRCStore::getInstance()->getDB();
         $queryResult = unserialize($queryData['queryResult']);
         //update access frequency and query priority
         $priority = 0;
         $qrcStore->updateQueryData($queryData['queryId'], $queryData['queryResult'], $queryData['lastUpdate'], $queryData['accessFrequency'] + 1, $queryData['invalidationFrequency'], $queryData['dirty'], $priority);
         if ($query instanceof SMWQueryResult) {
             $query->addErrors($queryResult->getErrors());
             $queryResult = new SMWQueryResult($query->getDescription()->getPrintRequests(), $query, $queryResult->getResults(), $store, $queryResult->hasFurtherResults());
         }
     }
     return $queryResult;
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:64,代码来源:SMW_QRC_QueryResultsCache.php

示例6: linkFurtherResults

 /**
  * Check whether a "further results" link would normally be generated for this
  * result set with the given parameters. Individual result printers may decide to
  * create or hide such a link independent of that, but this is the default.
  *
  * @param SMWQueryResult $results
  *
  * @return boolean
  */
 protected function linkFurtherResults(SMWQueryResult $results)
 {
     return $this->mInline && $results->hasFurtherResults() && $this->mSearchlabel !== '';
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:13,代码来源:SMW_ResultPrinter.php


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