<!--Tabella del menù-->
	<table width="100%">
		<tr bgcolor="#C0C0C0">
			<th>Giorno</th>
			<th>Colazione</th>
			<th>Spuntino Mattutino</th>
			<th>Pranzo</th>
			<th>Spuntino Pomeridiano</th>
			<th>Cena</th>

		</tr>

		<?php 
$mgr = new MenuManager();
$menu = $mgr->getMenuByPaziente($paziente);
?>
		<tbody>
  			<?php 
foreach ($menu as $m) {
    ?>
	  <tr class="table-row">
		  <td><?php 
    echo $m->giornoDellaSettimana;
    ?>
</td>
		  <td id="<?php 
    echo "colazione:", $m->idMenu;
    ?>
" contenteditable="true"><?php 
    echo $m->colazione;
<?php

include_once "MenuManager.php";
include_once "Menu.php";
$menMan = new MenuManager();
if (isset($_GET['userId'])) {
    $pazienteId = $_GET['userId'];
    $menus = $menMan->getMenuByPaziente($pazienteId);
    if (count($menus) > 0) {
        echo "<script type='text/javascript'>\n                   newUrl= 'modificaMenuSettimanale.php?id='+'{$pazienteId}'\n                window.location.replace(newUrl);\n            </script>";
    } else {
        $res = $menMan->creaMenu($pazienteId);
        echo "<script type='text/javascript'>\n                   newUrl= 'modificaMenuSettimanale.php?id='+'{$pazienteId}'\n                window.location.replace(newUrl);\n            </script>";
    }
} else {
    if (!empty($_POST)) {
        foreach ($_POST as $field_name => $val) {
            //clean post values
            $field_userid = strip_tags(trim($field_name));
            //separiamo dalla stringa ricevuta l'id dal nome della colonna
            $split_data = explode(':', $field_userid);
            $menuId = $split_data[1];
            $field_name = $split_data[0];
            if (!empty($menuId) && !empty($field_name) && !empty($val)) {
                //update the values
                $res = $menMan->modificaMenu($field_name, $val, $menuId);
                if (!$res) {
                    //echo "Errore nella query al database";
                }
            } else {
                echo "Invalid Requests";
Exemplo n.º 3
0
			<style type="text/css">
			table{ border-collapse:collapse;
				   width:100%;
				   height:70%;}
			table,td,th{ border: 2px solid black;}
			#bottone{heigh:150px;
					 width:100px;}
			</style>
			
			
	</head>
	
	<body>
	<?php 
$menuMgr = new MenuManager();
$menu = $menuMgr->getMenuByPaziente($emailPaziente);
if (count($menu) == 0) {
    echo "<h3  class='result'>Nessun menu trovato. Riprovare tra qualche ora o contattare il medico";
} else {
    ?>
	<p style="font-size:120%;
			  text-align:left;">
	Menù settimanale
	</p>
	
	<!--Tabella del menù-->
	<table width="100%">
		<tr bgcolor="#C0C0C0">
		<th>Giorno</th>
		<th>Colazione</th>
		<th>Spuntino Mattutino</th>