Esempio n. 1
0
 function generateForm(&$edit)
 {
     global $lr_session, $CONFIG;
     $this->smarty->assign('privacy_url', variable_get('privacy_policy', ''));
     $this->smarty->assign('app_org_short_name', variable_get('app_org_short_name', 'the league'));
     $this->smarty->assign('province_names', getProvinceNames());
     $this->smarty->assign('state_names', getStateNames());
     $this->smarty->assign('country_names', getCountryNames());
     $player_classes = array('player' => 'Player', 'visitor' => 'Non-player account');
     if ($lr_session->has_permission('person', 'edit', $this->person->id, 'class')) {
         $player_classes['administrator'] = 'Leaguerunner administrator';
         $player_classes['volunteer'] = 'Volunteer';
     }
     # Volunteers can unset themselves as volunteer if they wish.
     if ($this->person->class == 'volunteer') {
         $player_classes['volunteer'] = 'Volunteer';
     }
     $this->smarty->assign('player_classes', $player_classes);
     $this->smarty->assign('player_statuses', getOptionsFromEnum('person', 'status'));
     $this->smarty->assign('skill_levels', getOptionsFromRange(1, 10));
     $this->smarty->assign('start_years', getOptionsFromRange(1986, strftime('%Y', time()), 'reverse'));
     $this->smarty->assign('shirt_sizes', getShirtSizes());
     $this->smarty->assign('dog_questions', variable_get('dog_questions', 1));
     return true;
 }
