Class PolarLoader

Description

Class to load data files from user data directory to database

Located in /class/PolarLoader.class.php (line 44)


	
			
Variable Summary
string $dataPath
array $sports
integer $userId
Method Summary
void PolarLoader (integer $user_id)
boolean display_table (array $files, [integer $year = null])
array gen_files_vs_db_status ([integer $year = null])
void _action_row ()
integer _get_file_strings (integer $f_ind, array $file,  &$type, string &$status, string &$checkbox, array &$sum_file_by_status, array &$sum_file_by_type)
void _table_header ()
Variables
string $dataPath (line 55)

User data path from web server root (without trailing /)

array $sports (line 61)

List of sports (From database)

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

User ID (as in database)

Methods
Constructor PolarLoader (line 69)

Class constructor

void PolarLoader (integer $user_id)
  • integer $user_id: User ID (as in database)
display_table (line 374)

Display HTML table / form to load data files into database

  • return: true if at least one file, else false
boolean display_table (array $files, [integer $year = null])
  • array $files: Contains information on uploaded files. See gen_files_vs_db_status() for structure.
  • integer $year: Year displayed, else null
gen_files_vs_db_status (line 155)

Generate array of data files vs database with status and some data

  • return: Array of files with additional info, structure:
    • 'type' : Type of file in ('ppd','pdd','hrm')
    • 'status' : File status in ('new','updated','unchanged', 'missing') . 'new' if exists as data file and not in DB . 'updated' if older in DB than in data file . 'unchanged' if newer in DB than in data file . 'missing' if exists in DB and not as data file
    • 'name' : File name
    • 'year' : Year yyyy (if type is 'pdd' or 'hrm')
    • 'month' : Month in 1-12 (if type is 'pdd' or 'hrm')
    • 'day' : Day in 1-31 (if type is 'pdd' or 'hrm')
    • 'size' : Size of file in bytes
    For hrm, 'new' and 'updated' status, additional fields :
    • 'title', 'sport_id', 'real_distance', 'start_time', 'total_time', 'ascend', 'description'
    Array is sorted so it is in right order for parsing :
    • ppd file is first if present
    • by date, pdd file first, then hrm files by rank
  • todo: Add 'gpx' type for GPS data
array gen_files_vs_db_status ([integer $year = null])
  • integer $year: Year to consider (all years if null)
get_available_years (line 87)

Generate array of data files vs database with status and some data

  • return: Array of years where there is at least one data file or at list one record in database, sorted by year. Empty array if no data at all.
array get_available_years ()
_action_row (line 535)

Display multiple selection row

void _action_row ()
_get_file_strings (line 584)

Get localized strings common to all types of files and return file size

  • return: File size in bytes
integer _get_file_strings (integer $f_ind, array $file,  &$type, string &$status, string &$checkbox, array &$sum_file_by_status, array &$sum_file_by_type)
  • integer $f_ind: Index of file in files array
  • array $file: File Structure
  • string &$status: File status
  • string &$checkbox: Checkbox HTML input
  • array &$sum_file_by_status: in/out : add file size to status
  • array &$sum_file_by_type: in/out : add file size to type
  • &$type
_table_header (line 561)

Display table header or footer

void _table_header ()

Documentation generated on Sat, 28 Mar 2009 23:16:50 +0000 by phpDocumentor 1.4.1