<? $this->load->view( $this->aSystemVar['template_viewer_root'] . 'admin/_header') ?>

	<div class="bigCaption">
		<div class="clearBoth"></div>
		<div style="float:left;">
			Group '<i><?=$CGroupName?></i>' 
			<? if ( $bDelete ): ?>
				<span><a href="javascript:void(0);" onclick=" if (confirm('confirmation')){document.getElementById('delgroupform').submit();} return false;">delete this group</a></span>
				<?= form_open('admin/user_group/',array('id'=>'delgroupform')) ?>
					<input type="hidden" name="groupname" value="<?=$CGroupName?>" />
					<input type="hidden" name="deletegroup" value="1" />
				<?= form_close() ?>
			<? endif; ?>
		</div>
		<div style="float:right;text-align:right;font-size:14px;">
			<?= form_open('admin/user_group/') ?>
				add new group:
				<input type="text" name="newgroupname" />
				<input type="submit" name="newgroup" value="go" />
			<?= form_close() ?>
		</div>
		<div class="clearBoth"></div>
	</div>
	
	<div>
	</div>

	<div class="filter">
		<?= form_open('admin/user_group/') ?>
			<div style="text-align:center;">
				<select name="GroupName">
					<? foreach ( $GroupList as $sItem ) : ?>
						<option value="<?=$sItem?>" <?= ($sItem == $CGroupName ? ' selected="selected" ' : '') ?>><?=$sItem?></option>
					<? endforeach; ?>
				</select>

				<input type="submit" value="select" class="submit" />
			</div>
		<?= form_close(); ?>
	</div>

	<div class="optionList">
	<?= form_open('admin/user_group/'.$CGroupName) ?>
	
		<table cellpadding="0" cellspacing="1" class="contentList">

		<?
			$i = 0;
			foreach( $CGroupData as $sKey => $sValue )
			{

				switch ( $sKey )
				{
					case 'categ_to_hide':
					case 'categ_to_categ':
					case 'categ_to_post':
					
						$sCode = '<select name="'.$sKey.'[]" multiple="multiple" style="height:200px;">';
						$sCode .= '<option value="0" '.(in_array(0,$sValue)?'selected="selected"':'').' />-- root category --</option>';
						foreach ($CategoryList as $aCategory)
						{
							$sCode .= '<option value="' . $aCategory['Id'] . '" '.(in_array($aCategory['Id'],$sValue)?'selected="selected"':'').' />' . $aCategory['Title'] . '</option>';
						}
						$sCode .= '</select>';
					break;
					case 'new_categ_status':
					case 'new_post_status':			
						$sCode = '<select name="'.$sKey.'">';
						$sCode .= '<option value="active" ' . ( 'active' == $sValue ? 'selected="selected"' : '' ) . ' >active</option>';
						$sCode .= '<option value="inactive" ' . ( 'inactive' == $sValue ? 'selected="selected"' : '' ) . ' >inactive</option>';
						$sCode .= '</select>';
					break;
					default:
						$sCode = '<input type="text" name="'.$sKey.'" value="'.$sValue.'" />';
					break;
				}			
			
				if( ($i%2) == 0 )
				{
					$sClassName = 'odd';
				}
				else
				{
					$sClassName = 'even';
				}

				echo '<tr class="'.$sClassName.'">
						<td class="">';
						
				switch ($sKey)
				{
					case 'categ_to_hide':
						echo 'List of restricted categories:<br /><i>( all subcategories are affected )</i>';
					break;
					case 'categ_to_categ':
						echo 'Categories where allowed adding categories:<br /><i>( all subcategories are affected )</i>';
					break;
					case 'categ_to_post':
						echo 'Categories where allowed adding posts:<br /><i>( all subcategories are affected )</i>';
					break;
					case 'new_categ_status':
						echo 'Status of new category:';
					break;
					case 'new_post_status':
						echo 'Status of new post';
					break;
					case 'post_total_num':
						echo 'Max number of posts<br /><i>( \'-\' - not limited )</i>';
					break;
					case 'post_pic_num':
						echo 'Max number of pics for post<br /><i>( \'-\' - not limited )</i>';
					break;
					case 'pic_max_upload_size':
						echo 'Max size of pic to upload (KB)<br /><i>( \'-\' - not limited )</i>';
					break;
					case 'pic_max_upload_width':
						echo 'Max width of pic to upload<br /><i>( \'-\' - not limited )</i>';
					break;
					case 'pic_max_upload_height':
						echo 'Max height of pic to upload<br /><i>( \'-\' - not limited )</i>';
					break;
					case 'post_text_len':
						echo 'Max length of post body<br /><i>( \'-\' - not limited )</i>';
					break;
					case 'post_lifetime':
						echo 'Post lifetime (days)<br /><i>( \'-\' - not limited )</i>';
					break;
					default:
						echo $sKey;
					break;
				}
							
				echo '</td>
						<td>
							'.$sCode.'
						</td>
					</tr>';
					
				$i++;
			}
		
		?>

		</table>
		
		<input type="submit" name="groupchanges" value="apply" style="margin-top:10px;" />
		
	<?= form_close(); ?>
	
	</div>

<? $this->load->view( $this->aSystemVar['template_viewer_root'] . 'admin/_footer') ?>