Overview

Packages

  • Admin
  • Archive
  • Common
  • DB
  • Express
  • Form
  • Layout
  • Mailer
  • None
  • OpenHomeoDB
  • PDF
    • MC
  • Process
  • Rep
  • RevRep
  • SaveReps
  • Search
  • Session
  • SymRem
  • TreeView
  • UserDB

Classes

  • OpenHomeoDB
  • Overview
  • Package
  • Class
  • Tree

Class OpenHomeoDB

OpenHomeoDB provides the database public functionality for OpenHomeopath

DbPlugin
Extended by DB
Extended by OpenHomeoDB

Direct known subclasses

UserDB
Package: OpenHomeoDB
Category: Database
Copyright: 2007-2014 Henri Schumacher
License: GNU Affero General Public License v3
Author: Henri Schumacher <henri.hulski@gazeta.pl>
Located at include/classes/db/openhomeo_db.php
Methods summary
public
# archive_table_row( string $table, string $where, string $archive_type )

archive_table_row archives edited or deleted table rows.

archive_table_row archives edited or deleted table rows.

Parameters

$table
string
$table the table to be archived
$where
string
$where WHERE declaration for the rows to be archived
$archive_type
string
$archive_type reason, why archiving
public
# restore_table_row( string $table, string $where, string $timestamp )

restore_table_row restores archived table rows.

restore_table_row restores archived table rows.

Parameters

$table
string
$table the table to restore
$where
string
$where WHERE declaration for the rows to be restored
$timestamp
string
$timestamp timestamp given in the table row
public string
# get_custom_table( string $table )

get_custom_table determines which custom table for a given table will be used.

get_custom_table determines which custom table for a given table will be used.

Parameters

$table
string
$table given table (symptoms | sym_rem | materia)

Returns

string
custom table
public array
# get_custom_src( string $username, string $src_table )

get_custom_src returns an array with the sources the user has set for his personal either repertory profile or materia medica.

get_custom_src returns an array with the sources the user has set for his personal either repertory profile or materia medica.

Parameters

$username
string
$username the user
$src_table
string
$src_table which custom sources table to use (custom_rep | custom_materia)

Returns

array
public string
# get_sym_base_table( false|string $custom_symptom_lang = false )

get_sym_base_table returns the sym-basetable to be used for symptoms.

get_sym_base_table returns the sym-basetable to be used for symptoms.

If there exists no symptom-translations the whole sym-table will be used. If there are translations the language-based sym-table according to the usersettings will be used. If $custom_symptom_lang is set, the given language will be used.

Parameters

$custom_symptom_lang
false|string
$custom_symptom_lang optional the symptom language to be used as language code

Returns

string
public string|false
# get_custom_symptom_lang( array|string $sources = 'all' )

get_custom_symptom_lang returns the language to be used for symptoms

get_custom_symptom_lang returns the language to be used for symptoms

If there exists no symptom-translations the public function returns false. If there are translations the language according to the usersettings will be used. If given an array of src_id's as $sources the sym-language will only be returned, when for one of the given sources exists an translation. Else the public function returns false.

Parameters

$sources
array|string
$sources optional an array of src_id's to check

Returns

string|false
public array|false
# get_lang_only_symptom_table( )

get_lang_only_symptom_table returns an array with information about the language symptom table to be used if any, else false.

get_lang_only_symptom_table returns an array with information about the language symptom table to be used if any, else false.

If the user wants to use all symptoms from one language the public function returns an array with the language code, the language name and the symptom table. Else the public function returns false.

Returns

array|false
public boolean
# is_sym_lang( string $lang_id )

is_sym_lang returns true if the given language is used as a symptom language, else false.

is_sym_lang returns true if the given language is used as a symptom language, else false.

Parameters

$lang_id
string
$lang_id language code

Returns

boolean
public array
# get_sym_langs( )

get_sym_langs returns an array with used symptom languages in the database

get_sym_langs returns an array with used symptom languages in the database

Returns

array
public boolean|string
# is_custom_table( string $table )

is_custom_table determines which kind of table for the given table will be used.

is_custom_table determines which kind of table for the given table will be used.

If the user uses a custom table the public function returns true. If the given table is symptoms and the user uses all symptoms from one language the public function returns this language name in the current language. Else or if no user is logged in the public function returns false.

Parameters

$table
string
$table given table (symptoms | sym_rem | materia)

Returns

boolean|string
public boolean
# exist_symptom_translation( array|string $sources = 'all' )

exist_symptom_translation returns true if exists any translations for symptoms in the database, else false.

exist_symptom_translation returns true if exists any translations for symptoms in the database, else false.

If src_id's-array given as $sources, the public function checks only for symptoms related to the given sources.

Parameters

$sources
array|string
$sources optional an array of src_id's to check

Returns

boolean
public boolean
# is_translated( integer $sym_id )

