Exemple #1
0
 function ajaxAddChatroom()
 {
     $r = new Rooms();
     $r->ajaxChatroomAdd(array('jid' => '*****@*****.**', 'name' => 'Movim Chatroom', 'nick' => false, 'autojoin' => 0));
     $r->ajaxJoin('*****@*****.**');
     RPC::call('MovimUtils.redirect', $this->route('chat'));
 }
 function show($metaPoziadavkaID)
 {
     $res = $this->requirements->load($metaPoziadavkaID);
     $this->set("meta_poziadavka", $res["meta_poziadavka"]);
     $this->set("requirement", $res["requirement"]);
     // doplnujuce informacie, co, kto a kedy
     $subjects = new Subjects();
     $rooms = new Rooms();
     //TODO nenatiahnut to do meta poziadavky rovno aj nazov predmetu ??
     $id_predmet = $res["meta_poziadavka"]["id_predmet"];
     $subject = $subjects->getSubject($id_predmet);
     $student_count = $subjects->getStudentCount($id_predmet);
     $student_count_info = $subjects->getStudentCountInfo($id_predmet);
     $this->set("subject", $subject["nazov"]);
     $this->set('student_count', $student_count['count']);
     $this->set('student_count_info', $student_count_info);
     $this->set('rooms', $rooms->getAll());
     $this->set('metaPoziadavkaID', $metaPoziadavkaID);
     $id_predmet = $res["meta_poziadavka"]["id_predmet"];
     $id_poziadavka_typ = 1;
     $previousMetaID = $this->requirements->getPreviousMetaID($id_predmet, $metaPoziadavkaID);
     $nextMetaID = $this->requirements->getNextMetaID($id_predmet, $metaPoziadavkaID);
     $this->set("previousMetaID", $previousMetaID);
     $this->set("nextMetaID", $nextMetaID);
 }
Exemple #3
0
 function onDeleteError($packet)
 {
     Notification::append(null, $this->__('groups.deleted'));
     $m = new Rooms();
     $m->setBookmark();
     list($server, $node) = array_values($packet->content);
     $this->ajaxSubscriptions();
 }
 /**
  * @param ServiceRequest $request
  * @param Holder $holder
  * @param Rooms $rooms
  * @param ClientReference $client_reference
  * @throws ServiceHotelBookingException
  */
 public function __construct(ServiceRequest $request, Holder $holder, Rooms $rooms, ClientReference $client_reference)
 {
     try {
         $this->request_data = ["holder" => $holder->getHolderData(), "rooms" => $rooms->getRooms(), "clientReference" => $client_reference->getReference()];
         $this->response = $request->setHeaders(['json' => $this->request_data])->setOptions("bookings")->send("POST");
     } catch (\Exception $e) {
         throw new ServiceHotelBookingException($e->getMessage());
     }
 }
 public function index()
 {
     $faqs = Faq::where('Status', '=', 'Active')->get();
     $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all();
     $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all();
     $data['about'] = About::get()->all();
     return View::make('faqs.index', compact('faqs'))->with('data', $data);
 }
 public function loadModel($id)
 {
     $model = Rooms::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function index()
 {
     $testimonial = Testimonial::orderby('date', 'DESC')->where('Status', '=', 'Confirm')->paginate(10, ['Name', 'Email', 'Subject', 'Message', 'Date'], 'ID_Feedback');
     $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all();
     $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all();
     $data['about'] = About::get()->all();
     return View::make('Testimonials.index', compact('testimonial'))->with('data', $data);
 }
 public function show($id)
 {
     $events = Events::findOrFail($id);
     $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all();
     $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all();
     $data['about'] = About::get()->all();
     return View::make('Events.show', compact('events'))->with('event_active', 'active')->with('data', $data);
 }
 public function show($id)
 {
     $rooms = Rooms::where('ID_RoomType', '=', $id)->firstOrFail();
     $listRooms = Rooms::where('Status', '=', 'Active')->get();
     $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all();
     $data['about'] = About::get()->all();
     return View::make('Rooms.show', compact('rooms', 'listRooms'))->with('room_active', 'active')->with('listRoom', $listRooms)->with('data', $data);
 }
 public function show($id)
 {
     $dinas = Dinasevents::orderby('Event_Date', 'Desc')->where('Event_ID', '=', $id)->firstOrFail();
     $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all();
     $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all();
     $data['about'] = About::get()->all();
     return View::make('dinasevents.show', compact('dinas'))->with('data', $data);
 }
 public function show($id)
 {
     $travel = Travel::where('ID_Travel', '=', $id)->firstOrFail();
     $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all();
     $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all();
     $data['about'] = About::get()->all();
     $package = TravelPackage::where('ID_Travel', '=', $id)->get();
     return View::make('travels.show', compact('travel'))->with('package', $package)->with('data', $data);
 }
 public function show($id)
 {
     $destination = Destination::where('ID_Destination', '=', $id)->firstOrFail();
     $listDest = Destination::where('Status', '=', 'Active')->get();
     $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all();
     $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all();
     $data['about'] = About::get()->all();
     return View::make('Destinations.show', compact('destination', 'listDest'))->with('data', $data);
 }
 public function BookNormal($idRoom)
 {
     $rooms = Rooms::where('ID_RoomType', '=', $idRoom)->where('Status', '=', 'Active')->get();
     $tax = Tax::where('Status', '=', 'Active')->get();
     $additional = Additional::where('Status', '=', 'Active')->get();
     $countAdd = Additional::where('Status', '=', 'Active')->count();
     $data['about'] = About::get()->all();
     return View::make('Books.Normal.show')->with('data', $data)->with('rooms', $rooms)->with('tax', $tax)->with('additional', $additional)->with('countAdd', $countAdd);
 }
 public function show($id)
 {
     $facility = Facilities::where('ID_Facility', '=', $id)->firstOrFail();
     $faciList = Facilities::where('Status', '=', 'Active')->get();
     $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all();
     $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all();
     $data['about'] = About::get()->all();
     return View::make('Facilities.show', compact('facility', 'listFaci'))->with('faci_active', 'active')->with('faciList', $faciList)->with('data', $data);
 }
 public function postAdd()
 {
     $inputs = Input::all();
     DB::beginTransaction();
     try {
         $room = new Rooms();
         $data = array('name' => $inputs['roomName'], 'hotel_id' => $inputs['hotelID'], 'room_type_id' => $inputs['roomTypeID'], 'floors' => $inputs['floors'], 'buildings' => $inputs['building'], 'description' => $inputs['description']);
         $create = $room->create($data);
         if (!$create) {
             throw new Exception('Can not create room at this time');
         }
         DB::commit();
         return Redirect::to('room')->withSuccess('Data has been created successful !');
     } catch (Exception $e) {
         dd($e->getMessage());
         DB::rollback();
         return Redirect::back()->withInput()->withError('Count not been created !');
     }
 }
 public function show($id)
 {
     $room = Rooms::select('roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(15)->get();
     $countRoom = Rooms::where('Status', '=', 'Active')->count();
     $offer = Offer::findOrFail($id);
     $offerDetail = Offer::join('detail_offer', 'detail_offer.ID_Offer', '=', 'offer.ID_Offer')->join('roomtype_pic', 'roomtype_pic.ID_RoomType', '=', 'detail_offer.ID_RoomType')->join('roomtype', 'roomtype.ID_RoomType', '=', 'detail_offer.ID_RoomType')->where('offer.Status', '=', 'Active')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('offer.ID_Offer', '=', $id)->get();
     $offerCount = Offer::join('detail_offer', 'detail_offer.ID_Offer', '=', 'offer.ID_Offer')->join('roomtype_pic', 'roomtype_pic.ID_RoomType', '=', 'detail_offer.ID_RoomType')->join('roomtype', 'roomtype.ID_RoomType', '=', 'detail_offer.ID_RoomType')->where('offer.Status', '=', 'Active')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('offer.ID_Offer', '=', $id)->count();
     $data['about'] = About::get()->all();
     return View::make('offers.show')->with('offer', $offer)->with('offerDetail', $offerDetail)->with('room', $room)->with('countRoom', $countRoom)->with('offerCount', $offerCount)->with('data', $data);
 }
 public function index()
 {
     $room = Rooms::select('roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(15)->get();
     $data['about'] = About::get()->all();
     $countRoom = Rooms::where('Status', '=', 'Active')->count();
     $offer = Offer::where('Status', '=', 'Active')->take(15)->get();
     $countOffer = Offer::where('Status', '=', 'Active')->count();
     $about = About::all();
     return View::make('Books.View.index')->with('data', $data)->with('room', $room)->with('countRoom', $countRoom)->with('offer', $offer)->with('countOffer', $countOffer)->with('about', $about);
 }
 function show($metaPoziadavkaID)
 {
     $res = $this->requirements->load($metaPoziadavkaID);
     $this->set("meta_poziadavka", $res["meta_poziadavka"]);
     $this->set("requirement", $res["requirement"]);
     $subjects = new Subjects();
     $rooms = new Rooms();
     $id_predmet = $res["meta_poziadavka"]["id_predmet"];
     $subject = $subjects->getSubject($id_predmet);
     $student_count = $subjects->getStudentCount($id_predmet);
     $student_count_info = $subjects->getStudentCountInfo($id_predmet);
     $this->set("subject", $subject["nazov"]);
     $this->set('student_count', $student_count['count']);
     $this->set('student_count_info', $student_count_info);
     $this->set('rooms', $rooms->getAll());
     $this->set('types', $rooms->getTypes());
     $this->set('metaPoziadavkaID', $metaPoziadavkaID);
     $id_predmet = $res["meta_poziadavka"]["id_predmet"];
     $id_poziadavka_typ = 2;
     $previousMetaID = $this->requirements->getPreviousMetaID($id_predmet, $metaPoziadavkaID);
     $nextMetaID = $this->requirements->getNextMetaID($id_predmet, $metaPoziadavkaID);
     $this->set("previousMetaID", $previousMetaID);
     $this->set("nextMetaID", $nextMetaID);
 }
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $this->zwDevices = $this->getDevices();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Devices'])) {
         $model->attributes = $_POST['Devices'];
         //get room by room id
         $room = Rooms::model()->findAllByPk($model->attributes['tbl_rooms_idtbl_room']);
         if (count($room)) {
             foreach ($room as $rm) {
                 file_get_contents(Yii::app()->params['serverurl'] . "/server.php?command=setnode&node=" . urlencode($model->attributes['tbl_device_nodeid']) . "&name=" . urlencode($model->attributes['tbl_device_name']) . "&zone=" . $rm->tbl_room_name);
             }
         }
         if ($model->save()) {
             //update server details
             $this->redirect(array('admin'));
         }
     }
     $this->render('update', array('model' => $model));
 }
Exemple #20
0
<?php

session_start();
include $_SERVER['DOCUMENT_ROOT'] . '/config.php';
$Users = new Users();
$Users->id = validate($_SESSION['id'], 120);
$rs = $Users->IsAdmin();
if (!empty($rs->fields['id'])) {
    $Rooms = new Rooms();
    $Rooms->id = validate($_GET['id'], 120);
    //echo $_GET['id'];
    $Rooms->DeleteRoom();
    $Validate->Locate("/", 0, 0);
} else {
    $Validate->Locate("/", 0, 0);
}
 /**
  * Ziska data poziadavky, nastavi aj predmet aj semester
  * @param unknown_type $courseID
  * @return unknown_type
  */
 private function __getCommonData($courseID)
 {
     $rooms = new Rooms();
     $subjects = new Subjects();
     $student_count = $subjects->getStudentCount($courseID);
     $student_count_info = $subjects->getStudentCountInfo($courseID);
     $this->set('capacities', $rooms->getCapacities());
     $this->set('types', $rooms->getTypes());
     $this->set('type_capacity', $rooms->getCapacitiesForTypes());
     $this->set('rooms', $rooms->getAll());
     // zoradene, len podla nazvu
     $this->set('roomsByName', $rooms->getAll(true));
     $this->set('subject', $subjects->getSubject($courseID));
     $this->set('student_count', $student_count['count']);
     $this->set('student_count_info', $student_count_info);
     $this->set('course_id', $courseID);
     $this->set("semester_id", $this->session->read("semester"));
     // flag blokovania a comment k tomu
     $this->set('blokovanie_preberania', $this->subjects->isBlockedCopying($courseID));
 }
<?php

/* @var $this ClassTypeController */
/* @var $model ClassType */
/* @var $form CActiveForm */
$roomData = Rooms::model()->findAll();
$roomArray = CHtml::listData($roomData, 'room_Id', 'room_Number');
?>
<script type="text/javascript">
function myfunction(){
	var start = new Date();
	var end = new Date();
	start = document.getElementById("start_time").value;
	 end = document.getElementById("end_time").value;
	diff(start, end);
}
function diff(start, end) {
    start = start.split(":");
    end = end.split(":");
    var startDate = new Date(0, 0, 0, start[0], start[1], 0);
    var endDate = new Date(0, 0, 0, end[0], end[1], 0);
    var diff = endDate.getTime() - startDate.getTime();
    var hours = Math.floor(diff / 1000 / 60 / 60);
    diff -= hours * 1000 * 60 * 60;
    var minutes = Math.floor(diff / 1000 / 60);

    //alert(hours +"==="+minutes);
    
    var data= (hours < 9 ? "0" : "") + hours + ":" + (minutes < 9 ? "0" : "") + minutes;
    if(data != "NaN:NaN"){
    document.getElementById("total").value = data;
            File::delete($filename);
        }
        $package->delete();
    } else {
        for ($i = 0; $i < $package->count(); $i++) {
            if (File::exists($filename)) {
                File::delete($filename);
            }
            $package->delete();
        }
    }
});
/*---------------------------------------------------*/
//home
Route::get('/', function () {
    $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all();
    $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all();
    $data['dinas'] = Dinasevents::select(DB::raw("Event_ID, Event_Picture, Event_Date, Event_Title, CONCAT(SUBSTRING(Event_Description,1,100),'...') as IsiEvent"))->orderby('Event_Date', 'DESC')->take(40)->get()->all();
    $data['travel'] = Travel::where('Status', '=', 'Active')->take(40)->get()->all();
    $data['destination'] = Destination::where('Status', '=', 'Active')->take(40)->get()->all();
    $data['gallery'] = Gallery::where("Status", "!=", "Delete")->get()->all();
    $data['about'] = About::get()->all();
    Session::put('key', 'expiry', 1);
    $value = Session::get('key');
    return View::make('home')->with('index', 'active')->with('data', $data);
});
Route::get('post/listing', array('uses' => 'PostController@listing', 'as' => 'get.post.listing'));
Route::get('post/{id}', array('uses' => 'PostController@single', 'as' => 'get.post.single'))->where(array('id' => '[1-9][0-9]*', 'slug' => '[a-zA-Z0-9-_]+'));
Route::post('post/{id}', array('uses' => 'PostController@update', 'as' => 'post.post.update'))->where(array('id' => '[1-9][0-9]*'));
Route::resource('user', 'UserController');
//resource
Exemple #24
0
<div class="form">

    <?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'scene-devices-form', 'enableAjaxValidation' => false));
?>

    <p class="note">Fields with <span class="required">*</span> are required.</p>

    <?php 
echo $form->errorSummary($model);
?>

    <?php 
echo $form->labelEx($model, 'Room');
$models = Rooms::model()->findAll(array('order' => 'tbl_room_name'));
$list = CHtml::listData($models, 'idtbl_room', 'tbl_room_name');
echo CHtml::dropDownList('room_id', null, array("" => "Select Room") + $list, array('ajax' => array('type' => 'POST', 'url' => CController::createUrl('sceneDevices/getdevices'), 'update' => '#' . CHtml::activeId($model, 'tbl_devices_idtbl_device'))));
?>

    <div class="row">	
    <?php 
if (isset($_GET["sceneId"])) {
    $model->tbl_scene_idtbl_scene = $_GET["sceneId"];
}
echo $form->hiddenField($model, 'tbl_scene_idtbl_scene');
?>
    </div>

    <div class="row">
       <?php 
Exemple #25
0
<?php

session_start();
include 'config.php';
if (!isset($_SESSION['login']) && !isset($_SESSION['password'])) {
    $Validate->Locate("/login/");
} else {
    $Rooms = new Rooms();
    $Rooms->name = validate($_POST['name'], 120);
    $return = $Rooms->ViewRooms();
    while (!$return->EOF) {
        $view[] = array('id' => $return->fields['id'], 'name' => $return->fields['name'], 'create_date' => $return->fields['create_date']);
        $return->MoveNext();
    }
    //print_r($_SESSION);
    $lati->assign("login", $_SESSION['login']);
    $lati->assign("view", $view);
    $lati->assign("user_is_admin", $_SESSION['is_admin']);
}
$Config = new Config();
$lati->assign("page", "templates/default/index.tpl");
$lati->display("templates/default/main.tpl");
switch ($act) {
    case "logout":
        session_destroy();
        $Validate->Locate("/");
        break;
}
Exemple #26
0
<?php

require 'init.php';
$tpl->assign('groups', 'index');
$Groups = new Groups(array('groupid' => intval($_GET['id'])));
$Rooms = new Rooms();
if (!$Groups->Exist()) {
    redirection($config->url_site);
}
$GroupsInfo = $Groups->getInfo();
$tpl->assign('Groups', $GroupsInfo);
$tpl->assign('Rooms_groups', $Rooms->getRoomsUser($GroupsInfo['username']));
$tpl->assign('Membres', $Groups->getGroupsMemberships());
//print_r($Groups->getGroupsMemberships());
$tpl->display('header.tpl');
$tpl->display('groups_discussions.tpl');
$tpl->display('footer.tpl');
Exemple #27
0
<?php

require '../../../init.php';
$Rooms = new Rooms();
$i = 0;
foreach ($Rooms->getRoomsUser() as $g) {
    $class = $i % 2 == 0 ? 'even' : 'odd';
    ?>
<ul id="quickmenu-groups">
    <li class="<?php 
    echo $class;
    ?>
">
            <div title="Chef" ></div> <a href="#"><?php 
    echo $g['caption'];
    ?>
</a>
    </li>    
</ul>
<?php 
    $i++;
}
Exemple #28
0
 function onUnsubscribed($packet)
 {
     $arr = $packet->content;
     // Set the bookmark
     $r = new Rooms();
     $r->setBookmark();
     Notification::append(null, $this->__('group.unsubscribed'));
 }
