<?php
namespace wcf\system\search;
use wcf\data\conversation\message\SearchResultConversationMessageList;
+use wcf\data\conversation\Conversation;
use wcf\form\IForm;
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\WCF;
*/
public $conversationID = 0;
+ /**
+ * searched conversation
+ * @var Conversation
+ */
+ public $conversation;
+
/**
* message data cache
* @var array<\wcf\data\conversation\message\SearchResultConversationMessage>
*/
public function getJoins() {
return "JOIN wcf".WCF_N."_conversation_to_user conversation_to_user ON (conversation_to_user.participantID = ".WCF::getUser()->userID." AND conversation_to_user.conversationID = ".$this->getTableName().".conversationID)
- LEFT JOIN wcf".WCF_N."_conversation conversation ON (conversation.conversationID = ".$this->getTableName().".conversationID)";
+ LEFT JOIN wcf".WCF_N."_conversation conversation ON (conversation.conversationID = ".$this->getTableName().".conversationID)";
}
/**
public function isAccessible() {
return (WCF::getUser()->userID ? true : false);
}
+
+ /**
+ * @see \wcf\system\search\ISearchableObjectType::getFormTemplateName()
+ */
+ public function getFormTemplateName() {
+ if ($this->conversation) {
+ return 'searchConversationMessage';
+ }
+
+ return null;
+ }
+
+ /**
+ * @see \wcf\system\search\ISearchableObjectType::show()
+ */
+ public function show(IForm $form = null) {
+ // get existing values
+ if ($form !== null && isset($form->searchData['additionalData']['com.woltlab.wcf.conversation.message']['conversationID'])) {
+ $this->conversationID = $form->searchData['additionalData']['com.woltlab.wcf.conversation.message']['conversationID'];
+
+ if ($this->conversationID) {
+ $this->conversation = Conversation::getUserConversation($this->conversationID, WCF::getUser()->userID);
+
+ if ($this->conversation === null || !$this->conversation->canRead()) {
+ $this->conversationID = 0;
+ $this->conversation = null;
+ }
+ }
+ }
+
+ WCF::getTPL()->assign('searchedConversation', $this->conversation);
+ }
}
<item name="wcf.conversation.gotoLastPost"><![CDATA[Zur letzten Nachricht springen]]></item>
<item name="wcf.conversation.searchConversations"><![CDATA[Konversationen durchsuchen]]></item>
<item name="wcf.conversation.searchConversation"><![CDATA[Aktuelle Konversation durchsuchen]]></item>
+ <item name="wcf.conversation.searchedConversation"><![CDATA[Nur Konversation <a href="{link controller='Conversation' object=$searchedConversation}{/link}">{$searchedConversation->getTitle()}</a> durchsuchen]]></item>
<item name="wcf.conversation.participants.other"><![CDATA[und {if $conversation->participants - $participantSummaryCount == 1}ein weiterer{else}{#$conversation->participants-$participantSummaryCount} weitere{/if}]]></item>
<item name="wcf.conversation.attachments"><![CDATA[Diese Konversation enthält {if $conversation->attachments == 1}einen Dateianhang{else}{#$conversation->attachments} Dateianhänge{/if}.]]></item>
<item name="wcf.conversation.error.mailboxIsFull"><![CDATA[Sie haben das zulässige Limit für Konversationen bereits erreicht und können keine neuen Konversationen starten.]]></item>
<item name="wcf.conversation.gotoLastPost"><![CDATA[Jump to Last Message]]></item>
<item name="wcf.conversation.searchConversations"><![CDATA[Search Conversations]]></item>
<item name="wcf.conversation.searchConversation"><![CDATA[Search This Conversation Only]]></item>
+ <item name="wcf.conversation.searchedConversation"><![CDATA[Only search conversation <a href="{link controller='Conversation' object=$searchedConversation}{/link}">{$searchedConversation->getTitle()}</a>]]></item>
<item name="wcf.conversation.participants.other"><![CDATA[and {if $conversation->participants - $participantSummaryCount == 1}one other{else}{#$conversation->participants-$participantSummaryCount} others{/if}]]></item>
<item name="wcf.conversation.attachments"><![CDATA[Conversation contains {#$conversation->attachments} attachment{if $conversation->attachments != 1}s{/if}]]></item>
<item name="wcf.conversation.error.mailboxIsFull"><![CDATA[You have reached your maximum limit of conversations and are unable to start new ones.]]></item>