<?php
require_once GTFWConfiguration::GetValue( 'application', 'docroot').
'module/golongan_bidang/response/ProcessBidang.proc.class.php';
require_once GTFWConfiguration::GetValue( 'application', 'docroot').
'module/golongan_bidang/response/ProcessGolongan.proc.class.php';

class DoDelete extends JsonResponse {

   function TemplateModule() {
   }
   
   function ProcessRequest() {
		$golId = array();
		$bidangId = array();
		
		foreach($_POST['idDelete']->AsArray() as $value)
		{
			if (is_numeric($value)) $bidangId['idDelete'][] = $value;
			else $golId['idDelete'][] = substr($value, 3);
		}
		
		if (count($bidangId)!== 0)
		{
			$_POST = SanitizerFactory::Wrap($bidangId);
			$Obj = new ProcessBidang();
			$urlRedirect = $Obj->Delete();     
      }
		
		if (count($golId)!== 0)
		{
			$_POST = SanitizerFactory::Wrap($golId);
			$Obj = new ProcessGolongan();
			$urlRedirect = $Obj->Delete();     
      }
		
      return array( 'exec' => 'GtfwAjax.replaceContentWithUrl("subcontent-element","'.$urlRedirect.'&ascomponent=1")');       
    }

   function ParseTemplate($data = NULL) {
   }
}
?>
