<?php
/*


function users_menu($options){
global $MAIN_USER;
	$t = new PHPTAL( false );
	if ( MAIN_USER>0 ){
		// пользователь
   		$t -> setSource(TMPL_USER_MENU);
  	}else{
  		$t -> setSource(TMPL_GUEST_MENU);
  	}
  	$t -> B_USER_REGISTER_AS = sprintf(B_USER_REGISTER_AS, sys_url(URL_USER_REGISTER),sys_url(URL_USER_REGISTER_ORG),sys_url(URL_USER_RECOVER_PASS) );
  	$login = $MAIN_USER -> login();
  	$t -> profile_url = sprintf(URL_USER_PROFILE,$login );
  	$t -> login = $login;
  	$t -> blog_url = sprintf(URL_USER_BLOGS,$login );
  	$t -> count_posts =  $MAIN_USER -> count_blog_posts();
  	$t -> edit_profile_url =  sprintf(URL_USER_PROFILE_EDIT);
  	$t -> admin_url=  sprintf(URL_USER_ADMIN);
  	$t -> exit_url=  sprintf(URL_USER_EXIT);
  	$t -> points =  $MAIN_USER -> points();
  	$t -> is_admin =  $MAIN_USER -> is_admin();
  	return  $t -> execute();
	
}
define("TMPL_GUEST_MENU",
'
	<p class="top_enter"><a class="tf_link js" onclick="login_wnd()">${B_USER_INPUT_WITH_PASS}</a></p>
	<script type="text/javascript">
	function login_wnd(){
		
		wnd.set_title("${B_USER_INPUT_WITH_PASS}");
		wnd.set_content( o.$("login_form").innerHTML );
		wnd.show(510,210);
	}
	</script>


	<div id="login_form" style="display:none">
		<form    action="/?p_name=users_profile" method="post">
			<input type="hidden" name="act"  value="login" />
			<input type="hidden"   name="send"  value="1" />
			<input 
				class="in_text" 
				value="${B_USER_LOGIN}" 
				onfocus="if(this.value==\'${B_USER_LOGIN}\')this.value=\'\';"  
				onblur="if(this.value==\'\')this.value=\'${B_USER_LOGIN}\';"  
				type="text" name="login"  /> &nbsp; 
			<input  class="in_text" value="*****" type="password"
				 onfocus="if(this.value==\'*****\')this.value=\'\';"  
				 onblur="if(this.value==\'\')this.value=\'*****\';" 
				 name="pass" /> &nbsp;&nbsp; 
			<input type="submit" class="button_s"  value="${B_USER_INPUT}" />
			
			<div tal:omit-tag="MAIN_URL" tal:content="structure B_USER_REGISTER_AS" />
	
			
		</form>
	</div>'
);

define("TMPL_USER_MENU",
'
<ul class="usr_in">
	<li>${B_USER_YOU_INPUT_AS}</li>
	<li class="usr"><a href="${profile_url}">${login}</a> ${points}</li>
	<li><a href="${profile_url}">${B_USER_PROFILE}</a> </li>
	<li><a href="${blog_url}">${B_USER_BLOG}</a> (${count_posts})</li>
	<li><a href="${edit_profile_url}">${B_USER_MOD_PROFILE}</a></li>
	<li tal:condition="is_admin"><a  target="_blank" href="${admin_url}" style="color:red;">${B_USER_ADMIN}</a></li>
	<li><a href="${exit_url}">${B_USER_EXIT}</a></li>
</ul>
'
);*/
?>
