summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/src/MediaWiki/Specials/Ask/QueryInputWidget.php
blob: 9f6cb5323ce13ff523bcb352a506d400b09af30d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php

namespace SMW\MediaWiki\Specials\Ask;

use Html;
use SMW\Message;
use SMW\Utils\HtmlDivTable;

/**
 * @license GNU GPL v2+
 * @since   3.0
 *
 * @author mwjames
 */
class QueryInputWidget {

	/**
	 * @since 3.0
	 *
	 * @param string $queryString
	 * @param string $printoutString
	 *
	 * @return string
	 */
	public static function table( $queryString , $printoutString ) {

		$table = HtmlDivTable::open( [ 'style' => "width: 100%;" ] );

		$table .= HtmlDivTable::row(
			HtmlDivTable::cell(
				"<fieldset><legend>" . Message::get( 'smw_ask_queryhead', Message::TEXT, Message::USER_LANGUAGE ) . "</legend>" .
				'<textarea id="ask-query-condition" class="smw-ask-query-condition" name="q" rows="6" placeholder="...">' .
				htmlspecialchars( $queryString ) . '</textarea></fieldset>',
				[ 'class' => 'smw-ask-condition slowfade' ]
			) . HtmlDivTable::cell(
				'',
				[
					'style' => 'width:10px; border:0px; padding: 0px;'
				]
			) . HtmlDivTable::cell(
				"<fieldset><legend>" . Message::get( 'smw_ask_printhead', Message::TEXT, Message::USER_LANGUAGE ) . "</legend>" .
				'<textarea id="smw-property-input" class="smw-ask-query-printout" name="po" rows="6" placeholder="...">' .
				htmlspecialchars( $printoutString ) . '</textarea></fieldset>',
				[ 'class' => 'smw-ask-printhead slowfade' ]
			)
		);

		$table .= HtmlDivTable::close();

		return $table;
	}

}