/** * Renderize the view. * * @return null */ public function render(Myth $myth) { ?> <p> <?php echo REQUIRED_FIELDS_TEXT; ?> </p> <form action="<?php echo $this->generateURL('myth', 'edit', $myth->getIdMyth()); ?> " method="post"> <fieldset> <div class="row"> <div class="col-md-6"> <div> <label for="text_myth"> Texto <small>(*)</small> </label> <input name="text_myth" type="text" required value="<?php echo $myth->getTextMyth(); ?> " /> </div> </div> <div class="col-md-6"> <div> <input type="submit" value="Modificar" /> </div> </div> </div> </fieldset> </form> <?php }
/** * Modify a myth saved in the database. * * @param Myth $myth * @return integer */ public function editMyth(Myth $myth) { $sql = "UPDATE myth \n\t\t\tSET id_myth = '" . $myth->getIdMyth() . "', text_myth = '" . $myth->getTextMyth() . "' WHERE id_myth = '" . $myth->getIdMyth() . "'"; return DB::query($sql); }