<?php
require_once $_SERVER["DOCUMENT_ROOT"].'/config/includes.php';
$title = 'Добавление чат комнаты';
require_once FS_DIR.'/style/head.php';
user_null($us);
?>
<script>
function sendform() {
var msg = jQuery('#myform').serialize(); // ID формы
jQuery.ajax({
method: 'POST', // Метод отправки
url: '<?=URL;?>/post/add_chat.php', // Адрес обработчика
beforeSend: function(){
jQuery('#status').html('<img src="<?=URL;?>/img/loading.gif" width="35px" height="35px">'); // Промежуточный статус
},
data: msg,
cache: false,
success: function(html){
//Очищаем форму ввода сообщения
$("#mess_to_title").val('');
$("#mess_to_pass").val('');
$("#mess_to_send").val('');
$("#mess_to_rules").val('');
jQuery('#status').html('<br /><center><a href="/chat/my"><i class="icon-check"></i> Чат комната созданна</a></center>'); } }); // Вывод ответа
}
</script>
<script type="text/javascript">
$(document).ready(function(){
$(".smile").click(function(){
var smile = $(this).attr('alt');
var text = $.trim($("#mess_to_send").val());
$("#mess_to_send").focus().val(text + ' ' + smile + ' ');
});
});
</script>
<?
$chatuserinfo = R::count(bd.'chat', 'user = ?', [$us->id]);
if ($chatuserinfo >= 10){
echo'<div class="title"><i class="icon-chemistry"></i> Создавать можно не более 10 чатов</div>';
require_once FS_DIR.'/style/foot.php';
exit();
}
echo'
<div class="block">
<form method="post" id="myform" class="add-post" action="javascript:void(null);" onsubmit="sendform()">
<div class="input-container">
<i class="icon-note icon"></i>
<input id="mess_to_title" class="input-field" type="text" maxlength="35" name="name" placeholder="Тема чат комнаты" required/>
</div>
<div class="input-container">
<i class="icon-key icon"></i>
<input id="mess_to_pass" class="input-field" type="text" maxlength="20" name="pass" placeholder="Пароль(если вход по паролю или оставьте пустым)"/>
</div>';
include FS_DIR.SMAIL_LOAD;
echo '<div class="input-container">
<i class="icon-note icontext"></i>
<textarea id="mess_to_send" style="height:100px;" class="input-field" name="mess" minlength="20" maxlength="1000" placeholder="Полное описание чата" required></textarea>
</div>
<div class="input-container">
<i class="icon-info icontext"></i>
<textarea id="mess_to_rules" style="height:100px;" class="input-field" name="rules" minlength="10" maxlength="500" placeholder="Правила чат комнаты" required></textarea>
</div>
<input class="button" type="submit" name="submit" value="Создать"/>
<span id="status"></span>
<span id="status"></span>
</form>
</div>
<br />';
require_once FS_DIR.'/style/foot.php';
?>