This topic is locked
[SOLVED]

 Add "User info" option.

5/23/2020 7:29:15 AM
PHPRunner General questions
J
JCRamos author

I would like to know how to add one more option in the username-button dropdown to show user information, such as: group he belongs to, time of login, last time to login, etc. using alert() or showing a pop-up window.
Thank you.

fhumanes 5/25/2020



I would like to know how to add one more option in the username-button dropdown to show user information, such as: group he belongs to, time of login, last time to login, etc. using alert() or showing a pop-up window.
Thank you.



Hello:
Your question is very good, because in almost all commercial and non-commercial systems, there is an option to consult the parameters of the users.
In Runner, this is a menu option. There you can do whatever you want.
In version 10.X, you can add more buttons to the user's block and there, too, you can execute the code you want. I advise you to call a menu option from there (not visible from the menu) to make programming simple.
Cheers,

fernando

J
JCRamos author 5/26/2020

Gracias, Fernado. Ya he visto cómo hacerlo:
Se puede añadir opciones en el dropdown del usuario de la página de menú o en cualquier otra. Para ello en la celda donde está el dropdown crearemos un botón custom de nombre _info_user y que tendrá en sus eventos:
Before client

var win = Runner.displayPopup( {

url: "_info_user.php",

width: 500,

height: 300,

header: 'Información del usuario'

});


Server

// No es necesario


After client

// No es necesario


Crearemos un fichero _info_user.php que mostrará una ventana emergente con la información que queramos:

<?php

include("include/dbcommon.php");

?>
<!doctype html>

<html>

<head>

<meta http-equiv="X-UA-Compatible" content="IE=Edge">

<title>Info usuario</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

</head>

<body>

<table style="left:1px;top:0px;width:368px;height:100px;z-index:0;" id="Tabla1">

<tr>

<td colspan="2"><span style="color:#050;font-family:arial;font-size:13px;line-height:16px;"><strong><?php echo $_SESSION["nombre"] ?></strong></span></td>

</tr>

<tr>

<td><span style="color:#777777;font-family:Arial;font-size:13px;line-height:16px;">Usuario</span></td>

<td><span style="color:#000000;font-family:Arial;font-size:13px;line-height:16px;"><?php echo $_SESSION["UserID"] ?></span></td>

</tr>

<tr>

<td><span style="color:#777777;font-family:Arial;font-size:13px;line-height:16px;">Grupo</span></td>

<td><span style="color:#000000;font-family:Arial;font-size:13px;line-height:16px;"><?php echo $_SESSION["GroupID"] ?></span></td>

</tr>

<tr>

<td><span style="color:#777777;font-family:Arial;font-size:13px;line-height:16px;">IP</span></td>

<td><span style="color:#000000;font-family:Arial;font-size:13px;line-height:16px;"><?php echo $_SESSION["ip"] ?></span></td>

</tr>

<tr>

<td><span style="color:#777777;font-family:Arial;font-size:13px;line-height:16px;">Inicio sesión</span></td>

<td><span style="color:#000000;font-family:Arial;font-size:13px;line-height:16px;"><?php echo $_SESSION["hora_inicio_sesion"] ?></span></td>

</tr>

</table>

</body>

</html>


Después, pulsando en el dropdown del usuario en su enlace original "2" (que indica que tiene 2 opciones) veremos las opciones por defecto de Desconectar y Cambiar contraseña. Arrastrando el botón que hemos creado antes se añadirá como una nueva opción.
Sólo se añadirá al dropdown de la página donde estemos. Si lo queremos en todas las páginas, debemos hacer lo mismo para cada una: list, etc.
Gracias de nuevo. Juan Carlos.

fhumanes 5/28/2020

Muy buena solución y explicación.
Felicidades.
fernando