Esempio n. 2
0
function global_settings()
{
    $group = form_textfield('Organization name', 'edit[app_org_name]', variable_get('app_org_name', ''), 60, 120, 'Your organization\'s full name.');
    $group .= form_textfield('Organization short name', 'edit[app_org_short_name]', variable_get('app_org_short_name', ''), 60, 120, 'Your organization\'s abbreviated name or acronym.');
    $group .= form_textfield('Address', 'edit[app_org_address]', variable_get('app_org_address', ''), 60, 120, 'Your organization\'s street address.');
    $group .= form_textfield('Unit', 'edit[app_org_address2]', variable_get('app_org_address2', ''), 60, 120, 'Your organization\'s unit number, if any.');
    $group .= form_textfield('City', 'edit[app_org_city]', variable_get('app_org_city', ''), 60, 120, 'Your organization\'s city.');
    $group .= form_select('Province/State', 'edit[app_org_province]', variable_get('app_org_province', ''), getProvinceNames(), 'Your organization\'s province or state.');
    $group .= form_textfield('Postal code', 'edit[app_org_postal]', variable_get('app_org_postal', ''), 60, 120, 'Your organization\'s postal code.');
    $group .= form_textfield('Phone', 'edit[app_org_phone]', variable_get('app_org_phone', ''), 60, 120, 'Your organization\'s phone number.');
    $group .= form_textfield('Administrator name', 'edit[app_admin_name]', variable_get('app_admin_name', 'Leaguerunner Administrator'), 60, 120, 'The name (or descriptive role) of the system administrator. Mail from Leaguerunner will come from this name.');
    $group .= form_textfield('Administrator e-mail address', 'edit[app_admin_email]', variable_get('app_admin_email', $_SERVER['SERVER_ADMIN']), 60, 120, 'The e-mail address of the system administrator.  Mail from Leaguerunner will come from this address.');
    $output = form_group('Organization Details', $group);
    $group = form_textfield('Latitude', 'edit[location_latitude]', variable_get('location_latitude', ''), 10, 10, 'Latitude in decimal degrees for game location (center of city).  Used for calculating sunset times.');
    $group .= form_textfield('Longitude', 'edit[location_longitude]', variable_get('location_longitude', ''), 10, 10, 'Longitude in decimal degrees for game location (center of city).  Used for calculating sunset times.');
    $output .= form_group('Location Details', $group);
    $group = form_textfield('Name of application', 'edit[app_name]', variable_get('app_name', 'Leaguerunner'), 60, 120, 'The name this application will be known as to your users.');
    $group .= form_textfield('Items per page', 'edit[items_per_page]', variable_get('items_per_page', 25), 10, 10, 'The number of items that will be shown per page on long reports, 0 for no limit (not recommended).');
    $group .= form_textfield('Base location of static league files (filesystem)', 'edit[league_file_base]', variable_get('league_file_base', '/opt/websites/www.ocua.ca/static-content/leagues'), 60, 120, 'The filesystem location where files for permits, exported standings, etc, shall live.');
    $group .= form_textfield('Base location of static league files (URL)', 'edit[league_url_base]', variable_get('league_url_base', 'http://www.ocua.ca/leagues'), 60, 120, 'The web-accessible URL where files for permits, exported standings, etc, shall live.');
    $group .= form_textfield('Location of privacy policy (URL)', 'edit[privacy_policy]', variable_get('privacy_policy', "{$_SERVER['SERVER_NAME']}/privacy"), 60, 120, 'The web-accessible URL where the organization\'s privacy policy is located. Leave blank if you don\'t have an online privacy policy.');
    $group .= form_textfield('Location of password reset (URL)', 'edit[password_reset]', variable_get('password_reset', url('person/forgotpassword')), 60, 120, 'The web-accessible URL where the password reset page is located.');
    $group .= form_textfield('Google Maps API Key', 'edit[gmaps_key]', variable_get('gmaps_key', ''), 60, 120, 'An API key for the <a href="http://www.google.com/apis/maps/signup.html">Google Maps API</a>. Required for rendering custom Google Maps');
    $output .= form_group('Site configuration', $group);
    $group = form_select('Current Season', 'edit[current_season]', variable_get('current_season', 'Summer'), getOptionsFromQuery("SELECT id AS theKey, display_name AS theValue FROM season ORDER BY year, id"), 'Season of play currently in effect');
    $output .= form_group('Season Information', $group);
    $group = form_textfield('Spirit penalty for not entering score', 'edit[missing_score_spirit_penalty]', variable_get('missing_score_spirit_penalty', 3), 10, 10);
    $group .= form_textfield('Winning score to record for defaults', 'edit[default_winning_score]', variable_get('default_winning_score', 6), 10, 10);
    $group .= form_textfield('Losing score to record for defaults', 'edit[default_losing_score]', variable_get('default_losing_score', 0), 10, 10);
    $group .= form_radios('Transfer ratings points for defaults', 'edit[default_transfer_ratings]', variable_get('default_transfer_ratings', 0), array('Disabled', 'Enabled'));
    $group .= form_select('Spirit Questions', 'edit[spirit_questions]', variable_get('spirit_questions', 'team_spirit'), array('team_spirit' => 'team_spirit', 'ocua_team_spirit' => 'ocua_team_spirit'), 'Type of spirit questions to use.');
    $output .= form_group('Game Finalization', $group);
    return $output;
}
Esempio n. 3
0
 function generateForm(&$edit)
 {
     $this->smarty->assign('field_statuses', array('open' => 'open', 'closed' => 'closed'));
     $this->smarty->assign('ratings', field_rating_values());
     // TODO: Should become Field::get_eligible_parents()
     $sth = Field::query(array('_extra' => 'ISNULL(parent_fid)', '_order' => 'f.name,f.num'));
     $parents = array();
     $parents[0] = "---";
     while ($p = $sth->fetch(PDO::FETCH_OBJ)) {
         $parents[$p->fid] = $p->fullname;
     }
     $this->smarty->assign('parents', $parents);
     $this->smarty->assign('regions', getOptionsFromEnum('field', 'region'));
     $this->smarty->assign('noyes', array(0 => 'No', 1 => 'Yes'));
     $this->smarty->assign('province_names', getProvinceNames());
     $this->smarty->assign('state_names', getStateNames());
     $this->smarty->assign('country_names', getCountryNames());
     return true;
 }
Esempio n. 4
0
 function generateForm(&$edit)
 {
     if (!isset($edit['app_admin_email'])) {
         $edit['app_admin_email'] = $_SERVER['SERVER_ADMIN'];
     }
     if (!isset($edit['privacy_policy'])) {
         $edit['privacy_policy'] = $_SERVER['SERVER_NAME'] . "/privacy";
     }
     if (!isset($edit['password_reset'])) {
         $edit['password_reset'] = url('person/forgotpassword');
     }
     $this->smarty->assign('app_org_province', $edit['app_org_province']);
     $this->smarty->assign('province_names', getProvinceNames());
     $this->smarty->assign('state_names', getStateNames());
     $this->smarty->assign('country_names', getCountryNames());
     $this->smarty->assign('seasons', getOptionsFromQuery("SELECT id AS theKey, display_name AS theValue FROM season ORDER BY year, id"));
     $this->smarty->assign('enable_disable', array('Disabled', 'Enabled'));
     $this->smarty->assign('questions', array('team_spirit' => 'team_spirit', 'ocua_team_spirit' => 'ocua_team_spirit'));
     $this->smarty->assign('log_levels', array(KLogger::EMERG => 'Emergency', KLogger::ALERT => 'Alert', KLogger::CRIT => 'Critical', KLogger::ERR => 'Error', KLogger::WARN => 'Warning', KLogger::NOTICE => 'Notice', KLogger::INFO => 'Information', KLogger::DEBUG => 'Debug'));
     $this->smarty->assign('live_sandbox', array('Live', 'Sandbox'));
 }
