本文整理汇总了PHP中Evento::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Evento::insert方法的具体用法?PHP Evento::insert怎么用?PHP Evento::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Evento
的用法示例。
在下文中一共展示了Evento::insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postInsert
public function postInsert($data = array())
{
//Entrada
$entrada = new Entrada($this->entradaId);
//Tiene FIN?
if ($entrada->entradaIdFin && !$data["force"]) {
$evento = new Evento();
$order = $this->order + 1;
$evento->insert(array("fecha" => $data["fecha"], "entradaId" => $entrada->entradaIdFin, "order" => $order, "force" => $data["force"]));
}
//Log
Log::add(LOG_ADD_EVENTO, $this, true);
}
示例2: json
public function json()
{
$date = date("Y-m-d", strtotime($_REQUEST["date"]));
$hour = $_REQUEST["hour"];
$action = $_REQUEST["action"];
if (is_numeric($_REQUEST["order"]) && (int) $_REQUEST["order"] > 0) {
$orden = (int) $_REQUEST["order"];
}
if ($_REQUEST["toPosition"] && $_REQUEST["fromPosition"]) {
$action = "order";
}
switch ($action) {
//Order
case "order":
$evento = new Evento($_REQUEST["id"]);
$evento->order($date, $_REQUEST["toPosition"], $hour);
//Log
Log::add(LOG_MOVE_EVENTO, $_REQUEST);
break;
//Hour update
//Hour update
case "updateHour":
Evento::actualizarFechas($date, $hour);
//Log
Log::add(LOG_UPDATE_HOUR_PARRILLA, $_REQUEST);
break;
//Mosca2 add
//Mosca2 add
case "addMosca2":
$evento = new Evento($_REQUEST['eventoId']);
if ($evento->id) {
$mosca2 = new Mosca($_REQUEST['moscaId2']);
$evento->logo2 = $mosca2->codigo;
$evento->delay = $_REQUEST['delay'];
$evento->update();
//Log
Log::add(LOG_UPDATE_MOSCA2_PARRILLA, $_REQUEST);
}
break;
//New
//New
case "new":
$evento = new Evento();
$evento->entradaId = $_REQUEST["entradaId"];
$evento->insert(array("fecha" => $date, "hora" => $hour, "order" => $orden));
//Log
Log::add(LOG_ADD_EVENTO, $_REQUEST);
break;
//Import
//Import
case "import":
$order = $_REQUEST["order"];
if (count($_REQUEST["eventosId"])) {
foreach ($_REQUEST["eventosId"] as $eventoId) {
$evento = new Evento($eventoId);
$evento->insert(array("fecha" => $date, "hora" => $hour, "order" => $order, "force" => true));
$order++;
}
}
//Log
Log::add(LOG_IMPORT_EVENTOS, $_REQUEST);
break;
//Delete
//Delete
case "delete":
$evento = new Evento($_REQUEST["id"]);
$evento->delete();
//Actualizamos el orden
Evento::actualizarOrden($date);
//Actualizamos las fechas
Evento::actualizarFechas($date, $hour);
//Log
Log::add(LOG_DELETE_EVENTO, $_REQUEST);
break;
}
//Select
$eventos = Evento::select(array("fecha" => $date));
//Data
$data = array();
if (count($eventos)) {
foreach ($eventos as $evento) {
$data[] = $evento->getDataTablesJson();
}
}
echo json_encode(array("aaData" => $data));
}