コード例 #1
0
ファイル: register.php プロジェクト: h07r0d/leaguerunner
 function process()
 {
     global $CONFIG;
     $this->title = "Registration » {$this->event->name}";
     if ($this->registrant_id == 'choose') {
         $new_handler = new person_search();
         $new_handler->smarty =& $this->smarty;
         $new_handler->initialize();
         $new_handler->ops['Register for event'] = 'event/register/' . $this->event->registration_id;
         $new_handler->process();
         $this->template_name = $new_handler->template_name;
         return true;
     }
     $edit = $_POST['edit'];
     switch ($edit['step']) {
         default:
             // If we have a form, prompt user with it.
             if ($this->formbuilder) {
                 $this->template_name = 'pages/event/register/form.tpl';
                 $this->smarty->assign('formbuilder_editable', $this->formbuilder->render_editable(false));
                 return true;
             }
             // Otherwise, fall through to register automatically.
         // Otherwise, fall through to register automatically.
         case 'submit':
             $this->save();
             // dies on failure
             $rc = $this->generatePay();
             break;
         case 'confirm':
             $rc = $this->generateConfirm();
             break;
     }
     return $rc;
 }
コード例 #2
0
ファイル: roster.php プロジェクト: h07r0d/leaguerunner
 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;
 }
コード例 #3
0
ファイル: roster.php プロジェクト: roboshed/leaguerunner
 function process()
 {
     global $lr_session;
     $this->title = "{$this->team->name} » 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} » 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;
 }
コード例 #4
0
ファイル: member.php プロジェクト: roboshed/leaguerunner
 function process()
 {
     global $lr_session;
     $this->title = "{$this->league->fullname} » 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));
 }
コード例 #5
0
ファイル: listnew.php プロジェクト: roboshed/leaguerunner
 function process()
 {
     $_GET['lastname'] = '*';
     return parent::process();
 }