function execute( $par ) {
		global $wgOut, $wgRequest;

		require_once( "forms.php" );
		require_once( "type.php" );
		require_once( "OmegaWikiAttributes.php" );
		require_once( "ViewInformation.php" );

		initializeOmegaWikiAttributes( new ViewInformation() );
		$wgOut->setPageTitle( wfMsg( 'ow_needs_xlation_title' ) );

		$destinationLanguageId = array_key_exists( 'to-lang', $_GET ) ? $_GET['to-lang']:'';
		$collectionId = array_key_exists( 'collection', $_GET ) ? $_GET['collection'] : '';
		$sourceLanguageId = array_key_exists( 'from-lang', $_GET ) ? $_GET['from-lang'] : '';
                                                                
		$wgOut->addHTML( getOptionPanel(
			array(
				wfMsg( 'ow_needs_xlation_dest_lang' ) => getSuggest( 'to-lang', 'language', array(), $destinationLanguageId, languageIdAsText( $destinationLanguageId ) ),
				wfMsg( 'ow_needs_xlation_source_lang' ) => getSuggest( 'from-lang', 'language', array(), $sourceLanguageId, languageIdAsText( $sourceLanguageId ) ),
				wfMsg( 'ow_Collection_colon' ) => getSuggest( 'collection', 'collection', array(), $collectionId, collectionIdAsText( $collectionId ) )
			)
		) );

		if ( $destinationLanguageId == '' )
			$wgOut->addHTML( '<p>' . wfMsg( 'ow_needs_xlation_no_dest_lang' ) . '</p>' );
		else
			$this->showExpressionsNeedingTranslation( $sourceLanguageId, $destinationLanguageId, $collectionId );
	}
	function execute( $par ) {

		global $wgOut, $wgUser, $wgRequest;

		$wgOut->setPageTitle( 'Add Collection' );

		if ( !$wgUser->isAllowed( 'addcollection' ) ) {
			$wgOut->addHTML( 'You do not have permission to add a collection.' );
			return false;
		}

		$dbr = wfGetDB( DB_MASTER );

		if ( $wgRequest->getText( 'collection' ) ) {
			require_once( 'WikiDataAPI.php' );
			require_once( 'Transaction.php' );

			$dc = $wgRequest->getText( 'dataset' );
			$collectionName = $wgRequest->getText( 'collection' );
			startNewTransaction( $wgUser->getID(), wfGetIP(), 'Add collection ' . $collectionName );
			bootstrapCollection( $collectionName, $wgRequest->getText( 'language' ), $wgRequest->getText( 'type' ), $dc );
			$wgOut->addHTML( wfMsg( 'ow_collection_added', $collectionName ) . "<br />" );
		}
		$datasets = wdGetDatasets();
		$datasetarray[''] = wfMsgSc( "none_selected" );
		foreach ( $datasets as $datasetid => $dataset ) {
			$datasetarray[$datasetid] = $dataset->fetchName();
		}

		$wgOut->addHTML( getOptionPanel(
			array(
				'Collection name:' => getTextBox( 'collection' ),
				'Language of name:' => getSuggest( 'language', 'language' ),
				'Collection type:' => getSelect( 'type', array( '' => 'None', 'RELT' => 'RELT', 'LEVL' => 'LEVL', 'CLAS' => 'CLAS', 'MAPP' => 'MAPP' ) ),
				'Dataset:' => getSelect( 'dataset', $datasetarray )
			),
			'', array( 'create' => wfMsg( 'ow_create' ) )
		) );
	}
