updates
This commit is contained in:
parent
5dfd0e8895
commit
dad530edb4
@ -32,7 +32,7 @@ class formAddPromotion extends Form{
|
|||||||
<input type="text" name="tittle" id="tittle" placeholder="Título" required/><pre>'.$errorTittle.'</pre>
|
<input type="text" name="tittle" id="tittle" placeholder="Título" required/><pre>'.$errorTittle.'</pre>
|
||||||
<input type="text" name="description" id="description" placeholder="Descripción" required/><pre>'.$errorDescription.'</pre>
|
<input type="text" name="description" id="description" placeholder="Descripción" required/><pre>'.$errorDescription.'</pre>
|
||||||
<input type="text" name="code" id="code" placeholder="Codigo" required/><pre>'.$errorCode.'</pre>
|
<input type="text" name="code" id="code" placeholder="Codigo" required/><pre>'.$errorCode.'</pre>
|
||||||
<input type="text" name="active" id="active" placeholder="Activo" required/><pre>'.$errorActive.'</pre>
|
<input type="text" name="active" id="active" placeholder="Activo (si/no)" required/><pre>'.$errorActive.'</pre>
|
||||||
<div class="file">Imagen promocional:<input type="file" name="archivo" id="file" placeholder="Imagen promocional" /></div>
|
<div class="file">Imagen promocional:<input type="file" name="archivo" id="file" placeholder="Imagen promocional" /></div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
@ -67,10 +67,18 @@ class formAddPromotion extends Form{
|
|||||||
$result['code'] = "El idioma no es válido";
|
$result['code'] = "El idioma no es válido";
|
||||||
}
|
}
|
||||||
|
|
||||||
$active = $this->test_input($datos['active']) ?? null;
|
$active = strtolower($this->test_input($datos['active'])) ?? null;
|
||||||
//|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $description)
|
//|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $description)
|
||||||
if ( $active>1 ||$active<0 ) {
|
if ( strcmp($active,"si") == 0 || strcmp($active,"no") == 0) {
|
||||||
$result['active'] = "La descripcion no es válida";
|
if ( strcmp($active,"si") == 0 ) {
|
||||||
|
$boolean = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$boolean = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$result['active'] = "El valor activo debe ser si/no";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($result) === 0) {
|
if (count($result) === 0) {
|
||||||
@ -113,7 +121,7 @@ class formAddPromotion extends Form{
|
|||||||
// $result['img'] = 'Error al mover el archivo';
|
// $result['img'] = 'Error al mover el archivo';
|
||||||
//}
|
//}
|
||||||
//$nombreBd = str_replace("_", " ", $nombre);
|
//$nombreBd = str_replace("_", " ", $nombre);
|
||||||
$bd->createPromotion(null, $tittle,$description,$code,$active, $nombreBd);
|
$bd->createPromotion(null, $tittle,$description,$code,$boolean, $nombreBd);
|
||||||
$_SESSION['message'] = "<div class='row'>
|
$_SESSION['message'] = "<div class='row'>
|
||||||
<div class='column side'></div>
|
<div class='column side'></div>
|
||||||
<div class='column middle'>
|
<div class='column middle'>
|
||||||
@ -131,7 +139,8 @@ class formAddPromotion extends Form{
|
|||||||
}else {
|
}else {
|
||||||
$result['img'] = 'El archivo tiene un nombre o tipo no soportado';
|
$result['img'] = 'El archivo tiene un nombre o tipo no soportado';
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$result['img'] = 'Error al subir el archivo.';
|
$result['img'] = 'Error al subir el archivo.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,10 +74,18 @@ class formEditPromotion extends Form{
|
|||||||
$result['code'] = "El idioma no es válido";
|
$result['code'] = "El idioma no es válido";
|
||||||
}
|
}
|
||||||
|
|
||||||
$active = $this->test_input($datos['active']) ?? null;
|
$active = strtolower($this->test_input($datos['active'])) ?? null;
|
||||||
//|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $description)
|
//|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $description)
|
||||||
if ( $active>1 ||$active<0 ) {
|
if ( strcmp($active,"si") == 0 || strcmp($active,"no") == 0) {
|
||||||
$result['active'] = "La descripcion no es válida";
|
if ( strcmp($active,"si") == 0 ) {
|
||||||
|
$boolean = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$boolean = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$result['active'] = "El valor activo debe ser si/no";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($result) === 0) {
|
if (count($result) === 0) {
|
||||||
@ -118,7 +126,7 @@ class formEditPromotion extends Form{
|
|||||||
// $result['img'] = 'Error al mover el archivo';
|
// $result['img'] = 'Error al mover el archivo';
|
||||||
//}
|
//}
|
||||||
//$nombreBd = str_replace("_", " ", $nombre);
|
//$nombreBd = str_replace("_", " ", $nombre);
|
||||||
$bd->editPromotion($id, $tittle,$description,$code,$active, $nombreBd);
|
$bd->editPromotion($id, $tittle,$description,$code,$boolean, $nombreBd);
|
||||||
$_SESSION['message'] = "<div class='row'>
|
$_SESSION['message'] = "<div class='row'>
|
||||||
<div class='column side'></div>
|
<div class='column side'></div>
|
||||||
<div class='column middle'>
|
<div class='column middle'>
|
||||||
|
@ -382,7 +382,12 @@
|
|||||||
$tittles[$key] = $value->getTittle();
|
$tittles[$key] = $value->getTittle();
|
||||||
$descriptions[$key] = $value->getDescription();
|
$descriptions[$key] = $value->getDescription();
|
||||||
$codes[$key] = $value->getCode();
|
$codes[$key] = $value->getCode();
|
||||||
$actives[$key] = $value->getActive();
|
if ($value->getActive() == 0) {
|
||||||
|
$actives[$key] = "si";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$actives[$key] = "no";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$reply= "<div class='row'>
|
$reply= "<div class='row'>
|
||||||
|
Loading…
Reference in New Issue
Block a user