Esempio n. 1
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;
 }
Esempio n. 2
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;
 }
Esempio n. 3
0
 function process()
 {
     global $lr_session;
     $lr_session->expire();
     local_redirect(url("login"));
     return true;
 }
Esempio n. 4
0
 function process()
 {
     $edit =& $_POST['edit'];
     $this->template_name = 'pages/season/edit.tpl';
     $this->smarty->assign('yes_no', array('No', 'Yes'));
     $this->smarty->assign('seasons', getOptionsFromEnum('season', 'season'));
     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("season/view/" . $this->season->id));
     } else {
         /* Deal with multiple days and start times */
         if (strpos($season->day, ",")) {
             $season->day = explode(',', $season->day);
         }
         $this->season->archived = $this->season->archived ? 1 : 0;
         $this->smarty->assign('edit', (array) $this->season);
     }
     return true;
 }
Esempio n. 5
0
 function process()
 {
     global $lr_session;
     // Using these multiple times, so saving them
     $is_admin = $lr_session->is_admin();
     $is_captain = $lr_session->is_captain_of($this->team->team_id);
     $this->title = "{$this->team->name} » Roster Status";
     if ($this->team->roster_deadline > 0 && !$lr_session->is_admin() && time() > $this->team->roster_deadline) {
         info_exit('The roster deadline has passed.');
     }
     if (!$this->player) {
         $this->title = "{$this->team->name} » Add Player";
         if (!($is_admin || $is_captain)) {
             error_exit("You cannot add a person to that team!");
         }
         $new_handler = new person_search();
         $new_handler->smarty =& $this->smarty;
         $new_handler->initialize();
         $new_handler->ops['Add to ' . $this->team->name] = 'team/roster/' . $this->team->team_id;
         $new_handler->process();
         $this->template_name = $new_handler->template_name;
         return true;
     }
     if (!$this->player->is_player()) {
         error_exit('Only registered players can be added to a team.');
     }
     $events = $this->player->is_eligible_for($this->team->team_id);
     if ($events !== true) {
         // Captains and admins can modify players even if they haven't registered for events.
         // That way, the onus is on the player to register, saving captains the hassle.
         // So, only disable the roster change for players
         if (!($is_admin || $is_captain)) {
             $this->smarty->assign('prerequisites', $events);
             $this->smarty->assign('disabled', 'disabled="disabled"');
         }
     }
     $this->positions = Team::get_roster_positions();
     $this->currentStatus = $this->team->get_roster_status($this->player->user_id);
     $this->permittedStates = $this->permitted_roster_states();
     $edit =& $_POST['edit'];
     if ($this->player->status != 'active' && $edit['status'] && $edit['status'] != 'none') {
         error_exit("Inactive players may only be removed from a team.  Please contact this player directly to have them activate their account.");
     }
     if ($edit['step'] != 'perform') {
         $this->smarty->assign('current_status', $this->positions[$this->currentStatus]);
         $this->smarty->assign('player', $this->player);
         $this->smarty->assign('team', $this->team);
         $this->smarty->assign('states', $this->permittedStates);
         return true;
     }
     if (!array_key_exists($edit['status'], $this->permittedStates)) {
         error_exit("You do not have permission to set that status.");
     }
     if (!$this->team->set_roster_status($this->player->user_id, $edit['status'], $this->currentStatus)) {
         error_exit("Could not set roster status for {$this->player->fullname}");
     }
     local_redirect(url("team/view/" . $this->team->team_id));
     return true;
 }
Esempio n. 6
0
 function process()
 {
     if (!empty($_POST)) {
         $this->save($_POST);
         local_redirect(url("field/view/{$this->field->fid}"));
     } else {
         $this->generate_edit_map();
     }
 }
Esempio n. 7
0
 function perform(&$edit)
 {
     list($rc, $message) = $this->league->reschedule_games_for_day($edit['olddate'], $edit['newdate']);
     if ($rc) {
         local_redirect(url("schedule/view/" . $this->league->league_id));
     } else {
         error_exit("Failure rescheduling games: {$message}");
     }
 }
