/** * Hanldes a single property value. Returns an array with data for a single event or false. * * FIXME: 13 arguments, of which a whole bunch are byref... not a good design :) * * @since 1.5.3 * * @param SMWDataValue $object * @param $outputmode * @param SMWPrintRequest $pr * @param boolean $first_col * @param boolean &$hastitle * @param boolean &$hastime * @param boolean $first_value * @param boolean $isEventline * @param string &$curmeta * @param string &$curdata * @param &$date_value * @param boolean &$output * @param array &$positions * * @return false or array */ protected function handlePropertyValue( SMWDataValue $object, $outputmode, SMWPrintRequest $pr, $first_col, &$hastitle, &$hastime, $first_value, $isEventline, &$curmeta, &$curdata, $date_value, &$output, array &$positions ) { global $curarticle, $cururl; $event = false; $l = $this->getLinker( $first_col ); if ( !$hastitle && $object->getTypeID() != '_wpg' ) { // "linking" non-pages in title positions confuses timeline scripts, don't try this $l = null; } if ( $object->getTypeID() == '_wpg' ) { // use shorter "LongText" for wikipage $objectlabel = $object->getLongText( $outputmode, $l ); } else { $objectlabel = $object->getShortText( $outputmode, $l ); } $urlobject = ( $l !== null ); $header = ''; if ( $first_value ) { // find header for current value: if ( $this->mShowHeaders && ( '' != $pr->getLabel() ) ) { $header = $pr->getText( $outputmode, $this->mLinker ) . ': '; } // is this a start date? if ( ( $pr->getMode() == SMWPrintRequest::PRINT_PROP ) && ( $date_value == $this->m_tlstart ) ) { // FIXME: Timeline scripts should support XSD format explicitly. They // currently seem to implement iso8601 which deviates from XSD in cases. // NOTE: We can assume $object to be an SMWDataValue in this case. $curmeta .= Html::element( 'span', array( 'class' => 'smwtlstart' ), $object->getXMLSchemaDate() ); $positions[$object->getHash()] = $object->getXMLSchemaDate(); $hastime = true; } // is this the end date? if ( ( $pr->getMode() == SMWPrintRequest::PRINT_PROP ) && ( $date_value == $this->m_tlend ) ) { // NOTE: We can assume $object to be an SMWDataValue in this case. $curmeta .= Html::element( 'span', array( 'class' => 'smwtlend' ), $object->getXMLSchemaDate( false ) ); } // find title for displaying event if ( !$hastitle ) { $curmeta .= Html::element( 'span', array( 'class' => $urlobject ? 'smwtlurl' : 'smwtltitle' ), $objectlabel ); if ( $pr->getMode() == SMWPrintRequest::PRINT_THIS ) { $curarticle = $object->getShortText( $outputmode, false ); $cururl = $object->getTitle()->getFullUrl(); } // NOTE: type Title of $object implied $hastitle = true; } } elseif ( $output ) { // it *can* happen that output is false here, if the subject was not printed (fixed subject query) and mutliple items appear in the first row $curdata .= ', '; } if ( !$first_col || !$first_value || $isEventline ) { $curdata .= $header . $objectlabel; $output = true; } if ( $isEventline && ( $pr->getMode() == SMWPrintRequest::PRINT_PROP ) && ( $pr->getTypeID() == '_dat' ) && ( '' != $pr->getLabel() ) && ( $date_value != $this->m_tlstart ) && ( $date_value != $this->m_tlend ) ) { $event = array( $object->getXMLSchemaDate(), $pr->getLabel(), $object->getDataItem()->getSortKey(), ); } return $event; }
/** * Returns the GV for a single SMWDataValue. * * @since 1.5.4 * * @param SMWDataValue $object * @param $outputmode * @param boolean $isName Is this the name that should be used for the node? * @param string $name * @param string $labelName * * @return string */ protected function getGVForDataValue(SMWDataValue $object, $outputmode, $isName, $name, $labelName) { $graphInput = ''; $text = $object->getShortText($outputmode); if ($this->m_graphLink) { $nodeLinkURL = "[[" . $text . "]]"; } $text = $this->getWordWrappedText($text, $this->m_wordWrapLimit); if ($this->m_graphLink) { $graphInput .= " \"{$text}\" [URL = \"{$nodeLinkURL}\"]; "; } if (!$isName) { $graphInput .= $this->m_parentRelation ? " \"{$text}\" -> \"{$name}\" " : " \"{$name}\" -> \"{$text}\" "; if ($this->m_graphLabel || $this->m_graphColor) { $graphInput .= ' ['; if (array_search($labelName, $this->m_labelArray, true) === false) { $this->m_labelArray[] = $labelName; } $color = $this->m_graphColors[array_search($labelName, $this->m_labelArray, true)]; if ($this->m_graphLabel) { $graphInput .= "label=\"{$labelName}\""; if ($this->m_graphColor) { $graphInput .= ",fontcolor={$color},"; } } if ($this->m_graphColor) { $graphInput .= "color={$color}"; } $graphInput .= ']'; } $graphInput .= ';'; } return $graphInput; }
/** * Returns the GV for a single SMWDataValue. * * @since 1.5.4 * * @param SMWDataValue $object * @param $outputmode * @param boolean $isName Is this the name that should be used for the node? * @param string $name * @param string $labelName * * @return string */ protected function getGVForDataValue( SMWDataValue $object, $outputmode, $isName, $name, $labelName ) { $graphInput = ''; $text = $object->getShortText( $outputmode ); if ( $this->m_graphLink ) { $nodeLinkTitle = Title::newFromText( $text ); $nodeLinkURL = $nodeLinkTitle->getLocalURL(); } $text = $this->getWordWrappedText( $text, $this->m_wordWrapLimit ); if ( $this->m_graphLink ) { $graphInput .= " \"$text\" [URL = \"$nodeLinkURL\"]; "; } if ( !$isName ) { $graphInput .= $this->m_parentRelation ? " \"$text\" -> \"$name\" " : " \"$name\" -> \"$text\" "; if ( $this->m_graphLabel && $this->m_graphColor ) { $graphInput .= ' ['; if ( array_search( $labelName, $this->m_labelArray, true ) === false ) { $this->m_labelArray[] = $labelName; } $color = $this->m_graphColors[array_search( $labelName, $this->m_labelArray, true )]; if ( $this->m_graphLabel ) { $graphInput .= "label=\"$labelName\""; if ( $this->m_graphColor ) $graphInput .= ",fontcolor=$color,"; } if ( $this->m_graphColor ) { $graphInput .= "color=$color"; } $graphInput .= ']'; } $graphInput .= ';'; } return $graphInput; }