<?php

include("../includes/site_config.php");
include('../session_handler.inc');
//include("../includes/functions.php");
include("../languages/english_admin.php");
include("include/header.php");
include("../includes/tab_functions.js");
$block = ereg("MSIE",$_SERVER['HTTP_USER_AGENT'])?'block':'table-row';
$Sess_UserType= $_SESSION['Sess_UserType'];
if ($Sess_UserType != "A") {
	exit;
}
# retrieve the template
//$area = 'member';

# select all parameters from table

//$group= $_REQUEST['group'];

/**
 * Display correct inpur field for current option
 *
 * @param object $option
 * @return string
 *
 */
function display_option($option) {
    $res = "";

    if($option->type=='list' || $option->type=='skin'|| $option->type=='language'){
       $res .= "<select name=\"options[$option->name]\">";
		foreach ($option->list as $value => $label){
            $selected = ($value == $option->value) ? "SELECTED" : "";
			$res .= "<option value=\"$value\" $selected>$label</option>";
   		}
        $res .= "</select>";
    } else {
        $res = "<input class=\"input\" type=\"text\" name=\"options[$option->name]\" value=\"$option->value\"><br>";
		
    }
    return $res;
}
?>
<? include("admin_tabs.php");?>


<div class="mainwidth">
<div class="admin-page-header"><div class="admin-page-heading">&nbsp;&nbsp;Memberships</div></div>
<div class="clear"></div>
<div class="admin-page">
  <table width="<?php print("$CONST_TABLE_WIDTH"); ?>" align="<?php print("$CONST_TABLE_ALIGN"); ?>" border="0" cellspacing="<?php print("$CONST_TABLE_CELLSPACING"); ?>" cellpadding="<?php print("$CONST_TABLE_CELLPADDING"); ?>">
  <form method='post' action='<?php echo $CONST_LINK_ROOT?>/admin/com_settings.php<?php print("?PHPSESSID=".session_id()); ?>'>
<?
$manager = &OptionManager::GetInstance();
 $aGroups = $manager->GetGroupList();

//if ($group=== null && count($aGroups)) {
//for($j=0; $j<count($aGroups); $j++){

    //$group = $aGroups[$j]->Name; 
$group = 'payment'; 

 $aOptions = ($group !== null) ? $manager->GetListByGroup($group) : array();
 


?>
<script>
<!--

function switchBlock(id,show){

    if (document.getElementById(id).disabled){
        document.getElementById(id).style.display=show;
        document.getElementById(id).disabled=false;
        document.getElementById(id+'_up').style.display='none';
        document.getElementById(id+'_down').style.display=show;
    }else{
        document.getElementById(id).style.display='none';
        document.getElementById(id).disabled=true;
        document.getElementById(id+'_up').style.display=show;
        document.getElementById(id+'_down').style.display='none';
    }
}

-->

</script>

    
	
	<!-- -->
	
	
	<!--<tr class="tdeven" >
<td align="left" class="links_blue_large" width="25%"><b><?php echo $group ?></b></td>
            <td align="left" valign="top" colspan=2 class=tdunderline> <div id=<?=$group?>_up style="float:left;padding-right:10px;">

                <a href="#" class="switch" onClick="switchBlock('<?=$group?>','<?=$block?>');return false;">[+]</a>

              </div>

              <div id=<?=$group?>_down style="display:none;float:left;padding-right:10px;">

                <a href="#" class="switch" onClick="switchBlock('<?=$group?>','<?=$block?>');return false;">[-]</a>

              </div>

             

            </td>

    </tr>
	
	
          <tr class="<?=$class?>"  id="<?=$group?>" style="display:none" >
		  <td align="left" valign="top">&nbsp; </td>

            <td align="left" valign="top">
			<table border="0" cellpadding="0" cellspacing="0" width="100%">-->

    <?
foreach ($aOptions as $option){
//$i=0;
//$class = ($i++%2) ? "tdeven" : "tdodd";
?>
        

            
			<tr>
				
         
           <td  width=20% align="left" ><?=$option->label?><br></td>
         <td  width=10% align="left" ><?=display_option($option)?><br></td>
          <td  width=70% align="left"><?=$option->comments?><br></td>
         

             
		</tr>
           <? }?>
		   	<tr align="center">
				<td colspan="3" class="tdfoot"><input name="Validate2" type="submit" class="normal" value="<?php echo BUTTON_UPDATE ?>"></td>
			  </tr>

			<!--</table>
			
			</td>
          </tr>-->
       <!-- <script language=javascript>document.getElementById('<?=$group?>').disabled = true;</script>-->
    
    
          <?php /*?><tr>
            <td  colspan="3" align="left" valign="top" class="tdhead">&nbsp;</td>
          </tr>
      
          <tr class="tdodd">
		  <td>
			<!--<select name=group onChange="this.form.submit();">-->
<? foreach ($aGroups as $oRow) {
    $selected= ($oRow->Name == $group)? "selected" : "";
?>
				<?php /*?><option value="<?=$oRow->Name?>" <?=$selected?>><?=$oRow->Title?></option>
<? }?>
			<!--</select>-->
		  </td>
		  </tr><?php */?>
		
        
        <input type="hidden" name="group" value="<?=$group?>">
         

  
         <? //}}?>
          <tr>
            <td colspan="3" class="tdhead"  align="left">&nbsp;</td>
          </tr>
    </form>

</table></div><div class="admin-page-bottom"></div></div>



<?php include("include/footer.php"); ?>
