<?php
header("Content-Type: application/xhtml+xml; charset=iso-8859-1"); 
$ob_sfUser		= myUser::getUser();
$taskId				= $taskId;
//$this->block	= $this->getRequestParameter('typeClass');

$ob_SubMenu = new menu_class;
$ob_SubMenu->getInit($ob_sfUser->getRoleId());

$menu_2nd = $ob_SubMenu->getMenu($taskId);

foreach ($menu_2nd as $key => $val){

	$menu_3nd = $ob_SubMenu->getMenu($val['TaskId']);

	if(sizeof($menu_3nd) > 0){

		foreach ($menu_3nd as $key1 => $val2){

			$pila = $ob_SubMenu->getTask($val2['TaskId']);
			$pila = array('tasks'=>$pila);
			$menu_3nd[$key1] = array_merge($menu_3nd[$key1], $pila);

		}

		$pila = array('submenu'=>$menu_3nd);
		$menu_2nd[$key] = array_merge($menu_2nd[$key], $pila);

	}

}

ViewResponse::getInstance()->setMethodAjax();
?>
<? echo use_helper('Javascript'); ?>
<table border="0" cellpadding="0" cellspacing="0" class="leftMenu">
	<? if ( count ($menu_2nd) > 0){ ?>
		<? $contFor1 = 0; ?>
		<? foreach ($menu_2nd as $key => $value){ ?>
			<? if ($value['Access'] && $value['TaskType'] == 'menu'){ ?>
  <tr>
    <td>
    	<table class="menu" border="0" cellpadding="0" cellspacing="0">
	      <tr>
	        <td>
	        	<!--parte donde esta el titulo de la seccion del menu-->
	        	<table border="0" cellpadding="0" cellspacing="0" class="titleMenu">
	            <tr>
	              <td background="/images/common/css/main/menu_r2_c2.gif" width="5" height="21"></td>
	              <td background="/images/common/css/main/menu_r2_c3.gif" width="155" onclick="scrollFunction('<?=$key?>'); return false;" style="cursor:pointer; font-family:Verdana, Arial, Helvetica, sans-serif; color:#000099; font-size:11px;"><?=$value['ButtonText']?> </td>
	              <td background="/images/common/css/main/menu_r2_c5.gif" width="6" height="21"></td>
	            </tr>
	        	</table>
	       	</td>
	      </tr>
	      <tr>
	        <td>
	        	<!--sector de los procesos del menu-->
		        <div id="contentProcMenu_<?=$key?>" class="scrollTable" style="display:<?=$contFor1==0?"":"none";?>">
		        	<table border="0" cellpadding="0" cellspacing="0" class="elementMenu">
		        		<? if ( count ($value['submenu']) > 0){ ?>
		        			<? $contFor2 = 0; ?>
		        			<? foreach ($value['submenu'] as $key2 => $value2){ ?>
		        				<? if ($value2['Access'] && $value2['TaskType'] == 'proc'){ ?>
		            <tr>
		              <td width="24" height="19" align="center" valign="middle" class="iconMenu"><img src="<?=$value2['tasks']['PathImageId']?>" width="15" height="15"></td>
					        <td width="136" class="textMenu" onclick="objMainTab.reqBody('<?=$value2['tasks']['PathScriptId']?>','<?= $key?>');"><?=$value2['ButtonText']?></td>
		            </tr>
		            			<? if($contFor1 == 0 && $contFor2 == 0) { echo javascript_tag("$('contentResult').innerHTML = '<iframe name=\"contentResultxx\" id=\"contentResultxx\" width=\"100%\" height=\"100%\" src=\"\" frameborder=\"0\"></iframe>';"); echo javascript_tag("objMainTab.reqBody('".$value2['tasks']['PathScriptId']."','".$key."');"); } ?>
		            			<? $contFor2++; ?>
		            		<? } ?>
		            	<? } ?>
		            <? } ?>
		        	</table>
	        	</div>
	        </td>
	      </tr>
	    </table>
	  </td>
	</tr>
	
  <tr>
    <td>&nbsp;</td>
  </tr>
					<? $contFor1++; ?>
				<? } ?>
  	<? } ?>
  <? }else{      
  		 //echo javascript_tag("$('contentResult').innerHTML = '<iframe name=\"contentResultxx\" id=\"contentResultxx\" width=\"100%\" height=\"10%\" src=\"\"></iframe>';");
       echo javascript_tag("$('contentResult').innerHTML = '';");
  	 }
  ?>

</table>
</div>