<?php

$modificar = $_GET['modificar'];
$eliminar = $_GET['eliminar'];
$visibleM = '';
$visibleE = '';
if ($modificar == 1) {
    $visibleM = 'inline-block;';
} else {
    $visibleM = 'none;';
}
if ($eliminar == 1) {
    $visibleE = 'inline-block;';
} else {
    $visibleE = 'none;';
}
$tiponormalegal = \App\TipoNormaLegal::All();
$row = array();
foreach ($tiponormalegal as $key => $value) {
    $row[$key][] = '<a href="tiponormalegal/' . $value['idTipoNormaLegal'] . '/edit">' . '<span class="glyphicon glyphicon-pencil" style = "display:' . $visibleM . '"></span>' . '</a>&nbsp;' . '<a href="tiponormalegal/' . $value['idTipoNormaLegal'] . '/edit?accion=eliminar">' . '<span class="glyphicon glyphicon-trash" style = "display:' . $visibleE . '"></span>' . '</a>';
    $row[$key][] = $value['idTipoNormaLegal'];
    $row[$key][] = $value['codigoTipoNormaLegal'];
    $row[$key][] = $value['nombreTipoNormaLegal'];
}
$output['aaData'] = $row;
echo json_encode($output);
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $frecuenciaMedicion = \App\FrecuenciaMedicion::All()->lists('nombreFrecuenciaMedicion', 'idFrecuenciaMedicion');
     $idTipoNormaLegal = \App\TipoNormaLegal::All()->lists('idTipoNormaLegal');
     $nombreTipoNormaLegal = \App\TipoNormaLegal::All()->lists('nombreTipoNormaLegal');
     $idExpideNormaLegal = \App\ExpideNormaLegal::All()->lists('idExpideNormaLegal');
     $nombreExpideNormaLegal = \App\ExpideNormaLegal::All()->lists('nombreExpideNormaLegal');
     $matrizLegal = \App\MatrizLegal::find($id);
     return view('matrizlegal', compact('idTipoNormaLegal', 'nombreTipoNormaLegal', 'idExpideNormaLegal', 'nombreExpideNormaLegal', 'frecuenciaMedicion'), ['matrizLegal' => $matrizLegal]);
 }