本文整理汇总了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();
}
}
示例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;
}
}
示例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();
}
}
示例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 .= '     <b>' . wfMessage('smw_result_results')->text() . ' ' . $wgLang->formatNum($offset + 1) . ' – ' . $wgLang->formatNum($offset + $res->getCount()) . '</b>    ';
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 .= '        (';
$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;
}
示例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;
}
示例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 !== '';
}