(UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.') GROUP BY tusuario.id_user ORDER BY last_connect DESC', $groups ); break; case 'postgresql': $sql = sprintf( "SELECT tusuario.id_user, tusuario.last_connect FROM tusuario INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user AND tusuario_perfil.id_grupo IN (%s) WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.') GROUP BY tusuario.id_user ORDER BY last_connect DESC', $groups ); break; case 'oracle': $sql = sprintf( "SELECT tusuario.id_user, tusuario.last_connect FROM tusuario INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user AND tusuario_perfil.id_grupo IN (%s) WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.') GROUP BY tusuario.id_user ORDER BY last_connect DESC', $groups ); break; } $rows = db_get_all_rows_sql($sql); if (empty($rows)) { $rows = []; echo "
".__('No other users connected').'
'; } else { $table->cellpadding = 0; $table->cellspacing = 0; $table->width = '100%'; $table->class = 'info_table'; $table->size = []; $table->data = []; $table->head = []; $table->head[0] = __('User'); $table->head[1] = __('Date'); $rowPair = true; $iterator = 0; // Get data foreach ($rows as $row) { if ($rowPair) { $table->rowclass[$iterator] = 'rowPair'; } else { $table->rowclass[$iterator] = 'rowOdd'; } $rowPair = !$rowPair; $iterator++; $data = []; $data[0] = ''.$row['id_user'].''; $data[1] = date($config['date_format'], $row['last_connect']); array_push($table->data, $data); } html_print_table($table); } } extensions_add_godmode_menu_option(__('Users connected'), 'UM', 'gusuarios', 'users/icon.png', 'v1r1'); extensions_add_operation_menu_option(__('Users connected'), 'workspace', 'users/icon.png', 'v1r1', '', 'UM'); extensions_add_godmode_function('users_extension_main_god'); extensions_add_main_function('users_extension_main');