Esempio n. 5
0
 function generateForm($data = array())
 {
     $output = form_hidden("edit[step]", "confirm");
     $output .= form_textfield("Field Identification", 'edit[num]', $data['num'], 15, 15, "Location of this field at the given site; cannot be 0");
     $output .= form_select("Field Status", 'edit[status]', $data['status'], array('open' => 'open', 'closed' => 'closed'));
     $output .= form_select("Field Rating", 'edit[rating]', $data['rating'], field_rating_values(), "Rate this field on the scale provided");
     // TODO: Should become Field::get_eligible_parents()
     $sth = Field::query(array('_extra' => 'ISNULL(parent_fid)', '_order' => 'f.name,f.num'));
     $parents = array();
     $parents[0] = "---";
     while ($p = $sth->fetch(PDO::FETCH_OBJ)) {
         $parents[$p->fid] = $p->fullname;
     }
     $output .= form_select("Parent Field", 'edit[parent_fid]', $data['parent_fid'], $parents, "Inherit location and name from other field");
     if (!$data['parent_fid']) {
         $output .= form_textfield("Field Name", 'edit[name]', $data['name'], 35, 255, "Name of field (do not append number)");
         $output .= form_textfield("Field Code", 'edit[code]', $data['code'], 3, 3, "Three-letter abbreviation for field site");
         $output .= form_select("Region", 'edit[region]', $data['region'], getOptionsFromEnum('field', 'region'), "Area of city this field is located in");
         $output .= form_select("Is indoor", 'edit[is_indoor]', $data['is_indoor'], array(0 => 'No', 1 => 'Yes'), "Is this an indoor field");
         $output .= form_textfield('Street and Number', 'edit[location_street]', $data['location_street'], 25, 100);
         $output .= form_textfield('City', 'edit[location_city]', $data['location_city'], 25, 100, 'Name of city');
         $output .= form_select('Province', 'edit[location_province]', $data['location_province'], getProvinceNames(), 'Select a province from the list');
         $output .= form_textfield("Location Map", 'edit[location_url]', $data['location_url'], 50, 255, "URL for image that shows how to reach the field");
         $output .= form_textfield("Layout Map", 'edit[layout_url]', $data['layout_url'], 50, 255, "URL for image that shows how to set up fields at the site");
         $output .= form_textarea("Driving Directions", 'edit[driving_directions]', $data['driving_directions'], 60, 5, "");
         $output .= form_textarea("Parking Details", 'edit[parking_details]', $data['parking_details'], 60, 5, "");
         $output .= form_textarea("Transit Directions", 'edit[transit_directions]', $data['transit_directions'], 60, 5, "");
         $output .= form_textarea("Biking Directions", 'edit[biking_directions]', $data['biking_directions'], 60, 5, "");
         $output .= form_textarea("Public Washrooms", 'edit[washrooms]', $data['washrooms'], 60, 5, "");
         $output .= form_textarea("Special Instructions", 'edit[public_instructions]', $data['public_instructions'], 60, 5, "Specific instructions for this site that don't fit any other category.");
         $output .= form_textarea("Private Instructions", 'edit[site_instructions]', $data['site_instructions'], 60, 5, "Instructions for this site that should be shown only to logged-in members.");
         $output .= form_textarea("Sponsorship", 'edit[sponsor]', $data['sponsor'], 60, 5, "");
     }
     $output .= form_submit('Submit') . form_reset('Reset');
     return form($output);
 }
Esempio n. 6
0
function getProvinceStateNames()
{
    return array_merge(getProvinceNames(), getStateNames());
}