00001 <?php
00002
00015 class SMWSpecialUnusedProperties extends SpecialPage {
00016
00017 public function __construct() {
00018 parent::__construct( 'UnusedProperties' );
00019 }
00020
00021 public function execute( $param ) {
00022 wfProfileIn( 'smwfDoSpecialUnusedProperties (SMW)' );
00023
00024 global $wgOut;
00025
00026 $wgOut->setPageTitle( wfMsg( 'unusedproperties' ) );
00027
00028 $rep = new SMWUnusedPropertiesPage();
00029
00030 list( $limit, $offset ) = wfCheckLimits();
00031 $rep->doQuery( $offset, $limit );
00032
00033
00034 SMWOutputs::commitToOutputPage( $wgOut );
00035
00036 wfProfileOut( 'smwfDoSpecialUnusedProperties (SMW)' );
00037 }
00038 }
00039
00048 class SMWUnusedPropertiesPage extends SMWQueryPage {
00049
00050 function getName() {
00051 return "UnusedProperties";
00052 }
00053
00054 function isExpensive() {
00055 return false;
00056 }
00057
00058 function isSyndicated() {
00059 return false;
00060 }
00061
00062 function getPageHeader() {
00063 return '<p>' . wfMsg( 'smw_unusedproperties_docu' ) . "</p><br />\n";
00064 }
00065
00066 function formatResult( $skin, $result ) {
00067 $linker = smwfGetLinker();
00068
00069 $proplink = $linker->link(
00070 $result->getDiWikiPage()->getTitle(),
00071 $result->getLabel()
00072 );
00073
00074 $types = smwfGetStore()->getPropertyValues( $result->getDiWikiPage(), new SMWDIProperty( '_TYPE' ) );
00075 $errors = array();
00076
00077 if ( count( $types ) >= 1 ) {
00078 $typestring = SMWDataValueFactory::newDataItemValue( current( $types ), new SMWDIProperty( '_TYPE' ) )->getLongHTMLText( $linker );
00079 } else {
00080 $type = SMWTypesValue::newFromTypeId( '_wpg' );
00081 $typestring = $type->getLongHTMLText( $linker );
00082 $errors[] = wfMsg( 'smw_propertylackstype', $type->getLongHTMLText() );
00083 }
00084
00085 return wfMsg( 'smw_unusedproperty_template', $proplink, $typestring ) . ' ' . smwfEncodeMessages( $errors );
00086 }
00087
00091 function getResults( $requestoptions ) {
00092 return smwfGetStore()->getUnusedPropertiesSpecial( $requestoptions );
00093 }
00094
00095 }
00096