<?php
class Normal_MenuPower extends netsControl {
	public function Normal_MenuPower(){
		$this->netsControl();
	}
	public function Control($pColumn){
		$tmpControl=$pColumn['stcotName'].'Txt'.$pColumn['NameExtend'];
		$tmpIntroduct='';
		if(strlen($pColumn['stcoctUiIntroduct'])>0 && $pColumn['stcoctUiIntroduct']!='&nbsp;'){
			$tmpIntroduct='<div id="'.$tmpControl.'_Messagebox" class="ControlIntroduct">'.$pColumn['stcoctUiIntroduct'].'</div>';
		}else{
			$tmpIntroduct='<div id="'.$tmpControl.'_Messagebox" class="DHidden">'.$pColumn['stcoctUiIntroduct'].'</div>';
		}
		$tmpDb=new netsDb($this->sConnString);
		$tmpParid=1;

$tmpSQL_Module=' SELECT A.smtID,A.smtName,A.smtParid
	FROM {Nets.TableHead}netssysmodule AS A
	INNER JOIN {Nets.TableHead}netssysmodulecont AS B ON B.smctIndexID=A.smtID
	WHERE 1=1 AND A.smtRecycle=0 AND A.smtChecked>1 AND (1=2 {Nets.Parid})
	ORDER BY A.smtOrderBy DESC,A.smtID DESC ';
$tmpSQL_Module=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL_Module);
$tmpSQL_Function=' SELECT A.sftID,A.sftName,A.sftPower_Flag
	FROM {Nets.TableHead}netssysfunction AS A
	INNER JOIN {Nets.TableHead}netssysfunctioncont AS B ON B.sfctIndexID=A.sftID
	WHERE 1=1 AND A.sftRecycle=0 AND A.sftChecked>1 AND A.sftModuleid={Nets.Parid}
	ORDER BY A.sftOrderBy DESC,A.sftID DESC ';
$tmpSQL_Function=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL_Function);

?>
<!-- #<?php echo ($tmpControl); ?> -->
<?php if ($pColumn['stcoctSingleLine']==0) { ?><tr id="<?php echo($tmpControl); ?>_RowBox" class="<?php echo ($pColumn['LineStyle']); ?>"><?php } ?>
<td id="<?php echo ($tmpControl); ?>_Label" class="PanelTitle"><?php echo ($pColumn['stcoctUiName']); ?>：</td>
<td id="<?php echo ($tmpControl); ?>PanelBox" class="PanelBox <?php if ($pColumn['stcoctSingleLine']==1) { ?>PanelMultiColumn<?php } ?>" <?php if ($pColumn['stcoctSingleLine']==0 && $pColumn['stcoctColspan']>1) { ?>colspan="<?php echo($pColumn['stcoctColspan']); ?>"<?php } ?>>
<!--S.<?php echo ($tmpControl); ?>-->

