Mister Spy Say ="Hello Kids ... :D"
___ ____ _ _____
| \/ (_) | | / ___|
| . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _
| |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | |
| | | | \__ \ || __/ | /\__/ / |_) | |_| |
\_| |_/_|___/\__\___|_| \____/| .__/ \__, |
| | __/ |
|_| |___/
Bot Mister Spy V3
Mister Spy
Mister Spy
<?php
require_once('../../inc_library.php');
ob_clean();
/* declaramos variables */
$oEmpleados = new Empleados();
$oTratamientos = new Tratamientos();
$oUsuarios = new Usuarios();
/* inicializamos variables */
$IdTurno = '';
$IdUsuario = '';
$IdTratamiento = '';
$IdEmpleado = '';
$IdMaquina = '';
$FechaHoraDesde = '';
$IdEstado = '';
$Fecha = '';
$Hora = '';
$Minuto = '';
/* si llega el id es una modificacion */
if ($_REQUEST["id"])
{
$IdTurno = intval($_REQUEST["id"]);
$oTurno = Calendar::GetById($IdTurno);
$IdUsuario = $oTurno->IdUsuario;
$IdTratamiento = $oTurno->IdTratamiento;
$IdEmpleado = $oTurno->IdEmpleado;
$IdMaquina = $oTurno->IdMaquina;
$FechaHoraDesde = $oTurno->FechaHoraDesde;
$IdEstado = $oTurno->IdEstado;
$Descripcion = $oTurno->Descripcion;
$Color = $oTurno->Color;
$IdEstado = $oTurno->IdEstado;
$FechaHoraDesde = $oTurno->FechaHoraDesde;
$FechaHoraDesde = split(' ', $FechaHoraDesde);
$Fecha = $FechaHoraDesde[0];
$Tiempo = split(':', $FechaHoraDesde[1]);
$Hora = $Tiempo[0];
$Minuto = $Tiempo[1];
}
$arrEmpleados = $oEmpleados->GetAllProfesionales();
$arrUsuarios = $oUsuarios->GetAll();
$disabled = '';
if ($CurrentUser->IdPerfil == Perfiles::Profesional)
{
$disabled = 'disabled="disabled"';
$IdEmpleado = $CurrentUser->IdEmpleado;
}
if ($IdTurno != '')
$Action = '?Action=Update&IdTurno=' . $IdTurno;
else
$Action = '?Action=Create';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Calendar Details</title>
<link href="<?=Config::UrlSitio?>css/basico_backend.css" rel="stylesheet" type="text/css" />
<link href="css/main.css" rel="stylesheet" type="text/css" />
<link href="css/dp.css" rel="stylesheet" />
<link href="css/dropdown.css" rel="stylesheet" />
<link href="css/colorselect.css" rel="stylesheet" />
<script src="src/jquery.js" type="text/javascript"></script>
<script src="src/Plugins/Common.js" type="text/javascript"></script>
<script src="src/Plugins/jquery.form.js" type="text/javascript"></script>
<script src="src/Plugins/jquery.validate.js" type="text/javascript"></script>
<script src="src/Plugins/datepicker_lang_ES.js" type="text/javascript"></script>
<script src="src/Plugins/jquery.datepicker.js" type="text/javascript"></script>
<script src="src/Plugins/jquery.dropdown.js" type="text/javascript"></script>
<script src="src/Plugins/jquery.colorselect.js" type="text/javascript"></script>
<script type="text/javascript">
if (!DateAdd || typeof (DateDiff) != "function")
{
var DateAdd = function(interval, number, idate)
{
number = parseInt(number);
var date;
if (typeof (idate) == "string")
{
date = idate.split(/\D/);
eval("var date = new Date(" + date.join(",") + ")");
}
if (typeof (idate) == "object")
{
date = new Date(idate.toString());
}
switch (interval)
{
case "y": date.setFullYear(date.getFullYear() + number); break;
case "m": date.setMonth(date.getMonth() + number); break;
case "d": date.setDate(date.getDate() + number); break;
case "w": date.setDate(date.getDate() + 7 * number); break;
case "h": date.setHours(date.getHours() + number); break;
case "n": date.setMinutes(date.getMinutes() + number); break;
case "s": date.setSeconds(date.getSeconds() + number); break;
case "l": date.setMilliseconds(date.getMilliseconds() + number); break;
}
return date;
}
}
function getHM(date)
{
var hour =date.getHours();
var minute= date.getMinutes();
var ret= (hour>9?hour:"0"+hour)+":"+(minute>9?minute:"0"+minute) ;
return ret;
}
$(document).ready(function()
{
//debugger;
var DATA_FEED_URL = "php/datafeed.php";
$("#Savebtn").click(function() { $("#fmEdit").submit(); });
$("#Closebtn").click(function() { CloseModelWindow(); });
$("#Deletebtn").click(function()
{
if (confirm("¿Desea eliminar el turno?"))
{
var param = [{ "name": "IdTurno", value: '<?=$IdTurno?>'}];
$.post(DATA_FEED_URL + "?Action=Delete",
param,
function(data)
{
if (data.IsSuccess)
{
alert(data.Msg);
CloseModelWindow(null,true);
}
else
{
alert("Ocurrio un error.\r\n" + data.Msg);
}
}
,"json");
}
});
$("#stpartdate").datepicker({ picker: "<button class='calpick'></button>"});
//to define parameters of ajaxform
var options =
{
beforeSubmit: function()
{
return true;
},
dataType: "json",
success: function(data)
{
alert(data.Msg);
if (data.IsSuccess)
{
CloseModelWindow(null,true);
}
}
};
$.validator.addMethod("date", function(value, element)
{
var arrs = value.split(i18n.datepicker.dateformat.separator);
var year = arrs[i18n.datepicker.dateformat.year_index];
var month = arrs[i18n.datepicker.dateformat.month_index];
var day = arrs[i18n.datepicker.dateformat.day_index];
var standvalue = [year,month,day].join("-");
return this.optional(element) || /^(?:(?:1[6-9]|[2-9]\d)?\d{2}[\/\-\.](?:0?[1,3-9]|1[0-2])[\/\-\.](?:29|30))(?: (?:0?\d|1\d|2[0-3])\:(?:0?\d|[1-5]\d)\:(?:0?\d|[1-5]\d)(?: \d{1,3})?)?$|^(?:(?:1[6-9]|[2-9]\d)?\d{2}[\/\-\.](?:0?[1,3,5,7,8]|1[02])[\/\-\.]31)(?: (?:0?\d|1\d|2[0-3])\:(?:0?\d|[1-5]\d)\:(?:0?\d|[1-5]\d)(?: \d{1,3})?)?$|^(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])[\/\-\.]0?2[\/\-\.]29)(?: (?:0?\d|1\d|2[0-3])\:(?:0?\d|[1-5]\d)\:(?:0?\d|[1-5]\d)(?: \d{1,3})?)?$|^(?:(?:16|[2468][048]|[3579][26])00[\/\-\.]0?2[\/\-\.]29)(?: (?:0?\d|1\d|2[0-3])\:(?:0?\d|[1-5]\d)\:(?:0?\d|[1-5]\d)(?: \d{1,3})?)?$|^(?:(?:1[6-9]|[2-9]\d)?\d{2}[\/\-\.](?:0?[1-9]|1[0-2])[\/\-\.](?:0?[1-9]|1\d|2[0-8]))(?: (?:0?\d|1\d|2[0-3])\:(?:0?\d|[1-5]\d)\:(?:0?\d|[1-5]\d)(?:\d{1,3})?)?$/.test(standvalue);
}, "Formato de dia invalido");
$.validator.addMethod("safe", function(value, element) {
return this.optional(element) || /^[^$\<\>]+$/.test(value);
}, "$<> not allowed");
$("#fmEdit").validate({
submitHandler: function(form) { $("#fmEdit").ajaxSubmit(options); },
errorElement: "div",
errorClass: "cusErrorPanel",
errorPlacement: function(error, element)
{
showerror(error, element);
}
});
function showerror(error, target)
{
var pos = target.position();
var height = target.height();
var newpos = { left: pos.left, top: pos.top + height + 2 }
var form = $("#fmEdit");
error.appendTo(form).css(newpos);
}
});
function LoadTratamientos(Element, IdEmpleado, IdSelected)
{
var arr = new Array();
var opts = Get(Element).options;
var obj;
var opt;
var oTratamientos;
opts.length = 0;
opts.add(new Option('[Seleccione]', ''));
if (IdEmpleado == '')
return;
arr['IdEmpleado'] = IdEmpleado;
obj = SendXMLRequest('EmpleadoTratamientos', 'GetAllByEmpleado', null, arr);
if (obj.Status.Id != 0)
{
alert(obj.Status.Description);
return;
}
oTratamientos = obj.Response.Rows;
for (var i=0; oTratamientos && i<oTratamientos.length; i++)
{
var oTratamiento = oTratamientos[i];
oTratamiento = TratamientosGetById(oTratamiento.IdTratamiento);
opt = new Option(oTratamiento.Nombre, oTratamiento.IdTratamiento);
opt.selected = (oTratamiento.IdTratamiento == IdSelected);
opts.add(opt);
}
}
function LoadMaquinas(Element, IdTratamiento, IdSelected)
{
var arr = new Array();
var opts = Get(Element).options;
var obj;
var opt;
var oMaquinas;
opts.length = 0;
opts.add(new Option('[Seleccione]', ''));
if (IdTratamiento == '')
return;
arr['IdTratamiento'] = IdTratamiento;
obj = SendXMLRequest('TratamientoMaquinas', 'GetAllByTratamiento', null, arr);
if (obj.Status.Id != 0)
{
alert(obj.Status.Description);
return;
}
oMaquinas = obj.Response.Rows;
for (var i=0; oMaquinas && i<oMaquinas.length; i++)
{
var oMaquina = oMaquinas[i];
oMaquina = MaquinasGetById(oMaquina.IdMaquina);
opt = new Option(oMaquina.Nombre, oMaquina.IdMaquina);
opt.selected = (oMaquina.IdMaquina == IdSelected);
opts.add(opt);
}
}
function TratamientosGetById(IdTratamiento)
{
var arr = new Array();
var obj;
var oTratamiento;
if (IdTratamiento == '')
return;
arr['IdTratamiento'] = IdTratamiento;
obj = SendXMLRequest('Tratamientos', 'GetById', null, arr);
if (obj.Status.Id != 0)
{
alert(obj.Status.Description);
return;
}
oTratamiento = obj.Response;
return oTratamiento;
}
function MaquinasGetById(IdMaquina)
{
var arr = new Array();
var obj;
var oMaquina;
if (IdMaquina == '')
return;
arr['IdMaquina'] = IdMaquina;
obj = SendXMLRequest('Maquinas', 'GetById', null, arr);
if (obj.Status.Id != 0)
{
alert(obj.Status.Description);
return;
}
oMaquina = obj.Response;
return oMaquina;
}
function SendXMLRequest(Module, Command, FunctionReady, arrParams)
{
var objXMLHttp;
var url;
var o = new Object();
var oNode, oNodeTmp;
var objStr;
// the default error
o.Status = new Object();
o.Status.Id = 4;
o.Status.Description = 'Internal error';
if (window.ActiveXObject) //for IE
{
objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) //for Mozilla
{
objXMLHttp = new XMLHttpRequest();
}
url = '/espanol/xml/xmlhelper.php';
url+= '?module=' + Module;
url+= '&command=' + Command;
if (arrParams)
{
for (var key in arrParams)
{
if (typeof arrParams[key] == "function")
continue;
url+= '&' + key + '=' + arrParams[key];
}
}
objXMLHttp.open("GET", url, false, "", "");
if (window.XMLHttpRequest)
objXMLHttp.send(null);
else
objXMLHttp.send();
if (objXMLHttp.readyState == 4 && objXMLHttp.status == 200)
objXML = objXMLHttp.responseXML;
else
return o;
if (!objXML.documentElement || objXML.documentElement.nodeName != 'Request')
{
o.Status.Description+= '\n' + objXMLHttp.responseText;
return o;
}
oNode = objXML.firstChild;
while (oNode)
{
objStr = '';
oNodeTmp = oNode;
while (oNodeTmp)
{
if (oNodeTmp.nodeName == '#document')
objStr = objStr.substring(1);
else if (oNodeTmp.nodeName == '#text')
objStr = ' = "' + oNodeTmp.nodeValue.replace(/"/g, '\\"') + '";';
else if (oNodeTmp.nodeName == 'Row')
{
if (oNode == oNodeTmp)
{
if (parseInt(oNodeTmp.getAttribute('id')) == 0)
objStr = '.Rows = Array( new Object() );';
else
objStr = '.Rows['+(oNodeTmp.getAttribute('id'))+'] = new Object();';
}
else
objStr = '.Rows['+(oNodeTmp.getAttribute('id'))+']' + objStr;
}
else
{
if (oNode == oNodeTmp && oNodeTmp.childNodes.length >= 1)
objStr = '.' + oNodeTmp.nodeName + ' = new Object();';
else if (oNode == oNodeTmp)
objStr = '.' + oNodeTmp.nodeName + ' = "";';
else
{
//FIXME: Agregado para caracteres especiales
//objStr = '.' + oNodeTmp.nodeName + ToString(objStr);
objStr = '.' + oNodeTmp.nodeName + objStr;
}
}
oNodeTmp = oNodeTmp.parentNode;
}
try
{
eval(objStr);
}
catch (e)
{
alert(objStr + ' ' + e.description);
}
if (oNode.firstChild)
oNode = oNode.firstChild;
else if (oNode.nextSibling)
oNode = oNode.nextSibling;
else
{
while (oNode.parentNode && !oNode.parentNode.nextSibling)
oNode = oNode.parentNode;
if (oNode && oNode.parentNode)
oNode = oNode.parentNode.nextSibling;
else
oNode = null;
}
}
/* TODO: por ahora solo funciona como sincrónico */
if (FunctionReady)
FunctionReady(Request);
return Request;
}
function Get(Name)
{
return document.getElementById(Name);
}
function OptionSetSelected(element, value)
{
var i;
var opts = Get(element).options;
if (!element)
return false;
for (i=0; i<opts.length; i++)
{
if (opts[i].value == value)
{
opts[i].selected = true;
return true;
}
}
return false;
}
function ClearCombo(element, texto)
{
var i;
var opts = Get(element).options;
if (!element)
return false;
if (opts == undefined)
return false;
if (texto == null)
texto = '[Seleccione...]';
for (i=opts.length; i>0; i--)
opts[i] = null;
opts[0] = new Option(texto, '0');
}
</script>
<style type="text/css">
.calpick{
width:16px;
height:16px;
border:none;
cursor:pointer;
background:url("sample-css/cal.gif") no-repeat center 2px;
margin-left:-22px;
}
</style>
</head>
<body>
<div>
<div class="toolBotton">
<a id="Savebtn" class="imgbtn" href="javascript:void(0);">
<span class="Save" title="Guardar cambios">Guardar</span>
</a>
<?php if(isset($oTurno)){ ?>
<a id="Deletebtn" class="imgbtn" href="javascript:void(0);">
<span class="Delete" title="Cancelar cambios">Eliminar</span>
</a>
<?php } ?>
<a id="Closebtn" class="imgbtn" href="javascript:void(0);">
<span class="Close" title="Cerrar ventana" >Cerrar</span>
</a>
</a>
</div>
<div style="clear: both">
</div>
<div class="infocontainer">
<form action="php/datafeed.php<?=$Action?>" class="fform" id="fmEdit" method="post">
<?php if ($CurrentUser->IdPerfil == Perfiles::Profesional) { ?>
<input type="hidden" name="IdEmpleado" id="IdEmpleado" value="<?=$IdEmpleado?>" />
<input type="hidden" name="IdEstado" id="IdEstado" value="<?=$IdEstado?>" />
<?php } ?>
<label <?=($CurrentUser->IdPerfil == Perfiles::Profesional) ? 'style="display:none;"' : ''?> >
<span>*Profesional:</span>
<select name="IdEmpleado" id="IdEmpleado" class="required camporFormularioSimple" onChange="javascript: LoadTratamientos('IdTratamiento', this.value, '');" <?=$disabled?> >
<option value="">[Seleccione]</option>
<?php if ($arrEmpleados) { ?>
<?php foreach ($arrEmpleados as $oEmpleado) { ?>
<option value="<?=$oEmpleado->IdEmpleado?>" <?=($oEmpleado->IdEmpleado == $IdEmpleado) ? "selected='selected'" : ""?> >
<?=$oEmpleado->GetUsuario()?>
</option>
<?php } ?>
<?php } ?>
</select>
</label>
<label>
<span>*Paciente:</span>
<select name="IdUsuario" id="IdUsuario" class="required camporFormularioSimple">
<option value="">[Seleccione]</option>
<?php if ($arrUsuarios) { ?>
<?php foreach ($arrUsuarios as $oUsuario) { ?>
<option value="<?=$oUsuario->IdUsuario?>" <?=($oUsuario->IdUsuario == $IdUsuario) ? "selected='selected'" : ""?> >
<?=$oUsuario->GetUsuario()?>
</option>
<?php } ?>
<?php } ?>
</select>
</label>
<label>
<span>*Tratamiento:</span>
<select name="IdTratamiento" id="IdTratamiento" class="required camporFormularioSimple" onchange="javascript: LoadMaquinas('IdMaquina', this.value, '');">
<option value="">[Seleccione]</option>
</select>
</label>
<label>
<span>Máquina:</span>
<select name="IdMaquina" id="IdMaquina" class="camporFormularioSimple">
<option value="">[Seleccione]</option>
</select>
</label>
<label>
<span>*Fecha:</span>
<div>
<input MaxLength="10" class="required date" id="stpartdate" name="stpartdate" style="padding-left:2px;width:90px;" type="text" value="<?=($Fecha != '') ? php2JsTimeEdit(mySql2PhpTime($Fecha)) : ''?>" />
<select name="Hora" id="Hora" class="required camporFormularioChico">
<option value="">[Hora]</option>
<?php for ($i=Config::HoraLaboralInicio; $i<=Config::HoraLaboralFin; $i++) { ?>
<?php $value = ($i < 10) ? '0' . $i : $i;?>
<?php $selected = ($value == $Hora) ? "selected='selected'" : ""; ?>
<option value="<?=$value?>" <?=$selected?> ><?=$value?> hs</option>
<?php } ?>
</select>
<select name="Minuto" id="Minuto" class="required camporFormularioChico">
<option value="">[Minuto]</option>
<?php for ($i=0; $i<60; $i+=5) { ?>
<?php $value = ($i < 10) ? '0' . $i : $i;?>
<?php $selected = ($value == $Minuto) ? "selected='selected'" : ""; ?>
<option value="<?=$value?>" <?=$selected?> ><?=$value?> ms</option>
<?php } ?>
</select>
</div>
</label>
<label>
<span>Detalles:</span>
<textarea id="Descripcion" name="Descripcion" rows="2" style="width:95%; height:100px"><?=$Descripcion?></textarea>
</label>
</form>
</div>
</div>
</body>
</html>
<script language="javascript">
LoadTratamientos('IdTratamiento', '<?=$IdEmpleado?>', '<?=$IdTratamiento?>');
LoadMaquinas('IdMaquina', '<?=$IdTratamiento?>', '<?=$IdMaquina?>');
</script>
Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat