/** * 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> <div class="col-md-6"> <div> <input type="submit" value="Modificar" /> </div> </div> </div> </fieldset> </form> <?php }
/** * 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); }
/** * 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()) . "' WHERE id_slider = '" . $slider->getIdSlider() . "'"; return DB::query($sql); }