Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var sess = wialon.core.Session.getInstance(); // get instance of current Session
- // flags to specify what kind of data should be returned
- var flags = wialon.item.Item.dataFlag.base | wialon.item.Unit.dataFlag.lastMessage | wialon.item.Unit.dataFlag.restricted;
- sess.updateDataFlags(// load items to current session
- [{type: "type", data: "avl_unit", flags: flags, mode: 0}], // Items specification
- function (code) { // updateDataFlags callback
- if (code) {
- msg(wialon.core.Errors.getErrorText(code));
- return;
- } // exit if error code
- // append option to select
- var info = wialon.core.Session.getInstance().getItem("<?php echo $id; ?>"); // get unit by id
- var pos = info.getPosition();
- var uniqueid = info.getUniqueId();
- var phonenumber = info.getPhoneNumber();
- var time = wialon.util.DateTime.formatTime(pos.t);
- var now = new Date(); // Conseguimos los datos de Ahora
- var nowyear = now.getYear();
- var nowmonth = now.getMonth();
- var nowday = now.getDay(); // Que dia estamos
- var nowhour = now.getHours(); // Hora actual
- var nowminute = now.getMinutes(); // Minuto actual
- var nowsecond = now.getSeconds(); // Segundo actual
- var tiempo1 = new Date(nowyear, nowmonth, nowday, 0, 0, 0, 0);
- var tiempo2 = new Date(nowyear, nowmonth, nowday, nowhour, nowminute, nowsecond, 0);
- var dif = tiempo1.getTime() - tiempo2.getTime();
- var Segundos_de_T1_a_T2 = dif / 1000;
- var Segundos_entre_fechas = Math.abs(Segundos_de_T1_a_T2);
- $("#unitlist").append("<p>P " + info.getName() + " " + phonenumber + " " + uniqueid + " " + "<?php echo $id; ?>" + " "+ Segundos_entre_fechas +" " + pos.x + " " + pos.y + " " + pos.s + "</p>");
- }
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement