Class: Core

Source Location: /class_core.php

Class Overview [line 16]


Core methods. Will be extended by other classes.

Author(s):

  • Elpidio Latorilla

Version:

  • beta 1.0.08

Copyright:

  • 2002,2003 Elpidio Latorilla

Variables

Methods


Child classes:

Address
Address methods.
Appointment
Appointment methods.
Department
Department methods.
Diagnostics
Diagnostics.
Image
Image methods.
Immunization
Immunization methods.
Insurance
Insurance methods.
Measurement
Measurement methods.
News
News methods.
Notes
Notes methods.
Person
Person methods.
Personell
Personnel methods.
Prescription
Prescription methods.
Obstetrics
Obstetrics methods.
Comm
Communication information methods.
Product
Product methods.
OPRoom
Operating Room methods.
Access
Class for access authentication routínes.

Inherited Variables

Inherited Methods



Class Details

Core methods. Will be extended by other classes.

Note this class should be instantiated only after a "$db" adodb connector object has been established by an adodb instance

Tags:

[ Top ]


Class Variables

$buffer =

[line 52]

Type: mixed

Overrides:

[ Top ]

$buffer_array = array()

[line 36]

Tags:

  • var - For internal update/insert operations

Type: array

Overrides:

[ Top ]

$coretable =

[line 20]

Tags:

  • var - Table name used for core routines. Default table name.

Type: string

Overrides:

[ Top ]

$data_array = array()

[line 32]

Tags:

  • var - For internal update/insert operations

Type: array

Overrides:

[ Top ]

$dead_stat = "'deleted','hidden','inactive','void'"

[line 76]

Status items used in sql queries "IN (???)"

Tags:

  • access - private

Type: string

Overrides:

[ Top ]

$do_intern =

[line 61]

Tags:

  • access - private

Type: boolean

Overrides:

[ Top ]

$error_msg = ''

[line 70]

Internal error message usually used in debugging.

Tags:

  • access - private

Type: string

Overrides:

[ Top ]

$is_preloaded = FALSE

[line 64]

Type: mixed

Overrides:

[ Top ]

$normal_stat = "'','normal'"

[line 82]

Status items used in sql queries "IN (???)"

Tags:

  • access - private

Type: string

Overrides:

[ Top ]

$ok =

[line 62]

Tags:

  • access - private

Type: boolean

Overrides:

[ Top ]

$rec_count =

[line 48]

Tags:

  • var - For counting resulting rows. Can be extracted w/ the "LastRecordCount()" method.

Type: int

Overrides:

[ Top ]

$ref_array = array()

[line 28]

Tags:

  • var - Contains fieldnames of the table named in the $coretable. For internal update/insert operations.

Type: array

Overrides:

[ Top ]

$res = array()

[line 56]

Tags:

  • var - Used for containing results returned as pointer.

Type: array

Overrides:

[ Top ]

$result =

[line 40]

Tags:

  • var - record object For sql query results.

Type: ADODB

Overrides:

[ Top ]

$sql = ''

[line 24]

Tags:

  • var - Holder for SQL query. Can be extracted with the "getLastQuery()" method.

Type: string

Overrides:

[ Top ]

$where =

[line 44]

Tags:

  • var - For update sql queries condition

Type: string

Overrides:

[ Top ]


Class Methods

coreFieldNames

array coreFieldNames( )

[line 499]

Returns the core field names of the core table in an array.

Tags:

  • access - public

Parameters:

[ Top ]

deleteDBCache

boolean deleteDBCache( char $id)

[line 489]

Deletes data from the database cache based on the id key.

Tags:

  • access - public

Parameters:

  • char $id - ID of data for deletion.

[ Top ]

FilesListArray

mixed FilesListArray( [string $path = ''], [string $filter = ''], [string $sort = 'ASC'])

[line 510]

Returns a list of filename within a path in array.

Tags:

  • return - array or boolean
  • access - public

Parameters:

  • string $path - Path of the filenames relative to the root path.
  • string $filter - Discriminator string.
  • string $sort - The sort direction (ASC or DESC) defaults to ASC (ascending)

[ Top ]

getAllDataArray

mixed getAllDataArray( )

[line 313]

Returns all records with the all items from the table.

The table name must be set in the coretable first by setTable() method.

