Index: trunk/extensions/Wikidata/OmegaWiki/SpecialNeedsTranslation.php |
— | — | @@ -54,6 +54,31 @@ |
55 | 55 | |
56 | 56 | $dbr = wfGetDB( DB_SLAVE ); |
57 | 57 | |
| 58 | + $sqlcount = 'SELECT COUNT(*)' . |
| 59 | + " FROM ({$dc}_syntrans source_syntrans, {$dc}_expression source_expression)"; |
| 60 | + |
| 61 | + if ( $collectionId != '' ) |
| 62 | + $sqlcount .= " JOIN {$dc}_collection_contents ON source_syntrans.defined_meaning_id = member_mid"; |
| 63 | + |
| 64 | + $sqlcount .= ' WHERE source_syntrans.expression_id = source_expression.expression_id'; |
| 65 | + |
| 66 | + if ( $sourceLanguageId != '' ) |
| 67 | + $sqlcount .= ' AND source_expression.language_id = ' . $sourceLanguageId; |
| 68 | + if ( $collectionId != '' ) |
| 69 | + $sqlcount .= " AND {$dc}_collection_contents.collection_id = " . $collectionId . |
| 70 | + ' AND ' . getLatestTransactionRestriction( "{$dc}_collection_contents" ); |
| 71 | + |
| 72 | + $sqlcount .= ' AND NOT EXISTS (' . |
| 73 | + " SELECT * FROM {$dc}_syntrans destination_syntrans, {$dc}_expression destination_expression" . |
| 74 | + ' WHERE destination_syntrans.expression_id = destination_expression.expression_id AND destination_expression.language_id = ' . $destinationLanguageId . |
| 75 | + ' AND source_syntrans.defined_meaning_id = destination_syntrans.defined_meaning_id' . |
| 76 | + ' AND ' . getLatestTransactionRestriction( 'destination_syntrans' ) . |
| 77 | + ' AND ' . getLatestTransactionRestriction( 'destination_expression' ) . |
| 78 | + ')' . |
| 79 | + ' AND ' . getLatestTransactionRestriction( 'source_syntrans' ) . |
| 80 | + ' AND ' . getLatestTransactionRestriction( 'source_expression' ) ; |
| 81 | + |
| 82 | + |
58 | 83 | $sql = 'SELECT source_expression.expression_id AS source_expression_id, source_expression.language_id AS source_language_id, source_expression.spelling AS source_spelling, source_syntrans.defined_meaning_id AS source_defined_meaning_id' . |
59 | 84 | " FROM ({$dc}_syntrans source_syntrans, {$dc}_expression source_expression)"; |
60 | 85 | |
— | — | @@ -80,6 +105,13 @@ |
81 | 106 | ' LIMIT 100'; |
82 | 107 | |
83 | 108 | $queryResult = $dbr->query( $sql ); |
| 109 | + |
| 110 | + $queryResultCount_r = mysql_query( $sqlcount ); |
| 111 | + $queryResultCount_a = mysql_fetch_row( $queryResultCount_r ); |
| 112 | + $queryResultCount = $queryResultCount_a[0]; |
| 113 | + $nbshown = min ( 100, $queryResultCount ) ; |
| 114 | + |
| 115 | + |
84 | 116 | $definitionAttribute = new Attribute( "definition", wfMsg( "ow_Definition" ), "definition" ); |
85 | 117 | $recordSet = new ArrayRecordSet( new Structure( $o->definedMeaningId, $o->expressionId, $o->expression, $definitionAttribute ), new Structure( $o->definedMeaningId, $o->expressionId ) ); |
86 | 118 | |
— | — | @@ -101,6 +133,7 @@ |
102 | 134 | |
103 | 135 | global $wgOut; |
104 | 136 | |
| 137 | + $wgOut->addHTML( "Showing $nbshown out of $queryResultCount" ) ; |
105 | 138 | $wgOut->addHTML( $editor->view( new IdStack( "expression" ), $recordSet ) ); |
106 | 139 | } |
107 | 140 | } |