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();
 
   93    private function showMessages(
$messages, $durationForm, $export = 
false, $psessions = array(), $from = 
null, $to = 
null)
 
   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 ilGlobalTemplate(
'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 ||
 
  142                        if ($prevDate != $currentDate) {
 
  143                            switch ($time_format) {
 
  145                                    $date_string = $dateTime->get(
IL_CAL_FKT_DATE, 
'H:i', $this->ilUser->getTimeZone());
 
  149                                    $date_string = $dateTime->get(
IL_CAL_FKT_DATE, 
'g:ia', $this->ilUser->getTimeZone());
 
  153                            $roomTpl->setVariable(
'MESSAGETIME', $date_string);
 
  154                            $prevDate = $currentDate;
 
  157                        $roomTpl->parseCurrentBlock();
 
  159                        $lastDateTime = $dateTime;
 
  171        if (isset($scopes[
''])) {
 
  175        if (!$messagesShown) {
 
  177            $roomTpl->setVariable(
'LBL_NO_MESSAGES', $this->ilLng->txt(
'no_messages'));
 
  180        asort($scopes, SORT_STRING);
 
  182        $scopes = array($this->ilLng->txt(
'main')) + $scopes;
 
  184        if (count($scopes) > 1) {
 
  186            $select->setOptions($scopes);
 
  188            if (isset($_REQUEST[
'scope'])) {
 
  189                $select->setValue($_REQUEST[
'scope']);
 
  192            $durationForm->addItem($select);
 
  202            $unixFrom = $from->getUnixTime();
 
  203            $unixTo = $to->getUnixTime();
 
  205            if ($unixFrom == $unixTo) {
 
  215            $isPrivateRoom = (boolean) ((
int) $_REQUEST[
'scope']);
 
  216            if ($isPrivateRoom) {
 
  217                $roomTpl->setVariable(
'ROOM_TITLE', sprintf($this->ilLng->txt(
'history_title_private_room'), $scopes[(
int) $_REQUEST[
'scope']]) . 
' (' . $date_sub . 
')');
 
  219                $roomTpl->setVariable(
'ROOM_TITLE', sprintf($this->ilLng->txt(
'history_title_general'), $this->gui->object->getTitle()) . 
' (' . $date_sub . 
')');
 
  224            header(
"Content-Type: text/html");
 
  225            header(
"Content-Disposition: attachment; filename=\"" . urlencode($scopes[(
int) $_REQUEST[
'scope']] . 
'.html') . 
"\"");
 
  226            echo $roomTpl->get();
 
  230        $roomTpl->setVariable(
'PERIOD_FORM', $durationForm->getHTML());
 
  232        $this->mainTpl->setVariable(
'ADM_CONTENT', $roomTpl->get());
 
  237        $this->tabs->activateSubTab(
'bysession');
 
  249        $scope = $room->getRoomId();
 
  254        $durationForm = $formFactory->getSessionForm($room->getSessions($chat_user));
 
  255        $durationForm->setTitle($this->ilLng->txt(
'history_bysession_title'));
 
  256        $durationForm->addCommandButton(
'history-bySessionExport', $this->ilLng->txt(
'export'));
 
  257        $durationForm->addCommandButton(
'history-bySession', $this->ilLng->txt(
'show'));
 
  258        $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(),
 
An exception for terminatinating execution or to throw for unit testing.
Class ilChatroomGUIHandler.
redirectIfNoPermission($permission)
Checks for requested permissions and redirects if the permission check failed.
Class ilChatroom Keeps methods to prepare and display the history task.
executeDefault($requestedMethod)
@inheritDoc
__construct(ilChatroomObjectGUI $gui)
{}
showMessages($messages, $durationForm, $export=false, $psessions=array(), $from=null, $to=null)
Prepares history table and displays it.
bySession($export=false)
Prepares and displays history period form by session.
byDay($export=false)
Prepares and displays history period form by day.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
This class provides processing control methods.
getFormAction( $a_gui_obj, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=false)
Get form action url for gui class object.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
static useRelativeDates()
check if relative dates are used
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
@classDescription Date and time handling
special template class to simplify handling of ITX/PEAR
special template class to simplify handling of ITX/PEAR
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc