mejoras realizadas a url

parent 75f0ccfb
......@@ -28,9 +28,7 @@
<div class="container">
<form class="form">
<div class="card-body">
<div class="form-group">
{%include 'backend_content/includes/messagesCrearCampania.html.twig'%}
</div>
<div class="form-group row">
<input id="jsonContenido" type="hidden" value="{{jsonContenido}}"/>
<div class="col-lg-12">
......@@ -83,6 +81,13 @@
<span class="form-text text-muted">Ingrese el código pixel facebook.</span>
</div>
</div>
<div class="form-group row">
<div class="col-lg-12">
<label>Url Campaña:</label>
<input id="url_campania" type="text" class="form-control" value="{{campania.getCamUrlFinalCampania()}}" placeholder=""/>
<span class="form-text text-muted">Url generada para la campaña.</span>
</div>
</div>
</div>
<!--begin::Card-->
<div class="card card-custom">
......@@ -114,8 +119,15 @@
<button type="reset" class="btn btn-danger">Borrar</button>
</div>#}
</div>
<br>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
{%include 'backend_content/includes/messagesCrearCampania.html.twig'%}
</div>
</div>
</div>
</form>
</div>
<!--end::Container-->
</div>
......@@ -186,15 +198,15 @@
var startDate = moment();
var endDate = moment().add(1, 'days');
if($("#fechaInicioActual").val() == ""){
if ($("#fechaInicioActual").val() == "") {
startDate = moment();
}else{
} else {
startDate = moment($("#fechaInicioActual").val(), "YYYY/MM/DD");
}
if($("#fechaFinActual").val() == ""){
if ($("#fechaFinActual").val() == "") {
endDate = moment().add(1, 'days');
}else{
} else {
endDate = moment($("#fechaFinActual").val(), "YYYY/MM/DD");
}
......@@ -607,7 +619,7 @@
lastIndex = data.contenidoId;
var valorFila = data.filaValor;
json.id = lastIndex;
var actionColumns = '\n\<a id="edit_'+lastIndex+'" href="" onclick="showModalEditar(event,'+lastIndex+')" class="navi-link"><span class="btn btn-icon btn-light btn-hover-primary btn-sm"><i class="fa fa-lg fa-edit"></i></span></a>\n\
var actionColumns = '\n\<a id="edit_' + lastIndex + '" href="" onclick="showModalEditar(event,' + lastIndex + ')" class="navi-link"><span class="btn btn-icon btn-light btn-hover-primary btn-sm"><i class="fa fa-lg fa-edit"></i></span></a>\n\
<a id="delete_' + lastIndex + '" href="" onclick="eliminarContenido(event,' + lastIndex + ')" class="navi-link">\n\
<span class="btn btn-icon btn-light btn-hover-primary btn-sm">\n\
<i class="fa fa-lg fa-trash"></i>\n\
......@@ -666,7 +678,7 @@
var formData = new FormData();
var url = "{{path('campania_update_contenido')}}";
formData.append("campaniaId", campaniaId);
formData.append("contenidoId", conId );
formData.append("contenidoId", conId);
formData.append("disposicionId", $("#generador-contenido-selector-disposicion-entorno-columnasEditar").val());
formData.append("seccionId", $("#generador-contenido-selector-seccionEditar").val());
formData.append("filaId", $("#generador-contenido-selector-fila-editar").val());
......@@ -706,13 +718,14 @@
}
},
success: function (data) {
console.log(data);
$("#mensaje-exito-crear-campania").show();
$("#mensaje-error-crear-campania").hide();
$("#contenido-mensaje-crear-campania-exito").html(data.msg);
lastIndex = data.contenidoId;
var valorFila = data.filaValor;
json.id = lastIndex;
var actionColumns = '\n\<a id="edit_'+lastIndex+'" href="" onclick="showModalEditar(event,'+lastIndex+')" class="navi-link"><span class="btn btn-icon btn-light btn-hover-primary btn-sm"><i class="fa fa-lg fa-edit"></i></span></a>\n\
var actionColumns = '\n\<a id="edit_' + lastIndex + '" href="" onclick="showModalEditar(event,' + lastIndex + ')" class="navi-link"><span class="btn btn-icon btn-light btn-hover-primary btn-sm"><i class="fa fa-lg fa-edit"></i></span></a>\n\
<a id="delete_' + lastIndex + '" href="" onclick="eliminarContenido(event,' + lastIndex + ')" class="navi-link">\n\
<span class="btn btn-icon btn-light btn-hover-primary btn-sm">\n\
<i class="fa fa-lg fa-trash"></i>\n\
......@@ -764,6 +777,9 @@
$("#btnGuardarGeneracionContenidoEditar").html("Guardar");
$("#btnGuardarGeneracionContenidoEditar").attr("disabled", false);
},
});
}
......@@ -912,7 +928,7 @@
}
function deleteFromJson(id) {
var jsonContenidoTemp = {'head': [], 'body': [] , 'footer': []};
var jsonContenidoTemp = {'head': [], 'body': [], 'footer': []};
for (var k = 0; k < jsonContenidoCampania["head"].length; k++) {
if (jsonContenidoCampania["head"][k]["id"] == id) {
......@@ -998,6 +1014,8 @@
$("#btnGuardarCampania").html("Guardar");
$("#btnGuardarCampania").attr("disabled", false);
$("#btnCancelarCampania").show();
//URL campania
$("#urlCampania").val(data.urlCampania);
}
});
}
......@@ -1111,6 +1129,8 @@
});
/**
* CARGA DEL DOCUMENTO
*
......@@ -1119,6 +1139,7 @@
jQuery(document).ready(function () {
calendariosContainer.init();
generateTable();
});
......
......@@ -53,6 +53,7 @@
<column name="ope_id" phpName="OpeId" type="INTEGER" required="false"/>
<column name="ser_id" phpName="SerId" type="INTEGER" required="false"/>
<column name="tem_id" phpName="TemId" type="INTEGER" required="false"/>
<column name="cam_unique_key" phpName="CamUniqueKey" type="LONGVARCHAR" required="false"/>
<column name="cam_nombre" phpName="CamNombre" type="VARCHAR" size="1000" required="false"/>
<column name="cam_titulo_lp" phpName="CamTituloLp" type="VARCHAR" size="1000" required="false"/>
<column name="cam_adwords" phpName="CamAdwords" type="VARCHAR" size="1000" required="false"/>
......
......@@ -13,4 +13,7 @@ class Template extends BaseTemplate
/*Eliminado*/
const ELIMINADO_TRUE = 1;
const ELIMINADO_FALSE = 0;
const TEMPLATE_1 = 1;
const TEMPLATE_2 = 2;
}
......@@ -46,6 +46,7 @@ class CampaniaTableMap extends TableMap
$this->addColumn('ope_id', 'OpeId', 'INTEGER', false, null, null);
$this->addColumn('ser_id', 'SerId', 'INTEGER', false, null, null);
$this->addForeignKey('tem_id', 'TemId', 'INTEGER', 'template', 'tem_id', false, null, null);
$this->addColumn('cam_unique_key', 'CamUniqueKey', 'LONGVARCHAR', false, null, null);
$this->addColumn('cam_nombre', 'CamNombre', 'VARCHAR', false, 1000, null);
$this->addColumn('cam_titulo_lp', 'CamTituloLp', 'VARCHAR', false, 1000, null);
$this->addColumn('cam_adwords', 'CamAdwords', 'VARCHAR', false, 1000, null);
......
......@@ -70,6 +70,12 @@ abstract class BaseCampania extends BaseObject implements Persistent
*/
protected $tem_id;
/**
* The value for the cam_unique_key field.
* @var string
*/
protected $cam_unique_key;
/**
* The value for the cam_nombre field.
* @var string
......@@ -241,6 +247,17 @@ abstract class BaseCampania extends BaseObject implements Persistent
return $this->tem_id;
}
/**
* Get the [cam_unique_key] column value.
*
* @return string
*/
public function getCamUniqueKey()
{
return $this->cam_unique_key;
}
/**
* Get the [cam_nombre] column value.
*
......@@ -588,6 +605,27 @@ abstract class BaseCampania extends BaseObject implements Persistent
return $this;
} // setTemId()
/**
* Set the value of [cam_unique_key] column.
*
* @param string $v new value
* @return Campania The current object (for fluent API support)
*/
public function setCamUniqueKey($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->cam_unique_key !== $v) {
$this->cam_unique_key = $v;
$this->modifiedColumns[] = CampaniaPeer::CAM_UNIQUE_KEY;
}
return $this;
} // setCamUniqueKey()
/**
* Set the value of [cam_nombre] column.
*
......@@ -905,19 +943,20 @@ abstract class BaseCampania extends BaseObject implements Persistent
$this->ope_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
$this->ser_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
$this->tem_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
$this->cam_nombre = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
$this->cam_titulo_lp = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
$this->cam_adwords = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
$this->cam_pixel_facebook = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
$this->cam_url_final_campania = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
$this->cam_tipo = ($row[$startcol + 9] !== null) ? (int) $row[$startcol + 9] : null;
$this->cam_estado = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null;
$this->cam_eliminado = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null;
$this->cam_fecha_inicio = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
$this->cam_fecha_fin = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null;
$this->cam_json_estructura = ($row[$startcol + 14] !== null) ? (string) $row[$startcol + 14] : null;
$this->created_at = ($row[$startcol + 15] !== null) ? (string) $row[$startcol + 15] : null;
$this->updated_at = ($row[$startcol + 16] !== null) ? (string) $row[$startcol + 16] : null;
$this->cam_unique_key = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
$this->cam_nombre = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
$this->cam_titulo_lp = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
$this->cam_adwords = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
$this->cam_pixel_facebook = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
$this->cam_url_final_campania = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
$this->cam_tipo = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null;
$this->cam_estado = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null;
$this->cam_eliminado = ($row[$startcol + 12] !== null) ? (int) $row[$startcol + 12] : null;
$this->cam_fecha_inicio = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null;
$this->cam_fecha_fin = ($row[$startcol + 14] !== null) ? (string) $row[$startcol + 14] : null;
$this->cam_json_estructura = ($row[$startcol + 15] !== null) ? (string) $row[$startcol + 15] : null;
$this->created_at = ($row[$startcol + 16] !== null) ? (string) $row[$startcol + 16] : null;
$this->updated_at = ($row[$startcol + 17] !== null) ? (string) $row[$startcol + 17] : null;
$this->resetModified();
$this->setNew(false);
......@@ -927,7 +966,7 @@ abstract class BaseCampania extends BaseObject implements Persistent
}
$this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 17; // 17 = CampaniaPeer::NUM_HYDRATE_COLUMNS.
return $startcol + 18; // 18 = CampaniaPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating Campania object", $e);
......@@ -1218,6 +1257,9 @@ abstract class BaseCampania extends BaseObject implements Persistent
if ($this->isColumnModified(CampaniaPeer::TEM_ID)) {
$modifiedColumns[':p' . $index++] = '`tem_id`';
}
if ($this->isColumnModified(CampaniaPeer::CAM_UNIQUE_KEY)) {
$modifiedColumns[':p' . $index++] = '`cam_unique_key`';
}
if ($this->isColumnModified(CampaniaPeer::CAM_NOMBRE)) {
$modifiedColumns[':p' . $index++] = '`cam_nombre`';
}
......@@ -1280,6 +1322,9 @@ abstract class BaseCampania extends BaseObject implements Persistent
case '`tem_id`':
$stmt->bindValue($identifier, $this->tem_id, PDO::PARAM_INT);
break;
case '`cam_unique_key`':
$stmt->bindValue($identifier, $this->cam_unique_key, PDO::PARAM_STR);
break;
case '`cam_nombre`':
$stmt->bindValue($identifier, $this->cam_nombre, PDO::PARAM_STR);
break;
......@@ -1494,42 +1539,45 @@ abstract class BaseCampania extends BaseObject implements Persistent
return $this->getTemId();
break;
case 4:
return $this->getCamNombre();
return $this->getCamUniqueKey();
break;
case 5:
return $this->getCamTituloLp();
return $this->getCamNombre();
break;
case 6:
return $this->getCamAdwords();
return $this->getCamTituloLp();
break;
case 7:
return $this->getCamPixelFacebook();
return $this->getCamAdwords();
break;
case 8:
return $this->getCamUrlFinalCampania();
return $this->getCamPixelFacebook();
break;
case 9:
return $this->getCamTipo();
return $this->getCamUrlFinalCampania();
break;
case 10:
return $this->getCamEstado();
return $this->getCamTipo();
break;
case 11:
return $this->getCamEliminado();
return $this->getCamEstado();
break;
case 12:
return $this->getCamFechaInicio();
return $this->getCamEliminado();
break;
case 13:
return $this->getCamFechaFin();
return $this->getCamFechaInicio();
break;
case 14:
return $this->getCamJsonEstructura();
return $this->getCamFechaFin();
break;
case 15:
return $this->getCreatedAt();
return $this->getCamJsonEstructura();
break;
case 16:
return $this->getCreatedAt();
break;
case 17:
return $this->getUpdatedAt();
break;
default:
......@@ -1565,19 +1613,20 @@ abstract class BaseCampania extends BaseObject implements Persistent
$keys[1] => $this->getOpeId(),
$keys[2] => $this->getSerId(),
$keys[3] => $this->getTemId(),
$keys[4] => $this->getCamNombre(),
$keys[5] => $this->getCamTituloLp(),
$keys[6] => $this->getCamAdwords(),
$keys[7] => $this->getCamPixelFacebook(),
$keys[8] => $this->getCamUrlFinalCampania(),
$keys[9] => $this->getCamTipo(),
$keys[10] => $this->getCamEstado(),
$keys[11] => $this->getCamEliminado(),
$keys[12] => $this->getCamFechaInicio(),
$keys[13] => $this->getCamFechaFin(),
$keys[14] => $this->getCamJsonEstructura(),
$keys[15] => $this->getCreatedAt(),
$keys[16] => $this->getUpdatedAt(),
$keys[4] => $this->getCamUniqueKey(),
$keys[5] => $this->getCamNombre(),
$keys[6] => $this->getCamTituloLp(),
$keys[7] => $this->getCamAdwords(),
$keys[8] => $this->getCamPixelFacebook(),
$keys[9] => $this->getCamUrlFinalCampania(),
$keys[10] => $this->getCamTipo(),
$keys[11] => $this->getCamEstado(),
$keys[12] => $this->getCamEliminado(),
$keys[13] => $this->getCamFechaInicio(),
$keys[14] => $this->getCamFechaFin(),
$keys[15] => $this->getCamJsonEstructura(),
$keys[16] => $this->getCreatedAt(),
$keys[17] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
......@@ -1641,42 +1690,45 @@ abstract class BaseCampania extends BaseObject implements Persistent
$this->setTemId($value);
break;
case 4:
$this->setCamNombre($value);
$this->setCamUniqueKey($value);
break;
case 5:
$this->setCamTituloLp($value);
$this->setCamNombre($value);
break;
case 6:
$this->setCamAdwords($value);
$this->setCamTituloLp($value);
break;
case 7:
$this->setCamPixelFacebook($value);
$this->setCamAdwords($value);
break;
case 8:
$this->setCamUrlFinalCampania($value);
$this->setCamPixelFacebook($value);
break;
case 9:
$this->setCamTipo($value);
$this->setCamUrlFinalCampania($value);
break;
case 10:
$this->setCamEstado($value);
$this->setCamTipo($value);
break;
case 11:
$this->setCamEliminado($value);
$this->setCamEstado($value);
break;
case 12:
$this->setCamFechaInicio($value);
$this->setCamEliminado($value);
break;
case 13:
$this->setCamFechaFin($value);
$this->setCamFechaInicio($value);
break;
case 14:
$this->setCamJsonEstructura($value);
$this->setCamFechaFin($value);
break;
case 15:
$this->setCreatedAt($value);
$this->setCamJsonEstructura($value);
break;
case 16:
$this->setCreatedAt($value);
break;
case 17:
$this->setUpdatedAt($value);
break;
} // switch()
......@@ -1707,19 +1759,20 @@ abstract class BaseCampania extends BaseObject implements Persistent
if (array_key_exists($keys[1], $arr)) $this->setOpeId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setSerId($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setTemId($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setCamNombre($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setCamTituloLp($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setCamAdwords($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setCamPixelFacebook($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setCamUrlFinalCampania($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setCamTipo($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setCamEstado($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setCamEliminado($arr[$keys[11]]);
if (array_key_exists($keys[12], $arr)) $this->setCamFechaInicio($arr[$keys[12]]);
if (array_key_exists($keys[13], $arr)) $this->setCamFechaFin($arr[$keys[13]]);
if (array_key_exists($keys[14], $arr)) $this->setCamJsonEstructura($arr[$keys[14]]);
if (array_key_exists($keys[15], $arr)) $this->setCreatedAt($arr[$keys[15]]);
if (array_key_exists($keys[16], $arr)) $this->setUpdatedAt($arr[$keys[16]]);
if (array_key_exists($keys[4], $arr)) $this->setCamUniqueKey($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setCamNombre($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setCamTituloLp($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setCamAdwords($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setCamPixelFacebook($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setCamUrlFinalCampania($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setCamTipo($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setCamEstado($arr[$keys[11]]);
if (array_key_exists($keys[12], $arr)) $this->setCamEliminado($arr[$keys[12]]);
if (array_key_exists($keys[13], $arr)) $this->setCamFechaInicio($arr[$keys[13]]);
if (array_key_exists($keys[14], $arr)) $this->setCamFechaFin($arr[$keys[14]]);
if (array_key_exists($keys[15], $arr)) $this->setCamJsonEstructura($arr[$keys[15]]);
if (array_key_exists($keys[16], $arr)) $this->setCreatedAt($arr[$keys[16]]);
if (array_key_exists($keys[17], $arr)) $this->setUpdatedAt($arr[$keys[17]]);
}
/**
......@@ -1735,6 +1788,7 @@ abstract class BaseCampania extends BaseObject implements Persistent
if ($this->isColumnModified(CampaniaPeer::OPE_ID)) $criteria->add(CampaniaPeer::OPE_ID, $this->ope_id);
if ($this->isColumnModified(CampaniaPeer::SER_ID)) $criteria->add(CampaniaPeer::SER_ID, $this->ser_id);
if ($this->isColumnModified(CampaniaPeer::TEM_ID)) $criteria->add(CampaniaPeer::TEM_ID, $this->tem_id);
if ($this->isColumnModified(CampaniaPeer::CAM_UNIQUE_KEY)) $criteria->add(CampaniaPeer::CAM_UNIQUE_KEY, $this->cam_unique_key);
if ($this->isColumnModified(CampaniaPeer::CAM_NOMBRE)) $criteria->add(CampaniaPeer::CAM_NOMBRE, $this->cam_nombre);
if ($this->isColumnModified(CampaniaPeer::CAM_TITULO_LP)) $criteria->add(CampaniaPeer::CAM_TITULO_LP, $this->cam_titulo_lp);
if ($this->isColumnModified(CampaniaPeer::CAM_ADWORDS)) $criteria->add(CampaniaPeer::CAM_ADWORDS, $this->cam_adwords);
......@@ -1814,6 +1868,7 @@ abstract class BaseCampania extends BaseObject implements Persistent
$copyObj->setOpeId($this->getOpeId());
$copyObj->setSerId($this->getSerId());
$copyObj->setTemId($this->getTemId());
$copyObj->setCamUniqueKey($this->getCamUniqueKey());
$copyObj->setCamNombre($this->getCamNombre());
$copyObj->setCamTituloLp($this->getCamTituloLp());
$copyObj->setCamAdwords($this->getCamAdwords());
......@@ -2577,6 +2632,7 @@ abstract class BaseCampania extends BaseObject implements Persistent
$this->ope_id = null;
$this->ser_id = null;
$this->tem_id = null;
$this->cam_unique_key = null;
$this->cam_nombre = null;
$this->cam_titulo_lp = null;
$this->cam_adwords = null;
......
......@@ -30,13 +30,13 @@ abstract class BaseCampaniaPeer
const TM_CLASS = 'AppBundle\\Model\\map\\CampaniaTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 17;
const NUM_COLUMNS = 18;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 17;
const NUM_HYDRATE_COLUMNS = 18;
/** the column name for the cam_id field */
const CAM_ID = 'campania.cam_id';
......@@ -50,6 +50,9 @@ abstract class BaseCampaniaPeer
/** the column name for the tem_id field */
const TEM_ID = 'campania.tem_id';
/** the column name for the cam_unique_key field */
const CAM_UNIQUE_KEY = 'campania.cam_unique_key';
/** the column name for the cam_nombre field */
const CAM_NOMBRE = 'campania.cam_nombre';
......@@ -108,12 +111,12 @@ abstract class BaseCampaniaPeer
* e.g. CampaniaPeer::$fieldNames[CampaniaPeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('CamId', 'OpeId', 'SerId', 'TemId', 'CamNombre', 'CamTituloLp', 'CamAdwords', 'CamPixelFacebook', 'CamUrlFinalCampania', 'CamTipo', 'CamEstado', 'CamEliminado', 'CamFechaInicio', 'CamFechaFin', 'CamJsonEstructura', 'CreatedAt', 'UpdatedAt', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('camId', 'opeId', 'serId', 'temId', 'camNombre', 'camTituloLp', 'camAdwords', 'camPixelFacebook', 'camUrlFinalCampania', 'camTipo', 'camEstado', 'camEliminado', 'camFechaInicio', 'camFechaFin', 'camJsonEstructura', 'createdAt', 'updatedAt', ),
BasePeer::TYPE_COLNAME => array (CampaniaPeer::CAM_ID, CampaniaPeer::OPE_ID, CampaniaPeer::SER_ID, CampaniaPeer::TEM_ID, CampaniaPeer::CAM_NOMBRE, CampaniaPeer::CAM_TITULO_LP, CampaniaPeer::CAM_ADWORDS, CampaniaPeer::CAM_PIXEL_FACEBOOK, CampaniaPeer::CAM_URL_FINAL_CAMPANIA, CampaniaPeer::CAM_TIPO, CampaniaPeer::CAM_ESTADO, CampaniaPeer::CAM_ELIMINADO, CampaniaPeer::CAM_FECHA_INICIO, CampaniaPeer::CAM_FECHA_FIN, CampaniaPeer::CAM_JSON_ESTRUCTURA, CampaniaPeer::CREATED_AT, CampaniaPeer::UPDATED_AT, ),
BasePeer::TYPE_RAW_COLNAME => array ('CAM_ID', 'OPE_ID', 'SER_ID', 'TEM_ID', 'CAM_NOMBRE', 'CAM_TITULO_LP', 'CAM_ADWORDS', 'CAM_PIXEL_FACEBOOK', 'CAM_URL_FINAL_CAMPANIA', 'CAM_TIPO', 'CAM_ESTADO', 'CAM_ELIMINADO', 'CAM_FECHA_INICIO', 'CAM_FECHA_FIN', 'CAM_JSON_ESTRUCTURA', 'CREATED_AT', 'UPDATED_AT', ),
BasePeer::TYPE_FIELDNAME => array ('cam_id', 'ope_id', 'ser_id', 'tem_id', 'cam_nombre', 'cam_titulo_lp', 'cam_adwords', 'cam_pixel_facebook', 'cam_url_final_campania', 'cam_tipo', 'cam_estado', 'cam_eliminado', 'cam_fecha_inicio', 'cam_fecha_fin', 'cam_json_estructura', 'created_at', 'updated_at', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, )
BasePeer::TYPE_PHPNAME => array ('CamId', 'OpeId', 'SerId', 'TemId', 'CamUniqueKey', 'CamNombre', 'CamTituloLp', 'CamAdwords', 'CamPixelFacebook', 'CamUrlFinalCampania', 'CamTipo', 'CamEstado', 'CamEliminado', 'CamFechaInicio', 'CamFechaFin', 'CamJsonEstructura', 'CreatedAt', 'UpdatedAt', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('camId', 'opeId', 'serId', 'temId', 'camUniqueKey', 'camNombre', 'camTituloLp', 'camAdwords', 'camPixelFacebook', 'camUrlFinalCampania', 'camTipo', 'camEstado', 'camEliminado', 'camFechaInicio', 'camFechaFin', 'camJsonEstructura', 'createdAt', 'updatedAt', ),
BasePeer::TYPE_COLNAME => array (CampaniaPeer::CAM_ID, CampaniaPeer::OPE_ID, CampaniaPeer::SER_ID, CampaniaPeer::TEM_ID, CampaniaPeer::CAM_UNIQUE_KEY, CampaniaPeer::CAM_NOMBRE, CampaniaPeer::CAM_TITULO_LP, CampaniaPeer::CAM_ADWORDS, CampaniaPeer::CAM_PIXEL_FACEBOOK, CampaniaPeer::CAM_URL_FINAL_CAMPANIA, CampaniaPeer::CAM_TIPO, CampaniaPeer::CAM_ESTADO, CampaniaPeer::CAM_ELIMINADO, CampaniaPeer::CAM_FECHA_INICIO, CampaniaPeer::CAM_FECHA_FIN, CampaniaPeer::CAM_JSON_ESTRUCTURA, CampaniaPeer::CREATED_AT, CampaniaPeer::UPDATED_AT, ),
BasePeer::TYPE_RAW_COLNAME => array ('CAM_ID', 'OPE_ID', 'SER_ID', 'TEM_ID', 'CAM_UNIQUE_KEY', 'CAM_NOMBRE', 'CAM_TITULO_LP', 'CAM_ADWORDS', 'CAM_PIXEL_FACEBOOK', 'CAM_URL_FINAL_CAMPANIA', 'CAM_TIPO', 'CAM_ESTADO', 'CAM_ELIMINADO', 'CAM_FECHA_INICIO', 'CAM_FECHA_FIN', 'CAM_JSON_ESTRUCTURA', 'CREATED_AT', 'UPDATED_AT', ),
BasePeer::TYPE_FIELDNAME => array ('cam_id', 'ope_id', 'ser_id', 'tem_id', 'cam_unique_key', 'cam_nombre', 'cam_titulo_lp', 'cam_adwords', 'cam_pixel_facebook', 'cam_url_final_campania', 'cam_tipo', 'cam_estado', 'cam_eliminado', 'cam_fecha_inicio', 'cam_fecha_fin', 'cam_json_estructura', 'created_at', 'updated_at', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
/**
......@@ -123,12 +126,12 @@ abstract class BaseCampaniaPeer
* e.g. CampaniaPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('CamId' => 0, 'OpeId' => 1, 'SerId' => 2, 'TemId' => 3, 'CamNombre' => 4, 'CamTituloLp' => 5, 'CamAdwords' => 6, 'CamPixelFacebook' => 7, 'CamUrlFinalCampania' => 8, 'CamTipo' => 9, 'CamEstado' => 10, 'CamEliminado' => 11, 'CamFechaInicio' => 12, 'CamFechaFin' => 13, 'CamJsonEstructura' => 14, 'CreatedAt' => 15, 'UpdatedAt' => 16, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('camId' => 0, 'opeId' => 1, 'serId' => 2, 'temId' => 3, 'camNombre' => 4, 'camTituloLp' => 5, 'camAdwords' => 6, 'camPixelFacebook' => 7, 'camUrlFinalCampania' => 8, 'camTipo' => 9, 'camEstado' => 10, 'camEliminado' => 11, 'camFechaInicio' => 12, 'camFechaFin' => 13, 'camJsonEstructura' => 14, 'createdAt' => 15, 'updatedAt' => 16, ),
BasePeer::TYPE_COLNAME => array (CampaniaPeer::CAM_ID => 0, CampaniaPeer::OPE_ID => 1, CampaniaPeer::SER_ID => 2, CampaniaPeer::TEM_ID => 3, CampaniaPeer::CAM_NOMBRE => 4, CampaniaPeer::CAM_TITULO_LP => 5, CampaniaPeer::CAM_ADWORDS => 6, CampaniaPeer::CAM_PIXEL_FACEBOOK => 7, CampaniaPeer::CAM_URL_FINAL_CAMPANIA => 8, CampaniaPeer::CAM_TIPO => 9, CampaniaPeer::CAM_ESTADO => 10, CampaniaPeer::CAM_ELIMINADO => 11, CampaniaPeer::CAM_FECHA_INICIO => 12, CampaniaPeer::CAM_FECHA_FIN => 13, CampaniaPeer::CAM_JSON_ESTRUCTURA => 14, CampaniaPeer::CREATED_AT => 15, CampaniaPeer::UPDATED_AT => 16, ),
BasePeer::TYPE_RAW_COLNAME => array ('CAM_ID' => 0, 'OPE_ID' => 1, 'SER_ID' => 2, 'TEM_ID' => 3, 'CAM_NOMBRE' => 4, 'CAM_TITULO_LP' => 5, 'CAM_ADWORDS' => 6, 'CAM_PIXEL_FACEBOOK' => 7, 'CAM_URL_FINAL_CAMPANIA' => 8, 'CAM_TIPO' => 9, 'CAM_ESTADO' => 10, 'CAM_ELIMINADO' => 11, 'CAM_FECHA_INICIO' => 12, 'CAM_FECHA_FIN' => 13, 'CAM_JSON_ESTRUCTURA' => 14, 'CREATED_AT' => 15, 'UPDATED_AT' => 16, ),
BasePeer::TYPE_FIELDNAME => array ('cam_id' => 0, 'ope_id' => 1, 'ser_id' => 2, 'tem_id' => 3, 'cam_nombre' => 4, 'cam_titulo_lp' => 5, 'cam_adwords' => 6, 'cam_pixel_facebook' => 7, 'cam_url_final_campania' => 8, 'cam_tipo' => 9, 'cam_estado' => 10, 'cam_eliminado' => 11, 'cam_fecha_inicio' => 12, 'cam_fecha_fin' => 13, 'cam_json_estructura' => 14, 'created_at' => 15, 'updated_at' => 16, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, )
BasePeer::TYPE_PHPNAME => array ('CamId' => 0, 'OpeId' => 1, 'SerId' => 2, 'TemId' => 3, 'CamUniqueKey' => 4, 'CamNombre' => 5, 'CamTituloLp' => 6, 'CamAdwords' => 7, 'CamPixelFacebook' => 8, 'CamUrlFinalCampania' => 9, 'CamTipo' => 10, 'CamEstado' => 11, 'CamEliminado' => 12, 'CamFechaInicio' => 13, 'CamFechaFin' => 14, 'CamJsonEstructura' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('camId' => 0, 'opeId' => 1, 'serId' => 2, 'temId' => 3, 'camUniqueKey' => 4, 'camNombre' => 5, 'camTituloLp' => 6, 'camAdwords' => 7, 'camPixelFacebook' => 8, 'camUrlFinalCampania' => 9, 'camTipo' => 10, 'camEstado' => 11, 'camEliminado' => 12, 'camFechaInicio' => 13, 'camFechaFin' => 14, 'camJsonEstructura' => 15, 'createdAt' => 16, 'updatedAt' => 17, ),
BasePeer::TYPE_COLNAME => array (CampaniaPeer::CAM_ID => 0, CampaniaPeer::OPE_ID => 1, CampaniaPeer::SER_ID => 2, CampaniaPeer::TEM_ID => 3, CampaniaPeer::CAM_UNIQUE_KEY => 4, CampaniaPeer::CAM_NOMBRE => 5, CampaniaPeer::CAM_TITULO_LP => 6, CampaniaPeer::CAM_ADWORDS => 7, CampaniaPeer::CAM_PIXEL_FACEBOOK => 8, CampaniaPeer::CAM_URL_FINAL_CAMPANIA => 9, CampaniaPeer::CAM_TIPO => 10, CampaniaPeer::CAM_ESTADO => 11, CampaniaPeer::CAM_ELIMINADO => 12, CampaniaPeer::CAM_FECHA_INICIO => 13, CampaniaPeer::CAM_FECHA_FIN => 14, CampaniaPeer::CAM_JSON_ESTRUCTURA => 15, CampaniaPeer::CREATED_AT => 16, CampaniaPeer::UPDATED_AT => 17, ),
BasePeer::TYPE_RAW_COLNAME => array ('CAM_ID' => 0, 'OPE_ID' => 1, 'SER_ID' => 2, 'TEM_ID' => 3, 'CAM_UNIQUE_KEY' => 4, 'CAM_NOMBRE' => 5, 'CAM_TITULO_LP' => 6, 'CAM_ADWORDS' => 7, 'CAM_PIXEL_FACEBOOK' => 8, 'CAM_URL_FINAL_CAMPANIA' => 9, 'CAM_TIPO' => 10, 'CAM_ESTADO' => 11, 'CAM_ELIMINADO' => 12, 'CAM_FECHA_INICIO' => 13, 'CAM_FECHA_FIN' => 14, 'CAM_JSON_ESTRUCTURA' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ),
BasePeer::TYPE_FIELDNAME => array ('cam_id' => 0, 'ope_id' => 1, 'ser_id' => 2, 'tem_id' => 3, 'cam_unique_key' => 4, 'cam_nombre' => 5, 'cam_titulo_lp' => 6, 'cam_adwords' => 7, 'cam_pixel_facebook' => 8, 'cam_url_final_campania' => 9, 'cam_tipo' => 10, 'cam_estado' => 11, 'cam_eliminado' => 12, 'cam_fecha_inicio' => 13, 'cam_fecha_fin' => 14, 'cam_json_estructura' => 15, 'created_at' => 16, 'updated_at' => 17, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
/**
......@@ -206,6 +209,7 @@ abstract class BaseCampaniaPeer
$criteria->addSelectColumn(CampaniaPeer::OPE_ID);
$criteria->addSelectColumn(CampaniaPeer::SER_ID);
$criteria->addSelectColumn(CampaniaPeer::TEM_ID);
$criteria->addSelectColumn(CampaniaPeer::CAM_UNIQUE_KEY);
$criteria->addSelectColumn(CampaniaPeer::CAM_NOMBRE);
$criteria->addSelectColumn(CampaniaPeer::CAM_TITULO_LP);
$criteria->addSelectColumn(CampaniaPeer::CAM_ADWORDS);
......@@ -224,6 +228,7 @@ abstract class BaseCampaniaPeer
$criteria->addSelectColumn($alias . '.ope_id');
$criteria->addSelectColumn($alias . '.ser_id');
$criteria->addSelectColumn($alias . '.tem_id');
$criteria->addSelectColumn($alias . '.cam_unique_key');
$criteria->addSelectColumn($alias . '.cam_nombre');
$criteria->addSelectColumn($alias . '.cam_titulo_lp');
$criteria->addSelectColumn($alias . '.cam_adwords');
......
......@@ -24,6 +24,7 @@ use AppBundle\Model\Template;
* @method CampaniaQuery orderByOpeId($order = Criteria::ASC) Order by the ope_id column
* @method CampaniaQuery orderBySerId($order = Criteria::ASC) Order by the ser_id column
* @method CampaniaQuery orderByTemId($order = Criteria::ASC) Order by the tem_id column
* @method CampaniaQuery orderByCamUniqueKey($order = Criteria::ASC) Order by the cam_unique_key column
* @method CampaniaQuery orderByCamNombre($order = Criteria::ASC) Order by the cam_nombre column
* @method CampaniaQuery orderByCamTituloLp($order = Criteria::ASC) Order by the cam_titulo_lp column
* @method CampaniaQuery orderByCamAdwords($order = Criteria::ASC) Order by the cam_adwords column
......@@ -42,6 +43,7 @@ use AppBundle\Model\Template;
* @method CampaniaQuery groupByOpeId() Group by the ope_id column
* @method CampaniaQuery groupBySerId() Group by the ser_id column
* @method CampaniaQuery groupByTemId() Group by the tem_id column
* @method CampaniaQuery groupByCamUniqueKey() Group by the cam_unique_key column
* @method CampaniaQuery groupByCamNombre() Group by the cam_nombre column
* @method CampaniaQuery groupByCamTituloLp() Group by the cam_titulo_lp column
* @method CampaniaQuery groupByCamAdwords() Group by the cam_adwords column
......@@ -78,6 +80,7 @@ use AppBundle\Model\Template;
* @method Campania findOneByOpeId(int $ope_id) Return the first Campania filtered by the ope_id column
* @method Campania findOneBySerId(int $ser_id) Return the first Campania filtered by the ser_id column
* @method Campania findOneByTemId(int $tem_id) Return the first Campania filtered by the tem_id column
* @method Campania findOneByCamUniqueKey(string $cam_unique_key) Return the first Campania filtered by the cam_unique_key column
* @method Campania findOneByCamNombre(string $cam_nombre) Return the first Campania filtered by the cam_nombre column
* @method Campania findOneByCamTituloLp(string $cam_titulo_lp) Return the first Campania filtered by the cam_titulo_lp column
* @method Campania findOneByCamAdwords(string $cam_adwords) Return the first Campania filtered by the cam_adwords column
......@@ -96,6 +99,7 @@ use AppBundle\Model\Template;
* @method array findByOpeId(int $ope_id) Return Campania objects filtered by the ope_id column
* @method array findBySerId(int $ser_id) Return Campania objects filtered by the ser_id column
* @method array findByTemId(int $tem_id) Return Campania objects filtered by the tem_id column
* @method array findByCamUniqueKey(string $cam_unique_key) Return Campania objects filtered by the cam_unique_key column
* @method array findByCamNombre(string $cam_nombre) Return Campania objects filtered by the cam_nombre column
* @method array findByCamTituloLp(string $cam_titulo_lp) Return Campania objects filtered by the cam_titulo_lp column
* @method array findByCamAdwords(string $cam_adwords) Return Campania objects filtered by the cam_adwords column
......@@ -214,7 +218,7 @@ abstract class BaseCampaniaQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `cam_id`, `ope_id`, `ser_id`, `tem_id`, `cam_nombre`, `cam_titulo_lp`, `cam_adwords`, `cam_pixel_facebook`, `cam_url_final_campania`, `cam_tipo`, `cam_estado`, `cam_eliminado`, `cam_fecha_inicio`, `cam_fecha_fin`, `cam_json_estructura`, `created_at`, `updated_at` FROM `campania` WHERE `cam_id` = :p0';
$sql = 'SELECT `cam_id`, `ope_id`, `ser_id`, `tem_id`, `cam_unique_key`, `cam_nombre`, `cam_titulo_lp`, `cam_adwords`, `cam_pixel_facebook`, `cam_url_final_campania`, `cam_tipo`, `cam_estado`, `cam_eliminado`, `cam_fecha_inicio`, `cam_fecha_fin`, `cam_json_estructura`, `created_at`, `updated_at` FROM `campania` WHERE `cam_id` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
......@@ -473,6 +477,35 @@ abstract class BaseCampaniaQuery extends ModelCriteria
return $this->addUsingAlias(CampaniaPeer::TEM_ID, $temId, $comparison);
}
/**
* Filter the query on the cam_unique_key column
*
* Example usage:
* <code>
* $query->filterByCamUniqueKey('fooValue'); // WHERE cam_unique_key = 'fooValue'
* $query->filterByCamUniqueKey('%fooValue%'); // WHERE cam_unique_key LIKE '%fooValue%'
* </code>
*
* @param string $camUniqueKey The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CampaniaQuery The current query, for fluid interface
*/
public function filterByCamUniqueKey($camUniqueKey = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($camUniqueKey)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $camUniqueKey)) {
$camUniqueKey = str_replace('*', '%', $camUniqueKey);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CampaniaPeer::CAM_UNIQUE_KEY, $camUniqueKey, $comparison);
}
/**
* Filter the query on the cam_nombre column
*
......
......@@ -51,6 +51,7 @@
<column name="ope_id" phpName="OpeId" type="INTEGER" required="false"/>
<column name="ser_id" phpName="SerId" type="INTEGER" required="false"/>
<column name="tem_id" phpName="TemId" type="INTEGER" required="false"/>
<column name="cam_unique_key" phpName="CamUniqueKey" type="LONGVARCHAR" required="false"/>
<column name="cam_nombre" phpName="CamNombre" type="VARCHAR" size="1000" required="false"/>
<column name="cam_titulo_lp" phpName="CamTituloLp" type="VARCHAR" size="1000" required="false"/>
<column name="cam_adwords" phpName="CamAdwords" type="VARCHAR" size="1000" required="false"/>
......
......@@ -50,6 +50,116 @@ class CampaniaController extends Controller {
);
}
public function actualizarCampaniaAction(Request $request) {
$log = Utiles::setLog('CampaniaBundle\Controller\CampaniaController:actualizarCampaniaAction', 'mcafee/campania/index');
$campaniaId = $request->get("campaniaId", null);
$templateId = $request->get("templateId", null);
$campaniaNombre = $request->get("campaniaNombre", null);
$campaniaTitulo = $request->get("campaniaTitulo", null);
$campaniaAdWords = $request->get("campaniaAdWords", null);
$campaniaFacebook = $request->get("campaniaPixel", null);
$fechaInicio = $request->get("fechaInicio", null);
$fechaFin = $request->get("fechaFin", null);
$jsonContenido = $request->get("jsonContenido", null);
$jResponse = new JsonResponse();
$log->debug("campania id : $campaniaId || template id : $templateId ||campania nombre : $campaniaNombre || campania titulo : $campaniaTitulo || campania ad words : $campaniaAdWords || campania facebook : $campaniaFacebook || fecha inicio : $fechaInicio || jsoncontenido : $jsonContenido ");
if ($campaniaId == null || $campaniaId == "") {
$log->debug("la camapaña no existe...");
$jResponse->setStatusCode(JsonResponse::HTTP_BAD_REQUEST, '- CAMPAIGN EMPTY');
$jResponse->setData(array("msg" => "La campaña no existe"));
return $jResponse;
}
if ($templateId == null || $templateId == "") {
$log->debug("la plantilla no existe...");
$jResponse->setStatusCode(JsonResponse::HTTP_BAD_REQUEST, '- TEMPLATE EMPTY');
$jResponse->setData(array("msg" => "Debe seleccionar una plantilla"));
return $jResponse;
}
if ($campaniaNombre == null || $campaniaNombre == "") {
$log->debug("el nombre de la camapaña no puede estar vacio...");
$jResponse->setStatusCode(JsonResponse::HTTP_BAD_REQUEST, '- CAMPAIGN NAME EMPTY');
$jResponse->setData(array("msg" => "Debe ingresar un nombre para la campaña"));
return $jResponse;
}
if ($campaniaTitulo == null || $campaniaTitulo == "") {
$log->debug("el titulo de la camapaña no puede estar vacio...");
$jResponse->setStatusCode(JsonResponse::HTTP_BAD_REQUEST, '- TITLE EMPTY');
$jResponse->setData(array("msg" => "Debe ingresar un titulo para la campaña"));
return $jResponse;
}
$log->debug("generando la camapaña...");
$campania = CampaniaQuery::create()->findPk($campaniaId);
$campania->setTemId($templateId);
$campania->setCamNombre($campaniaNombre);
$campania->setCamTituloLp($campaniaTitulo);
$campania->setCamFechaInicio($fechaInicio);
$campania->setCamFechaFin($fechaFin);
$campania->setCamEstado(Campania::ESTADO_ACTIVO);
$campania->setCamEliminado(Campania::ELIMINADO_FALSE);
$campania->setCamPixelFacebook($campaniaFacebook);
$campania->setCamAdwords($campaniaAdWords);
$campania->setCamJsonEstructura($jsonContenido);
$campania->setCamUniqueKey(uniqid("str_" . $campania->getCamId() . "_"));
$campania->save();
$log->debug("generando/actualizando url de la campaña...");
switch ($campania->getTemId()) {
case Template::TEMPLATE_1:
$queryString = array("uid" => $campania->getCamUniqueKey());
$url = Utiles::getParametroConfiguracion("url_base") . Utiles::getParametroConfiguracion("url_landing_1") . "?" . http_build_query($queryString);
$campania->setCamUrlFinalCampania($url);
$campania->save();
break;
case Template::Template_2:
$queryString = array("uid" => $campania->getCamUniqueKey());
$url = Utiles::getParametroConfiguracion("url_base") . Utiles::getParametroConfiguracion("url_landing_2") . "?" . http_build_query($queryString);
$campania->setCamUrlFinalCampania($url);
$campania->save();
break;
default:
$queryString = array("uid" => $campania->getCamUniqueKey());
$url = Utiles::getParametroConfiguracion("url_base") . Utiles::getParametroConfiguracion("url_landing_1") . "?" . http_build_query($queryString);
$campania->setCamUrlFinalCampania($url);
$campania->save();
break;
}
$jResponse->setStatusCode(JsonResponse::HTTP_OK, '- UPDATE CAMPAIGN');
$jResponse->setData(array("msg" => "Se ha generado el contenido correctamente para la campaña $campaniaId ", "urlCampania" => $url));
return $jResponse;
}
public function eliminarCampaniaAction(Request $request) {
$log = Utiles::setLog('CampaniaBundle\Controller\CampaniaController:eliminarCampaniaAction', 'mcafee/campania/index');
$camId = $request->get("camId", null);
$log->debug("eliminando campaña $camId...");
$jResponse = new JsonResponse();
if ($camId == "" || $camId == null) {
$log->debug("la campaña no existe...");
$jResponse->setStatusCode(JsonResponse::HTTP_BAD_REQUEST, '- CAMPAIGN NOT');
$jResponse->setData(array("msg" => "La campaña no existe"));
return $jResponse;
}
$campania = CampaniaQuery::create()->findPk($camId);
$campania->setCamEstado(Campania::ESTADO_INACTIVO);
$campania->setCamEliminado(Campania::ELIMINADO_TRUE);
$campania->save();
$jResponse->setStatusCode(JsonResponse::HTTP_OK, '- DELETE CAMPAIGN');
$jResponse->setData(array("msg" => "Se ha eliminado correctamente la campaña $camId"));
return $jResponse;
}
/**
*
* @param Request $request
......@@ -390,91 +500,6 @@ class CampaniaController extends Controller {
return $jResponse;
}
public function actualizarCampaniaAction(Request $request) {
$log = Utiles::setLog('CampaniaBundle\Controller\CampaniaController:actualizarCampaniaAction', 'mcafee/campania/index');
$campaniaId = $request->get("campaniaId", null);
$templateId = $request->get("templateId", null);
$campaniaNombre = $request->get("campaniaNombre", null);
$campaniaTitulo = $request->get("campaniaTitulo", null);
$campaniaAdWords = $request->get("campaniaAdWords", null);
$campaniaFacebook = $request->get("campaniaPixel", null);
$fechaInicio = $request->get("fechaInicio", null);
$fechaFin = $request->get("fechaFin", null);
$jsonContenido = $request->get("jsonContenido", null);
$jResponse = new JsonResponse();
$log->debug("campania id : $campaniaId || template id : $templateId ||campania nombre : $campaniaNombre || campania titulo : $campaniaTitulo || campania ad words : $campaniaAdWords || campania facebook : $campaniaFacebook || fecha inicio : $fechaInicio || jsoncontenido : $jsonContenido ");
if ($campaniaId == null || $campaniaId == "") {
$log->debug("la camapaña no existe...");
$jResponse->setStatusCode(JsonResponse::HTTP_BAD_REQUEST, '- CAMPAIGN EMPTY');
$jResponse->setData(array("msg" => "La campaña no existe"));
return $jResponse;
}
if ($templateId == null || $templateId == "") {
$log->debug("la plantilla no existe...");
$jResponse->setStatusCode(JsonResponse::HTTP_BAD_REQUEST, '- TEMPLATE EMPTY');
$jResponse->setData(array("msg" => "Debe seleccionar una plantilla"));
return $jResponse;
}
if ($campaniaNombre == null || $campaniaNombre == "") {
$log->debug("el nombre de la camapaña no puede estar vacio...");
$jResponse->setStatusCode(JsonResponse::HTTP_BAD_REQUEST, '- CAMPAIGN NAME EMPTY');
$jResponse->setData(array("msg" => "Debe ingresar un nombre para la campaña"));
return $jResponse;
}
if ($campaniaTitulo == null || $campaniaTitulo == "") {
$log->debug("el titulo de la camapaña no puede estar vacio...");
$jResponse->setStatusCode(JsonResponse::HTTP_BAD_REQUEST, '- TITLE EMPTY');
$jResponse->setData(array("msg" => "Debe ingresar un titulo para la campaña"));
return $jResponse;
}
$log->debug("generando la camapaña...");
$campania = CampaniaQuery::create()->findPk($campaniaId);
$campania->setTemId($templateId);
$campania->setCamNombre($campaniaNombre);
$campania->setCamTituloLp($campaniaTitulo);
$campania->setCamFechaInicio($fechaInicio);
$campania->setCamFechaFin($fechaFin);
$campania->setCamEstado(Campania::ESTADO_ACTIVO);
$campania->setCamEliminado(Campania::ELIMINADO_FALSE);
$campania->setCamPixelFacebook($campaniaFacebook);
$campania->setCamAdwords($campaniaAdWords);
$campania->setCamJsonEstructura($jsonContenido);
$campania->save();
$jResponse->setStatusCode(JsonResponse::HTTP_OK, '- UPDATE CAMPAIGN');
$jResponse->setData(array("msg" => "Se ha generado el contenido correctamente para la campaña $campaniaId "));
return $jResponse;
}
public function eliminarCampaniaAction(Request $request) {
$log = Utiles::setLog('CampaniaBundle\Controller\CampaniaController:eliminarCampaniaAction', 'mcafee/campania/index');
$camId = $request->get("camId", null);
$log->debug("eliminando campaña $camId...");
$jResponse = new JsonResponse();
if ($camId == "" || $camId == null) {
$log->debug("la campaña no existe...");
$jResponse->setStatusCode(JsonResponse::HTTP_BAD_REQUEST, '- CAMPAIGN NOT');
$jResponse->setData(array("msg" => "La campaña no existe"));
return $jResponse;
}
$campania = CampaniaQuery::create()->findPk($camId);
$campania->setCamEstado(Campania::ESTADO_INACTIVO);
$campania->setCamEliminado(Campania::ELIMINADO_TRUE);
$campania->save();
$jResponse->setStatusCode(JsonResponse::HTTP_OK, '- DELETE CAMPAIGN');
$jResponse->setData(array("msg" => "Se ha eliminado correctamente la campaña $camId"));
return $jResponse;
}
public function listadoCampaniasAction(Request $request) {
$log = Utiles::setLog('CampaniaBundle\Controller\CampaniaController:listadoCampaniasAction', 'mcafee/campania/index');
$log->debug("mostrando campanias...");
......@@ -482,6 +507,7 @@ class CampaniaController extends Controller {
return $this->render("backend_content/pages/campanias/listadoCampanias.html.twig", array("campanias" => $campanias));
}
//BORRAR LUEGO, SOLO PRUEBA
public function cargarHtmlFrontAction(Request $request) {
$data = array('id' => 24);
$data_json = json_encode($data);
......@@ -494,7 +520,7 @@ class CampaniaController extends Controller {
);
try {
$url = Utiles::getParametroConfiguracion("url_base")."/api/mcafee/campania/obtener/contenido.json";
$url = Utiles::getParametroConfiguracion("url_base") . "/api/mcafee/campania/obtener/contenido.json";
$ch = curl_init($url);
//curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POST, 1);
......@@ -530,9 +556,9 @@ class CampaniaController extends Controller {
$disposicionesColumnasFilas = DisposicionColumnasQuery::create()->filterByDcoEstado(DisposicionColumnas::ACTIVO_TRUE)->filterByDcoEliminado(DisposicionColumnas::ACTIVO_FALSE)->find();
$filas = FilaQuery::create()->filterByFilEstado(Fila::ACTIVO_TRUE)->filterByFilEliminado(Fila::ELIMINADO_FALSE)->filterBySecId(self::DEFAULT_SEC_ID)->filterByCamId($camId)->find();
if($contenido == CampaniaContenido::TIPO_VIDEO){
if ($contenido == CampaniaContenido::TIPO_VIDEO) {
$tipos = TipoQuery::create()->filterByTipEstado(Tipo::ACTIVO_TRUE)->filterByTipEliminado(Tipo::ELIMINADO_FALSE)->filterByTipId(array(Tipo::TIPO_VIDEO), \Criteria::NOT_IN)->find();
}else{
} else {
$tipos = TipoQuery::create()->filterByTipEstado(Tipo::ACTIVO_TRUE)->filterByTipEliminado(Tipo::ELIMINADO_FALSE)->find();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment