psportal-murray/applicationFormUtils.php

432 lines
22 KiB
PHP
Raw Normal View History

2019-02-18 02:40:33 +00:00
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
include_once "utils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
include_once "formUtils.php";
include_once "applicationFormUtils.php";
if ($localHost)
include_once "fpdf.php";
else
include_once "fpdf/fpdf.php";
/*
$doc = new DOMDocument('1.0');
$root = $doc->createElement('html');
*/
class ApplicationForm extends FPDF
{
private $memberData = NULL;
private $inset = 5;
private $topMargin = 2.5;
function __construct($data)
{
global $timeZone;
parent::__construct("P", "mm", "Letter");
date_default_timezone_set($timeZone);
$doubleNewLine = "\n\n";
$initial = "\n\n\n(initial)";
$firstLine = "I confirm that the information I have provided is true and correct. I promise to be excellent to people.";
$secondLine = 'I am aware of, and will abide by, the member responsibilities listed in the Bylaws of Calgary Protospace, Ltd. I have signed or will sign a "Release of Liability, Waiver of Claims, Assumption of Risks and Indemnity Agreement". I release Calgary Protospace Limited, its members, directors, staff and agents from any and all liability arising out of this application, my use of equipment, tools or space at Protospace and my participation in any Protospace program, facility or event."';
$thirdLine = "I agree to pay the required dues for membership. I understand that failure to do this may result in termination of my membership. I understand that dues will continue to be charged unless I request to end my membership.";
$fourthLine = "I am also aware that my application is subject to review and a probationary period before my membership becomes active";
$riskOne = 'I acknowledge that inherent risks, dangers and hazards exist when using hand tools, power tools, supplies, and other equipment commonly used in electronics construction, fabrication, software design and other activities hosted by Calgary Protospace Inc. ("Protospace"). Participation in such activities and/or the use of equipment associated with technology design, manufacture and experimentation may result in injury, illness, death or damage to personal property. These risks and dangers may be caused by other people, including Protospace members, participants, or guests, or by accidents, acts of nature or other causes. Risks and dangers may arise from foreseeable or unforeseeable causes including, but not limited to, electrocution, burns, impalement, and injury from slips or falls.';
$riskTwo = "I am responsible for my own safety during Protospace's activities. This includes ensuring that tools are in proper working order, and that tools are used safely and responsibly. I agree not to use any tools I do not know how to use. I agree not to use tools or equipment while under the influence of drugs or alcohol.";
$riskThree = "I acknowledge that a Protospace member who may be acting as my host or Sponsor and other Members of Protospace may advise me on safe work practices, but this does not constitute training, nor a supervisory relationship. I further acknowledge that responsibility for safely using Protospace's facilities, tools or equipment lies entirely on myself. Failure to follow reasonable safety protocols or wilful violation of reasonable safety protocols may result in expulsion from Protospace facilities. If I am currently a Protospace member, or become one, wilful violation of reasonable safety protocols may result in the termination of my membership and/or access rights.";
$riskFour = "Until and unless I apply for and am accepted as a full member of Calgary Protospace, I understand that as a Guest, in order to access Protospace facilities or space, I must be accompanied by a member of Protospace, and I will not seek to access nor to remain in the space unaccompanied, until and unless I have become a member and have been issued my own key, key fob, or access card.";
$waiverZero = "In consideration of Protospace allowing me to participate in Protospace's activities, and for other good and valuable consideration, the receipt and sufficiency of which is acknowledged, I hereby agree as follows:";
$waiverOne = "1. RELEASE OF LIABILITY: The Participant (me), fully assumes all risks associated with participation in events, and exempts and releases Protospace, its members, officers, agents, and directors, from any and all liability arising out of any damage, expense, loss or injury including death to the participant or the participant's property while upon Protospace's premises, or using any of Protospace's equipment, or while participating in any of Protospace's activities, whether such loss, damage, or injury results from the negligence of Protospace, its members, its agents, or from some other cause.";
$waiverTwo = "2. COVENANT NOT TO SUE: The Participant agrees never to institute any suit or action at law or otherwise against Protospace, its members, officers, board members, agents, nor to initiate or any way assist in the prosecution of any claim for damages or course of action that the member, member's heirs, executors or administrators hereafter may have by reason of injury to the person of the member or to the participant's property arising from the activities contemplated by this agreement.";
$waiverThree = "3. THIRD PARTY INDEMNIFICATION: The Participant will indemnify, save and hold harmless Protospace, its members, officers, directors, or agents from any and all losses, claims, actions, or proceedings of every kind and character which may be presented or initiated by any Third Party and which arise directly or indirectly from the actions of the Participant while engaged in the activities contemplated by this agreement.";
$waiverFour = "4. ACCEPTABLE SPEECH AND BEHAVIOUR: Protospace is accepting of all races, creeds, genders, orientations, religions and any other type of identifier. While Protospace is encouraging of freedom of speech and the open sharing of ideas of all types, hateful speech, harassment, threats or violence will not be tolerated. Use of Protospace or Protospace Members' equipment while intoxicated or otherwise impaired is forbidden for reasons of safety. Such actions or speech may result in consequences including warnings, membership suspension or termination, or expulsion from the facility (temporarily or permanently).";
$waiverFive = "5. This Release Agreement shall be effective and binding upon my heirs, next of kin, executors, administrators, assigns and representatives, in the event of my death or incapacity.";
$waiverSix = "6. This Release Agreement and any rights, duties and obligations as between myself and Protospace, its members, officers, directors or agents shall be governed by and interpreted solely in accordance with the laws of Alberta and no other jurisdiction.";
$waiverSeven = "7. Any litigation involving myself and Protospace, its members, officers, directors, or agents shall be brought solely in Alberta and shall be within the exclusive jurisdiction of the Courts of Alberta.";
$waiverEight = "8. I hereby acknowledge that I have CAREFULLY read all of the provisions above, fully understand the terms and conditions expressed there, and do freely choose acceptance of the provisions of the foregoing paragraphs relating to assumption of risk, release of liability, covenant not to sue, and third party indemnification. I am aware that this is a release of liability and a contract between myself and Protospace, and sign it of my own free will.";
$waiverNine = "9. I hereby acknowledge the danger involved in participating at Protospace, and agree to assume any and all risks of bodily injury, death or property damage, whether those risks are known or unknown.";
$waiverTen = "10. I hereby acknowledge that I have been shown the safety equipment in the space.";
$waiverEleven = "In entering into this Release Agreement, I am not relying on any oral or written representations or statements made by Protospace, its members, officers, board members, or agents with the respect to the safety of Protospace's activities, other than what is set forth in this Release Agreement.";
$waiverTwelve = "I CONFIRM THAT I HAVE READ AND UNDERSTOOD THIS RELEASE AGREEMENT PRIOR TO SIGNING IT, AND I AM AWARE THAT BY SIGNING THIS RELEASE AGREEMENT I AM WAIVING CERTAIN LEGAL RIGHTS WHICH I OR MY HEIRS, NEXT OF KIN, EXECUTORS, ADMINISTRATORS, ASSIGNS, AND REPRESENTATIVES MAY HAVE AGAINST CALGARY PROTOSPACE LTD, ITS MEMBERS, OFFICERS, DIRECTORS, OR AGENTS.";
$tour = "The following member certifies that the participant has been shown the emergency exits and safety equipment in the facility, and has been given an opportunity to examine this document and appears to understand its contents";
$guardian = "In the case of a participant who is a minor:\nI acknowledge and agree to be bound by the terms of this agreement both for myself, and on the part of the minor named as the participant.";
$this->SetTopMargin($this->topMargin);
$this->memberData = arrayCopy($data);
$this->AddPage();
$this->SetFont('Arial', 'B', 20);
$this->Cell(0, 9, "Protospace Membership Application", 0, 1, "C");
$this->Line($this->inset, 18, $this->GetPageWidth() - $this->inset, 18);
$this->SetFont('Times','',16);
$this->Cell(0, 10, "Welcome", 0, 1);
$this->SetFont('Times', '', 12);
$this->Cell($this->inset, 0, "Thank you for your interest.", 0, 1);
$this->SetY($this->GetY() + 3);
$lineX = $this->GetX();
$lineY = $this->GetY();
$this->drawDataEntryBox(65, 10, "First Name", $this->memberData['first_name']);
$this->drawDataEntryBox(65, 10, "Last Name", $this->memberData['last_name']);
$this->drawDataEntryBox(65, 10, "Nick Name (Optional)", $this->memberData['nickname']);
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(85, 10, "Mailing Address", $this->memberData['street_address']);
$this->drawDataEntryBox(65, 10, "City, Province", $this->memberData['city'] . ", " . $this->memberData['province']);
$this->drawDataEntryBox(45, 10, "Postal Code", $this->memberData['postal_code']);
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(105, 10, "Email Address", $this->memberData['email']);
$this->drawDataEntryBox(90, 10, "Phone Number", $this->memberData['phone']);
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(195, 10, "How did you hear about Protospace?", "");
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(105, 10, "Emergency Contact Name (Optional)", $this->memberData['emergency_contact_name']);
$this->drawDataEntryBox(90, 10, "Emergency Contact Phone (Optional)", $this->memberData['emergency_contact_phone']);
$this->SetX($lineX + 40);
$this->SetY($lineY + 13);
$lineY = $this->GetY();
$this->drawDataEntryBox(120, 10, "Students - Institution Name and Course of Study (Optional)", "");
$this->SetX($lineX);
$this->SetY($lineY + 13);
$lineY = $this->GetY();
$this->SetFont('Arial', '', 10);
$this->Write(4, $firstLine);
$this->SetX($lineX);
$this->SetY($lineY + 8);
$lineY = $this->GetY();
$this->Write(4, $secondLine);
$this->Write(4, $doubleNewLine);
$this->Write(4, $thirdLine);
$this->Write(4, $doubleNewLine);
$this->Write(4, $fourthLine);
$this->Write(4, $doubleNewLine);
$this->SetX($lineX);
$lineY = $this->GetY();
$this->drawDataEntryBox(145, 10, "Signature of Applicant or the Applicant's Parent or Guardian", ""); //$this->memberData['first_name'] . " " . $this->memberData['last_name']);
$this->drawDataEntryBox(50, 10, "Date Signed", date("Y-m-d"));
$this->SetX($lineX);
$this->SetY($lineY + 12);
$lineY = $this->GetY();
$this->drawDataEntryBox(195, 15, "Notes or Comments", "");
$this->SetX($lineX);
$this->SetY($lineY + 18);
$lineY = $this->GetY();
$this->Line($lineX, $lineY, $lineX + 195, $lineY);
$this->SetX($lineX);
$this->SetY($lineY + 6);
$lineY = $this->GetY();
$this->SetFont('Arial', '', 16);
$this->Text($lineX, $lineY, "Payment of your first dues is required with this application.");
$this->SetX($lineX);
$this->SetY($lineY + 2);
$lineY = $this->GetY();
$this->drawDataEntryBox(55, 10, "Payment Amount", "");
$this->drawDataEntryBox(45, 10, "Payment Date", "");
$this->drawDataEntryBox(95, 10, "Recipt Number (For Cheque or Cash)", "");
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawPaymentChoiceBox(195, 18, "Where will we find your payment?");
$this->SetX($lineX);
$this->SetY($lineY + 22);
$lineY = $this->GetY();
$this->Line($lineX, $lineY, $lineX + 195, $lineY);
$this->SetX($lineX);
$this->SetY($lineY + 6);
$lineY = $this->GetY();
$this->SetFont('Arial', '', 16);
$this->Text($lineX, $lineY, "Sponsors and Approval");
$this->SetX($lineX);
$this->SetY($lineY + 3);
$lineY = $this->GetY();
$this->drawDataEntryBox(95, 10, "Sponsor 1 - Name", "");
$this->drawDataEntryBox(55, 10, "Signature", "");
$this->drawDataEntryBox(45, 10, "Date Signed", "");
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(95, 10, "Sponsor 2 - Name", "");
$this->drawDataEntryBox(55, 10, "Signature", "");
$this->drawDataEntryBox(45, 10, "Date Signed", "");
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(65, 10, "ID checked by:", "");
$this->drawDataEntryBox(65, 10, "Application checked by:", "");
$this->drawDataEntryBox(65, 10, "Liability form checked by:", "");
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(95, 10, "Confirmed by (Director)", "");
$this->drawDataEntryBox(55, 10, "Signature", "");
$this->drawDataEntryBox(45, 10, "Date Signed", "");
$this->AddPage();
$this->SetFont('Arial', '', 16);
$this->Cell(0, 6, "Calgary Protospace Ltd.", 0, 1, "C");
$this->Cell(0, 6, "Release of Liability, Waiver of Claims,", 0, 1, "C");
$this->Cell(0, 6, "Assumption of Risks and Indemnity Agreement", 0, 1, "C");
$this->SetFont('Arial', '', 12);
$this->Cell(0, 3, '("Release Agreement")', 0, 1, "C");
$this->Write(2, $doubleNewLine);
$this->SetFont('Times', '', 14);
$this->Write(5, "Assumption of Risks");
$this->SetFont('Times', '', 12);
//$this->Write(2, $doubleNewLine);
$this->Write(4, $doubleNewLine . $riskOne);
//$this->Write(2, $doubleNewLine);
$this->Write(4, $doubleNewLine . $riskTwo);
$this->Write(4, $doubleNewLine . $riskThree);
$this->Write(4, $doubleNewLine . $riskFour);
$this->Write(4, $initial);
$this->Line($this->GetX() + 2, $this->GetY() + 4, $this->GetX() + 25, $this->GetY() + 4);
$this->SetFont('Times', '', 14);
$this->Write(5, "\n\nRelease of Liability, Waiver of Claims and Indemnity Agreement");
$this->SetFont('Times', '', 12);
$this->Write(4, $doubleNewLine . $waiverZero);
$this->Write(4, $doubleNewLine . $waiverOne);
$this->Write(4, $doubleNewLine . $waiverTwo);
$this->Write(4, $doubleNewLine . $waiverThree);
$this->Write(4, $doubleNewLine . $waiverFour);
$this->Write(4, $doubleNewLine . $waiverFive);
$this->Write(4, $doubleNewLine . $waiverSix);
$this->Write(4, $doubleNewLine . $waiverSeven);
$this->Write(4, $doubleNewLine . $waiverEight);
$this->Write(4, $initial);
$this->Line($this->GetX() + 2, $this->GetY() + 4, $this->GetX() + 25, $this->GetY() + 4);
$this->Write(4, $doubleNewLine . $waiverNine);
$this->Write(4, $initial);
$this->Line($this->GetX() + 2, $this->GetY() + 4, $this->GetX() + 25, $this->GetY() + 4);
$this->Write(4, $doubleNewLine . $waiverTen);
$this->Write(4, $initial);
$this->Line($this->GetX() + 2, $this->GetY() + 4, $this->GetX() + 25, $this->GetY() + 4);
$this->Write(4, $doubleNewLine . $waiverEleven);
$this->Write(4, $doubleNewLine . $waiverTwelve);
$this->SetX($lineX);
$lineY = $this->GetY() + 6;
$this->SetY($lineY);
$this->drawDataEntryBox(55, 10, "Participant Name - Print", "");
$this->drawDataEntryBox(140, 10, "", $this->memberData['first_name'] . " " . $this->memberData['last_name']);
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(55, 10, "Signature", "");
$this->drawDataEntryBox(140, 10, "", "");
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(55, 10, "Date (YYYY-MM-DD)", "");
$this->drawDataEntryBox(70, 10, "", date("Y-m-d"));
$this->drawDataEntryBox(70, 10, "Orignial signing date", "");
$this->SetFont('Times', '', 12);
$this->SetX($lineX);
$this->SetY($lineY + 12);
$lineY = $this->GetY();
$this->Write(4, $tour);
$this->SetX($lineX);
$lineY = $this->GetY() + 6;
$this->SetY($lineY);
$this->drawDataEntryBox(85, 10, "Touring Member - Print", "");
$this->drawDataEntryBox(110, 10, "Touring Member - Signature", "");
$this->SetFont('Times', '', 12);
$this->SetX($lineX);
$lineY = $this->GetY() + 12;
$this->SetY($lineY);
$this->Write(4, $guardian);
$this->SetX($lineX);
$lineY = $this->GetY() + 6;
$this->SetY($lineY);
$this->drawDataEntryBox(75, 10, "Name of Parent or Guardian", "");
$this->drawDataEntryBox(75, 10, "Signature of Parent or Guardian", "");
$this->drawDataEntryBox(45, 10, "Date", date("Y-m-d"));
$this->SetFont('Times', '', 12);
}
function drawDataEntryBox($w, $h, $label, $data)
{
$origX = $this->GetX();
$origY = $this->GetY();
$this->Rect($origX, $origY, $w, $h);
$this->SetFont('Arial', '', 8);
$this->Text($origX + 2, $origY + 3, $label);
$this->SetFont('Times', 'B', 14);
$this->Text($origX + 8, $origY + 8, $data);
$this->SetY($origY);
$this->SetX($origX + $w);
}
function drawPaymentChoiceBox($w, $h, $label)
{
$origX = $this->GetX();
$origY = $this->GetY();
$this->Rect($origX, $origY, $w, $h);
$this->SetFont('Arial', '', 8);
$this->Text($origX + 2, $origY + 3, $label);
$this->SetFont('Arial', '', 10);
$this->Rect($origX + 5, $origY + 6, 2, 2);
$this->Text($origX + 8, $origY + 8, "I made a one time payment via PayPal or email Interact");
$this->Rect($origX + 5, $origY + 12, 2, 2);
$this->Text($origX + 8, $origY + 14, "I set up a recuring PayPal payment");
$this->Rect($origX + 100, $origY + 6, 2, 2);
$this->Text($origX + 103, $origY + 8, "I paid by cheque");
$this->Rect($origX + 100, $origY + 12, 2, 2);
$this->Text($origX + 103, $origY + 14, "I paid by cash");
$this->Rect($origX + 135, $origY + 6, 2, 2);
$this->Text($origX + 138, $origY + 8, "I paid by a credit card (Square)");
/*
$this->drawCheckBoxChoice($origX + 5, $origY + 6, "I made a one time payment via PayPal or email Interact");
$this->drawCheckBoxChoice($origX + 5, $origY + 12, "I set up a recuring PayPal payment");
$this->drawCheckBoxChoice($origX + 55, $origY + 6, "I paid by cheque");
$this->drawCheckBoxChoice($origX + 55, $origY + 12, "I paid by cash");
$this->drawCheckBoxChoice($origX + 125, $origY + 6, "I paid by a credit card/n(Square)");
*/
$this->SetY($origY + $h);
$this->SetX($origX + $w);
}
function drawCheckBoxChoice($x, $y, $label)
{
$origX = $this->GetX();
$origY = $this->GetY();
//$this->SetX($origX + $x);
//$this->SetY($origY + $y);
//$this->Box($x, $y, 2, 2);
$this->Rect($x, $y, 2, 2);
//$this->SetX($origX + $x + 5);
//$this->SetY($origY + $y);
$this->SetFont('Arial', '', 10);
$this->Text($origX + $x + 5, $origY + $y, $label);
//$this->Write(4, $label);
$this->SetX($origX);
$this->SetY($origY);
}
/*
* Override of default
*/
function Header()
{
$this->SetFont('Times', '', 10);
$firstName = $this->memberData['first_name'];
$lastName = $this->memberData['last_name'];
$id = $this->memberData['id'];
$this->Cell(0, 6, "$firstName $lastName ($id)", 0, 1, "R");
}
/*
* Override of default
*/
function Footer()
{
}
}
function generateForm($memberID)
{
$member = getMemberRowData($memberID);
$pdf = new FPDF("P", "mm", "Letter");
$pdf->SetTopMargin(2.5);
$pdf->AddPage();
$inset = 5;
/*
$pdf->Line(0, 0, 100, 0);
$pdf->Line(0, 0, 0, 100);*/
$pdf->SetFont('Times','',12);
$pdf->Cell(0, 6, "${member['first_name']} ${member['last_name']} (${member['id']})", 0, 1, "R");
$pdf->SetFont('Arial', 'B', 20);
$pdf->Cell(0, 10, "Protospace Membership Application", 0, 1, "C");
$pdf->Line($inset, 20, $pdf->GetPageWidth() - $inset, 20);
$pdf->SetFont('Times','',16);
$pdf->Cell(0, 10, "Welcome", 0, 1);
$pdf->SetFont('Times', '', 12);
$pdf->Cell($inset, 0, "Thank you for your interest.", 0, 1);
//$pdf->
$pdf->Output();
}
?>