3 * The ApplicantsForm control is used to accept or decline applicants in a batch process.
5 * Copyright 2003 Mark O'Sullivan
6 * This file is part of Lussumo's Software Library.
7 * Lussumo's Software Library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
8 * Lussumo's Software Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
9 * You should have received a copy of the GNU General Public License along with Vanilla; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
10 * The latest source code is available at www.lussumo.com
11 * Contact Mark O'Sullivan at mark [at] lussumo [dot] com
13 * @author Mark O'Sullivan
14 * @copyright 2003 Mark O'Sullivan
15 * @license http://lussumo.com/community/gpl.txt GPL 2
22 * The ApplicantsForm control is used to accept or decline applicants in a batch process.
25 class ApplicantsForm
extends PostBackControl
{
29 function ApplicantsForm(&$Context) {
30 $this->Name
= "ApplicantsForm";
31 $this->ValidActions
= array("Applicants", "ProcessApplicants");
32 $this->Constructor($Context);
33 if (!$this->Context
->Session
->User
->Permission("PERMISSION_APPROVE_APPLICANTS")) {
34 $this->IsPostBack
= 0;
35 } elseif ($this->IsPostBack
) {
36 $this->Context
->PageTitle
= $this->Context
->GetDefinition('MembershipApplicants');
38 // See if the form has been submitted
39 if ($this->PostBackAction
== 'ProcessApplicants' && $this->IsValidFormPostBack()) {
40 $Action = ForceIncomingString('btnSubmit', '');
41 // Compare to language dictionary to figure out exactly what should be done
42 if ($Action != '') $Action = ($Context->GetDefinition('ApproveForMembership') == $Action) ?
'Approve' : 'Decline';
43 // Retrieve the id's to manipulate
44 $ApplicantIDs = ForceIncomingArray('ApplicantID', array());
46 // Approve or decline the applicants
47 if ($Action != '' && is_array($ApplicantIDs) && count($ApplicantIDs) > 0) {
48 $um = $this->Context
->ObjectFactory
->NewContextObject($this->Context
, 'UserManager');
49 if ($Action == 'Approve') {
50 $um->ApproveApplicant($ApplicantIDs);
52 $um->RemoveApplicant($ApplicantIDs);
57 // There is no need to load all of the applicants since they were already loaded by the settings.php page
58 // $um = $this->Context->ObjectFactory->NewContextObject($this->Context, 'UserManager');
59 // $this->ApplicantData = $um->GetUsersByRoleId(0);
61 $this->CallDelegate("Constructor");
65 if ($this->IsPostBack
) {
66 $this->CallDelegate("PreRender");
67 $this->PostBackParams
->Set('PostBackAction', 'ProcessApplicants');
68 include(ThemeFilePath($this->Context
->Configuration
, 'settings_applicants_form.php'));
69 $this->CallDelegate("PostRender");