@ -311,69 +311,102 @@ function api_get_months_long($language = null) {
*/
/**
* Answers in what order names of a person to be shown or sorted, depending on a given language.
* @param string $language (optional) Language indentificator. If it is omited, the current interface language is assumed.
* @return bool The result TRUE means that the order shold be first_name last_name, FALSE means last_name first_name.
* Checks whether a given format represents prson name in Western order (for which first name is first).
* @param int/string $format (optional) The person name format. It may be a pattern-string (for example '%t. %l, %f') or some of the constants PERSON_NAME_COMMON_CONVENTION (default), PERSON_NAME_WESTERN_ORDER, PERSON_NAME_EASTERN_ORDER, PERSON_NAME_LIBRARY_ORDER.
* @param string $language (optional) The language indentificator. If it is omited, the current interface language is assumed. This parameter has meaning with the format PERSON_NAME_COMMON_CONVENTION only.
* @return bool The result TRUE means that the order is first_name last_name, FALSE means last_name first_name.
* Note: You may use this function:
* 1. for determing the order of the fields or columns "First name" and "Last name" in forms and tables;
* 2. for constructing the ORDER clause of SQL queries, related to first name and last name;
* 3. for adjusting php-implemented sorting by names in tables and reports.
* @author Ivan Tcholakov
*/
function api_is_western_name_order($language = null) {
function api_is_western_name_order($format = null, $language = null) {
* Builds a person (full) name depending on the convention for a given language.
* @param string $first_name The first name of the preson.
* @param string $last_name The last name of the person.
* @param string $language (optional) Language indentificator. If it is omited, the current interface language is assumed.
* @param int (optional) $option A parameter for overriding the common convention, it should be used in limited number of cases.
* Its values may be: PERSON_NAME_COMMON_CONVENTION (default), PERSON_NAME_WESTERN_ORDER, PERSON_NAME_EASTERN_ORDER, PERSON_NAME_LIBRARY_ORDER.
* @param string $title The title of the person.
* @param int/string $format (optional) The person name format. It may be a pattern-string (for example '%t. %l, %f') or some of the constants PERSON_NAME_COMMON_CONVENTION (default), PERSON_NAME_WESTERN_ORDER, PERSON_NAME_EASTERN_ORDER, PERSON_NAME_LIBRARY_ORDER.
* @param string $language (optional) The language indentificator. If it is omited, the current interface language is assumed. This parameter has meaning with the format PERSON_NAME_COMMON_CONVENTION only.
* @return bool The result is sort of full name of the person.
* Sample results:
* Peter Ustinoff - the Western order
* Ustinoff Peter - the Eastern order
* Ustinoff, Peter - the library order
* Note: See the file dokeos/main/inc/lib/internationalization_database/name_order_conventions.php
* where you can revise the convention for your language.
* Peter Ustinoff or Dr. Peter Ustinoff - the Western order
* Ustinoff Peter or Dr. Ustinoff Peter - the Eastern order
* Ustinoff, Peter or - Dr. Ustinoff, Peter - the library order
* Note: See the file dokeos/main/inc/lib/internationalization_database/name_order_conventions.php where you can revise the convention for your language.
* @author Carlos Vargas <carlos.vargas@dokeos.com> - initial implementation.
* @author Ivan Tcholakov
*/
function api_get_person_name($first_name, $last_name, $language = null, $option = PERSON_NAME_COMMON_CONVENTION) {