public function __construct( $property, $label = '', $aggregation = '' ) {
		parent::__construct( WOM_TYPE_QUERYPRINTOUT );
		$this->m_property = $property;
		$this->m_label = $label;

		$this->m_aggregation = ( defined( 'SMW_AGGREGATION_VERSION' ) ? $aggregation : '' );
	}
	public function __construct( $name ) {
		parent::__construct( WOM_TYPE_CATEGORY );
		$title = Title::newFromText( $name, NS_CATEGORY );
		if ( $title == null ) {
			// no idea why, just leave it
			$this->m_name = $name;
		} else {
			$this->m_name = $title->getText();
		}
	}
	public function __construct( $property, $value, $caption = '' ) {
		parent::__construct( WOM_TYPE_PROPERTY );

		if ( !defined( 'SMW_VERSION' ) ) {
			// MW hook will catch this exception
			throw new MWException( __METHOD__ . ": Property model is invalid. Please install 'SemanticMediaWiki extension' first." );
		}

		$user_property = SMWPropertyValue::makeUserProperty( $property );
		if ( count ( $user_property->getErrors() ) > 0 ) {
			$user_property = SMWPropertyValue::makeUserProperty( '///NA///' );
		} else {
			$property = '';
		}
		$smwdatavalue = null;
		// FIXME: property should be collection object according to templates
		// if template/field used
		if ( preg_match ( '/\{\{.+\}\}/s', $value . $caption ) ) {
			$value = $value . ( $caption == '' ? '' : "|{$caption}" );
			$caption = '';
		} else {
			if ( version_compare ( SMW_VERSION, '1.6', '>=' ) ) {
				$smwdatavalue = SMWDataValueFactory::newPropertyObjectValue( $user_property->getDataItem(), $value, $caption );
			} else {
				$smwdatavalue = SMWDataValueFactory::newPropertyObjectValue( $user_property, $value, $caption );
			}
			if ( count ( $smwdatavalue->getErrors() ) > 0 ) {
				$smwdatavalue = null;
			}
		}

		$this->m_user_property = $user_property;
		$this->m_smwdatavalue = $smwdatavalue;
		$this->m_property = $property;
		$this->m_value = $value;
		$this->m_caption = $caption;
		$this->m_visible = !preg_match( '/^\s+$/', $caption );
	}
예제 #4
0
	public function __construct( $text = '' ) {
		parent::__construct( WOM_TYPE_TEXT );
		$this->m_text = $text;
	}
	public function __construct( $magicword, $doubleUnderscore = false ) {
		parent::__construct( WOM_TYPE_MAGICWORD );
		$this->m_magicword = $magicword;
		$this->m_doubleUnderscore = $doubleUnderscore;
	}
예제 #6
0
	public function __construct( $link, $caption = null ) {
		parent::__construct( WOM_TYPE_LINK );
		$this->m_link = $link;
		$this->m_caption = $caption;
	}