Esempio n. 8
0
 function process()
 {
     global $lr_session;
     # Nuke HTML just in case
     $team_name = check_form($this->team->name, ENT_NOQUOTES);
     $this->title = "{$team_name} » Move";
     $edit = $_POST['edit'];
     if ($edit['step']) {
         if ($edit['target'] < 1) {
             error_exit("That is not a valid league to move to");
         }
         if (!$lr_session->has_permission('league', 'manage teams', $edit['target'])) {
             error_exit("Sorry, you cannot move teams to leagues you do not coordinate");
         }
         $targetleague = League::load(array('league_id' => $edit['target']));
         if (!$targetleague) {
             error_exit("You must supply a valid league to move to");
         }
         if ($targetleague->league_id == $this->team->league_id) {
             error_exit("You can't move a team to the league it's currently in!");
         }
     }
     if ($edit['swaptarget']) {
         $target_team = Team::load(array('team_id' => $edit['swaptarget']));
         if (!$target_team) {
             error_exit("You must supply a valid target team ID");
         }
         if ($target_team->league_id == $this->team->league_id) {
             error_exit("You can't swap with a team that's already in the same league!");
         }
         if ($target_team->league_id != $targetleague->league_id) {
             error_exit("You can't swap with a team that's not in the league you want to move to!");
         }
         if (!$lr_session->has_permission('league', 'manage teams', $target_team->league_id)) {
             error_exit("Sorry, you cannot move teams to leagues you do not coordinate");
         }
     }
     switch ($edit['step']) {
         case 'perform':
             $sourceleague = League::load(array('league_id' => $this->team->league_id));
             $this->perform($targetleague, $target_team);
             local_redirect(url("league/view/" . $sourceleague->league_id));
         case 'confirm':
             return $this->confirm($targetleague, $target_team);
         case 'swaptarget':
             return $this->choose_swaptarget($targetleague);
         default:
             return $this->choose_league();
     }
     error_exit("Error: This code should never be reached.");
 }
Esempio n. 9
0
 function process()
 {
     global $dbh, $lr_session;
     $this->title = $this->team->name . " &raquo; Rank Fields";
     if ($lr_session->has_permission('team', 'viewfieldprefs', $this->team->team_id) && !$lr_session->has_permission('team', 'edit', $this->team->team_id)) {
         # Non-captain team members can view the preferences
         return $this->process_readonly();
     }
     $this->template_name = 'pages/team/fieldpreference.tpl';
     $fields = array();
     $selected = array();
     // Load any currently-selected selected fields
     $sth = $dbh->prepare("SELECT r.site_id, f.name, f.region FROM team_site_ranking r LEFT JOIN field f ON (f.fid = r.site_id) WHERE team_id = ? ORDER BY rank ASC");
     $sth->execute(array($this->team->team_id));
     $chosen = array();
     while ($item = $sth->fetch(PDO::FETCH_OBJ)) {
         $chosen[$item->site_id] = "{$item->name} ({$item->region})";
         array_push($selected, $item->site_id);
     }
     if (count($chosen) > 0) {
         $fields['Previously Chosen'] = $chosen;
     } else {
         $fields['Previously Chosen'] = array();
     }
     // Ugh, now figure out what fields to display
     $sth = $dbh->prepare("SELECT f.fid, f.region, f.name\n\t\t\tFROM field f\n\t\t\tWHERE f.fid IN ( SELECT\n\t\t\t\tDISTINCT COALESCE(f.parent_fid, f.fid)\n\t\t\t\tFROM leagueteams lt,\n\t\t\t\t\tleague_gameslot_availability a,\n\t\t\t\t\tgameslot g,\n\t\t\t\t\tfield f\n\t\t\t\tWHERE\n\t\t\t\t\tf.fid = g.fid\n\t\t\t\t\tAND g.slot_id = a.slot_id\n\t\t\t\t\tAND a.league_id = lt.league_id\n\t\t\t\t\tAND lt.team_id = ?)\n\t\t\tORDER BY f.region, f.name");
     $sth->execute(array($this->team->team_id));
     while ($field = $sth->fetch(PDO::FETCH_OBJ)) {
         if (array_key_exists($field->fid, $fields['Previously Chosen'])) {
             continue;
         }
         if (!array_key_exists($field->region, $fields)) {
             $fields[$field->region] = array();
         }
         $fields[$field->region][$field->fid] = "{$field->name} ({$field->region})";
     }
     $this->smarty->assign('fields', $fields);
     $this->smarty->assign('selected', $selected);
     $this->smarty->assign('team', $this->team);
     $edit = $_POST['edit'];
     if ($edit['step'] == 'perform' && $lr_session->has_permission('team', 'edit', $this->team->team_id)) {
         $errors = $this->check_input_errors($edit);
         if (count($errors) > 0) {
             $this->smarty->assign('formErrors', $errors);
             return true;
         }
         $this->perform($edit);
         local_redirect(url("team/fieldpreference/" . $this->team->team_id));
     }
     return true;
 }
