<?php
class Normal_ChildChooseX extends netsControl {
	public function Normal_ChildChooseX(){
		$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>';
		}
		$tmpCode=new netsCode();
		$tmpDb=new netsDb($this->sConnString);
		$tmpDefaultValue=-1;
		$tmpDefaultText='未设置分类';
		
		$tmpParameter=explode($this->sysSPLIT13,$pColumn['Parameter']);
		if($tmpParameter[0]==0){
			$tmpValues=explode($this->sysSPLIT1,$tmpParameter[1]);
		}else{
			$tmpValues=explode($this->sysSPLIT1,$pColumn['Value']);
		}
		$Coun0=0;
		while(count($tmpParameter)>$Coun0){
			$tmpParameter[$Coun0]=str_replace($this->sysSPLIT4,'',$tmpParameter[$Coun0]);
			$tmpParameter[$Coun0]=str_replace($this->sysSPLIT10,'',$tmpParameter[$Coun0]);
			$Coun0++;
		}
?>
<!-- #<?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 if($tmpParameter[0]==1){ ?>
<!-- ------ #Type <?php echo ($tmpParameter[0]); ?> ------ -->
<table id="<?php echo($tmpControl); ?>_Mainbox" class="ChildChooseX_0" cellpadding="0" cellspacing="0"><tr><td><img src="<?php echo($this->sysFileConfig['sysCoreRoot']); ?>Ui/Common/Img/Control/childChoose_0.jpg" /></td>
<?php
$tmpValues=array();
$tmpTexts=array();
$pColumn['Value']=$tmpCode->Int32($pColumn['Value'],$tmpParameter[1]);

$tmpRows=array();
$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpParameter[6]);
$tmpSTR=str_replace('{Nets.ID}',$pColumn['Value'],$tmpSTR);
$tmpData0=$tmpDb->Search($tmpSTR);
while(count($tmpData0)>0){
	$tmpRows[]=$tmpData0[0];
	$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpParameter[6]);
	$tmpSTR=str_replace('{Nets.ID}',$tmpData0[0][$tmpParameter[2].'Parid'],$tmpSTR);
	$tmpData0=$tmpDb->Search($tmpSTR);
}

$Coun0=0;
krsort($tmpRows);
foreach($tmpRows as $Row0){ ?>
<td class="ChildChoose_1"><a id="<?php echo($tmpControl); ?>_RowText_<?php echo($Coun0); ?>" href="#Here" class="Link1 FBlue1" onclick="<?php echo($tmpControl); ?>_JS.onOpen(<?php echo($Coun0); ?>);"><?php echo($Row0[$tmpParameter[2].'Name']); ?></a></td>
<?php
	$tmpValues[]=$Row0[$tmpParameter[2].'ID'];
	$tmpTexts[]=$Row0[$tmpParameter[2].'Name'];
	$Coun0++;
}
?>
<td class="ChildChoose_1"><a id="<?php echo($tmpControl); ?>_RowText_<?php echo($Coun0); ?>" href="#Here" class="Link1 FBlue1" onclick="<?php echo($tmpControl); ?>_JS.onOpen(<?php echo($Coun0); ?>);"><?php echo($tmpDefaultText); ?></a></td>
<td><img src="<?php echo($this->sysFileConfig['sysCoreRoot']); ?>Ui/Common/Img/Control/childChoose_2.jpg" /></td></tr></table>
<!-- #Cells -->
<ul id="<?php echo($tmpControl); ?>_Cellsbox" class="ChildChooseX_CellsBox DHidden"></ul>
<!-- #Button -->
<ul class="ChildChoose_9">
<li class="ChildChoose_10"><input id="<?php echo($tmpControl); ?>" name="<?php echo($tmpControl); ?>" type="text" value="<?php echo($pColumn['Value']); ?>" /></li>
<li class="ChildChoose_5"><a href="#Here" class="Link1 FBlack3" onclick="<?php echo($tmpControl); ?>_JS.Reset(0);">重置</a></li>
<li class="DClear"></li></ul>
<?php echo ($tmpIntroduct); ?>
<!-- #JSCRIPT -->
<script type="text/javascript">
var Coun0=0;
var tmpAR0=new Array();
var tmpAR1=new Array();
<?php
$Coun0=0;
while(count($tmpValues)>$Coun0){ ?>
tmpAR0[Coun0]="<?php echo($tmpValues[$Coun0]); ?>";
tmpAR1[Coun0]="<?php echo($tmpTexts[$Coun0]); ?>";
Coun0++;
<?php
	$Coun0++;
}
?>
var <?php echo($tmpControl); ?>_JS=new childChooseX_Dynamic();
tmpAR0[Coun0]=<?php echo($tmpControl); ?>_JS.sDefaultValue;
tmpAR1[Coun0]=<?php echo($tmpControl); ?>_JS.sDefaultText;
<?php echo($tmpControl); ?>_JS.initial("<?php echo($tmpControl); ?>","<?php echo($this->sysFileConfig['sysCoreRoot'].$tmpParameter[5]); ?>",tmpAR0,tmpAR1);

