Choose your database:
AnySQL
MySQL
MS SQL Server
PostgreSQL
SQLite
Firebird
Oracle
SQL Anywhere
DB2
MaxDB

Subscribe to our news:
Partners

Firebird PHP Generator online Help

Prev Return to chapter overview Next

OnPageLoaded

This event occurs after the page is completely loaded from the server. It allows you, for example, to add additional filters to the dataset.

 

Signature:

function OnPageLoaded()

 

Parameters:

This method has no parameters.

 

Example 1

The following code is used in our Schema Browser Demo to filter database objects belonging to the selected database:

 

applyDatasetFilter($this->dataset);

 

Here applyDatasetFilter() is a function defined in the schema_browser_utils.php file as follows:

 

function applyDatasetFilter(Dataset $dataset) {

    if (GetApplication()->IsGETValueSet('database'))

        $value = GetApplication()->GetGETValue('database');

    else

        $value = ArrayUtils::GetArrayValueDef($_COOKIE, 'database');

    if (StringUtils::IsNullOrEmpty($value)) {

        $globalConnectionOptions = GetGlobalConnectionOptions();

        $value = $globalConnectionOptions['database'];

    }

    if (!StringUtils::IsNullOrEmpty($value)) {

        $dataset->AddFieldFilter('Database_name', new FieldFilter($value, '='));

        setcookie('database', $value);

    }

}

 

Example 2

The following code is used in our Feature Demo to filter countries according to the values selected in the form:

 

// default values

$minLifeExpectancy = 40;

$maxLifeExpectancy = 90;

 

// checking values in the browser address line 

if (GetApplication()->isGetValueSet('minLifeExpectancy') &&

       GetApplication()->isGetValueSet('maxLifeExpectancy')) {

    $minLifeExpectancy = GetApplication()->GetGETValue('minLifeExpectancy');

    $maxLifeExpectancy = GetApplication()->GetGETValue('maxLifeExpectancy');

 

// or (if not found) in the session

} else if (isset($_SESSION['minLifeExpectancy']) && 

           isset($_SESSION['maxLifeExpectancy'])) {

    $minLifeExpectancy = $_SESSION['minLifeExpectancy'];

    $maxLifeExpectancy = $_SESSION['maxLifeExpectancy'];

}

 

// saving calculated values to the session

$_SESSION['minLifeExpectancy'] = $minLifeExpectancy;

$_SESSION['maxLifeExpectancy'] = $maxLifeExpectancy;

 

// applying filter to the dataset

$this->dataset->AddCustomCondition(

    "life_expectancy >= {$minLifeExpectancy} ".

    "AND life_expectancy <= {$maxLifeExpectancy}");



Prev Return to chapter overview Next