Exemplo n.º 1
0
 /**
  * @since 2.1
  *
  * @param DIProperty $property
  *
  * @return PrintRequest
  */
 public function newPropertyPrintRequest(DIProperty $property)
 {
     $propertyValue = new PropertyValue('__pro');
     $propertyValue->setDataItem($property);
     $instance = new PrintRequest(PrintRequest::PRINT_PROP, $propertyValue->getWikiValue(), $propertyValue);
     return $instance;
 }
 /**
  * @since 2.1
  */
 public function initialize()
 {
     $params = explode('/', $this->queryString);
     reset($params);
     // Remove empty elements
     $params = array_filter($params, 'strlen');
     $property = isset($this->requestOptions['property']) ? $this->requestOptions['property'] : current($params);
     $value = isset($this->requestOptions['value']) ? $this->requestOptions['value'] : next($params);
     $property = $this->urlEncoder->decode($property);
     $value = str_replace(array('-25'), array('%'), $value);
     $this->property = PropertyValue::makeUserProperty($property);
     if (!$this->property->isValid()) {
         $this->propertyString = $property;
         $this->value = null;
         $this->valueString = $value;
     } else {
         $this->propertyString = $this->property->getWikiValue();
         $this->value = DataValueFactory::getInstance()->newPropertyObjectValue($this->property->getDataItem(), $this->urlEncoder->decode($value));
         $this->valueString = $this->value->isValid() ? $this->value->getWikiValue() : $value;
     }
     $this->setLimit();
     $this->setOffset();
     $this->setNearbySearch();
 }
 /**
  * @see DataValue::getWikiValue
  */
 public function getWikiValue()
 {
     return $this->lastPropertyChainValue !== null ? $this->lastPropertyChainValue->getWikiValue() : '';
 }
 /**
  * Figures out the label of the property to be used. For outgoing ones it is just
  * the text, for incoming ones we try to figure out the inverse one if needed,
  * either by looking for an explicitly stated one or by creating a default one.
  *
  * @param[in] $property SMWPropertyValue  The property of interest
  * @param[in] $incoming bool  If it is an incoming property
  *
  * @return string  The label of the property
  */
 private function getPropertyLabel(\SMWPropertyValue $property, $incoming = false)
 {
     if ($incoming && $this->getOption('showInverse')) {
         $oppositeprop = \SMWPropertyValue::makeUserProperty(wfMessage('smw_inverse_label_property')->text());
         $labelarray = $this->store->getPropertyValues($property->getDataItem()->getDiWikiPage(), $oppositeprop->getDataItem());
         $rv = count($labelarray) > 0 ? $labelarray[0]->getLongWikiText() : wfMessage('smw_inverse_label_default', $property->getWikiValue())->text();
     } else {
         $rv = $property->getWikiValue();
     }
     return $this->unbreak($rv);
 }
	/**
	 * Figures out the label of the property to be used. For outgoing ones it is just
	 * the text, for incoming ones we try to figure out the inverse one if needed,
	 * either by looking for an explicitly stated one or by creating a default one.
	 *
	 * @param[in] $property SMWPropertyValue  The property of interest
	 * @param[in] $incoming bool  If it is an incoming property
	 *
	 * @return string  The label of the property
	 */
	private function getPropertyLabel( SMWPropertyValue $property, $incoming = false ) {
		global $smwgBrowseShowInverse;

		if ( $incoming && $smwgBrowseShowInverse ) {
			$oppositeprop = SMWPropertyValue::makeUserProperty( wfMsg( 'smw_inverse_label_property' ) );
			$labelarray = &smwfGetStore()->getPropertyValues( $property->getDataItem()->getDiWikiPage(), $oppositeprop->getDataItem() );
			$rv = ( count( $labelarray ) > 0 ) ? $labelarray[0]->getLongWikiText():
			       wfMsg( 'smw_inverse_label_default', $property->getWikiValue() );
		} else {
			$rv = $property->getWikiValue();
		}

		return $this->unbreak( $rv );
	}
Exemplo n.º 6
0
	/**
	 * Adds a single property value pair to the data. value may be null.
	 *
	 * @param SMWPropertyValue $property
	 * @param SMWDataValue $value
	 */
	public function addPropertyValue( SMWPropertyValue $property, SMWDataValue $value ) {
		$this->addPropertynameValue( $property->getWikiValue(), $value );
	}