29        require_once 
'Modules/Chatroom/classes/class.ilChatroomFormFactory.php';
 
   30        require_once 
'Modules/Chatroom/classes/class.ilChatroom.php';
 
   31        require_once 
'Modules/Chatroom/classes/class.ilChatroomUser.php';
 
   49                include_once 
'Modules/Chatroom/classes/class.ilChatroom.php';
 
   53                        $ilCtrl->setParameterByClass(
"ilrepositorygui", 
"ref_id", ROOT_FOLDER_ID);
 
   54                        $ilCtrl->redirectByClass(
"ilrepositorygui", 
"");
 
   57                $this->gui->switchToVisibleMode();
 
   59                $tpl->addCSS(
'Modules/Chatroom/templates/default/style.css');
 
   64                        $roomTpl = 
new ilTemplate(
'tpl.history_export.html', 
true, 
true, 
'Modules/Chatroom');
 
   68                        $roomTpl = 
new ilTemplate(
'tpl.history.html', 
true, 
true, 
'Modules/Chatroom');
 
   79                $time_format = 
$ilUser->getTimeFormat();
 
   86                        $message[
'message']->message = json_decode($message[
'message']->message);
 
   88                        switch($message[
'message']->type)
 
   97                                                $roomTpl->setCurrentBlock(
'MESSAGELINE');
 
   98                                                $roomTpl->setVariable(
'MESSAGECONTENT', $message[
'message']->message->content); 
 
   99                                                $roomTpl->setVariable(
'MESSAGESENDER', $message[
'message']->user->username);
 
  100                                                if(
null == $lastDateTime ||
 
  108                                                if($prevDate != $currentDate)
 
  120                                                        $roomTpl->setVariable(
'MESSAGETIME', $date_string);
 
  121                                                        $prevDate = $currentDate;
 
  124                                                $roomTpl->parseCurrentBlock();
 
  126                                                $lastDateTime = $dateTime;
 
  134                foreach($psessions as $session)
 
  136                        $scopes[$session[
'proom_id']] = $session[
'title'];
 
  139                if(isset($scopes[
'']))
 
  147                        $roomTpl->setVariable(
'LBL_NO_MESSAGES', 
$lng->txt(
'no_messages'));
 
  150                asort($scopes, SORT_STRING);
 
  152                $scopes = array(
$lng->txt(
'main')) + $scopes;
 
  154                if(count($scopes) > 1)
 
  157                        $select->setOptions($scopes);
 
  164                        $durationForm->addItem($select);
 
  173                $unixFrom = $from->getUnixTime();
 
  174                $unixTo   = $to->getUnixTime();
 
  176                if($unixFrom == $unixTo)
 
  189                $isPrivateRoom = (boolean)((
int)
$_REQUEST[
'scope']);
 
  192                        $roomTpl->setVariable(
'ROOM_TITLE', sprintf(
$lng->txt(
'history_title_private_room'), $scopes[(
int)
$_REQUEST[
'scope']]) . 
' (' . $date_sub . 
')');
 
  196                        $roomTpl->setVariable(
'ROOM_TITLE', sprintf(
$lng->txt(
'history_title_general'), $this->gui->object->getTitle()) . 
' (' . $date_sub . 
')');
 
  203                        header(
"Content-Type: text/html");
 
  204                        header(
"Content-Disposition: attachment; filename=\"" . urlencode($scopes[(
int)
$_REQUEST[
'scope']] . 
'.html') . 
"\"");
 
  205                        echo $roomTpl->get();
 
  209                $roomTpl->setVariable(
'PERIOD_FORM', $durationForm->getHTML());
 
  211                $tpl->setVariable(
'ADM_CONTENT', $roomTpl->get());
 
  228    public function byDay($export = 
false)
 
  234            $tpl->addJavaScript(
'./Services/Form/js/date_duration.js');
 
  236            $scope = $room->getRoomId();
 
  241            $durationForm = $formFactory->getPeriodForm();
 
  242            $durationForm->setTitle( 
$lng->txt(
'history_byday_title') );
 
  243            $durationForm->addCommandButton( 
'history-byDayExport', 
$lng->txt( 
'export' ) );
 
  244            $durationForm->addCommandButton( 
'history-byDay', 
$lng->txt( 
'show' ) );
 
  245            $durationForm->setFormAction( 
$ilCtrl->getFormAction( $this->gui ), 
'history-byDay' );
 
  247            if( strtolower( $_SERVER[
'REQUEST_METHOD'] ) == 
'post' )
 
  249                $durationForm->checkInput();
 
  250                $period = $durationForm->getItemByPostVar( 
'timeperiod' );
 
  252                        $from = $period->getStart(),
 
  253                        $to = $period->getEnd(),
 
  254                         $chat_user->getUserId() ,
 
  263                    $period = $durationForm->getItemByPostVar( 
'timeperiod' );
 
  264                    $period->setStart( $from );
 
  265                    $period->setEnd( $to );
 
  270                        $chat_user->getUserId(),
 
  275        $psessions = $room->getPrivateRoomSessions(
 
  278                $chat_user->getUserId(),
 
  298        $scope = $room->getRoomId();
 
  303        $durationForm = $formFactory->getSessionForm( $room->getSessions( $chat_user ) );
 
  304        $durationForm->setTitle( 
$lng->txt(
'history_bysession_title') );
 
  305        $durationForm->addCommandButton( 
'history-bySessionExport', 
$lng->txt( 
'export' ) );
 
  306        $durationForm->addCommandButton( 
'history-bySession', 
$lng->txt( 
'show' ) );
 
  307        $durationForm->setFormAction(
 
  308                $ilCtrl->getFormAction( $this->gui ), 
'history-bySession' 
  311        if( strtolower( $_SERVER[
'REQUEST_METHOD'] ) == 
'post' )
 
  313            $durationForm->checkInput();
 
  314            $postVals = explode( 
',', 
$_POST[
'session'] );
 
  315            $durationForm->setValuesByArray( array(
'session' => 
$_POST[
'session']) );
 
  320                $chat_user->getUserId(),
 
  326            $last_session = $room->getLastSession( $chat_user );
 
  342                $chat_user->getUserId(),
 
  348                $psessions = $room->getPrivateRoomSessions(
 
  351                        $chat_user->getUserId(),
 
  358                $psessions =  array();
 
  361        $psessions = $room->getPrivateRoomSessions(
 
  364                $chat_user->getUserId(),
 
byDay($export=false)
Prepares and displays history period form by day.
showMessages($messages, $durationForm, $export=false, $psessions=array(), $from, $to)
Prepares history table and displays it.
__construct(ilChatroomObjectGUI $gui)
Constructor.
bySession($export=false)
Prepares and displays history period form by session.
executeDefault($method)
Calls $this->byDay method.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
static setUseRelativeDates($a_status)
set use relative dates
static formatDate(ilDateTime $date)
Format a date @access public.
static useRelativeDates()
check if relative dates are used
@classDescription Date and time handling
special template class to simplify handling of ITX/PEAR
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']