Exemplo n.º 3
0
 function search($searchText)
 {
     global $wgOut, $wgRequest, $wgFilterLanguageId, $wgSearchWithinWordsDefaultValue, $wgSearchWithinExternalIdentifiersDefaultValue, $wgShowSearchWithinExternalIdentifiersOption, $wgShowSearchWithinWordsOption;
     $collectionId = $wgRequest->getInt("collection");
     $languageId = $wgRequest->getInt("language");
     $withinWords = $wgRequest->getBool("within-words");
     $withinExternalIdentifiers = $wgRequest->getBool("within-external-identifiers");
     if (!$withinWords && !$withinExternalIdentifiers) {
         $withinWords = $wgSearchWithinWordsDefaultValue;
         $withinExternalIdentifiers = $wgSearchWithinExternalIdentifiersDefaultValue;
     }
     $languageName = languageIdAsText($languageId);
     $options = array();
     $options[wfMsg('datasearch_search_text')] = getTextBox('search-text', $searchText);
     if ($wgFilterLanguageId == 0) {
         $options[wfMsg('datasearch_language')] = getSuggest('language', "language", array(), $languageId, $languageName);
     } else {
         $languageId = $wgFilterLanguageId;
     }
     $options[wfMsg('ow_Collection_colon')] = getSuggest('collection', 'collection', array(), $collectionId, collectionIdAsText($collectionId));
     if ($wgShowSearchWithinWordsOption) {
         $options[wfMsg('datasearch_within_words')] = getCheckBox('within-words', $withinWords);
     } else {
         $withinWords = $wgSearchWithinWordsDefaultValue;
     }
     if ($wgShowSearchWithinExternalIdentifiersOption) {
         $options[wfMsg('datasearch_within_ext_ids')] = getCheckBox('within-external-identifiers', $withinExternalIdentifiers);
     } else {
         $withinExternalIdentifiers = $wgSearchWithinExternalIdentifiersDefaultValue;
     }
     $wgOut->addHTML(getOptionPanel($options));
     if ($withinWords) {
         if ($languageId != 0 && $languageName != "") {
             $wgOut->addHTML('<h1>' . wfMsg('datasearch_match_words_lang', $languageName, $searchText) . '</h1>');
         } else {
             $wgOut->addHTML('<h1>' . wfMsg('datasearch_match_words', $searchText) . '</h1>');
         }
         $resultCount = $this->searchWordsCount($searchText, $collectionId, $languageId);
         $wgOut->addHTML('<p>' . wfMsgExt('datasearch_showing_only', 'parsemag', 100, $resultCount) . '</p>');
         $wgOut->addHTML($this->searchWords($searchText, $collectionId, $languageId));
     }
     if ($withinExternalIdentifiers) {
         $wgOut->addHTML('<h1>' . wfMsg('datasearch_match_ext_ids', $searchText) . '</i></h1>');
         $wgOut->addHTML('<p>' . wfMsgExt('datasearch_showing_only', 'parsemag', 100) . '</p>');
         $wgOut->addHTML($this->searchExternalIdentifiers($searchText, $collectionId));
     }
 }
