コード例 #1
0
	protected function getSemanticInfo( $title ) {
		$result = array();
		$sStore = NMStorage::getDatabase();
		$semdata = smwfGetStore()->getSemanticData( $title );
		foreach ( $semdata->getProperties() as $property ) {
			if ( !$property->isShown() && $property->getWikiValue() != '' ) { // showing this is not desired, hide
				continue;
			} elseif ( $property->isUserDefined() ) { // user defined property
				$property->setCaption( preg_replace( '/[ ]/u', ' ', $property->getWikiValue(), 2 ) );
			}

			$propvalues = $semdata->getPropertyValues( $property );
			if ( $property->getWikiValue() != '' ) {
				foreach ( $propvalues as $propvalue ) {
					if ( $propvalue->getWikiValue() != '' ) {
						$result[SMWNotifyProcessor::toInfoId( 2, 0, $sStore->lookupSmwId( SMW_NS_PROPERTY, $property->getDBkey() ) )][] = array( 'name' => $property, 'value' => $propvalue );
					}
				}
			} else {
				foreach ( $propvalues as $propvalue ) {
					if ( ( $propvalue instanceof SMWWikiPageValue ) && ( $propvalue->getNamespace() == NS_CATEGORY ) ) {
						$result[SMWNotifyProcessor::toInfoId( 0, 0, $sStore->lookupSmwId( NS_CATEGORY, $propvalue->getDBkey() ) )][] = array( 'name' => $propvalue, 'value' => null );
					}
				}
			}
		}
		return $result;
	}
コード例 #2
0
	public function getMonitoredNotificationsDetail( $page_id ) {
		$fname = 'NotifyMe::getMonitoredNotificationsDetail';
		wfProfileIn( $fname );

		$result = array();

		$notifies = $this->getMonitoredNotifications( $page_id );

		$db = wfGetDB( DB_SLAVE );

		foreach ( $notifies as $user_id => $notify ) {
			foreach ( $notify as $notify_id => $notify_detail ) {
				if ( $notify_detail['rep_all'] == 1 ) {
					$result[$user_id]['rep_all'][$notify_id] = $notify_detail['name'];
				} else {
					$res = $db->select( $db->tableName( 'smw_nm_relations' ), array( 'smw_id', 'type' ), "notify_id=$notify_id AND subquery=0", $fname );
					if ( $db->numRows( $res ) > 0 ) {
						while ( $row = $db->fetchObject( $res ) ) {
							$result[$user_id]['semantic'][SMWNotifyProcessor::toInfoId( $row->type, 0, $row->smw_id )][$notify_id] = $notify_detail['name'];
						}
					}
					$db->freeResult( $res );
				}
			}
		}

		wfProfileOut( $fname );
		return $result;
	}