function guardarDispositivo() { $dispositivo = new Dispositivo(); $dispositivo->setFields($_POST); $dispositivo->baja_logica = FALSE_; return $dispositivo->save(); }
function procesar(&$nextAction) { $dispositivo = new Dispositivo($_GET['id']); $dispositivo->baja_logica = 1; if ($dispositivo->update()) { $nextAction->setNextAction("DispositivoAdm", "eliminacion.dispositivo.ok"); } else { $nextAction->setNextAction("DispositivoAdm", "eliminacion.dispositivo.error", array(error => "1")); } }
function procesar(&$nextAction) { $dispositivo = new Dispositivo($_GET['id']); //Se copian todos los valores ingresados $dispositivo->setFields($_POST); $params["id"] = $dispositivo->id; if ($dispositivo->update()) { $nextAction->setNextAction("DispositivoAdm", "modificacion.dispositivo.ok", $params); } else { $params['error'] = "1"; $nextAction->setNextAction("DispositivoAdm", "modificacion.dispositivo.error", $params); } }
public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { Dispositivo::create([]); } }
function __construct($dispositivo) { $this->disp = $dispositivo; $this->dispositivos = new Properties(); $this->dispositivos->load(file_get_contents("./sinta.properties")); $this->status = $this->dispositivos->getProperty($this->disp . ".status"); parent::__construct($dispositivo); }
function __construct($dispositivo) { $this->mesa = new Properties(); $this->mesa->load(file_get_contents("./sinta.properties")); $this->status = $this->mesa->getProperty($dispositivo . ".status"); $this->disp = $dispositivo; parent::__construct($dispositivo); $this->conexion = new PHPTelnet(); }
public function created($model) { if (Config::get('var.push', false)) { $dispositivos = Dispositivo::active()->eventos()->get(); $disp = []; foreach ($dispositivos as $dispositivo) { $disp[] = PushNotification::Device($dispositivo->token); } $devices = PushNotification::DeviceCollection($disp); $actions = []; $actions[0] = new stdClass(); $actions[0]->icon = 'eye'; $actions[0]->title = 'ver'; $actions[0]->callback = 'mycallback'; $devices = PushNotification::DeviceCollection($disp); $message = PushNotification::Message($model->user->nombre . ' ha agregado un nuevo evento', ['badge' => 1, 'image' => 'www/logo.png', 'soundname' => 'alert', 'title' => 'Nueva Evento', "ledColor" => [0, 146, 234, 255], 'actions' => $actions]); $collection = PushNotification::app('android')->to($devices)->send($message); } }
public function push() { Notificacion::InsertarNotificacionesMasivas(Input::get('titulo'), Input::get('mensaje')); //Notificaciones en android $dispositivos = Dispositivo::active()->mensajes()->get(); $disp = []; foreach ($dispositivos as $dispositivo) { $disp[] = PushNotification::Device($dispositivo->token); } $devices = PushNotification::DeviceCollection($disp); $message = PushNotification::Message(Input::get('mensaje'), ['badge' => 1, 'image' => 'www/logo.png', 'soundname' => 'alert', "ledColor" => [0, 146, 234, 255], 'title' => Input::get('titulo'), "style" => "inbox", "summaryText" => "Tienes %n% notificaciones", 'actions' => [["title" => "Abrir", "callback" => "abrir", "foreground" => false]]]); $collection = PushNotification::app('android')->to($devices)->send($message); // notificaciones en el navegador require_once 'vendor/autoload.php'; Pushpad\Pushpad::$auth_token = '3f31ce907b0008fbde64d2f21399b9c7'; Pushpad\Pushpad::$project_id = 1211; $notification = new Pushpad\Notification(array('body' => Input::get('mensaje', ''), 'title' => Input::get('titulo', 'Residencias Online'))); $notification->broadcast(['tags' => []]); Session::flash('success', 'Mensaje enviado'); return Redirect::back(); }
$app->redirect($app->urlFor('Inicio')); }); //****Recogida de lecturas realizadas por dispositivo****// $app->get('/getLecturas/:disId', function ($disId) use($app) { require_once 'Modelos/DisDatos.php'; $resp = array(); $resultado = DisDatos::getLecturasByDisp($disId); if (!is_null($resultado)) { $resp['estado'] = 'OK'; $resp['mensaje'] = $resultado; } else { $resp['estado'] = 'KO'; $resp['mensaje'] = 'No hay lecturas del dispositivo: ' . $disId; } echo json_encode($resp); }); $app->get('/getAllPos', function () use($app) { require_once 'Modelos/Dispositivo.php'; $idUsu = 1; $resp = array(); $resultado = Dispositivo::getAllDisp($idUsu); if ($resultado['estado'] == 1) { $resp['estado'] = 'OK'; $resp['mensaje'] = $resultado['resultado']; } else { $resp['estado'] = 'KO'; $resp['mensaje'] = $resultado['resultado']; } echo json_encode($resp); }); $app->run();
public function cargarCobros() { $mes = Input::get('mes'); $año = Input::get('año'); foreach (Residencias::all() as $residencia) { $solvencia = Solvencia::firstorNew(['mes' => $mes, 'año' => $año, 'residencia_id' => $residencia->id]); $solvencia->estado = 3; $solvencia->monto = getdeuda($residencia->id, $mes, $año); $solvencia->save(); } Notificacion::InsertarNotificacionesMasivas("Nuevo Recibo Agregado", "Se ha agregado el recibo de " . getMeses()[$mes] . $año); Session::flash('success', "Cobros cargados Correctamente"); if (Config::get('var.push', false)) { $dispositivos = Dispositivo::active()->mensajes()->get(); $disp = []; foreach ($dispositivos as $dispositivo) { $disp[] = PushNotification::Device($dispositivo->token); } $devices = PushNotification::DeviceCollection($disp); $message = PushNotification::Message("Se ha agregado el recibo de " . getMeses()[$mes] . $año, ['badge' => 1, 'image' => 'www/logo.png', 'soundname' => 'alert', "ledColor" => [0, 146, 234, 255], 'title' => 'Nueva Recibo Agregado']); $collection = PushNotification::app('android')->to($devices)->send($message); } return Redirect::to('admin/Finanzas/gestion?mes=' . $mes . '&año=' . $año); }
public function listacuentas() { $hash = $_GET['id']; $decrypted = $this->decrypt($hash); $datos = explode('|', $decrypted); $token_usuario = $datos[0]; $token_movil = $datos[1]; $idDispositivo = $datos[2]; $user = Usuario::find_by_access_token_movil($token_usuario); if (empty($user)) { $this->logg->error("1048: Usuario no Autorizado en listacuentas " . $token_usuario . "con dispositivo " . $idDispositivo); $result = array("estado" => "NOK", "codResp" => "1048", "mensaje" => "Usuario No Autorizado."); $this->response($this->json($result), 200); } else { $dispositivo = Dispositivo::find_by_id_dispositivo_and_usuario_id_and_token($idDispositivo, $user->id, $token_movil); if (empty($dispositivo)) { $this->logg->error("1049: Dispositivo No Autorizado al Usuario en registrodispositivo " . $user->id . "con dispositivo " . $idDispositivo); $result = array("estado" => "NOK", "codResp" => "1049", "mensaje" => "Dispositivo No Autorizado."); $this->response($this->json($result), 200); } else { $this->cuentasUsuario = Elemento::find_all_by_usuario_id_and_tipo($user->id, "cuenta"); if (empty($this->cuentasUsuario)) { $result = array("estado" => "NOK", "codResp" => "1050", "mensaje" => "No Se Encontraton Cuentas Bancarias."); $this->response($this->json($result), 200); } else { $cuentas = array(); foreach ($this->cuentasUsuario as $cuentasUsuario) { array_push($cuentas, $cuentasUsuario->to_json()); } $result = array("estado" => "OK", "codResp" => "1051", "cuentas" => $cuentas); $this->response($this->json($result), 200); } } } }
/** * Remove the specified resource from storage. * DELETE /dispositivos/{id} * * @param int $id * @return Response */ public function destroy($id) { Dispositivo::delete($id); return "true"; }