Class PolarCalendar

Description

Class to handle Calendar (browsing with day info / exercises summary)

Located in /class/PolarCalendar.class.php (line 40)


	
			
Variable Summary
array $sports
integer $userId
integer $weekNb
Method Summary
void PolarCalendar (integer $user_id, [integer $week_nb = null])
void display_html ([string $min_date = NULL], [string $max_date = NULL], string $nickname)
array get_days ([string $min_date = NULL], [string $max_date = NULL])
void get_week_limits (string &$min_date, string &$max_date)
string _close_bar_graph (handler $img)
string _display_hr_graph_bar (array $hrs, integer $elapsed, integer $max_elapsed, integer $rest_hr, integer $max_hr, integer &$width, integer &$height)
void _gen_navigation_bar (string $min_exe_date, string $max_exe_date, string $min_date)
array _get_exercises_hr_stats (string $min_day, string $max_day)
Variables
array $sports (line 57)

List of sports (From database)

  • var: Index is sport ID, element: array('name' => name, 'abbrev' => abbreviation)
integer $userId (line 46)

User ID (as in database)

integer $weekNb (line 51)

Number of weeks to display

Methods
Constructor PolarCalendar (line 67)

Class constructor

void PolarCalendar (integer $user_id, [integer $week_nb = null])
  • integer $user_id: User ID (as in database)
  • integer $week_nb: Number of weeks to display, take config $GLOBALS['calendar_week_nb'] if null.
display_html (line 206)

Display online exercises and day info summary between 2 dates in HTML array

void display_html ([string $min_date = NULL], [string $max_date = NULL], string $nickname)
  • string $min_date: Format YYYY-MM-DD, default: first day of current week - N-1 weeks
  • string $max_date: Format YYYY-MM-DD, default: min_date + N weeks
  • string $nickname: User nickname to display
get_days (line 166)

Get online exercises and day info summary between 2 dates

  • return:

    Array of days. Index is YYYY-MM-DD. Format of a day is array('info' => dayinfo, 'exes' => array(rank => exercise)), where

    dayinfo: array of fields :

    • temperature (celcius x 10)
    • weather (list of values)
    exercise: array of fields :
    • id
    • sport_id
      • start_time (HH:MM:SS)
      • elapsed (seconds x 10)
      • real_distance (meters)
      • avg_hr
      • avg_speed (km/h x 10)
      • ascend (meters)
      • energy (Kcal)
      • physio_energy (Kcal)
      • exercise_type in ('training','contest')

    array get_days ([string $min_date = NULL], [string $max_date = NULL])
    • string $min_date: Format YYYY-MM-DD, default: first day of current week - N-1 weeks
    • string $max_date: Format YYYY-MM-DD, default: min_date + N weeks
    get_week_limits (line 84)

    Get first and last days of a period matching weeks

    void get_week_limits (string &$min_date, string &$max_date)
    • string &$min_date: Format YYYY-MM-DD, if NULL: first day of current week - N-1 weeks
    • string &$max_date: Format YYYY-MM-DD, if NULL: min_date + N weeks
    _close_bar_graph (line 655)

    Close a GD graph and create GIF file in TMP directory

    • return: File name of graph
    string _close_bar_graph (handler $img)
    • handler $img: GD image handler
    _display_hr_graph_bar (line 595)

    Display graphical bar graph for heart rate distribution (whole week)

    GD library is used.

    • return: File name of generated graph (in TMP directory)
    string _display_hr_graph_bar (array $hrs, integer $elapsed, integer $max_elapsed, integer $rest_hr, integer $max_hr, integer &$width, integer &$height)
    • array $hrs: Array of heart distribution (from stat table)
    • integer $elapsed: Elapsed time for whole week (seconds x 10)
    • integer $max_elapsed: Maximum elapsed time for displayed weeks (seconds x 10), used to set bar graph length.
    • integer $rest_hr: Rest heart rate
    • integer $max_hr: Maximum heart rate
    • integer &$width: Image width in pixels
    • integer &$height: Image height in pixels
    _gen_navigation_bar (line 544)

    Display navigation bar

    void _gen_navigation_bar (string $min_exe_date, string $max_exe_date, string $min_date)
    • string $min_exe_date: Date of first exercise for user (format YYYY-MM-DD).
    • string $max_exe_date: Date of last exercise for user (format YYYY-MM-DD).
    • string $min_date: Date of first day displayed (must be a monday) (format YYYY-MM-DD).
    _get_exercises_hr_stats (line 673)

    Get heart rate statistics for exercises within a period

    • return: Heart rate statistics (bpm => <nb of occurences>)
    array _get_exercises_hr_stats (string $min_day, string $max_day)
    • string $min_day: First day of period (format : YYYY-MM-DD)
    • string $max_day: Last day of period (format : YYYY-MM-DD)

    Documentation generated on Sat, 28 Mar 2009 23:15:53 +0000 by phpDocumentor 1.4.1