</script>




<?php }else if($tmpParameter[0]==0){ ?>
<!-- ------ #Type <?php echo ($tmpParameter[0]); ?> ------ -->
<table id="<?php echo($tmpControl); ?>_Mainbox" class="ChildChooseX_0" cellpadding="0" cellspacing="0"><tr><td><img src="<?php echo($this->sysFileConfig['sysCoreRoot']); ?>Ui/Common/Img/Control/childChoose_0.jpg" /></td>
<?php
$tmpAR0=explode($this->sysSPLIT1,$tmpParameter[1]);
$tmpValues=explode($this->sysSPLIT1,$pColumn['Value']);
$tmpTexts=array();
if(count($tmpAR0)!=count($tmpValues)){
	$tmpValues=$tmpAR0;
}
array_pop($tmpValues);
$Coun0=0;
foreach($tmpValues as $Row0){
	$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpParameter[6]);
	$tmpSTR=str_replace('{Nets.ID}',$Row0,$tmpSTR);
	$tmpData1=$tmpDb->Search($tmpSTR);
	$tmpValue=$tmpDefaultValue;
	$tmpText=$tmpDefaultText;
	if(count($tmpData1)==1){
		$tmpValue=$tmpData1[0][$tmpParameter[2].'ID'];
		$tmpText=$tmpData1[0][$tmpParameter[2].'Name'];
	}
	$tmpTexts[]=$tmpText;
?>
<td class="ChildChoose_1"><a id="<?php echo($tmpControl); ?>_RowText_<?php echo($Coun0); ?>" href="#Here" class="Link1 FBlue1" onclick="<?php echo($tmpControl); ?>_JS.onOpen(<?php echo($Coun0); ?>);"><?php echo($tmpText); ?></a></td>
<?php $Coun0++; } ?>
<td><img src="<?php echo($this->sysFileConfig['sysCoreRoot']); ?>Ui/Common/Img/Control/childChoose_2.jpg" /></td></tr></table>
<!-- #Cells -->
<ul id="<?php echo($tmpControl); ?>_Cellsbox" class="ChildChooseX_CellsBox DHidden"></ul>
<!-- #Button -->
<ul class="ChildChoose_9">
<li class="ChildChoose_10"><input  id="<?php echo($tmpControl); ?>" name="<?php echo($tmpControl); ?>" type="text" value="<?php
foreach($tmpValues as $Row0){
	echo($Row0.$this->sysSPLIT1);
}
?>" /></li>
<li class="ChildChoose_5"><a href="#Here" class="Link1 FBlack3" onclick="<?php echo($tmpControl); ?>_JS.Reset(0);">重置</a></li>
<li class="DClear"></li></ul>
<?php echo ($tmpIntroduct); ?>
<!-- #JScript -->
<script type="text/javascript">
var Coun0=0;
var tmpAR0=new Array();
var tmpAR1=new Array();
<?php
$Coun0=0;
while(count($tmpValues)>$Coun0){ ?>
tmpAR0[Coun0]="<?php echo($tmpValues[$Coun0]); ?>";
tmpAR1[Coun0]="<?php echo($tmpTexts[$Coun0]); ?>";
Coun0++;
<?php
	$Coun0++;
}
?>
var <?php echo($tmpControl); ?>_JS=new childChooseX_Fixed();
<?php echo($tmpControl); ?>_JS.initial("<?php echo($tmpControl); ?>","<?php echo($this->sysFileConfig['sysCoreRoot'].$tmpParameter[5]); ?>",tmpAR0,tmpAR1);

</script>
<?php } ?><!--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
	}
}
?>