<?php require_once '../classes/Diet.class.php'; $diet = new Diet(); $name = $_POST['name']; $iddish = $diet->addIngredient($name);
<?php require_once '../templates/mainbar.php'; require_once '../classes/Diet.class.php'; ?> <link href="<?php echo $CFG->dircss; ?> "type='text/css' rel='stylesheet'> <?php $diet = new Diet(); $combineds = $diet->combineDishes(); if (!is_array($combineds)) { echo '<div class="alert alert-dismissable alert-danger">' . $combineds . '</div>'; return false; } $weekdays = array('LUNES', 'MARTES', 'MIÉRCOLES', 'JUEVES', 'VIERNES', 'SÁBADO', 'DOMINGO'); $th = '<th></th><th></th>'; for ($i = 0; $i < DAYS; $i++) { $th .= '<th>' . $weekdays[$i] . '</th><th class="success">Kcal</th>'; } $data = '<div id="dishlist-tbl">'; $data .= '<legend>Cuadro semanal</legend>'; $data .= '<table class="table table-striped table-hover">'; $data .= $th . '</tr><tr>'; $cont = 0; $totalkcal = array(); $a = 0; $i = 0; while ($i < count($combineds)) { $totalkcal[] = $combineds[$i]['totalkcal'];
<?php require_once '../templates/mainbar.php'; require_once '../classes/Diet.class.php'; $diet = new Diet(); $dishesarray = $diet->getDishes(1); $dishesarray2 = $diet->getDishes(2); $dishesarray = array_merge($dishesarray, $dishesarray2); $orden = array(); foreach ($dishesarray as $key => $row) { $orden[$key] = strtoupper($row['name']); } array_multisort($orden, SORT_ASC, $dishesarray); $data = '<div id="dishlist-tbl">'; $data .= '<legend>Lista de platos</legend>'; $data .= '<table class="table table-striped table-hover"><th>Nombre</th><th>Kcal</th><th>Acciones</th>'; foreach ($dishesarray as $disharray) { $data .= '<tr><td><a href="http://localhost/dietplanner/requests/getDish.php?id=' . $disharray['id'] . '">' . $disharray['name'] . '</a></td>'; $data .= '<td>' . $disharray['kcal'] . '</td>'; $data .= '<td><span class="glyphicon glyphicon-pencil" alt="Editar"></span></button></td></tr>'; } $data .= '</table>'; echo $data;
<?php require_once '../classes/Diet.class.php'; $diet = new Diet(); $name = $_POST['name']; $kcal = $_POST['kcal']; $dish = $_POST['type']; $iddish = $diet->setDish($name, $kcal, $dish); $ingredientsarray = $_POST['ingredientes']; $diet->setIngredients($iddish, $ingredientsarray);