Exemplo n.º 4
0
    var $parentKat;
    var $requestedKat;
    var $title;
    var $items;
}
class Item
{
    var $type;
    var $id;
    var $img;
    var $display;
    var $favorite;
}
$db = mysqli_connect($GLOBALS["db_host"], $GLOBALS["db_user"], $GLOBALS["db_pwd"]);
mysqli_select_db($db, $GLOBALS["db_name"]);
getSuggest();
function getSuggest()
{
    global $db;
    $erlaubteEbenen = getChildEbenen(0);
    $suchfeld = "";
    $mandant = "";
    if (isset($_REQUEST['suchtext'])) {
        $suchfeld = utf8_decode(rawurldecode($_REQUEST['suchtext']));
    }
    if (isset($_REQUEST['mandant'])) {
        $mandant = utf8_decode(rawurldecode($_REQUEST['mandant']));
    }
    $search_sql = "select fe.ID as id,ftl.value as titel,b.URL as image from foi_title_lang ftl join foi_ebene fe on fe.FK_FOI_ID = ftl.fk_foi_id join foi f on fe.FK_FOI_ID = f.ID left join foi_bild fb on fb.FK_FOI_ID = fe.FK_FOI_ID left join bild b on b.id = fb.FK_BILD_ID where (ftl.value like '%|suchbegriff|%') AND (f.BEGINN <= CURDATE() and f.ENDE >= CURDATE() or f.ENDE is null) AND fe.FK_EBENE_ID IN (" . implode(",", $erlaubteEbenen) . ") group by fe.FK_FOI_ID order by ftl.value";
    $query = str_replace("|suchbegriff|", $suchfeld, $search_sql);
    //echo($query);
function getFilterOptionsPanel( $fromTransactionId, $transactionCount, $userName, $showRollBackOptions ) {
	$countOptions = array();
	
	for ( $i = 1; $i <= 20; $i++ )
		$countOptions[$i] = $i;
	
	return getOptionPanel(
		array(
			wfMsg( 'ow_transaction_from_transaction' ) =>
				getSuggest(
					'from-transaction',
					'transaction',
					array(),
					$fromTransactionId,
					getTransactionLabel( $fromTransactionId ),
					array( 0, 2, 3 )
				),
			wfMsg( 'ow_transaction_count' ) =>
				getSelect( 'transaction-count',
					$countOptions,
					$transactionCount
				),
			wfMsg( 'ow_transaction_user' ) => getTextBox( 'user-name', $userName ),
			wfMsg( 'ow_transaction_show_rollback' ) => getCheckBox( 'show-roll-back-options', $showRollBackOptions )
		)
	);
}
Exemplo n.º 6
0
function getInputFieldForType( $name, $type, $value ) {
	global $wgDefinedMeaning;
	switch( $type ) {
		case "language": return getLanguageSelect( $name );
		case "spelling": return getTextBox( $name, $value );
		case "boolean": return getCheckBox( $name, $value );
		case "$wgDefinedMeaning":
		case "defining-expression":
			return getSuggest( $name, $wgDefinedMeaning );
		case "relation-type": return getSuggest( $name, "relation-type" );
		case "attribute": return getSuggest( $name, "attribute" );
		case "collection": return getSuggest( $name, "collection" );
		case "short-text": return getTextBox( $name, $value );
		case "text": return getTextArea( $name, $value );
	}
}
Exemplo n.º 7
0
	public function history() {
		global
			$wgOut, $wgTitle, $wgRequest;
			
		$wgOut->enableClientCache( false );

		$title = $wgTitle->getPrefixedText();

		if ( !$this->showClassicPageTitles )
			$title = $this->getTitle();

		$wgOut->setPageTitle( wfMsgSc( "history", $title ) );

		# Plain filter for the lifespan info about each record
		if ( isset( $_GET['show'] ) ) {
			$this->showRecordLifeSpan = isset( $_GET["show-record-life-span"] );
			$this->transaction = (int) $_GET["transaction"];
		}
		else {
			$this->showRecordLifeSpan = true;
			$this->transaction = 0;
		}
		
		# Up to which transaction to view the data
		if ( $this->transaction == 0 )
			$this->queryTransactionInformation = new QueryHistoryTransactionInformation();
		else
			$this->queryTransactionInformation = new QueryAtTransactionInformation( $this->transaction, $this->showRecordLifeSpan );
			
		$transactionId = $wgRequest->getInt( 'transaction' );

		$wgOut->addHTML( getOptionPanel(
			array(
				wfMsg( 'ow_history_transaction' ) => getSuggest( 'transaction', 'transaction', array(), $transactionId, getTransactionLabel( $transactionId ), array( 0, 2, 3 ) ),
				wfMsg( 'ow_history_show_life_span' ) => getCheckBox( 'show-record-life-span', $this->showRecordLifeSpan )
			),
			'history'
		) );

		$viewInformation = new ViewInformation();
		$viewInformation->filterLanguageId = $this->filterLanguageId;
		$viewInformation->showRecordLifeSpan = $this->showRecordLifeSpan;
		$viewInformation->queryTransactionInformation = $this->queryTransactionInformation;
		$viewInformation->setPropertyToColumnFilters( $this->propertyToColumnFilters );
		
		$this->viewInformation = $viewInformation;

		initializeOmegaWikiAttributes( $this->viewInformation );
		initializeObjectAttributeEditors( $viewInformation );
	}
Exemplo n.º 8
0
{
    var $type;
    var $id;
    var $img;
    var $display;
    var $favorite;
}
$db = mysqli_connect($GLOBALS["db_host"], $GLOBALS["db_user"], $GLOBALS["db_pwd"]);
mysqli_select_db($db, $GLOBALS["db_name"]);
$order_criteria = "ORDER BY ftl.value ASC";
if (isset($_POST["lat"]) && isset($_POST["lon"])) {
    if (is_numeric($_POST["lat"]) && is_numeric($_POST["lon"])) {
        $order_criteria = "ORDER BY dist(f.GEOM,geometryfromtext('POINT(" . $_POST["lon"] . " " . $_POST["lat"] . ")')) ASC";
    }
}
getSuggest($order_criteria);
function getSuggest($order_criteria)
{
    global $db;
    $erlaubteEbenen = getChildEbenen(0);
    $suchfeld = "";
    $mandant = "";
    if (isset($_REQUEST['suchtext'])) {
        $suchfeld = utf8_decode(rawurldecode($_REQUEST['suchtext']));
    }
    if (isset($_REQUEST['mandant'])) {
        $mandant = utf8_decode(rawurldecode($_REQUEST['mandant']));
    }
    $search_sql = "select fe.ID as id,ftl.value as titel,b.URL as image from foi_title_lang ftl join foi_ebene fe on fe.FK_FOI_ID = ftl.fk_foi_id join foi f on fe.FK_FOI_ID = f.ID left join foi_bild fb on fb.FK_FOI_ID = fe.FK_FOI_ID left join bild b on b.id = fb.FK_BILD_ID where (ftl.value like '%|suchbegriff|%') AND (f.BEGINN <= CURDATE() and f.ENDE >= CURDATE() or f.ENDE is null) AND ftl.FK_LANG_ID=" . $_SESSION["languageID"] . " AND f.AKTIV='Y' AND fe.FK_EBENE_ID IN (" . implode(",", $erlaubteEbenen) . ") group by fe.FK_FOI_ID " . $order_criteria;
    $query = str_replace("|suchbegriff|", $suchfeld, $search_sql);
    //echo($query);
	protected function ui() {

		global $wgOut, $wgRequest, $wgLang, $wgDefinedMeaning;
		$lang = $wgLang->getCode();
		require_once( "forms.php" );
		$wgOut->addHTML( wfMsgSc( "conceptmapping_uitext" ) );
		$sets = wdGetDataSets();
		$options = array();
		$html = "";
		$mappings = array();
		$rq = array();

		foreach ( $sets as $key => $setObject ) {
			$set = $setObject->getPrefix();
			$rq[$set] = $wgRequest->getText( "set_" . $set );
			$rq[$set] = trim( $rq[$set] );
			$rq[$set] = (int)$rq[$set];
			if ( $rq[$set] ) {
				$dmModel = new DefinedMeaningModel( $rq[$set], null, $setObject );
				$defaultSel = $dmModel->getSyntransByLanguageCode( $lang );
				$options[$setObject->fetchName()] = getSuggest( "set_$set", $wgDefinedMeaning, array(), $rq[$set], $defaultSel, array( 0 ), $setObject );
			} else {
				$options[$setObject->fetchName()] = getSuggest( "set_$set", $wgDefinedMeaning, array(), null, null, array( 0 ), $setObject );
			}

		}
		$wgOut->addHTML( getOptionPanel( $options ) );
		$noerror = $wgRequest->getText( "suppressWarnings" );

		foreach ( $sets as $key => $setObject ) {
			$set = $setObject->getPrefix();
			if ( !$rq[$set] ) {
				$wgOut->addHTML( ' <span style="color:yellow">[' . wfMsgSc( "dm_not_present" ) . ']</span>' );
			} else  {
				$dmModel = new DefinedMeaningModel( $rq[$set], null, $setObject );
				$dmModel->checkExistence();
				if ( $dmModel->exists() ) {
					$id = $dmModel->getId();
					$title = $dmModel->getTitleText();
				} else {
					$id = null;
					$title = null;
				}
				if ( !$noerror ) {
					$wgOut->addHTML( "$key: " . $rq[$set] . " ($title)" );
				}
				if ( $id != null ) {
					$mappings[$key] = $id;
					if ( !$noerror ) {
						$wgOut->addHTML( ' <span style="color:green">[' . wfMsgSc( "dm_OK" ) . ']</span>' );
					}
				} else {
					if ( !$noerror ) {
						$wgOut->addHTML( ' <span style="color:red">[' . wfMsgSc( "dm_not_found" ) . ']</span>' );
					}
				}
			}
			$wgOut->addHTML( "<br />\n" );
		}
		if ( sizeOf( $mappings ) > 1 ) {
			createConceptMapping( $mappings );
			$wgOut->addHTML( wfMsgSc( "mapping_successful" ) );
		} else {
			$wgOut->addHTML( wfMsgSc( "mapping_unsuccessful" ) );
		}

	}
Exemplo n.º 10
0
	public function getEditHTML( IdStack $idPath, $value ) {
		global $wgOptionSuffix;
		// note: it is normal that the "updateSelectOptions(" has no closing parenthesis. An additional parameter and ')' is added by the function updateSuggestValue (suggest.js)
		$parameters = array(
			"level" => $this->attributesLevelName,
			"onUpdate" => 'updateSelectOptions(\'' . $this->updateId( $idPath->getId() ) . $wgOptionSuffix . '\''
		);

		return getSuggest( $this->updateId( $idPath->getId() ), $this->suggestType(), $parameters );
	}