<?php require '../public/system/headers/headers.php';?>
<?php echo $this->headLink()->appendStylesheet($this->websiteUrl . 'system/css/seotoaster.css'); ?>
<?php echo $this->headLink()->appendStylesheet($this->websiteUrl .'system/js/thickbox/thickbox.css'); ?>
<?php $this->headScript()->appendFile($this->websiteUrl . 'system/js/jquery/jquery.js'); ?>
<?php $this->headScript()->appendFile($this->websiteUrl . 'system/js/thickbox/thickbox.js'); ?>
<?php echo $this->headScript(); ?>
<?php if($this->currentUser->getRoleId() != RCMS_Object_User_User::USER_ROLE_SUPERADMIN): ?>
<script type="text/javascript">window.location.href = '<?php echo $this->websiteUrl; ?>';</script>
<?php else: ?>
<?php $this->headLink()->appendStylesheet($this->websiteUrl . 'system/css/seotoaster.css'); ?>
<?php echo $this->headLink(); ?>
<?php $this->headScript()->appendFile($this->websiteUrl . 'system/js/jquery/jquery.js'); ?>
<?php $this->headScript()->appendFile($this->websiteUrl . 'system/js/system.js'); ?>
<?php echo $this->headScript(); ?>
<input type="hidden" id="hid-main-wsurl" name="hid-main-wsurl" value="<?php echo $this->websiteUrl; ?>" />
<div id="seotoaster" class="manageuser">
<div class="close_window" onclick="parent.tb_remove();"></div>
<div class="admineditwhat">{%Manage users%}</div>
    <?php echo $this->form; ?>
<?php  if($this->error != '') :?>
    <div class="errors" onclick="this.style.display='none';"><?php echo $this->error; ?></div>
<?php endif; ?>
<?php if(isset($this->success) && $this->success != ''): ?><div class="success" onclick="this.style.display='none';"><?php echo $this->success; ?></div><?php endif; ?>
<?php if(!empty($this->users) && is_array($this->users)): ?>
<div class="users">
<table width="690" class="title" cellpadding="0" cellspacing="0" border="0">
<tr>
    <td align="left" width="115">{%Nickname%}</td>
    <td align="left" width="140">{%Login%}</td>
    <td align="left" width="200">{%Email%}</td>
    <td align="center" width="25">{%Role%}</td>
    <td align="center" width="30">{%Del%}</td>
</tr>
</table>
<div id="list">
<table width="690" cellpadding="0" cellspacing="0" border="0">
<?php foreach($this->users as $user): ?>
<tr>
    <td align="left" style="width:125px;"> <a href="javascript:;" onclick="editUser('<?php echo $this->websiteUrl; ?>', '<?php echo $user['id']; ?>');"><?php echo $user['nickname']; ?></a></td>
    <td align="left" style="width:130px;"><?php echo $user['login']; ?></td>
    <td align="left" style="width:175px;"><?php echo $user['email']; ?></td>
    <td align="center" style="width:40px;"><?php echo $user['role_name']; ?></td>
    <td align="center" style="width:30px;">
        <img style="cursor:pointer;" alt="ico-delete" title="delete this user" src="<?php echo $this->websiteUrl; ?>system/images/ico_delete.gif" onclick="deleteUser('<?php echo $this->websiteUrl; ?>', '<?php echo $user['id']; ?>', this);" />
    </td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
<?php endif; ?>
</div>
<?php endif; ?>