Class constructor
void
PolarDbQuery
()
Activate a new user
boolean
activate_user
(integer $user_id, string $activ_code)
-
integer
$user_id: ID of user to activate
-
string
$activ_code: Activation code (32 chars)
Update user password
boolean
change_user_password
(integer $user_id, string $old_password, string $new_password)
-
integer
$user_id: User ID
-
string
$old_password: Old (current) user password
-
string
$new_password: New user password
Delete day info from database (by user ID and day)
boolean
delete_day_info
(integer $user_id, string $day)
-
integer
$user_id: User ID
-
string
$day: day of day info (format : YYYY-MM-DD)
Delete exercise and all related data from database by user ID, day, and rank
Note : Get exercise ID, then calls delete_exercise_by_id().
boolean
delete_exercise_by_day_rank
(integer $user_id, string $day, integer $rank)
-
integer
$user_id: User ID
-
string
$day: day of exercise (format : YYYY-MM-DD)
-
integer
$rank: Rank of exercise within day
Delete exercise and all related data from database by exercise ID
Note : Related data in tables :
- plw_data : Exercise data as in HRM file (if recorded)
- plw_stat : Exercise statistics (if recorded)
- plw_int_training : Interval training elements (if type is int_training)
- plw_lap : Exercise laps
boolean
delete_exercise_by_id
(integer $id)
Get day information data for a user
array
get_day_info
(integer $user_id, string $day)
-
integer
$user_id: User ID
-
string
$day: Day (format : YYYY-MM-DD)
Get exercises summary + sum / avg / max by sport within a period
Used to compute weekly statistics for instance.
Consider exercises in reports only.
array
get_exercises_by_sport
(integer $user_id, string $min_day, [string $max_day = null], [boolean $detail = true])
-
integer
$user_id: User ID
-
string
$min_day: First day in period (format : YYYY-MM-DD)
-
string
$max_day: Last day in period (format : YYYY-MM-DD) If null, then period ends at current date.
-
boolean
$detail: true to get exercises summary, else false
Get global statistics about online exercises
Consider all active members. Consider all online exercises having a matching sport ID (even unknown).
array
get_exercises_stats
(array $params, integer &$sum_nb_exe)
-
array
$params: Associative array of parameters :
- 'max_age' : Only exercises newer than <max_age> days
- 'min_elapsed' : Only exercises during at least
<min_elapsed> minutes
- 'publish_list' : Array of publish status to filter
('public' => 'public' or 'public-but-desc')
- 'by_publish' : Split by publish status if true
- 'sport_list' : Array of sport indexes to filter
- 'by_sport' : Split by sport index if true
-
integer
&$sum_nb_exe: Total nb of matching exercises
Get exercise information
array
get_exercise_info
(integer $exe_id)
-
integer
$exe_id: Exercise ID
Get all laps in an exercise
array
get_exercise_laps
(integer $exe_id, [string $lap_type = null])
-
integer
$exe_id: Exercise ID
-
string
$lap_type: Lap type in ('polar','distance','altitude','interval'). If null, all types are returned.
Get statistics for an exercise
Statistics are for heart rate, speed, cadence, and stride length depending on s_mode while recording.
array
get_exercise_stats
(integer $exe_id)
-
integer
$exe_id: Exercise ID
Get global statistics about active members / online exercises
Consider all active members. Consider all online exercises (even with none matching sport ID)
array
get_global_stats
(array $params)
-
array
$params: Associative array of parameters :
- 'publish_list' : Array of publish status to filter
('public' => 'public' or 'public-but-desc')
- 'by_publish' : Split by publish status if true
Get interval training elements in an exercise
array
get_interval_training
(integer $exe_id)
-
integer
$exe_id: Exercise ID
Get last exercises of all public (and active) users.
Last means most recent exercise date / time. Exercises are sorted from most recent to less recent. Consider all online exercises having a matching sport ID (even unknown).
array
get_last_exercises_summary
([array $params = null])
-
array
$params: Associative array of parameters :
- 'max_exe' : Maximum number of exercises to return
- 'max_age' : Only exercises newer than <max_age> days
- 'min_elapsed' : Only exercises during at least
<min_elapsed> minutes
Get last active and public members
Last means most recent members (registration date). Members are sorted from most recent to less recent.
array
get_last_members_summary
([array $params = null])
-
array
$params: Associative array of parameters :
- 'max_mbr' : Maximum number of members to return
- 'max_age' : Only members newer than <max_age> days
- 'min_exe' : Only public members with at least
<min_exe> public exercises are considered.
Get read rights on one user booknote for another user (or anonymous reader)
string
get_read_rights
(integer $publish_user_id, integer $logged_user_id, string &$nickname)
-
integer
$publish_user_id: ID of user owner of booknote
-
integer
$logged_user_id: ID uf user logged in (null if anonymous)
-
string
&$nickname: Nickname of <publish_user_id> user
Get statistics for all exercises within a period
Used to compute weekly statistics for instance.
Consider exercises in reports only.
Statistics are for heart rate, speed, cadence, and stride length depending on s_mode while recording.
array
get_stats_for_period
(integer $user_id, string $min_day, string $max_day)
-
integer
$user_id: User ID
-
string
$min_day: First day in period (format : YYYY-MM-DD)
-
string
$max_day: Last day in period (format : YYYY-MM-DD)
Get user information data
array
get_user_info
(integer $user_id)
-
integer
$user_id: User ID
Get user preferences
array
get_user_preferences
(integer $user_id)
-
integer
$user_id: User ID
Create a new user (with inactive status)
boolean
insert_user
(array $info, integer &$user_id, string &$activ_code)
-
array
$info: Associative array of user fields :
- 'nickname' : User nickname
- 'email' : User email address
- 'password' : User password
- 'publish' : Publish status
-
integer
&$user_id: ID of user created
-
string
&$activ_code: Activation code (32 chars MD5 generated)
Login user, get user information data
User status must be 'active'. Also set last visit timestamp and use user language.
array
login_user
(string $email, string $password, [ $email_cookie = false], [ $password_cookie = false])
-
string
$email: Email of user
-
string
$password: Password of user
-
$email_cookie
-
$password_cookie
Set user preferences
Insert preference if not exist, delete if value is '', else update value.
boolean
set_user_preferences
(integer $user_id, array $prefs)
-
integer
$user_id: User ID
-
array
$prefs: User preferences : Associative array of preferences (see get_user_preferences)
Update user fields
boolean
update_user_info
(integer $user_id, array $info)
-
integer
$user_id: User ID
-
array
$info: Associative array of user fields :
- 'nickname' : User nickname
- 'publish' : Publish status
- 'language' : Language
- 'unit' : Unit (metric or us)
- 'gender' : Gender
- 'birthdate' : Birthdate dd/mm/yy[yy] (sep /,-,., ' ')
- 'height' : Height in cm (decimal sep is . or ,)
- 'weight' : Weight in kg (decimal sep is . or ,)
- 'rest_hr' : Rest HR (bpm)
- 'max_hr' : Max HR (bpm)
- 'vo2max' : VO2max in ml/kg/min (decimal sep is . or ,)
- 'vma' : MAS in km/h (decimal sep is . or ,)