<?php
header("Content-Type: application/xhtml+xml; charset=utf8"); 
$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  width="155" onclick="scrollFunction('<?=$key?>'); return false;" style="cursor:pointer;font-family: Arial, Helvetica, sans-serif;color: #2E3192;font-size: 15px;padding: 10px 10px;background-color: #FFF;font-weight: 600;border: 1px solid #dedede;"><?=$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; 
							$j=0;?>
		        			<? foreach ($value['submenu'] as $key2 => $value2){ ?>
		        				<? if ($value2['Access'] && $value2['TaskType'] == 'proc'){ 
								$j++;?>
		            <tr>
		              <td width="24" height="19" align="center" valign="middle" class="iconMenu">
		              	<i class="fa fa-arrow-right"></i>
		              </td>
					
					<td width="136" id="<?=$key.$contFor2?>" <?if($contFor1 == 0 && $contFor2 == 0){ ?> class="textMenuOver opcionI" <?php }else{ ?> class="textMenu opcionI" <?php }?> onclick="objMainTab.reqBody('<?=$value2['tasks']['PathScriptId']?>','<?= $key?>');cargarOpcionesMI('<?=$key.$contFor2?>')"><?=$value2['ButtonText']?></td>
		            </tr>
		            			<? if($contFor1 == 0 && $contFor2 == 0) { echo javascript_tag("$('contentResult').innerHTML = '<iframe name=\"contentResultxx\" id=\"contentResultxx\" width=\"100%\" style=\"display: block;height:100%\"  height=\"100%\" src=\"\" frameborder=\"0\"></iframe>';"); echo javascript_tag("objMainTab.reqBody('".$value2['tasks']['PathScriptId']."','".$key."');"); } ?>
		            			<? $contFor2++; ?>
		            		<? } ?>
		            	<?php
		        			 } ?>
		            <? } ?>
		        	</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>