Example #1
0
 function process()
 {
     $edit = $_POST['edit'];
     $this->template_name = 'pages/event/edit.tpl';
     $this->smarty->assign('event_types', $this->event_types);
     $this->smarty->assign('currency_codes', getCurrencyCodes());
     $this->smarty->assign('time_choices', getOptionsFromTimeRange(00, 2400, 30));
     $this->smarty->assign('yes_no', array('No', 'Yes'));
     $this->smarty->assign('seasons', getOptionsFromQuery("SELECT id AS theKey, display_name AS theValue FROM season ORDER BY year, id"));
     if ($edit['step'] == 'perform') {
         $errors = $this->check_input_errors($edit);
         if (count($errors) > 0) {
             $this->smarty->assign('edit', $edit);
             $this->smarty->assign('formErrors', $errors);
             return true;
         }
         $this->perform($edit);
         local_redirect(url("event/view/" . $this->event->registration_id));
     } else {
         # Smarty form auto-fill can't handle booleans directly,
         # so we substitute:
         $this->event->multiple = $this->event->multiple ? 1 : 0;
         $this->event->anonymous = $this->event->anonymous ? 1 : 0;
         $this->smarty->assign('edit', (array) $this->event);
     }
     return true;
 }
Example #2
0
 function process()
 {
     $edit =& $_POST['edit'];
     $this->template_name = 'pages/league/edit.tpl';
     $this->smarty->assign('status', getOptionsFromEnum('league', 'status'));
     $this->smarty->assign('seasons', getOptionsFromQuery("SELECT id AS theKey, display_name AS theValue FROM season ORDER BY year, id"));
     $this->smarty->assign('days', getOptionsFromEnum('league', 'day'));
     $this->smarty->assign('ratios', getOptionsFromEnum('league', 'ratio'));
     $this->smarty->assign('schedule_types', getOptionsFromEnum('league', 'schedule_type'));
     $this->smarty->assign('display_sotg', getOptionsFromEnum('league', 'display_sotg'));
     $this->smarty->assign('excludeTeams', getOptionsFromEnum('league', 'excludeTeams'));
     /* TODO: 10 is a magic number.  Make it a config variable */
     $this->smarty->assign('tiers', getOptionsFromRange(0, 10));
     /* TODO: 5 is a magic number.  Make it a config variable */
     $this->smarty->assign('rounds', getOptionsFromRange(0, 5));
     $this->smarty->assign('games_before_repeat', getOptionsFromRange(0, 9));
     if ($edit['step'] == 'perform') {
         $errors = $this->check_input_errors($edit);
         if (count($errors) > 0) {
             $this->smarty->assign('edit', $edit);
             $this->smarty->assign('formErrors', $errors);
             return true;
         }
         $this->perform($edit);
         local_redirect(url("league/view/" . $this->league->league_id));
     } else {
         /* Deal with multiple days and start times */
         if (strpos($league->day, ",")) {
             $league->day = explode(',', $league->day);
         }
         $this->smarty->assign('edit', (array) $this->league);
     }
     return true;
 }
Example #3
0
 function process()
 {
     global $CONFIG;
     $query_args = array('_order' => 'e.type,e.open,e.close,e.registration_id');
     $season_id = $_GET['season'];
     if ($season_id > 0) {
         $current_season = Season::load(array('id' => $season_id));
         $query_args['season_id'] = $season_id;
         $this->title = "{$current_season->display_name} Registration";
     } else {
         $this->title = "Registration";
         $query_args['_extra'] = 'e.open < DATE_ADD(NOW(), INTERVAL 1 WEEK) AND e.close > NOW()';
         $season_id = -1;
     }
     $this->template_name = 'pages/event/list.tpl';
     $pulldown_choices = getOptionsFromQuery("SELECT s.id AS theKey, s.display_name AS theValue FROM season s, registration_events e WHERE e.season_id = s.id GROUP BY s.id HAVING count(*) > 0 ORDER BY s.year, s.season");
     $pulldown_choices[-1] = "All open events";
     $this->smarty->assign('seasons', $pulldown_choices);
     $this->smarty->assign('season_id', $season_id);
     $type_desc = event_types();
     $events = array();
     $sth = Event::query($query_args);
     while ($e = $sth->fetchObject('Event')) {
         $e->full_type = $type_desc[$e->type];
         $events[] = $e;
     }
     $this->smarty->assign('events', $events);
     return true;
 }
Example #4
0
 function process()
 {
     global $dbh;
     $this->title = "Rankings &raquo; " . $this->field->name;
     $this->template_name = 'pages/field/rankings.tpl';
     $this->smarty->assign('field', $this->field);
     $current_season_id = $_GET['season'];
     if (!$current_season_id) {
         $current_season_id = strtolower(variable_get('current_season', 1));
     }
     $this->smarty->assign('seasons', getOptionsFromQuery("SELECT id AS theKey, display_name AS theValue FROM season ORDER BY year, id"));
     $this->smarty->assign('current_season_id', $current_season_id);
     $sth = $dbh->prepare('SELECT t.team_id, t.name, l.league_id, l.name AS league_name, r.rank FROM team_site_ranking r, team t, leagueteams lt, league l WHERE r.team_id = t.team_id AND lt.team_id = t.team_id AND l.league_id = lt.league_id AND l.season = :season AND r.site_id = :fid ORDER BY r.rank');
     if ($this->field->parent_fid) {
         $sth->execute(array('fid' => $this->field->parent_fid, 'season' => $current_season_id));
     } else {
         $sth->execute(array('fid' => $this->field->fid, 'season' => $current_season_id));
     }
     $teams = array();
     while ($t = $sth->fetch(PDO::FETCH_OBJ)) {
         $teams[] = $t;
     }
     $this->smarty->assign('teams', $teams);
     return true;
 }
Example #5
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;
}
Example #6
0
 function process()
 {
     global $lr_session;
     $current_season_id = $_GET['season'];
     if (!$current_season_id) {
         $current_season_id = strtolower(variable_get('current_season', 1));
     }
     $current_season = Season::load(array('id' => $current_season_id));
     if (!$current_season) {
         $current_season_id = 1;
         $current_season = Season::load(array('id' => $current_season_id));
     }
     $this->title = "{$current_season->display_name} Leagues";
     $this->template_name = 'pages/league/list.tpl';
     $this->smarty->assign('seasons', getOptionsFromQuery("SELECT id AS theKey, display_name AS theValue FROM season ORDER BY year, id"));
     $this->smarty->assign('current_season', $current_season);
     $current_season->load_leagues();
     $this->smarty->assign('leagues', $current_season->leagues);
     return true;
 }
Example #7
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'));
 }