public function testGettersAndSetters() { foreach ($this->clients as $client) { $c = new Client(); $c->setUser($client['user']); $c->setToken($client['token']); $this->assertEquals($client['user'], $c->getUser()); $this->assertEquals($client['token'], $c->getToken()); } }
/** * Renderize the view. * * @return null */ public function render(Client $client) { ?> <!-- JQUERY UI --> <link type="text/css" rel="stylesheet" href="<?php echo APP_PATH; ?> /css/jquery-ui.min.css"> <link type="text/css" rel="stylesheet" href="<?php echo APP_PATH; ?> /css/jquery-ui.theme.min.css"> <script type="text/javascript" src="<?php echo APP_PATH; ?> /js/jquery-ui.min.js"></script> <script type="text/javascript"> $(function(){ $("#date_suscription").datepicker({dateFormat: "yy-mm-dd"}); }); </script> <p> <?php echo REQUIRED_FIELDS_TEXT; ?> </p> <form action="<?php echo $this->generateURL('client', 'edit', $client->getIdClient()); ?> " method="post"> <fieldset> <div class="row"> <div class="col-md-6"> <div> <label for="category"> Categoría <small>(*)</small> </label> <select name="category" required> <option value=""> Seleccionar </option> <?php if ($client->getCategory() === "Socio") { ?> <option value="Socio" selected> Socio </option> <option value="Suscriptor"> Suscriptor </option> <?php } else { if ($client->getCategory() === "Suscriptor") { ?> <option value="Socio"> Socio </option> <option value="Suscriptor" selected> Suscriptor </option> <?php } else { ?> <option value="Socio"> Socio </option> <option value="Suscriptor"> Suscriptor </option> <?php } } ?> </select> </div> <div> <label for="client_name"> Nombre <small>(*)</small> </label> <input name="client_name" type="text" required value="<?php echo $client->getClientName(); ?> " /> </div> <div> <label for="agent"> Representante <small>(*)</small> </label> <input name="agent" type="text" required value="<?php echo $client->getAgent(); ?> " /> </div> <div> <label for="address"> Dirección <small>(*)</small> </label> <input name="address" type="text" required value="<?php echo $client->getAddress(); ?> " /> </div> <div> <label for="phone"> Teléfono <small>(*)</small> </label> <input name="phone" type="tel" required value="<?php echo $client->getPhone(); ?> " /> </div> </div> <div class="col-md-6"> <div> <label for="email"> Correo electrónico <small>(*)</small> </label> <input name="email" type="email" required value="<?php echo $client->getEmail(); ?> " /> </div> <div> <label for="website"> Sitio web </label> <input name="website" type="url" value="<?php echo $client->getWebsite(); ?> " /> </div> <div> <label for="user"> Usuario <small>(*)</small> </label> <input name="user" type="text" required value="<?php echo $client->getUser(); ?> " /> </div> <div> <label for="email"> Contraseña <small>(*)</small> </label> <input name="password" type="text" required /> </div> <div> <label for="date_suscription"> Fecha Suscripción <small>(*)</small> </label> <input id="date_suscription" name="date_suscription" type="text" required value="<?php echo $client->getDateSuscription(); ?> "/> </div> <div> <input type="submit" value="Modificar" /> </div> </div> </div> </fieldset> </form> <?php }
/** * Modify a client saved in the database. * * @param Client $client * @return integer */ public function editClient(Client $client) { $mcrypt = new MCrypt(); $sql = "UPDATE client \n\t\t\tSET id_client = '" . $client->getIdClient() . "', client_name = '" . replaceCharacters($client->getClientName()) . "', agent = '" . replaceCharacters($client->getAgent()) . "', address = '" . replaceCharacters($client->getAddress()) . "', phone = '" . $client->getPhone() . "', email = '" . $client->getEmail() . "', website = '" . $client->getWebsite() . "', user = '******', password = '******' WHERE id_client = '" . $client->getIdClient() . "'"; return DB::query($sql); }
/** * Renderize the view. * * @return null */ public function render(Client $client) { ?> <p> <?php echo REQUIRED_FIELDS_TEXT; ?> </p> <form action="<?php echo $this->generateURL('client', 'edit', $client->getIdClient()); ?> " method="post"> <fieldset> <div class="row"> <div class="col-md-6"> <div> <label for="client_name"> Nombre <small>(*)</small> </label> <input name="client_name" type="text" required value="<?php echo $client->getClientName(); ?> " /> </div> <div> <label for="agent"> Representante <small>(*)</small> </label> <input name="agent" type="text" required value="<?php echo $client->getAgent(); ?> " /> </div> <div> <label for="address"> Dirección <small>(*)</small> </label> <input name="address" type="text" required value="<?php echo $client->getAddress(); ?> " /> </div> <div> <label for="phone"> Teléfono <small>(*)</small> </label> <input name="phone" type="tel" required value="<?php echo $client->getPhone(); ?> " /> </div> </div> <div class="col-md-6"> <div> <label for="email"> Correo electrónico <small>(*)</small> </label> <input name="email" type="email" required value="<?php echo $client->getEmail(); ?> " /> </div> <div> <label for="website"> Sitio web </label> <input name="website" type="url" value="<?php echo $client->getWebsite(); ?> " /> </div> <div> <label for="user"> Usuario <small>(*)</small> </label> <input name="user" type="text" required value="<?php echo $client->getUser(); ?> " /> </div> <div> <label for="email"> Contraseña <small>(*)</small> </label> <input name="password" type="text" required value="<?php echo $client->getPassword(); ?> " /> </div> <div> <input type="submit" value="Modificar" /> </div> </div> </div> </fieldset> </form> <?php }