<?=$this->view(sett('cp_view_dir').'/'.'breadcrumb', $bc,true)?> 

<div class="uk-grid  uk-grid-medium uk-grid-match uk-margin-top uk-margin-bottom" data-uk-grid>
<div  class="uk-width-1-3@m">
	<div class="uk-card uk-card-default uk-card-small uk-card-hover">
	<div class="uk-card-header">
		<div class="uk-grid uk-grid-small">
			<div class="uk-width-auto"><h4 class="uk-margin-remove-bottom"><?= $user["full_name"]?></h4></div>
			<div class="uk-width-expand uk-text-left">
			
			<?php if($user['id']!=login('id') and ( admin_role() and is_login_best($user['id']) )): ?>
			
				<a onclick="return confirm('<?=lang('is_del')?>')"  href="<?=site_url("admin/users/home/del/$user[id]")?>" class="uk-icon-link uk-text-danger uk-margin-small-left" data-uk-icon="icon: trash"></a>
				<?php endif; ?>
				<?php if( admin_role() and is_login_best($user['id']) ): ?>
				<a href="<?=site_url("admin/users/home/edit/$user[id]")?>" class="uk-icon-link uk-margin-small-left" data-uk-icon="icon: cog"></a>
				<?php endif; ?><?php if($user['id']==login('id')): ?>
				<a href="<?=site_url("accounts/settings")?>" class="uk-icon-link uk-margin-small-left" data-uk-icon="icon: cog"></a>
				<?php endif; ?>
			</div>
		</div>
	</div>
	
	
	
	
	
	
	<div class="uk-card-body">
		 <ul class="uk-list uk-list-divider">
					<li ><b><?=lang('number')?> </b>: <?=$user['id']?> </li>
					<li ><b><?=lang('user_name')?></b>: <?=$user['user_name']?> </li>
					<li ><b><?=lang('full_name')?> </b>: <?=$user['full_name']?> </li>
					<li ><b><?=lang('email_adrs')?>  </b>: <?=$user['email']?> </li>
				</ul>						
							
	</div>
</div>
</div>
						
						


<?php if(is_right("users_edit")):?>
<div class="uk-width-1-3@m">
	<div class="uk-card uk-card-default uk-card-small uk-card-hover">
		<div class="uk-card-header">
			<h4 > <?=lang('role')?> </h4>
		</div>
		<div class="uk-card-body">
		
		<?php if($user['id']!=login('id') and ( right('users_edit_role') and is_login_best($user['id']) )):
				
		?>
		
<div class="uk-form-controls uk-form-controls-text"><?php $roles=get_roles_for();
			echo form_open();			
			foreach ($roles as $r):?>
			<label><input class="uk-radio" type="radio" value="<?=$r["id"]?>" name="id" <?= is($r["id"]==$user['user_role_id'],'checked=""')?>> <?=lang('role.'.$r['name'])?></label><br>
			<?php endforeach;?>
			 </div>
<br>			<center>
			<?=form_submit('role_submit', lang('save'),'class="uk-button uk-button-primary"')?>		
			</center>
			<?= form_close()?>	
			
			<?php else:?>
				<?=dbCol('name','user_roles',"id=$user[user_role_id]")?>
			<?php endif;?>
			
			
	<?php
				$user_role=get_role($user['id']);
				
			if($user_role!=100): ?>
			<ul uk-accordion="multiple: true">
    <li >
        <a class="uk-accordion-title uk-text-muted" href="#"><?=lang('rights')?></a>
        <div class="uk-accordion-content">
		
			<ul>
			<?php $rights=$this->user_model->get_rights();
			
			
			foreach ($rights as $r):
			if(role(100)){$r['hidden']=0;}
			
			?>
			<?php if (!in_array($r["code"],role_rights($user['user_role_id'])) or $r['hidden']==1){
				continue;
			}
			?>
			
			<li><?=lang('rht.'.$r["code"])?></li>
				

				
			
			<?php endforeach;?>	
			</ul></div>
			</li>
				</ul>
			
			
			
			
			
			<?php endif; ?>		
			
			
			
	</div>
	</div>
</div>
<?php endif ?>





<?php if(is_right("users_edit")):?>
<div class="uk-width-1-3@m">
	<div class="uk-card uk-card-default uk-card-small uk-card-hover">
		<div class="uk-card-header">
			<h4 ><?=lang('prsnl_rights')?> </h4>
		</div>
		<div class="uk-card-body">
		<?php if($user['id']!=login('id') and ( right('users_edit_rights') and is_login_best($user['id']) )): ?>
		<div class="uk-form-controls uk-form-controls-text">
<?php $rights=$this->user_model->get_rights();
			echo form_open();			
			foreach ($rights as $r):
				if(role(100)){$r['hidden']=0;}
			if($r['hidden']==1){
				if(in_array($r["code"],$user['rights'])){
				echo "<input type='hidden' name='id[]' value='$r[id]'>";
				}
			}else{
				
			?>
			
			<label><input type="checkbox" name="id[]" value="<?=$r["id"]?>" class="uk-checkbox"   <?= is(in_array($r["code"],$user['rights']),'checked=""')?>> <?=lang('rht.'.$r["code"])?></label><br>
				

				
			
			<?php }
			endforeach;?>
</div><br>			<center>
			<?=form_submit('urn_submit', lang('save'),'class="uk-button uk-button-primary"')?>		
			</center>
			<?= form_close()?>	
			<?php else:?>
				<ul>
			<?php $rights=$this->user_model->get_rights();
			
			
			foreach ($rights as $r):
			if(role(100)){$r['hidden']=0;}
			?>
			<?php if (!in_array($r["code"],$user['rights']) or $r['hidden']==1){
				continue;
			}
			?>
			
			<li><?=$r["name"]?></label></li>
				

				
			
			<?php endforeach;?>	
				</ul>
				
				
			<?php endif;?>
	</div>
	</div>
</div>
<?php endif ?>







</div>