Exemple #29
0
<?php

session_start();
include 'config.php';
if (empty($_SESSION['id'])) {
    $Validate->Locate("/", 0, 0);
}
$Rooms = new Rooms();
$id_user = validate($_GET['id_user']);
echo $id_user;
$pr = $Rooms->ViewPrivateRooms($_SESSION['id'], $id_user);
if (empty($pr->fields['id']) && $id_user != $_SESSION['id']) {
    //иначе на галвную
    $Rooms->AddPrivateRooms($_SESSION['id'], $id_user);
}
$id_room = $Rooms->ViewPrivateRooms($_SESSION['id'], $id_user);
$lati->assign("login", $_SESSION['login']);
$lati->assign("id_room", $id_room->fields['id']);
$lati->assign("id_user", $id_user);
$lati->assign("page", "templates/default/chat_private.tpl");
$lati->display("templates/default/main.tpl");
Exemple #30
-3
<?php

session_start();
include $_SERVER['DOCUMENT_ROOT'] . '/config.php';
$Rooms = new Rooms();
$id_user = validate($_POST['id_reciver']);
$id_room = $Rooms->ViewPrivateRooms($_SESSION['id'], $id_user);
if (empty($id_room->fields['id']) || empty($_SESSION['id'])) {
    $Validate->Locate("/rooms/", 0, 0);
} else {
    $id_room = $id_room->fields['id'];
    //$pr = $Rooms->ViewPrivateRoomsByUser($_SESSION['id'], $id_room);
    /*$Rooms->AddPrivateRooms($_SESSION['id'], $id_user);*/
    //ѕерекидываем назад или отсылаем что ничего нет
    $Rooms->id_user_last_message = $_SESSION['id'];
    $Rooms->id_private_room = $id_room;
    $Rooms->LastMessagePrivatViewed();
    $Messages = new Messages();
    $Messages->id_room = $id_room;
    $max_message = 60;
    $m = $Messages->MaxMessageRoomPrivate();
    $m = $m->fields[0];
    $mg = validate($_POST['id'], 120);
    if ($mg == 0) {
        $mg = $m - $max_message;
    }
    if ($mg < 0) {
        $mg = 0;
    }
    $Messages->mg = $mg;
    $Messages->m = $m;