Skip to content

Commit

Permalink
Chat: Abandon session view in history tab
Browse files Browse the repository at this point in the history
  • Loading branch information
mjansenDatabay committed Apr 22, 2024
1 parent 181ee60 commit 5cb4e2e
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 113 deletions.
27 changes: 0 additions & 27 deletions components/ILIAS/Chatroom/classes/class.ilChatroomFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,33 +263,6 @@ public function getUserChatNameSelectionForm(array $name_options): ilPropertyFor
return $form;
}

/**
* Returns session form with period set by given $sessions.
*/
public function getSessionForm(array $sessions): ilPropertyFormGUI
{
$form = new ilPropertyFormGUI();
$form->setPreventDoubleSubmission(false);
$list = new ilSelectInputGUI($this->lng->txt('session'), 'session');

$options = [];

foreach ($sessions as $session) {
$start = new ilDateTime($session['connected'], IL_CAL_UNIX);
$end = new ilDateTime($session['disconnected'], IL_CAL_UNIX);

$options[$session['connected'] . ',' .
$session['disconnected']] = ilDatePresentation::formatPeriod($start, $end);
}

$list->setOptions($options);
$list->setRequired(true);

$form->addItem($list);

return $form;
}

public function getClientSettingsForm(): ilPropertyFormGUI
{
$form = new ilPropertyFormGUI();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,18 +302,6 @@ public function getTabsForCommand(string $command): void
'link' => $DIC->ctrl()->getLinkTarget($this->gui, 'history-byday'),
'permission' => 'read',
'enabled' => $room ? $room->getSetting('enable_history') : false,
'subtabs' => [
'byday' => [
'lng' => 'history_by_day',
'link' => $DIC->ctrl()->getLinkTarget($this->gui, 'history-byday'),
'permission' => 'read'
],
'bysession' => [
'lng' => 'history_by_session',
'link' => $DIC->ctrl()->getLinkTarget($this->gui, 'history-bysession'),
'permission' => 'read'
]
]
],
'info' => [
'lng' => 'info_short',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@

declare(strict_types=1);

/**
* Class ilChatroom
* Keeps methods to prepare and display the history task.
* @author Jan Posselt <[email protected]>
* @version $Id$
* @ingroup components\ILIASChatroom
*/
class ilChatroomHistoryGUI extends ilChatroomGUIHandler
{
/**
Expand Down Expand Up @@ -100,6 +93,7 @@ public function byDay(bool $export = false): void

if ($submit_request) {
if ($durationForm->checkInput()) {
/** @var ilDateDurationInputGUI $period */
$period = $durationForm->getItemByPostVar('timeperiod');

$messages = $room->getHistory(
Expand Down Expand Up @@ -218,67 +212,6 @@ private function showMessages(
$this->mainTpl->setVariable('ADM_CONTENT', $roomTpl->get());
}

public function bySessionExport(): void
{
$this->tabs->activateSubTab('bysession');
$this->bySession(true);
}

public function bySession(bool $export = false): void
{
$room = ilChatroom::byObjectId($this->gui->getObject()->getId());
$this->exitIfNoRoomExists($room);

$scope = $room->getRoomId();

$chat_user = new ilChatroomUser($this->ilUser, $room);

$formFactory = new ilChatroomFormFactory();
$durationForm = $formFactory->getSessionForm($room->getSessions($chat_user));
$durationForm->setTitle($this->ilLng->txt('history_bysession_title'));
$durationForm->addCommandButton('history-bySessionExport', $this->ilLng->txt('export'));
$durationForm->addCommandButton('history-bySession', $this->ilLng->txt('show'));
$durationForm->setFormAction(
$this->ilCtrl->getFormAction($this->gui, 'history-bySession')
);

if (strtolower($this->http->request()->getServerParams()['REQUEST_METHOD']) === 'post') {
$session = $this->getRequestValue('session', $this->refinery->kindlyTo()->string());
$durationForm->checkInput();
$postVals = explode(',', (string) $session);
$durationForm->setValuesByArray([
'session' => $session
]);

$messages = $room->getHistory(
$from = new ilDateTime($postVals[0], IL_CAL_UNIX),
$to = new ilDateTime($postVals[1], IL_CAL_UNIX),
$chat_user->getUserId()
);
} else {
$last_session = $room->getLastSession($chat_user);

if ($last_session) {
$from = new ilDateTime($last_session['connected'], IL_CAL_UNIX);
$to = new ilDateTime($last_session['disconnected'], IL_CAL_UNIX);
} else {
$from = null;
$to = null;
}

$messages = $room->getHistory(
$from,
$to,
$chat_user->getUserId()
);
}

$from = new ilDateTime();
$to = new ilDateTime();

$this->showMessages($messages, $durationForm, $export, $from, $to);
}

public function executeDefault(string $requestedMethod): void
{
$this->byDay();
Expand Down
3 changes: 0 additions & 3 deletions lang/ilias_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2981,10 +2981,7 @@ chatroom#:#end_whisper#:#Beenden
chatroom#:#enter#:#Chat beitreten
chatroom#:#error_log#:#Chatserver Error-Log-File
chatroom#:#hint_display_past_msgs#:#Anzahl vergangener Beiträge, die beim Betreten des Chatraums angezeigt werden. Durch die Eingabe von „0“ wird die Anzeige deaktiviert.
chatroom#:#history_by_day#:#Tagesverlauf
chatroom#:#history_by_session#:#Sitzungverlauf
chatroom#:#history_byday_title#:#Zeitraum auswählen
chatroom#:#history_bysession_title#:#Sitzung auswählen
chatroom#:#history_cleared#:#Der Nachrichtenverlauf wurde durch die Moderation gelöscht.###Modified as part of gender mainstreaming activities for ILIAS 8
chatroom#:#history_title_general#:#Unterhaltungen im Chatraum „%s“
chatroom#:#ilias_chatserver_connection#:#Verbindung ILIAS zum Server
Expand Down
3 changes: 0 additions & 3 deletions lang/ilias_en.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2983,10 +2983,7 @@ chatroom#:#end_whisper#:#Cancel
chatroom#:#enter#:#Enter Chat Room
chatroom#:#error_log#:#Chatserver Error-Log
chatroom#:#hint_display_past_msgs#:#Number of previous messages shown when chat room is entered. A value of ‘0’ disables this feature.
chatroom#:#history_by_day#:#Daily History
chatroom#:#history_by_session#:#Session History
chatroom#:#history_byday_title#:#Show Conversation per Day
chatroom#:#history_bysession_title#:#Show Conversation per Session
chatroom#:#history_cleared#:#The message history was deleted by a moderator.
chatroom#:#history_title_general#:#Conversation in Chat Room "%s"
chatroom#:#ilias_chatserver_connection#:#ILIAS to Server Connection
Expand Down

0 comments on commit 5cb4e2e

Please sign in to comment.