<!-- ### -->
<?php
$tmpSTR=str_replace('{Nets.Parid}',' OR A.smtParid= '.$tmpParid,$tmpSQL_Module);
$tmpData_Root=$tmpDb->Search($tmpSTR);
$Coun_Root=0;
$Coun0=0;
foreach ($tmpData_Root as $Row_Root){ ?>
<div class="MenuPower_9"><?php echo ($Row_Root['smtName']); ?></div>
<ul class="">
<!-- ### -->
<?php
$tmpSTR=str_replace('{Nets.Parid}',' OR A.smtParid= '.$Row_Root['smtID'],$tmpSQL_Module);
$tmpData0=$tmpDb->Search($tmpSTR);
foreach ($tmpData0 as $Row0){
	$tmpControlname=$tmpControl.'_'.$Coun0; ?>
<li class="MenuPower_1"><table class="MenuPower_2" cellpadding="0" cellspacing="0"><tr>
<td class="MenuPower_3"><input id="<?php echo ($tmpControlname); ?>" name="<?php echo ($tmpControlname); ?>"
	value="<?php echo ($Row0['smtID']); ?>" onclick="tmpControl.menuPower_CheckAll('<?php echo ($tmpControl); ?>',<?php echo ($Coun0); ?>,-1,-1);" type="checkbox" <?php echo ($this->getChecked($pColumn['Value'],$Row0['smtID'],0)); ?> /></td>
<td id="<?php echo ($tmpControlname); ?>_FlagButton" class="MenuPower_7">+</td>
<td class="MenuPower_4"><a href="#Here" class="MenuPower_5" onclick="tmpControl.menuPower_ShowMenu('<?php echo ($tmpControl); ?>',<?php echo ($Coun0); ?>);"><?php echo ($Row0['smtName']); ?></a></td>
</tr></table></li>

<li id="<?php echo ($tmpControlname); ?>_Box" class="DHidden">
<?php
		$tmpSTR=str_replace('{Nets.Parid}',$Row0['smtID'],$tmpSQL_Function);
		$tmpData1=$tmpDb->Search($tmpSTR);
		$Coun1=0;
		foreach ($tmpData1 as $Row1){ ?>
<ul class="">
<?php
			$tmpAR_Flag=explode($this->sysSPLIT4,$Row1['sftPower_Flag']);
			$Coun2=0;
			foreach ($tmpAR_Flag as $Row2){
				$tmpAR3=explode($this->sysSPLIT2,$Row2);
				if (count($tmpAR3)==2) {
				$tmpControlname=$tmpControl.'_'.$Coun0.'_'.$Coun1.'_'.$Coun2;
				if($Coun2==0){ ?>

<li class="MenuPower_1_Red"><table class="MenuPower_2" cellpadding="0" cellspacing="0"><tr>
<td class="MenuPower_3_Red"><input id="<?php echo ($tmpControlname); ?>" name="<?php echo ($tmpControlname); ?>"
	value="<?php echo ($tmpAR3[1]); ?>" onclick="tmpControl.menuPower_Check('<?php echo ($tmpControl); ?>',<?php echo ($Coun0); ?>,<?php echo ($Coun1); ?>,<?php echo ($Coun2); ?>);" type="checkbox" <?php echo ($this->getChecked($pColumn['Value'],$tmpAR3[1],1)); ?> /></td>
<td class="MenuPower_4"><label href="#Here" class="MenuPower_5_Red" for="<?php echo ($tmpControlname); ?>"><?php echo ($tmpAR3[0]); ?>.<span class="MenuPower_8"><?php echo ($tmpAR3[1]); ?></span></label></td>
</tr></table></li>

<?php }else { ?>

<li class="MenuPower_1_Blue"><table class="MenuPower_2" cellpadding="0" cellspacing="0"><tr>
<td class="MenuPower_3_Blue"><input id="<?php echo ($tmpControlname); ?>" name="<?php echo ($tmpControlname); ?>"
	value="<?php echo ($tmpAR3[1]); ?>" onclick="tmpControl.menuPower_Check('<?php echo ($tmpControl); ?>',<?php echo ($Coun0); ?>,<?php echo ($Coun1); ?>,<?php echo ($Coun2); ?>);" type="checkbox" <?php echo ($this->getChecked($pColumn['Value'],$tmpAR3[1],2)); ?> /></td>
<td class="MenuPower_4"><label href="#Here" class="MenuPower_5_Blue" for="<?php echo ($tmpControlname); ?>"><?php echo ($tmpAR3[0]); ?>.<span class="MenuPower_8"><?php echo ($tmpAR3[1]); ?></span></label></td>
</tr></table></li>

<?php } } $Coun2++; } ?>
<li class="DClear"></li></ul>
<?php $Coun1++; } ?>
</li>
<?php $Coun0++; } ?>
<li class="DClear"></li></ul>
<?php $Coun_Root++; } ?>
<input id="<?php echo($tmpControl); ?>" name="<?php echo($tmpControl); ?>" type="hidden" value="<?php echo($pColumn['Value']); ?>" />

<?php echo ($tmpIntroduct); ?>&nbsp;
<!--sendRequest--><!--E.<?php echo ($tmpControl); ?>--></td>
<td id="<?php echo ($tmpControl); ?>_ImgIntroduct" class="PanelImgIntroduct">
<?php if(strlen($pColumn['stcoctUiImgIntroduct'])>0 && $pColumn['stcoctUiImgIntroduct']!='&nbsp;'){ ?>
<a href="#Here"><img src="<?php echo($this->sysFileConfig['sysUiCoreRoot']); ?>Ui/Common/Img/Common/icon_4.jpg" title="<?php echo($pColumn['stcoctUiImgIntroduct']); ?>" /></a>
<?php }else{ ?>&nbsp;<?php } ?></td><?php if ($pColumn['stcoctSingleLine']==0) { ?></tr><?php } ?>
<?php
	}
	private function getChecked($pParameter,$pValue,$pType){
		$tmpSTR='';
		$tmpAR0=explode($this->sysSPLIT2,$pParameter);
		foreach ($tmpAR0 as $Row0){
			$tmpAR1=explode($this->sysSPLIT1,$Row0);
			if ($pType==0 && count($tmpAR1)>1) {
				if ($tmpAR1[0]==$pValue) {
					$tmpSTR=' checked="checked" ';
				}
			}else if ($pType==1 && count($tmpAR1)>1) {
				if ($tmpAR1[1]==$pValue) {
					$tmpSTR=' checked="checked" ';
				}
			}else {
				$Coun1=0;
				foreach ($tmpAR1 as $Row1){
					if ($Coun1>1 && $Row1==$pValue) {
						$tmpSTR=' checked="checked" ';
					}
					$Coun1++;
				}
			}

		}
		
		
		return $tmpSTR;
	}
	
}
?>