/** * Get the HTML for displaying subproperties of this property. This list * is usually short and we implement no additional navigation. * * @return string */ protected function getSubpropertyList() { $store = smwfGetStore(); $options = new SMWRequestOptions(); $options->sort = true; $options->ascending = true; $subproperties = $store->getPropertySubjects(new SMWDIProperty('_SUBP'), $this->getDataItem(), $options); $result = ''; $resultCount = count($subproperties); if ($resultCount > 0) { $titleText = htmlspecialchars($this->mTitle->getText()); $result .= "<div id=\"mw-subcategories\">\n<h2>" . wfMessage('smw_subproperty_header', $titleText)->text() . "</h2>\n<p>"; if (!$this->mProperty->isUserDefined()) { $result .= wfMessage('smw_isspecprop')->text() . ' '; } $result .= wfMsgExt('smw_subpropertyarticlecount', array('parsemag'), $resultCount) . "</p>\n"; if ($resultCount < 6) { $result .= SMWPageLister::getShortList(0, $resultCount, $subproperties, null); } else { $result .= SMWPageLister::getColumnList(0, $resultCount, $subproperties, null); } $result .= "\n</div>"; } return $result; }
/** * Get the HTML for displaying subproperties of this property. This list * is usually short and we implement no additional navigation. * * @return string */ protected function getSubpropertyList() { $more = false; $requestOptions = new RequestOptions(); $requestOptions->sort = true; $requestOptions->ascending = true; // +1 look-ahead $requestOptions->setLimit($GLOBALS['smwgSubPropertyListLimit'] + 1); $subproperties = $this->store->getPropertySubjects(new DIProperty('_SUBP'), $this->getDataItem(), $requestOptions); // Pop the +1 look-ahead from the list if (count($subproperties) > $GLOBALS['smwgSubPropertyListLimit']) { array_pop($subproperties); $more = true; } $result = ''; $resultCount = count($subproperties); if ($more) { $message = Html::rawElement('span', array('class' => 'plainlinks'), wfMessage('smw-subpropertylist-count-with-restricted-note', $resultCount, $GLOBALS['smwgSubPropertyListLimit'])->parse()); } else { $message = wfMessage('smw-subpropertylist-count', $resultCount)->text(); } if ($resultCount > 0) { $titleText = htmlspecialchars($this->mTitle->getText()); $result .= "<div id=\"mw-subcategories\">\n<h2>" . wfMessage('smw_subproperty_header', $titleText)->text() . "</h2>\n<p>"; if (!$this->mProperty->isUserDefined()) { $result .= wfMessage('smw_isspecprop')->text() . ' '; } $result .= $message . "</p>" . "\n"; if ($resultCount < 6) { $result .= SMWPageLister::getShortList(0, $resultCount, $subproperties, null); } else { $result .= SMWPageLister::getColumnList(0, $resultCount, $subproperties, null); } $result .= "\n</div>"; } return $result; }