is_translated checks if the given symptom has a translation.

is_translated checks if the given symptom has a translation.

Parameters

$sym_id
integer
$sym_id sym_id from the symptom to check

Returns

boolean
public
# create_custom_table( string $table, string $custom_table = "" )

create_custom_table creates the custom table for sym_rem or materia based on the user preferences.

create_custom_table creates the custom table for sym_rem or materia based on the user preferences.

Parameters

$table
string
$table base table: sym_rem | materia
$custom_table
string
$custom_table optional custom_table to create
public
# create_custom_symptom_table( string $custom_table = "", boolean $update = false )

create_custom_table creates the custom table for symptoms based on the user preferences.

create_custom_table creates the custom table for symptoms based on the user preferences.

It also loggs the current number of symptoms of the base table and the name of the base table into the sym_stats table. So it's possible to check if symptoms will be added to the base table and update the custom table

Parameters

$custom_table
string
$custom_table optional custom_table to create
$update
boolean
$update if true updates custom symptom table when exists, if false leaves it unchanged
public
# update_custom_symptom_table( )

update_custom_symptom_table updates the custom symptom table if the symptom base table has changed.

update_custom_symptom_table updates the custom symptom table if the symptom base table has changed.

This public function is called during log in and also if no user is logged in for updating the default symptom table.

public string
# add_missing_parents( string $sym_table = "symptoms" )

add_missing_parents completes parent-rubrics in the symptom table.

add_missing_parents completes parent-rubrics in the symptom table.

If several rubrics exists, which starts with the same rubric before a '>', but the parent-rubric doesn't exists, it will be generated. If the rubric before '>' exists only once, the '>' will be converted in a comma (',').

Parameters

$sym_table
string
$sym_table optional the symptom table to update

Returns

string
the log info as html
public string
# update_symptom_tree( string $sym_table = "symptoms" )

update_symptom_tree updates the tree-structure of the symptom table.

update_symptom_tree updates the tree-structure of the symptom table.

First all symptoms that have no ">" in the symptom name will be parsed. Then we check if the symptom name occur again in the table followed by ">". In this case these symptoms get the "parent_id" of the superior symptom. Next all symptoms with one ">" will be parsed and so on.

Parameters

$sym_table
string
$sym_table optional the symptom table to update

Returns

string
the log info as html
public string
# update_symptom_tables( boolean $update_tree = false )

update_symptom_tables updates the main symptoms table and the language-symptom-tables.

update_symptom_tables updates the main symptoms table and the language-symptom-tables.

If symptoms were added, the public function completes parent-rubrics in the main symptoms table and updates its tree-structure. It also creates new language-symptom-tables and update the sym_stats table.

If no symptoms were added but $update_tree is true the public function only creates new language-symptom-tables.

This public function is called, when an administrator loggs in.

Parameters

$update_tree
boolean
$update_tree

Returns

string
the log info as html
public string
# update_lang_symptom_tables( boolean $create_tables = false )

update_lang_symptom_tables updates the language-symptom-tables.

update_lang_symptom_tables updates the language-symptom-tables.

The public function completes parent-rubrics in the language-symptom-tables, updates their tree-structure and creates/replaces the language-only views.

If $create_tables is true the language-symptom-tables ("sym__de", "sym__en", etc.) will be created/replaced on the base of the main symptom-table ("symptoms").

Parameters

$create_tables
boolean
$create_tables

Returns

string
the log info as html
public array|string
# get_source_id( array|integer $source_nr )

get_source_id returns a src_id for a given src_no.

get_source_id returns a src_id for a given src_no.

If $source_nr is an array of source-numbers it returns an array of source-id's.

Parameters

$source_nr
array|integer
$source_nr Parameter description (if any) ...

Returns

array|string
public array|integer
# get_source_nr( array|string $source_id )

get_source_nr returns a src_no for a given src_id.

get_source_nr returns a src_no for a given src_id.

If $source_id is an array of source-id's it returns an array of source-numbers.

Parameters

$source_id
array|string
$source_id

Returns

array|integer
public array
# extract_src_no( string $custom_table )

extract_src_no returns an array of source-numbers extracted from the given custom table-name.

extract_src_no returns an array of source-numbers extracted from the given custom table-name.

Parameters

$custom_table
string
$custom_table the custom table name to extract from

Returns

array
public string
# get_symptomname( integer $sym_id )

get_symptomname returns the symptom including the main rubric for a given sym_id.

get_symptomname returns the symptom including the main rubric for a given sym_id.

Parameters

$sym_id
integer
$sym_id the ID of the symptom to check

Returns

string
Methods inherited from DB
db_fetch_assoc(), db_fetch_row(), get_primary_key(), reset_result(), send_query_limit(), table_exists()
OpenHomeopath PHP code documentation API documentation generated by ApiGen 2.8.0