Tags:

  • return - ADODB record object or boolean
  • global - ADODB $db: db link Example: <code> $core->setTable('care_person'); $persons = $core->getAllDataArray(); while(list($x,$v)=each($persons)){ ... } </code>

Parameters:

[ Top ]

getAllDataObject

mixed getAllDataObject( )

[line 257]

Returns all records with all items from the table.

The table name must be set in the coretable first by setTable() method.

Tags:

  • return -

    ADODB record object or boolean

    Example:


    1 $core->setTable('care_person');
    2 $persons = $core->getAllDataObject();
    3 while($row=$persons->FetchRow()){
    4 ...
    5 }

Parameters:

[ Top ]

getAllItemsArray

array getAllItemsArray( string &$items)

[line 286]

Similar to getAllItemsObject() method but returns the records in an associative array.

Returns all records with the needed items from the table. The table name must be set in the coretable first by setTable() method.

Example:


1 $items="pid, name_last, name_first, birth_date, sex";
2 $core->setTable('care_person');
3 $persons = $core->getAllItemsArray($items);
4 while(list($x,$v)=each($persons)){
5 ...
6 }

Tags:

  • return - associative
  • access - private

Parameters:

  • string &$items - items By reference. Items to be returned from each record fetched from the table. The items should be separted with commas.

[ Top ]

getAllItemsObject

mixed getAllItemsObject( string &$items)

[line 231]

Returns all records with the needed items from the table.

The table name must be set in the coretable first by setTable() method.

Tags:

  • return -

    ADODB record object or boolean

    Example:


    1 $items="pid, name_last, name_first, birth_date, sex";
    2 $core->setTable('care_person');
    3 $persons = $core->getAllItemsObject($items);
    4 while($row=$persons->FetchRow()){
    5 ...
    6 }

Parameters:

  • string &$items - items By reference. Items to be returned from each record fetched from the table. The items should be separted with commas.

[ Top ]

getDBCache

mixed getDBCache( string $id, mixed &$data, [boolean $bin = FALSE])

[line 468]

Gets temporary data from the database cache.

Tags:

  • return - string, binary or boolean
  • access - public

Parameters:

  • string $id - Cached data identification
  • mixed &$data - By reference. Variable for the data to be fetched.
  • boolean $bin - Signals the type of data contained in the $data. FALSE=nonbinary data, TRUE=binary.

[ Top ]

getErrorMsg

string getErrorMsg( )

[line 418]

Feturns the value of error_msg, the internal error message.

Parameters:

[ Top ]

getLastQuery

string getLastQuery( )

[line 404]

Returns the the last sql query string

Parameters:

[ Top ]

getResult

mixed getResult( )

[line 411]

Feturns the value of result

Overridden in child classes as:

Lab::getResult()
Gets the test result data basing on encounter number, job id, and test group id keys.

Parameters:

[ Top ]

insertDataFromArray

boolean insertDataFromArray( array &$array)

[line 333]

Inserts data from an array (passed by reference) into a table.

This method uses the table and field names from internal variables previously set by "use????" methods that point the object to the proper table and fields names. Private or public (preferably private being called by other methods).

Tags:

  • access - private

Overridden in child classes as:

PersonInsurance::insertDataFromArray()
Inserts data from an array into a database table.
Person::insertDataFromArray()
Inserts the data into the care_person table.

Parameters:

  • array &$array - By reference. The array containing the data. Note: the array keys must correspond to the table field names.

[ Top ]

insertDataFromInternalArray

boolean insertDataFromInternalArray( )

[line 207]

Inserts data from the internal array previously filled with data by the setDataArray() method.

This method also uses the field names from the internal array $ref_array previously set by "use????" methods that point the core object to the proper table and fields names.

Tags:

  • access - public

Overridden in child classes as:

Person::insertDataFromInternalArray()
Inserts the data from the internal buffer array into the care_person table.

Parameters:

[ Top ]

isPreLoaded

boolean isPreLoaded( )

[line 436]

Returns the value of is_preloaded that is set by methods that preload large number of data.

Parameters:

[ Top ]

LastRecordCount

int LastRecordCount( )

[line 443]

Returns the value of rec_count

Parameters:

[ Top ]

saveDBCache

boolean saveDBCache( string $id, mixed &$data, [boolean $bin = FALSE])

[line 454]

Saves temporary data to a cache in database.

