2022-05-31 - 3 new functions
Return the field type if the given `field` is found for the given `table`
Take a table ps_patient:
desc ps_patient
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
uid | int(11) | NO | PRI | auto_increment | |
sn_cdate | datetime | YES | |||
sn_mdate | datetime | YES | |||
sn_cuid | int(11) | YES | |||
sn_muid | int(11) | YES | |||
uuid | varchar(255) | NO | MUL | ||
last_name | varchar(255) | NO | MUL | ||
middle_name | varchar(255) | YES | |||
first_name | varchar(255) | NO | MUL | ||
nickname | varchar(255) | YES | |||
gender | varchar(255) | YES | |||
address1 | varchar(255) | YES | |||
address2 | varchar(255) | YES | |||
city | varchar(255) | YES | |||
country | varchar(5) | YES |
field_format = sed_dev_util::validate_field("ps_patient", "last_name");
Result: field_format eq "varchar";
field_format = sed_dev_util::validate_field("ps_patient", "bad_field");
Result: field_format == undefined
Returns the original context(s) with the multi lingual fields for the given language
entries = {"name_en": "My module", "name_fr": "Mon module", "version": "2"}; sed_dev_util::languify("sed_mod", entries, "en");
Results: {"name": "My module", "version": "2"}
entries = {"name_en": "My module", "name_fr": "Mon module", "version": "2"}; sed_dev_util::languify("sed_mod", entries, "en", keep_original: true);
Results: {"name": "My module", "name_en": "My module", "name_fr": "Mon module", "version": "2"}
entries = [ {"name_en": "My module", "name_fr": "Mon module", "version": "2"}, {"name_en": "My other module", "name_fr": "Mon autre module", "version": "1.2"} ];sed_dev_util::languify("sed_mod", entries, "en");
Results: [{"version":"2","name":"My module"},{"name":"My other module","version":"1.2"}]
Return an array of lg codes for the given table name
Using the table ps_patient which is set to use the sed_site_lg table with languages en, fr, and de
table_lgs = sed_dev_util::get_languages("ps_patient");table_lgs;
Results: ["en","fr","de"]
Edit© 2024 extenso Inc. All rights reserved.