<?php

class netsCollection extends netsError {
	private $sysErrorClassID='0000';
	private $sysErrorFuncID=0;
	private $sysErrorID=0;
   
	public $sCharset='UTF-8';
	public $sSPLIT1='---#Rtb.Parameter---';

	public function netsCollection(){
		$this->netsError();
	}

	public function onCollection($pURLS,$pRULE,$pType,&$pData){
		$tmpContents=array();
		//-- ------ #Content ------ --
		$tmpCONTENT=$this->readURL($pURLS[0]);
		$tmpCONTENT=iconv($this->sCharset,$this->sysCharset.'//IGNORE',$tmpCONTENT);
		//-- ------ #Clear ------ --
		$tmpAR0=explode($pRULE[5],$tmpCONTENT);
		$tmpAR0=explode($pRULE[4],$tmpAR0[0]);
		$tmpContentRows=array();
		if(count($tmpAR0)>1){
			$tmpContentRows=explode($pRULE[6],$tmpAR0[1]);
		}else{
			$tmpContentRows=explode($pRULE[6],$tmpAR0[0]);
		}
		//-- ------ #Rows ------ --
		$Coun0=0;
		foreach($tmpContentRows as $Row0){
			//-- ------ #Columns ------ --
			$tmpRowContent=$Row0;
			$tmpRowAR=array();
			$tmpRowSTR=$pRULE[2];
			$Coun1=7;
			while(count($pRULE)>$Coun1){
				//-- ### --
				$tmpColumnRule=$pRULE[$Coun1];
				$tmpAR0=explode($tmpColumnRule[1],$tmpRowContent);
				if(count($tmpAR0)<=1){
					$tmpAR0=array('','',);
				}
				$tmpAR0=explode($tmpColumnRule[2],$tmpAR0[1]);
				if(count($tmpAR0)<=1){
					$tmpAR0=array('','',);
				}
				$tmpRowSTR=str_replace($tmpColumnRule[3],$tmpAR0[0],$tmpRowSTR);
				$tmpRowAR[$tmpColumnRule[3]]=$tmpAR0[0];
				//-- ### --
				$tmpSTR='';
				$tmpAR0=explode($tmpColumnRule[2],$tmpRowContent);
				$Coun2=1;
				while(count($tmpAR0)>$Coun2){
					$tmpSTR.=$tmpAR0[$Coun2].$tmpColumnRule[2];
					$Coun2++;
				}
				$tmpRowContent=$tmpSTR;
				$Coun1++;
			}
			//-- ### --
			$tmpRowSTR=str_replace('{Nets.INDEX}',$Coun0,$tmpRowSTR);
			$tmpRowSTR=str_replace('{Nets.INPUT}',$pURLS[0],$tmpRowSTR);
			$tmpURL=explode($this->sSPLIT1,$pURLS[0]);
			$Coun1=0;
			foreach($tmpURL as $Row1){
				$tmpRowSTR=str_replace('{Nets.Parameter_'.$Coun1.'}',$Row1,$tmpRowSTR);
				$Coun1++;
			}
			//-- ### --
			$tmpRowAR['{Nets.INDEX}']=$Coun0;
			$tmpRowAR['{Nets.INPUT}']=$pURLS[0];
			//-- ### --
			if ($pType==0) {
				$tmpContents[]=$tmpRowAR;
			}else {
				$tmpContents[]=$tmpRowSTR;
			}
			
			$Coun0++;
		}

		$pData=$tmpContents;
		return 0;
   }
   
}

?>