/** * Modify a slider saved in the database. * * @param Slider $slider * @return integer */ public function editSlider(Slider $slider) { $sql = "UPDATE slider \n\t\t\tSET id_slider = '" . $slider->getIdSlider() . "', title = '" . replaceCharacters($slider->getTitle()) . "', body = '" . $this->formatBody(replaceCharacters($slider->getBody())) . "', link = '" . $slider->getLink() . "' WHERE id_slider = '" . $slider->getIdSlider() . "'"; return DB::query($sql); }
/** * Renderize the view. * * @return null */ public function render(Slider $slider) { ?> <p> <?php echo REQUIRED_FIELDS_TEXT; ?> </p> <form action="<?php echo $this->generateURL('slider', 'edit', $slider->getIdSlider()); ?> " method="post"> <fieldset> <div class="row"> <div class="col-md-6"> <div> <label for="title"> Título <small>(*)</small> </label> <input name="title" type="text" required value="<?php echo $slider->getTitle(); ?> " /> </div> <div> <label for="body"> Cuerpo <small>(*)</small> </label> <textarea name="body" required><?php echo $slider->getBody(); ?> </textarea> </div> </div> <div class="col-md-6"> <div> <label for="link"> Link </label> <input name="link" type="text" value="<?php echo $slider->getLink(); ?> " /> </div> <div> <input type="submit" value="Modificar" /> </div> </div> </div> </fieldset> </form> <?php }