<?
define( 'ROOT_DIR', $_SERVER['DOCUMENT_ROOT'] );

include_once ROOT_DIR . '/engine/config.php';
include_once ROOT_DIR . '/engine/function.php';

if ( isset( $_SESSION['iduser'] ) ) {
?>
  <script type="text/javascript" >
    function addreyting() {
	  $.post('ajax.php?func=addreyting', {
	  }, function(data) {
		if(data == 1) {
		  $('.addreyting').fadeOut(0);
		  Page.Go(window.location.reload());
		}
	  });
	  return false;
	}
    function text_status_w() {
	    $.ajax({
		  type: 'POST',
		  url: 'ajax.php?func=text_status_w',
		  data: ({text: $('#exampleTextareaS').val()}),
		  dataType: 'html',
		  success: function(data) {
		    if(data == 1) {
			  Page.Go(window.location.reload());
			} else {
			  $('body').Qnotify({text:data, sound:'error'});
		    }
		  }
	    });
	    return false;
	  }
	  
    function accaunt_status() {
	   $('#accaunt_status_text').fadeOut(300);
	   $('#accaunt_status_pen').fadeOut(300);
	   $('#accaunt_status_edit').fadeIn(300);
	   $('#exampleTextareaS').fadeIn(300);
	}
	$(document).ready(function(){
	  $('.addreyting').tipTip({defaultPosition:'right'});
	});
  </script>
  <div class="">
	<div class="open_acn hidden-md-down">
	  <div class="accaut_block" >
		  <div class="accaut_block_avatar">
			<a href="/id<?=$config_user['id']?>"><img src="/temp/avatar/<?=$config_user['avatar']?>" class="accaut_avatar img-circle" alt="" /></a><br>
			<div style=" margin-top: 9px; margin-bottom: -11px;">
			  <span style="color: #fff; font-size: 14px; line-height: 1.1em;">
				<?=$config_user['username']?> - <?=status_user( $config_user['reyting'], $config_user['account'] )?><br>
				<font style="font-size: 12px;"><i class="fa fa-star" aria-hidden="true"></i> Ваш рейтинг: <?=$config_user['reyting']?></font>
			  </span>
			</div>
		  </div>
		  <?
			if ( $config_user['addreyting'] < time() ) {
			  ?>
				<div class="addreyting" onclick="addreyting(); return false;" title="Бонус +<?=$config['everybonus']?> к рейтингу"></div>  
			  <?
			}
		  ?>
	  </div>
		
	  <div class="open-accaunt-status-edit" >
	    <i id="accaunt_status_pen" onclick="accaunt_status(); return false;" class="fa fa-pencil" aria-hidden="true"></i>
		<i id="accaunt_status_edit" onclick="text_status_w(); return false;" class="fa fa-check" aria-hidden="true" style="display: none;"></i>
	  </div>
	  
	  <div class="open-accaunt-status" onclick="accaunt_status(); return false;" style="min-height: 44px;">
		<span id="accaunt_status_text">
		  <? if ( $config_user['text_status_wall'] == '' ) { ?>
		    Кликните сюда что бы написать свой текстовый статус, виден на вашей стенке.
		  <? } else { echo $config_user['text_status_wall']; } ?>
		</span>
	    <textarea class="form-control" style="display: none; width: 271px; height: 40px;" id="exampleTextareaS" rows="3"><?=$config_user['text_status_wall']?></textarea>
	  
	  </div>
		
	  <div class="acn_form_exit">
		<a href="/profile"> <button type="button" class="btn btn-secondary btn-sm"><div class="glyphicon glyphicon-user" aria-hidden="true" ></div> Профиль</button></a>
		<a href="/exit"><button type="button" class="btn btn-secondary btn-sm" style="float: right;"><div class="glyphicon glyphicon-off" aria-hidden="true" ></div> Выход</button></a>
	  </div>
	</div> 
  </div> 
<? }?>