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; }
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; }
function generateForm($datestamp) { $this->smarty->assign('field', $this->field); $this->smarty->assign('start_date', $datestamp); // TODO: replace getOptionsFromTimeRange with smarty plugin // TODO: implement for each field a usual_start_time to use as the start_time value $this->smarty->assign('start_time', '18:30'); $this->smarty->assign('end_time', '---'); $this->smarty->assign('start_end_times', getOptionsFromTimeRange(00, 2400, 5)); $weekday = strftime("%A", $datestamp); $sth = League::query(array('_day' => $weekday, 'status' => 'open', '_order' => 'l.league_id')); $leagues = array(); while ($league = $sth->fetchObject('League', array(LOAD_OBJECT_ONLY))) { $leagues[$league->league_id] = "({$league->season_name}) {$league->fullname}"; } $this->smarty->assign('leagues', $leagues); // TODO: perhaps have a repeat_until date instead? $this->smarty->assign('repeat_options', getOptionsFromRange(1, 24)); return true; }
function generateForm($datestamp) { $this->smarty->assign('field', $this->field); $this->smarty->assign('start_date', $datestamp); $this->smarty->assign('start_time', '18:30'); $this->smarty->assign('end_time', '---'); $this->smarty->assign('start_end_times', getOptionsFromTimeRange(00, 2400, 5)); $weekday = strftime("%A", $datestamp); $leagues = array(); $sth = League::query(array('_day' => $weekday, 'status' => 'open')); $leagues = array(); while ($league = $sth->fetchObject('League', array(LOAD_OBJECT_ONLY))) { $leagues[$league->league_id] = "{$league->season_name} - {$league->fullname}"; } $this->smarty->assign('leagues', $leagues); $this->smarty->assign('repeat_options', getOptionsFromRange(1, 24)); return true; }