Esempio n. 10
0
 function process()
 {
     $this->title = "{$this->league->fullname} &raquo; Ratings Adjustment";
     $this->template_name = 'pages/league/ratings.tpl';
     $edit =& $_POST['edit'];
     // make sure the teams are loaded
     $this->league->load_teams();
     if ($edit['step'] == 'perform') {
         $this->perform($edit);
         local_redirect(url("league/view/" . $this->league->league_id));
     }
     // TODO: replace with a load_teams_ordered() or maybe a flag to load_teams() ?
     list($order, $season, $round) = $this->league->calculate_standings(array('round' => $this->league->current_round));
     $this->smarty->assign('teams', $season);
     return true;
 }
Esempio n. 11
0
 function process()
 {
     global $lr_session;
     $this->title = 'Registration ' . $this->registration->formatted_order_id() . ' &raquo; Add Payment';
     $this->smarty->assign('reg', $this->registration);
     $this->smarty->assign('event', $this->event);
     // TODO: should be get_user() for consistency.
     $this->smarty->assign('registrant', $this->registration->user());
     $edit = $_POST['edit'];
     $payment = new RegistrationPayment();
     $payment->set('order_id', $this->registration->order_id);
     $payment->set('entered_by', $lr_session->user->user_id);
     $fields = array('payment_type', 'payment_amount', 'payment_method', 'paid_by', 'date_paid');
     foreach ($fields as $field) {
         $payment->set($field, $edit[$field]);
     }
     $dataInvalid = $payment->validate();
     if ($dataInvalid) {
         info_exit($dataInvalid . '<br>Please use your back button to return to the form, fix these errors, and try again.');
     }
     switch ($edit['step']) {
         default:
         case 'confirm':
             $this->smarty->assign('payment', $payment);
             $this->template_name = 'pages/registration/addpayment.tpl';
             break;
         case 'submit':
             if (!$payment->save()) {
                 error_exit("Internal error: couldn't save payment");
             }
             switch ($payment->payment_type) {
                 case 'Deposit':
                     $this->registration->set('payment', 'Deposit Paid');
                     break;
                 case 'Full':
                 case 'Remaining Balance':
                     $this->registration->set('payment', 'Paid');
                     break;
             }
             if (!$this->registration->save()) {
                 error_exit("Internal error: couldn't save changes to registration");
             }
             local_redirect(url("registration/view/" . $this->registration->order_id));
             break;
     }
     return true;
 }
Esempio n. 12
0
 function process()
 {
     $this->title = "Edit Field: {$this->field->fullname}";
     $edit = $_POST['edit'];
     switch ($edit['step']) {
         case 'confirm':
             $rc = $this->generateConfirm($edit);
             break;
         case 'perform':
             $this->perform($this->field, $edit);
             local_redirect(url("field/view/" . $this->field->fid));
             break;
         default:
             $rc = $this->generateForm((array) $this->field);
     }
     return $rc;
 }
Esempio n. 13
0
 function process()
 {
     $this->title = "Game {$this->game->game_id} &raquo; Remove Results";
     $this->template_name = 'pages/game/removeresults.tpl';
     switch ($_POST['step']) {
         case 'perform':
             if (!$this->game->removeresults()) {
                 error_exit("Could not successfully remove results for the game");
             }
             local_redirect(url("schedule/view/" . $this->league->league_id));
             break;
         default:
             $this->smarty->assign('game', $this->game);
             return true;
     }
     return $rc;
 }
Esempio n. 14
0
 function process()
 {
     global $lr_session;
     $this->title = "{$this->team->name} &raquo; Roster Status";
     if ($this->team->roster_deadline > 0 && !$lr_session->is_admin() && time() > $this->team->roster_deadline) {
         error_exit('The roster deadline has passed.');
     }
     if (!$this->player) {
         $this->title = "{$this->team->name} &raquo; Add Player";
         if (!($lr_session->is_admin() || $lr_session->is_captain_of($this->team->team_id))) {
             error_exit("You cannot add a person to that team!");
         }
         $new_handler = new person_search();
         $new_handler->smarty =& $this->smarty;
         $new_handler->initialize();
         $new_handler->ops['Add to ' . $this->team->name] = 'team/roster/' . $this->team->team_id;
         $new_handler->process();
         $this->template_name = $new_handler->template_name;
         return true;
     }
     if (!$this->player->is_player()) {
         error_exit('Only registered players can be added to a team.');
     }
     $this->positions = Team::get_roster_positions();
     $this->currentStatus = $this->team->get_roster_status($this->player->user_id);
     $this->permittedStates = $this->permitted_roster_states();
     $edit =& $_POST['edit'];
     if ($this->player->status != 'active' && $edit['status'] && $edit['status'] != 'none') {
         error_exit("Inactive players may only be removed from a team.  Please contact this player directly to have them activate their account.");
     }
     if ($edit['step'] != 'perform') {
         $this->smarty->assign('current_status', $this->positions[$this->currentStatus]);
         $this->smarty->assign('player', $this->player);
         $this->smarty->assign('team', $this->team);
         $this->smarty->assign('states', $this->permittedStates);
         return true;
     }
     if (!array_key_exists($edit['status'], $this->permittedStates)) {
         error_exit("You do not have permission to set that status.");
     }
     if (!$this->team->set_roster_status($this->player->user_id, $edit['status'], $this->currentStatus)) {
         error_exit("Could not set roster status for {$this->player->fullname}");
     }
     local_redirect(url("team/view/" . $this->team->team_id));
     return true;
 }
Esempio n. 15
0
 function process()
 {
     $this->title = 'Registration ' . $this->registration->formatted_order_id();
     $edit = $_POST['edit'];
     switch ($edit['step']) {
         case 'confirm':
             $rc = $this->generateConfirm($edit);
             break;
         case 'submit':
             $this->perform($edit);
             local_redirect(url("registration/view/" . $this->registration->order_id));
             break;
         default:
             $rc = $this->generateForm();
     }
     return $rc;
 }
Esempio n. 16
0
 function process()
 {
     global $lr_session;
     $this->title = "Game {$this->game->game_id}";
     $edit = $_POST['edit'];
     switch ($edit['step']) {
         case 'confirm':
             $rc = $this->generateConfirm($this->game, $edit);
             break;
         case 'perform':
             $this->perform($edit);
             local_redirect(url("game/view/" . $this->game->game_id));
             break;
         default:
             $rc = $this->generateForm();
     }
     return $rc;
 }
Esempio n. 17
0
 function process()
 {
     $edit = $_POST['edit'];
     $this->title = "{$this->league->fullname} &raquo; Edit Schedule";
     switch ($edit['step']) {
         case 'perform':
             $this->perform($edit);
             local_redirect(url("schedule/view/" . $this->league->league_id));
             break;
         case 'confirm':
             $rc = $this->generateConfirm($edit);
             break;
         default:
             $rc = $this->generateForm();
             break;
     }
     return $rc;
 }
Esempio n. 18
0
 function process()
 {
     $edit =& $_POST['edit'];
     $this->template_name = 'pages/team/edit.tpl';
     $this->smarty->assign('status', getOptionsFromEnum('team', 'status'));
     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("team/view/" . $this->team->team_id));
     } else {
         $this->smarty->assign('edit', (array) $this->team);
     }
     return true;
 }
Esempio n. 19
0
 function process()
 {
     $edit =& $_POST['edit'];
     $this->template_name = 'pages/note/edit.tpl';
     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("note/view/" . $this->note->id));
     } else {
         $this->smarty->assign('note', $this->note);
         $this->smarty->assign('edit', (array) $this->note);
     }
     return true;
 }
Esempio n. 20
0
 function process()
 {
     $edit = $_POST['edit'];
     $this->title = "Create Field";
     switch ($edit['step']) {
         case 'confirm':
             $rc = $this->generateConfirm($edit);
             break;
         case 'perform':
             $this->field = new Field();
             $this->perform($this->field, $edit);
             local_redirect(url("field/view/" . $this->field->fid));
             break;
         default:
             $edit = array();
             $rc = $this->generateForm($edit);
     }
     return $rc;
 }
Esempio n. 21
0
 function handle_valid($remember_me = 0, $next = null)
 {
     global $lr_session;
     $status = $lr_session->attr_get('status');
     // New users may be treated as active, if the right setting is on
     if ($lr_session->user->is_active()) {
         $status = 'active';
     }
     switch ($status) {
         case 'new':
             return $this->login_form("Login Denied.  Account creation is awaiting approval.");
         case 'locked':
             return $this->login_form("Login Denied.  Account has been locked by administrator.");
         case 'inactive':
             /* Inactive.  Send this person to the revalidation page(s) */
             local_redirect(url("person/activate"));
             break;
         case 'active':
             /* These accounts are active and can continue */
             /*
              * If the user wants to be remembered, set the proper cookie
              * such that the session won't expire.
              */
             $path = ini_get('session.cookie_path');
             if (!$path) {
                 $path = '/';
             }
             $domain = ini_get('session.cookie_domain');
             if ($remember_me) {
                 setcookie(session_name(), session_id(), time() + 3600 * 24 * 365, $path, $domain);
             } else {
                 setcookie(session_name(), session_id(), FALSE, $path, $domain);
             }
             if ($next) {
                 local_redirect(queryUnpickle($next));
             } else {
                 local_redirect(url("home"));
             }
             break;
     }
     return true;
 }
Esempio n. 22
0
 function process()
 {
     global $lr_session;
     $edit = $_POST['edit'];
     switch ($edit['step']) {
         case 'perform':
             if ($edit['password_one'] != $edit['password_two']) {
                 error_exit("You must enter the same password twice.");
             }
             $this->person->set_password($edit['password_one']);
             if (!$this->person->save()) {
                 error_exit("Couldn't change password due to internal error");
             }
             local_redirect(url("person/view/" . $this->person->user_id));
             break;
         default:
             $rc = $this->generateForm();
     }
     return $rc;
 }
Esempio n. 23
0
 function process()
 {
     $edit = $_POST['edit'];
     $this->template_name = 'pages/field/edit.tpl';
     $this->generateForm($edit);
     $this->smarty->assign('field', $this->field);
     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('field/view/' . $this->field->fid);
     } else {
         $this->smarty->assign('edit', (array) $this->field);
     }
     return true;
 }
Esempio n. 24
0
 function process()
 {
     $edit = $_POST['edit'];
     $this->smarty->assign('instructions', "Edit any of the following fields and click 'Submit' when done.");
     $this->template_name = 'pages/person/edit.tpl';
     $this->generateForm($edit);
     $this->smarty->assign('person', $this->person);
     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('person/view/' . $this->person->user_id);
     } else {
         $this->smarty->assign('edit', (array) $this->person);
     }
     return true;
 }
Esempio n. 25
0
 function process()
 {
     $this->template_name = 'pages/registration/delpayment.tpl';
     $this->smarty->assign('reg', $this->registration);
     $this->smarty->assign('event', $this->event);
     // TODO: should be get_user() for consistency.
     $this->smarty->assign('registrant', $this->registration->user());
     $this->smarty->assign('payment', $this->payment);
     $this->title = 'Registration ' . $this->registration->formatted_order_id() . ' &raquo; Delete Payment';
     if ($_POST['submit'] == 'Delete Payment') {
         if (!$this->payment->delete()) {
             error_exit("Could not delete payment");
         }
         $this->registration->set('payment', 'Pending');
         if (!$this->registration->save()) {
             error_exit("Could not save changes to registration");
         }
         local_redirect(url("registration/view/" . $this->registration->order_id));
     }
     return true;
 }
Esempio n. 26
0
 function process()
 {
     global $conf;
     $edit = $_POST['edit'];
     $this->template_name = 'pages/settings/' . $this->type . '/edit.tpl';
     $this->generateForm($edit);
     $this->smarty->assign('settings', $conf);
     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('settings/' . $this->type);
     } else {
         $this->smarty->assign('edit', $conf);
     }
     return true;
 }
Esempio n. 27
0
 function process()
 {
     $this->title = "{$this->field->fullname} Create Game Slot";
     if ($this->field->status != 'open') {
         error_exit("That field is closed");
     }
     $edit =& $_POST['edit'];
     if ($edit['date']) {
         list($year, $month, $day) = preg_split("/[\\/-]/", $edit['date']);
         $today = getdate();
         $yyyy = is_numeric($year) ? $year : $today['year'];
         $mm = is_numeric($month) ? $month : $today['mon'];
         $dd = is_numeric($day) ? $day : $today['mday'];
         if (!validate_date_input($yyyy, $mm, $dd)) {
             error_exit('That date is not valid');
         }
         $datestamp = mktime(6, 0, 0, $mm, $dd, $yyyy);
     }
     switch ($edit['step']) {
         case 'perform':
             if (!$this->perform($edit, $datestamp)) {
                 error_exit("Aieee!  Bad things happened in gameslot create");
             }
             local_redirect(url("field/view/{$this->field->fid}"));
             break;
         case 'confirm':
             $this->template_name = 'pages/slot/create/confirm.tpl';
             return $this->generateConfirm($edit, $datestamp);
             break;
         case 'details':
             $this->template_name = 'pages/slot/create/step2.tpl';
             return $this->generateForm($datestamp);
             break;
         default:
             $this->template_name = 'pages/slot/create/step1.tpl';
             return true;
     }
     error_exit("Error: This code should never be reached.");
 }
Esempio n. 28
0
 function process()
 {
     $edit = $_POST['edit'];
     $this->title = "{$this->person->fullname} &raquo; Approve";
     if ($edit['step'] == 'perform') {
         /* Actually do the approval on the 'perform' step */
         $this->perform($edit);
         local_redirect("person/listnew");
     }
     if ($this->person->status != 'new') {
         error_exit("That account has already been approved");
     }
     parent::process();
     $this->template_name = 'pages/person/approve.tpl';
     $sth = $this->person->find_duplicates();
     $duplicates = array();
     while ($user = $sth->fetchObject('Person', array(LOAD_OBJECT_ONLY))) {
         $duplicates[] = $user;
     }
     $this->smarty->assign('duplicates', $duplicates);
     return true;
 }
Esempio n. 29
0
 function process()
 {
     $edit = $_POST['edit'];
     $next = $_POST['next'];
     if (is_null($next)) {
         $next = $_GET['next'];
         if (is_null($next)) {
             $next = queryPickle('home');
         }
     }
     switch ($edit['step']) {
         case 'perform':
             $this->perform($edit);
             local_redirect(queryUnpickle($next));
         default:
             $this->template_name = 'pages/person/waiver.tpl';
             $this->smarty->assign('next_page', $next);
             $this->smarty->assign('waiver_text', $this->waiver_text);
             $rc = true;
     }
     return $rc;
 }
Esempio n. 30
0
 function process()
 {
     global $lr_session;
     $this->title = "{$this->league->fullname} &raquo; Member Status";
     if (!$this->player_id) {
         $new_handler = new person_search();
         $new_handler->smarty =& $this->smarty;
         $new_handler->initialize();
         $new_handler->ops['Add to ' . $this->league->fullname] = 'league/member/' . $this->league->league_id;
         $new_handler->extra_where = "(class = 'administrator' OR class = 'volunteer')";
         $new_handler->process();
         $this->template_name = $new_handler->template_name;
         return true;
     }
     if (!$lr_session->is_admin() && $this->player_id == $lr_session->attr_get('user_id')) {
         error_exit("You cannot add or remove yourself as league coordinator");
     }
     $player = Person::load(array('user_id' => $this->player_id));
     switch ($_GET['edit']['status']) {
         case 'remove':
             if (!$this->league->remove_coordinator($player)) {
                 error_exit("Failed attempting to remove coordinator from league");
             }
             break;
         default:
             if ($player->class != 'administrator' && $player->class != 'volunteer') {
                 error_exit("Only volunteer-class players can be made coordinator");
             }
             if (!$this->league->add_coordinator($player)) {
                 error_exit("Failed attempting to add coordinator to league");
             }
             break;
     }
     if (!$this->league->save()) {
         error_exit("Failed attempting to modify coordinators for league");
     }
     local_redirect(url("league/view/" . $this->league->league_id));
 }