/** * Listado de usuarios imetos * @param type $is_admin is boolean * @param type $userid is number */ public static function users_list($is_admin = false, $userid = 0) { //$enum_tipos_usuarios=getEnumOptions('usuarios', 'usertype'); if ($users = User::getAll($is_admin)) { echo "\n <h1>Listado de usuarios iMetos</h1>\n <table class=\"table table-striped table-hover table-bordered table-condensed\">\n <tr> \n <th> </th>\n <th>Usuario</th>\n <th>Mails</th>\n </tr>"; foreach ($users as $user) { echo "\n <tr>\n <td align=\"center\">\n <a class=\"link-tabla\" href=\"javascript:borrar_usuario('{$user->getId()}');\">\n <i class=\"fa fa-trash\"></i>\n </a> "; if ($user->getEnableFTP()) { echo " <a class=\"link-tabla\" href=\"javascript:realizar_informe('{$user->getUserFTP()}');\" title=\"Revisar sondas detenidas\">\n <i class=\"fa fa-terminal\"></i>\n </a> "; } echo " <a class=\"link-tabla\" href=\"javascript:mostrar_ocultar('conf_usuario_{$user->getId()}');\" title=\"Configuración de usuario\">\n <i class=\"fa fa-user\"></i>\n </a> "; echo " <a class=\"link-tabla\" href=\"javascript:mostrar_ocultar('conf_exporta_{$user->getId()}');\" title=\"Configuración de estaciones\">\n <i class=\"fa fa-pencil\"></i>\n </a>"; echo " </td>\n <td>{$user->getUsername()}</td>\n <td>{$user->getEmails()}</td>\n </tr>\n <tr>\n <td colspan=\"6\">\n <div id=\"conf_usuario_{$user->getId()}\" style=\"display:none\">\n <form name=\"user_edit\" method=\"post\" action=\"/users/edit/{$user->getId()}\">"; User::formulario_editar_usuario($user); echo " <div class=\"panel-body\" style=\"text-align:right\">\n <div class=\"form-group\">\n <button type=\"submit\" name=\"save_user\" class=\"btn btn-default\"><i class=\"fa fa-floppy-o\" aria-hidden=\"true\"></i> Guardar usuario</button> \n <button type=\"button\" name=\"close\" class=\"btn btn-default\" onClick=\"javascript:mostrar_ocultar('conf_usuario_{$user->getId()}');\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i> Cerrar</button> \n </div>\n </div>\n </form>"; echo " </div>\n <div class=\"conf_exporta\" id=\"conf_exporta_{$user->getId()}\" style=\"display:none\">"; // si esta habilitado muestra info de estaciones if ($user->getEnableMySQL()) { $BD = new IMETOS($user->getIdMySQL(), $user->getServerMySQL(), $user->getDatabaseMySQL(), $user->getUserMySQL(), $user->getPasswMySQL()); if ($stations = Station::getAll($BD, $user->getId())) { Station::listAll($BD, $stations, $user); } } echo " </div> <!-- cierre de div conf_exporta -->\n </td>\n </tr>"; } echo "</table>"; } else { echo "No se pudo cargar los usuarios<br>"; } }