<?php $usuario_core->validateUser(); require 'Logic/afiliado.php'; $hoteles = getHotelesByUsuario($usuario_core->getUsuario()->id); $productos = getEventos(); $monedas = getAllMonedas(); $idiomas = getAllIdiomas(); if (isset($_GET["id"])) { $afiliado = getAfiliado($_GET["id"]); if ($afiliado->hoteles && count($afiliado->hoteles)) { foreach ($afiliado->hoteles as $c) { foreach ($hoteles as $hotel) { if ($hotel->id == $c->hotelId) { $hotel->selected = true; } } } } if ($afiliado->eventos && count($afiliado->eventos)) { foreach ($afiliado->eventos as $c) { foreach ($productos as $evento) { if ($evento->id == $c->eventoId) { $evento->selected = true; } } } } $smarty->assign('afiliado', $afiliado); $smarty->assign('edit', true); } else {
<?php /* * Script que genera los eventos desde la base de datos indicandole el id del centro * en formato json para cargarlos en el calendario * * el formato de los eventos sera * * * evento = { * "title" : "Evento prueba", * "start" : "2015-07-22T10:14:28", * "end" : "2015-07-22T11:14:28", * "id" : "7", * "userID" : "1", * "color" : "#ff0000", * "className" : "ticketSrc_1", * "custom" : "test text here", * "eventDurationEditable" : true * }; * * * * * */ require_once dirname(__FILE__) . "/../querys/getEventos.php"; if (isset($_REQUEST['idCentro'])) { echo json_encode(getEventos($_REQUEST['idCentro'])); }
*/ function getEventos() { $url = consultaEventosUrl; $data = array("Token" => defaultToken, "IdArea" => 2, "IdSubarea" => 2, "Palabra" => null, "FechaDesde" => $_GET['from'], "FechaHasta" => $_GET['to']); $data_string = json_encode($data); $request = curl_init($url); curl_setopt($request, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($request, CURLOPT_POSTFIELDS, $data_string); curl_setopt($request, CURLOPT_RETURNTRANSFER, true); curl_setopt($request, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data_string))); $result = curl_exec($request); $aresult = json_decode($result)->Eventos; echo json_encode($aresult); } function getSubareas() { $url = consultaAreasUrl; $data = array("Token" => defaultToken, "IdArea" => 2); $data_string = json_encode($data); $request = curl_init($url); curl_setopt($request, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($request, CURLOPT_POSTFIELDS, $data_string); curl_setopt($request, CURLOPT_RETURNTRANSFER, true); curl_setopt($request, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data_string))); $result = curl_exec($request); $aresult = json_decode($result); echo json_encode($aresult); } getEventos(); //getSubareas();
<?php $logged = $usuario_core->validateUser(); if ($logged) { $eventos = getEventos(); $smarty->assign('eventos', $eventos); $smarty->display('admin/evento/lista.tpl'); }
<?php if (isset($_POST['op'])) { if ($_POST['op'] == "get_events") { $filtre = $_POST['filtre']; $result = getEventos($filtre); echo json_encode($result); } }