Tags:

  • access - public

Parameters:

  • string $id - Cached data identification
  • mixed &$data - By referece. Data to be saved.
  • boolean $bin - Signals the type of the data contained in the param $data. FALSE=nonbinary data, TRUE=binary

[ Top ]

setDataArray

void setDataArray( array &$array)

[line 113]

Points the core data array to the external array that holds the data to be stored.

Parameters:

  • array &$array - By reference, the associative array holding the data.

[ Top ]

setRefArray

boolean setRefArray( array &$array)

[line 101]

Points the reference variable $ref_array to the field names' array.

This field names array corresponds to the database table set by the setTable() method

Parameters:

  • array &$array - By reference, the associative array containing the field names.

[ Top ]

setSQL

void setSQL( string &$sql)

[line 136]

Sets the internal sql query variable to the sql query.

Parameters:

  • string &$sql - Query statement.

[ Top ]

setTable

void setTable( string $table)

[line 91]

Sets the coretable variable to the name of the database table.

This points the core object to that database table and all core routines will use this table until the core table is reset or replaced with another table name

Parameters:

  • string $table - Table name

[ Top ]

setWhereCondition

void setWhereCondition( string $cond)

[line 429]

Sets the "where" condition in an update query used with the updateDataFromInternalArray() method.

The where condition defaults to "nr='$nr'".

Tags:

  • access - private

Parameters:

  • string $cond - cond The constraint for the sql query.

[ Top ]

Transact

TRUE/FALSE Transact( [string $sql = ''])

[line 167]

Transaction routine, ADODB transaction. It internally uses the ADODB transaction routine.


1 $sql="INSERT INTO care_users (item) VALUES ('value')";
2 $core->Transact($sql);
If the query parameter is empty, the method will use the sql query stored internally. This internal sql query statement must be set with the setSQL() method or direct setting of variable before Transact() is called.


1 $sql="INSERT INTO care_users (item) VALUES ('value')";
2 $core->setSQL($sql);
3 $core->Transact();

or internally in class extensions


1 $this->sql="INSERT INTO care_users (item) VALUES ('value')";
2 $this->Transact();

Tags:

  • global - ADODB $db: db link
  • access - public

Overridden in child classes as:

Person::Transact()
Database transaction. Uses the adodb transaction method.

Parameters:

  • string $sql - sql SQL query statement.

[ Top ]

updateDataFromArray

boolean updateDataFromArray( array &$array, [int $item_nr = ''], [boolean $isnum = TRUE])

[line 363]

Updates a record with the data from an array (passed by reference) based on the primary key.

This method also uses the field names from an internal array previously set by "use????" methods that point the object to the proper table and fields names. private or public (preferably private being called by other methods)

Overridden in child classes as:

PersonInsurance::updateDataFromArray()
Updates a database table record with data from an array.

Parameters:

  • array &$array - Data. By reference. Note: the array keys must correspond to the table field names
  • int $item_nr - Key used in the update queries' "where" condition
  • boolean $isnum - Flags if the param $item_nr should be strictly numeric or not. Defaults to TRUE = strictly numeric.

[ Top ]

updateDataFromInternalArray

boolean updateDataFromInternalArray( [int $item_nr = ''], [boolean $isnum = TRUE])

[line 395]

Updates a table using data from an internal array previously filled with data by the setDataArray() method.

Update the record based on the primary key. This method also uses the field names from an internal array previously set by "use????" methods that point the object to the proper table and fields names.

Tags:

  • access - public

Parameters:

  • int $item_nr - Key used in the update queries' "where" condition
  • boolean $isnum - Flags if the param $item_nr should be strictly numeric or not. Defaults to TRUE = strictly numeric.

[ Top ]

_prepSaveArray

int _prepSaveArray( )

[line 185]

Filters the data array intended for saving, removing the key-value pairs that do not correspond to the table's field names.

Tags:

  • return - Size of the resulting data array.
  • access - private

Parameters:

[ Top ]

_RecordExists

boolean _RecordExists( [string $cond = ''])

[line 123]

Checks if a certain database record exists based onthe supplied query condition.

Should be used privately.

Parameters:

  • string $cond - The query "where" condition without the WHERE word.

[ Top ]


Documentation generated on Sun, 16 Nov 2003 01:02:34 +0100 by phpDocumentor 1.2.3