/** * Modify a sponsor saved in the database. * * @param Sponsor $sponsor * @return integer */ public function editSponsor(Sponsor $sponsor) { $sql = "UPDATE sponsor \n\t\t\tSET id_sponsor = '" . $sponsor->getIdSponsor() . "', name = '" . replaceCharacters($sponsor->getName()) . "', email = '" . $sponsor->getEmail() . "', website = '" . $sponsor->getWebsite() . "' WHERE id_sponsor = '" . $sponsor->getIdSponsor() . "'"; return DB::query($sql); }
/** * Renderize the view. * * @return null */ public function render(Sponsor $sponsor) { ?> <p> <?php echo REQUIRED_FIELDS_TEXT; ?> </p> <form action="<?php echo $this->generateURL('sponsor', 'edit', $sponsor->getIdSponsor()); ?> " method="post"> <fieldset> <div class="row"> <div class="col-md-6"> <div> <label for="name"> Nombre <small>(*)</small> </label> <input name="name" type="text" required value="<?php echo $sponsor->getName(); ?> " /> </div> <div> <label for="email"> Email <small>(*)</small> </label> <input name="email" type="text" required value="<?php echo $sponsor->getEmail(); ?> " /> </div> </div> <div class="col-md-6"> <div> <label for="website"> Web <small>(*)</small> </label> <input name="website" type="text" required value="<?php echo $sponsor->getWebsite(); ?> " /> </div> <div> <input type="submit" value="Modificar" /> </div> </div> </div> </fieldset> </form> <?php }