Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class user {
- private $membershipID;
- private $firstName;
- private $lastName;
- private $username;
- private $section;
- private $sectionNo;
- private $linking = false;
- private $dob;
- private $gender;
- private $homeTelNo;
- private $school;
- private $religion;
- private $ethnicity;
- private $canSwim = false;
- private $canPhoto = false;
- private $doctor;
- private $surgery;
- private $docTelNo;
- private $allergies;
- private $specialNeeds;
- private $pack;
- private $six;
- private $packNo;
- private $sixNo;
- private $na;
- private $ha;
- private $giftAid;
- private $giftAidPerson;
- private $crbNo;
- private $crbDate;
- private $addresses = array();
- private $contacts = array();
- private $joiningDates;
- private $permissions = array();
- private $pm;
- function __construct($membershipNo, $firstName, $lastName, $username, $linking, $dob, $gender, $homeTelNo) {
- $this->membershipID = $membershipNo;
- $this->firstName = $firstName;
- $this->lastName = $lastName;
- $this->username = $username;
- $this->linking = $linking;
- $this->dob = $dob;
- $this->gender = $gender;
- $this->homeTelNo = $homeTelNo;
- }
- function setPM($pm) {
- $this->pm = $pm;
- }
- function setPersonal($school, $religion, $ethnicity, $canSwim, $canPhoto) {
- $this->school = $school;
- $this->religion = $religion;
- $this->ethnicity = $ethnicity;
- $this->canSwim = $canSwim;
- $this->canPhoto = $canPhoto;
- }
- function setMedical($doctor, $surgery, $docTelNo, $allergies, $specialNeeds) {
- $this->doctor = $doctor;
- $this->surgery = $surgery;
- $this->docTelNo = $docTelNo;
- $this->allergies = $allergies;
- $this->specialNeeds = $specialNeeds;
- }
- function setOther($na, $ha, $giftAid, $giftAidPerson) {
- $this->na = $na;
- $this->ha = $ha;
- $this->giftAid = $giftAid;
- $this->giftAidPerson = $giftAidPerson;
- }
- function setNos($section, $pack, $six) {
- $this->sectionNo = $section;
- $this->packNo = $pack;
- $this->sixNo = $six;
- }
- function setCRB($crbNo, $crbDate) {
- $this->crbNo = $crbNo;
- $this->crbDate = $crbDate;
- }
- function setSection($section) { $this->section = $section; }
- function setPack($pack) { $this->pack = $pack; }
- function setSix($six) { $this->six = $six; }
- function setJoiningDates($jd) { $this->joiningDates = $jd; }
- function addAddress($address) { $this->addresses[] = $address; }
- function addContact($contact) { $this->contacts[] = $contact; }
- function addPermission($permission) { $this->permissions[] = $permission; }
- function getMemID() { return $this->membershipID;
- function getUserName() { return $this->username; }
- function getFullName() { return $this->firstName . " " . $this->lastName; }
- function getFullNameReverse() { return $this->lastName . " " . $this->firstName; }
- function getSectionNo() { return $this->sectionNo; }
- function getFirstName() { return $this->firstName; }
- function getLastName() { return $this->lastName; }
- function getPackNo() { return $this->packNo; }
- function getSixNo() { return $this->sixNo; }
- function getSectionName() { return $this->section->getName(); }
- function getSectionNumber() { return $this->section->getSectionID(); }
- function getDOB() { return $this->dob; }
- function getGender() { return $this->gender;}
- function getSchool() { return $this->school; }
- function getReligion() { return $this->religion; }
- function getEthnicity() { return $this->ethnicity; }
- function getPhoto() { return $this->canPhoto; }
- function getSwim() { return $this->canSwim; }
- function getHomeTelNo() { return $this->homeTelNo; }
- function getAddressList() {
- foreach ($this->addresses as $address) {
- $adds .= $address->getAddressForSelect();
- }
- return $adds;
- }
- function getContactList() {
- foreach ($this->contacts as $contact) {
- $cons .= $contact->getContactForSelect();
- }
- return $cons;
- }
- function getDoctor() { return $this->doctor; }
- function getSurgery() { return $this->surgery; }
- function getDocTelNo() { return $this->docTelNo; }
- function getAllergies() { return $this->allergies; }
- function getBehavour() { return $this->specialNeeds; }
- function getJoinedScouting() { return $this->joiningDates->getScouting(); }
- function getJoinedBeaver() { return $this->joiningDates->getBeaver(); }
- function getJoinedCub() { return $this->joiningDates->getCub(); }
- function getJoinedScout() { return $this->joiningDates->getScout(); }
- function getJoinedLeader() { return $this->joiningDates->getLeader(); }
- function getJoinedYoungLeader() { return $this->joiningDates->getYoungLeader(); }
- function getJoinedHelper() { return $this->joiningDates->getHelper(); }
- function getJoinedParent() { return $this->joiningDates->getParents(); }
- function getCRBNo() { return $this->crbNo; }
- function getCRBDate() { return $this->crbDate; }
- function printAddresses() {
- foreach ( $this->addresses as $address) {
- print $address->getAddress();
- }
- }
- function calculateAge() {
- $ageDate = strtotime($this->dob);
- $endDate = time();
- $dif = $endDate - $ageDate;
- $years = date('Y', $dif) - 1970;
- $months = date('n', $dif) - 1;
- return $years . " years and " . $months . " months old";
- }
- function hasPermission($perm) {
- $permission = $this->pm->getPermissionByName($perm);
- foreach ($this->permissions as $perm) {
- if($perm->getID() == $permission->getID())
- return 1;
- }
- return 0;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement