Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php |
— | — | @@ -13,10 +13,14 @@ |
14 | 14 | * @ingroup SMWQuery |
15 | 15 | */ |
16 | 16 | class SMWPrintRequest { |
17 | | - const PRINT_CATS = 0; // print all direct categories of the current element |
18 | | - const PRINT_PROP = 1; // print all property values of a certain attribute of the current element |
19 | | - const PRINT_THIS = 2; // print the current element |
20 | | - const PRINT_CCAT = 3; // check whether current element is in given category |
| 17 | + /// Query mode to print all direct categories of the current element. |
| 18 | + const PRINT_CATS = 0; |
| 19 | + /// Query mode to print all property values of a certain attribute of the current element. |
| 20 | + const PRINT_PROP = 1; |
| 21 | + /// Query mode to print the current element (page in result set). |
| 22 | + const PRINT_THIS = 2; |
| 23 | + /// Query mode to print whether current element is in given category (Boolean printout). |
| 24 | + const PRINT_CCAT = 3; |
21 | 25 | |
22 | 26 | protected $m_mode; // type of print request |
23 | 27 | protected $m_label; // string for labelling results, contains no markup |
— | — | @@ -70,7 +74,6 @@ |
71 | 75 | return $this->m_data->getShortHTMLText($linker); |
72 | 76 | case SMWPrintRequest::PRINT_THIS: default: return htmlspecialchars($this->m_label); |
73 | 77 | } |
74 | | - |
75 | 78 | } |
76 | 79 | |
77 | 80 | /** |
— | — | @@ -81,7 +84,7 @@ |
82 | 85 | return $this->m_label; |
83 | 86 | } else { |
84 | 87 | switch ($this->m_mode) { |
85 | | - case SMWPrintRequest::PRINT_CATS: |
| 88 | + case SMWPrintRequest::PRINT_CATS: |
86 | 89 | return $this->m_label; // TODO: link to Special:Categories |
87 | 90 | case SMWPrintRequest::PRINT_PROP: |
88 | 91 | return $this->m_data->getShortWikiText($linked); |
— | — | @@ -92,6 +95,9 @@ |
93 | 96 | } |
94 | 97 | } |
95 | 98 | |
| 99 | + /** |
| 100 | + * Convenience method for accessing the text in either HTML or Wiki format. |
| 101 | + */ |
96 | 102 | public function getText($outputmode, $linker = NULL) { |
97 | 103 | switch ($outputmode) { |
98 | 104 | case SMW_OUTPUT_WIKI: return $this->getWikiText($linker); |
— | — | @@ -100,19 +106,10 @@ |
101 | 107 | } |
102 | 108 | |
103 | 109 | /** |
104 | | - * @deprecated Use SMWPrintRequest::getData(). This method will vanish in SMW 1.5. |
| 110 | + * Return additional data related to the print request. The result might be |
| 111 | + * an object of class SMWPropertyValue or Title, or simply NULL if no data |
| 112 | + * is required for the given type of printout. |
105 | 113 | */ |
106 | | - public function getTitle() { |
107 | | - if ($this->m_data instanceof Title) { |
108 | | - return $this->m_data; |
109 | | - } else { |
110 | | - return NULL; |
111 | | - } |
112 | | - } |
113 | | - |
114 | | - /** |
115 | | - * Return additional data related to the print request. Might be |
116 | | - */ |
117 | 114 | public function getData() { |
118 | 115 | return $this->m_data; |
119 | 116 | } |
— | — | @@ -138,7 +135,9 @@ |
139 | 136 | |
140 | 137 | /** |
141 | 138 | * Return a hash string that is used to eliminate duplicate |
142 | | - * print requests. |
| 139 | + * print requests. The hash also includes the chosen label, |
| 140 | + * so it is possible to print the same date with different |
| 141 | + * labels. |
143 | 142 | */ |
144 | 143 | public function getHash() { |
145 | 144 | $hash = $this->m_mode . ':' . $this->m_label . ':'; |
— | — | @@ -185,6 +184,13 @@ |
186 | 185 | case SMWPrintRequest::PRINT_THIS: default: return ''; // no current serialisation |
187 | 186 | } |
188 | 187 | } |
| 188 | + |
| 189 | + /** |
| 190 | + * @deprecated Use SMWPrintRequest::getData(). This method will vanish in SMW 1.5. |
| 191 | + */ |
| 192 | + public function getTitle() { |
| 193 | + return ($this->m_data instanceof Title)?$this->m_data:NULL; |
| 194 | + } |
189 | 195 | } |
190 | 196 | |
191 | 197 | /** |
— | — | @@ -532,7 +538,7 @@ |
533 | 539 | return false; |
534 | 540 | } |
535 | 541 | } |
536 | | - |
| 542 | + |
537 | 543 | public function getSize() { |
538 | 544 | return 1; |
539 | 545 | } |
— | — | @@ -969,4 +975,3 @@ |
970 | 976 | return $result; |
971 | 977 | } |
972 | 978 | } |
973 | | - |