public function fetchUsersOnline()
    {
        Container::get('hooks')->fire('model.index.fetch_users_online_start');

        // Fetch users online info and generate strings for output
        $online = [];
        $online['num_guests'] = 0;

        $query['select'] = ['user_id', 'ident'];
        $query['where'] = ['idle' => '0'];
//        $query['order_by'] = array('ident');

        $query = DB::forTable('online')
            ->select_many($query['select'])
            ->where($query['where'])
            ->orderByExpr('ident');
//            ->order_by_many($query['order_by']);

        $query = Container::get('hooks')->fireDB('model.index.query_fetch_users_online', $query);

        $query = $query->find_result_set();

        foreach ($query as $user_online) {
            if ($user_online->user_id > 1) {
                if (User::get()->g_view_users == '1') {
                    $online['users'][] = "\n\t\t\t\t".'<dd><a href="'.
                        Router::pathFor('userProfile', ['id' => $user_online->user_id]).'">'.
                        Utils::escape($user_online->ident).'</a>';
                } else {
                    $online['users'][] = "\n\t\t\t\t".'<dd>'.Utils::escape($user_online->ident);
                }
            } else {
                ++$online['num_guests'];
            }
        }

        if (isset($online['users'])) {
            $online['num_users'] = count($online['users']);
        } else {
            $online['num_users'] = 0;
        }

        $online = Container::get('hooks')->fire('model.index.fetch_users_online', $online);

        return $online;
    }
public function fetchUsersOnline()
    {
        Container::get('hooks')->fire('model.index.fetch_users_online_start');

        // Fetch users online info and generate strings for output
        $online = [];
        $online['num_guests'] = 0;

        $query['select'] = ['user_id', 'ident'];
        $query['where'] = ['idle' => '0'];
//        $query['order_by'] = array('ident');

        $query = DB::forTable('online')
            ->select_many($query['select'])
            ->where($query['where'])
            ->orderByExpr('ident');
//            ->order_by_many($query['order_by']);

        $query = Container::get('hooks')->fireDB('model.index.query_fetch_users_online', $query);

        $query = $query->find_result_set();

        foreach ($query as $user_online) {
            if ($user_online->user_id > 1) {
                if (User::get()->g_view_users == '1') {
                    $online['users'][] = "\n\t\t\t\t".'<dd><a href="'.
                        Router::pathFor('userProfile', ['id' => $user_online->user_id]).'">'.
                        Utils::escape($user_online->ident).'</a>';
                } else {
                    $online['users'][] = "\n\t\t\t\t".'<dd>'.Utils::escape($user_online->ident);
                }
            } else {
                ++$online['num_guests'];
            }
        }

        if (isset($online['users'])) {
            $online['num_users'] = count($online['users']);
        } else {
            $online['num_users'] = 0;
        }

        $online = Container::get('hooks')->fire('model.index.fetch_users_online', $online);

        return $online;
    }
public function fetchUsersOnline ( ) { Container :: get ( 'hooks' ) -> fire ( 'model.index.fetch_users_online_start' ) ; // Fetch users online info and generate strings for output $ online = [ ] ; $ online [ 'num_guests' ] = 0 ; $ query [ 'select' ] = [ 'user_id' , 'ident' ] ; $ query [ 'where' ] = [ 'idle' => '0' ] ; //        $query['order_by'] = array('ident'); $ query = DB :: forTable ( 'online' ) -> select_many ( $ query [ 'select' ] ) -> where ( $ query [ 'where' ] ) -> orderByExpr ( 'ident' ) ; //            ->order_by_many($query['order_by']); $ query = Container :: get ( 'hooks' ) -> fireDB ( 'model.index.query_fetch_users_online' , $ query ) ; $ query = $ query -> find_result_set ( ) ; foreach ( $ query as $ user_online ) { if ( $ user_online -> user_id > 1 ) { if ( User :: get ( ) -> g_view_users == '1' ) { $ online [ 'users' ] [ ] = "\n\t\t\t\t" . '<dd><a href="' . Router :: pathFor ( 'userProfile' , [ 'id' => $ user_online -> user_id ] ) . '">' . Utils :: escape ( $ user_online -> ident ) . '</a>' ; } else { $ online [ 'users' ] [ ] = "\n\t\t\t\t" . '<dd>' . Utils :: escape ( $ user_online -> ident ) ; } } else { ++ $ online [ 'num_guests' ] ; } } if ( isset ( $ online [ 'users' ] ) ) { $ online [ 'num_users' ] = count ( $ online [ 'users' ] ) ; } else { $ online [ 'num_users' ] = 0 ; } $ online = Container :: get ( 'hooks' ) -> fire ( 'model.index.fetch_users_online' , $ online ) ; return $ online ; }
Returns the elements needed to display users online
Returns the elements needed to display users online