18 parent::__construct($gui);
19 require_once
'Modules/Chatroom/classes/class.ilChatroomFormFactory.php';
20 require_once
'Modules/Chatroom/classes/class.ilChatroom.php';
21 require_once
'Modules/Chatroom/classes/class.ilChatroomUser.php';
26 $this->tabs->activateSubTab(
'byday');
34 public function byDay($export =
false)
38 $this->mainTpl->addJavaScript(
'./Services/Form/js/date_duration.js');
40 $scope = $room->getRoomId();
45 $durationForm = $formFactory->getPeriodForm();
46 $durationForm->setTitle($this->ilLng->txt(
'history_byday_title'));
47 $durationForm->addCommandButton(
'history-byDayExport', $this->ilLng->txt(
'export'));
48 $durationForm->addCommandButton(
'history-byDay', $this->ilLng->txt(
'show'));
53 $submit_request = strtolower(
$_SERVER[
'REQUEST_METHOD']) ==
'post';
57 if ($submit_request) {
58 if ($durationForm->checkInput()) {
59 $period = $durationForm->getItemByPostVar(
'timeperiod');
62 $from = $period->getStart(),
63 $to = $period->getEnd(),
64 $chat_user->getUserId(),
65 isset($_REQUEST[
'scope']) ? $_REQUEST[
'scope'] : 0
68 $psessions = $room->getPrivateRoomSessions(
71 $chat_user->getUserId(),
78 $durationForm->setValuesByPost();
95 include_once
'Modules/Chatroom/classes/class.ilChatroom.php';
99 $this->gui->switchToVisibleMode();
101 $this->mainTpl->addCSS(
'Modules/Chatroom/templates/default/style.css');
105 $roomTpl =
new ilTemplate(
'tpl.history_export.html',
true,
true,
'Modules/Chatroom');
107 $roomTpl =
new ilTemplate(
'tpl.history.html',
true,
true,
'Modules/Chatroom');
116 $time_format = $this->ilUser->getTimeFormat();
120 $lastDateTime = null;
124 switch ($message[
'message']->type) {
126 if (($_REQUEST[
'scope'] && $message[
'message']->subRoomId == $_REQUEST[
'scope']) || (!$_REQUEST[
'scope'] && !$message[
'message']->subRoomId)) {
131 $roomTpl->setCurrentBlock(
'MESSAGELINE');
132 $roomTpl->setVariable(
'MESSAGECONTENT', $message[
'message']->content);
133 $roomTpl->setVariable(
'MESSAGESENDER', $message[
'message']->from->username);
134 if (null == $lastDateTime ||
143 switch ($time_format) {
145 $date_string = $dateTime->get(
IL_CAL_FKT_DATE,
'H:i', $this->ilUser->getTimeZone());
148 $date_string = $dateTime->get(
IL_CAL_FKT_DATE,
'g:ia', $this->ilUser->getTimeZone());
152 $roomTpl->setVariable(
'MESSAGETIME', $date_string);
156 $roomTpl->parseCurrentBlock();
158 $lastDateTime = $dateTime;
167 $scopes[$session[
'proom_id']] = $session[
'title'];
170 if (isset($scopes[
''])) {
174 if (!$messagesShown) {
176 $roomTpl->setVariable(
'LBL_NO_MESSAGES', $this->ilLng->txt(
'no_messages'));
179 asort($scopes, SORT_STRING);
181 $scopes = array($this->ilLng->txt(
'main')) + $scopes;
183 if (count($scopes) > 1) {
187 if (isset($_REQUEST[
'scope'])) {
188 $select->setValue($_REQUEST[
'scope']);
191 $durationForm->addItem($select);
201 $unixFrom =
$from->getUnixTime();
202 $unixTo = $to->getUnixTime();
204 if ($unixFrom == $unixTo) {
214 $isPrivateRoom = (boolean) ((
int) $_REQUEST[
'scope']);
215 if ($isPrivateRoom) {
216 $roomTpl->setVariable(
'ROOM_TITLE', sprintf($this->ilLng->txt(
'history_title_private_room'), $scopes[(int) $_REQUEST[
'scope']]) .
' (' . $date_sub .
')');
218 $roomTpl->setVariable(
'ROOM_TITLE', sprintf($this->ilLng->txt(
'history_title_general'), $this->gui->object->getTitle()) .
' (' . $date_sub .
')');
223 header(
"Content-Type: text/html");
224 header(
"Content-Disposition: attachment; filename=\"" . urlencode($scopes[(
int) $_REQUEST[
'scope']] .
'.html') .
"\"");
225 echo $roomTpl->get();
229 $roomTpl->setVariable(
'PERIOD_FORM', $durationForm->getHTML());
231 $this->mainTpl->setVariable(
'ADM_CONTENT', $roomTpl->get());
236 $this->tabs->activateSubTab(
'bysession');
248 $scope = $room->getRoomId();
253 $durationForm = $formFactory->getSessionForm($room->getSessions($chat_user));
254 $durationForm->setTitle($this->ilLng->txt(
'history_bysession_title'));
255 $durationForm->addCommandButton(
'history-bySessionExport', $this->ilLng->txt(
'export'));
256 $durationForm->addCommandButton(
'history-bySession', $this->ilLng->txt(
'show'));
257 $durationForm->setFormAction(
262 if (strtolower(
$_SERVER[
'REQUEST_METHOD']) ==
'post') {
263 $durationForm->checkInput();
264 $postVals = explode(
',',
$_POST[
'session']);
265 $durationForm->setValuesByArray(array(
'session' =>
$_POST[
'session']));
270 $chat_user->getUserId(),
271 isset($_REQUEST[
'scope']) ? $_REQUEST[
'scope'] : 0
274 $last_session = $room->getLastSession($chat_user);
287 $chat_user->getUserId(),
288 isset($_REQUEST[
'scope']) ? $_REQUEST[
'scope'] : 0
293 $psessions = $room->getPrivateRoomSessions(
296 $chat_user->getUserId(),
302 $psessions = array();
305 $psessions = $room->getPrivateRoomSessions(
308 $chat_user->getUserId(),
bySession($export=false)
Prepares and displays history period form by session.
This class provides processing control methods.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
byDay($export=false)
Prepares and displays history period form by day.
redirectIfNoPermission($permission)
Checks for requested permissions and redirects if the permission check failed.
static setUseRelativeDates($a_status)
set use relative dates
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static useRelativeDates()
check if relative dates are used
catch(Exception $e) $message
showMessages($messages, $durationForm, $export=false, $psessions=array(), $from, $to)
Prepares history table and displays it.
Class ilChatroomGUIHandler.
special template class to simplify handling of ITX/PEAR
executeDefault($method)
{}
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
__construct(ilChatroomObjectGUI $gui)
{}
Class ilChatroom Keeps methods to prepare and display the history task.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
getFormAction( $a_gui_obj, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get form action url for gui class object.