コード例 #1
0
	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 );
	}
コード例 #2
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));
     }
 }