<?php

	/**
	 * Template für die Verwaltung der Berechtigunen
	 */

?>
<div class="wpsg_admin_submenu">
	
	<div class="head">
		<div class="title"><?php echo __("Einstellungen", "wpsg"); ?></div>			
		<div style="clear:both;"></div>
	</div>

	<ul>		
		<?php foreach ($this->view['arSubAction'] as $k => $v) { ?>		
		<li class="<?php echo (($k == $this->view['subAction'])?'current':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&amp;subaction=<?php echo $k; ?>"><?php echo $v['Menutext']; ?></a></li>
		<?php } ?>
	</ul>
			
</div>
		
<div class="wpsg_admin_content">
	<form name="form1" method="post" enctype="multipart/form-data" action="<?php echo wpsg_hspc(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&subaction='.$_REQUEST['subaction'].'&noheader=1'); ?>">

		<?php global $wpdb; $arRoles = get_option($wpdb->prefix."user_roles"); ?>

		<table class="wpsg_access_table" cellpadding="0" cellspacing="0">
			<tr>
				<th class="wpsg_col_capname"></th>
				<?php foreach ($arRoles as $role_key => $r) { ?>
				<th class="wpsg_col_cap"><?php echo $r['name']; ?></th>
				<?php } ?>
				<th></th>
			</tr>
			<tr>
				<td class="wpsg_col_capname"><?php echo __('Menüpunkt sichtbar', 'wpsg'); ?></td>
				<?php foreach ($arRoles as $role_key => $r) { ?>
				<td class="wpsg_col_cap">
					<input type="hidden" name="wpsg_cap[<?php echo $role_key; ?>][wpsg_menu]" value="0" />
					<input type="checkbox" <?php echo ((isset($r['capabilities']['wpsg_menu']) && $r['capabilities']['wpsg_menu'] == "1")?'checked="checked"':''); ?> name="wpsg_cap[<?php echo $role_key; ?>][wpsg_menu]" value="1" /> 
				</td>
				<?php } ?>
				<td></td>
			</tr>
			<tr>
				<td class="wpsg_col_capname"><?php echo __('Konfiguration', 'wpsg'); ?></td>
				<?php foreach ($arRoles as $role_key => $r) { ?>
				<td class="wpsg_col_cap">
					<input type="hidden" name="wpsg_cap[<?php echo $role_key; ?>][wpsg_conf]" value="0" />
					<input type="checkbox" <?php echo ((isset($r['capabilities']['wpsg_conf']) && $r['capabilities']['wpsg_conf'] == "1")?'checked="checked"':''); ?> name="wpsg_cap[<?php echo $role_key; ?>][wpsg_conf]" value="1" /> 
				</td>
				<?php } ?>
				<td></td>
			</tr>
			<?php if ($this->hasMod('wpsg_mod_core')) { ?>
			<tr>
				<td class="wpsg_col_capname"><?php echo __('Lizenzverwaltung', 'wpsg'); ?></td>
				<?php foreach ($arRoles as $role_key => $r) { ?>
				<td class="wpsg_col_cap">
					<input type="hidden" name="wpsg_cap[<?php echo $role_key; ?>][wpsg_lizence]" value="0" />
					<input type="checkbox" <?php echo ((isset($r['capabilities']['wpsg_lizence']) && $r['capabilities']['wpsg_lizence'] == "1")?'checked="checked"':''); ?> name="wpsg_cap[<?php echo $role_key; ?>][wpsg_lizence]" value="1" /> 
				</td>
				<?php } ?>
				<td></td>
			</tr>	
			<?php } ?>
			<tr>
				<td class="wpsg_col_capname"><?php echo __('Bestellverwaltung', 'wpsg'); ?></td>
				<?php foreach ($arRoles as $role_key => $r) { ?>
				<td class="wpsg_col_cap">
					<input type="hidden" name="wpsg_cap[<?php echo $role_key; ?>][wpsg_order]" value="0" />
					<input type="checkbox" <?php echo ((isset($r['capabilities']['wpsg_order']) && $r['capabilities']['wpsg_order'] == "1")?'checked="checked"':''); ?> name="wpsg_cap[<?php echo $role_key; ?>][wpsg_order]" value="1" /> 
				</td>
				<?php } ?>
				<td></td>
			</tr>		
			<tr>
				<td class="wpsg_col_capname"><?php echo __('Produktverwaltung', 'wpsg'); ?></td>
				<?php foreach ($arRoles as $role_key => $r) { ?>
				<td class="wpsg_col_cap">
					<input type="hidden" name="wpsg_cap[<?php echo $role_key; ?>][wpsg_produkt]" value="0" />
					<input type="checkbox" <?php echo ((isset($r['capabilities']['wpsg_produkt']) && $r['capabilities']['wpsg_produkt'] == "1")?'checked="checked"':''); ?> name="wpsg_cap[<?php echo $role_key; ?>][wpsg_produkt]" value="1" /> 
				</td>
				<?php } ?>
				<td></td>
			</tr>			
			<?php $this->callMods('admin_setcapabilities'); ?>
		</table>
		
		<br />
		<input type="submit" value="<?php echo __('Berechtigungen Speichern', 'wpsg'); ?>" name="submit" id="submit" class="button-primary" />		
  
  	</form>
</div>