Advertisement
Guest User

user.php class

a guest
Jul 21st, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.51 KB | None | 0 0
  1. <?php
  2.  
  3. class user {
  4.    
  5.     private $membershipID;
  6.     private $firstName;
  7.     private $lastName;
  8.     private $username;
  9.     private $section;
  10.     private $sectionNo;
  11.     private $linking = false;
  12.     private $dob;
  13.     private $gender;
  14.     private $homeTelNo;
  15.    
  16.     private $school;
  17.     private $religion;
  18.     private $ethnicity;
  19.     private $canSwim = false;
  20.     private $canPhoto = false;
  21.    
  22.     private $doctor;
  23.     private $surgery;
  24.     private $docTelNo;
  25.     private $allergies;
  26.     private $specialNeeds;
  27.    
  28.     private $pack;
  29.     private $six;
  30.     private $packNo;
  31.     private $sixNo;
  32.    
  33.     private $na;
  34.     private $ha;
  35.    
  36.     private $giftAid;
  37.     private $giftAidPerson;
  38.    
  39.     private $crbNo;
  40.     private $crbDate;
  41.    
  42.     private $addresses = array();
  43.     private $contacts = array();
  44.    
  45.     private $joiningDates;
  46.    
  47.     private $permissions = array();
  48.     private $pm;
  49.    
  50.     function __construct($membershipNo, $firstName, $lastName, $username, $linking, $dob, $gender, $homeTelNo) {
  51.         $this->membershipID = $membershipNo;
  52.         $this->firstName = $firstName;
  53.         $this->lastName = $lastName;
  54.         $this->username = $username;
  55.         $this->linking = $linking;
  56.         $this->dob = $dob;
  57.         $this->gender = $gender;
  58.         $this->homeTelNo = $homeTelNo;
  59.     }
  60.    
  61.     function setPM($pm) {
  62.         $this->pm = $pm;
  63.     }
  64.    
  65.     function setPersonal($school, $religion, $ethnicity, $canSwim, $canPhoto) {
  66.         $this->school = $school;
  67.         $this->religion = $religion;
  68.         $this->ethnicity = $ethnicity;
  69.         $this->canSwim = $canSwim;
  70.         $this->canPhoto = $canPhoto;
  71.     }
  72.    
  73.     function setMedical($doctor, $surgery, $docTelNo, $allergies, $specialNeeds) {
  74.         $this->doctor = $doctor;
  75.         $this->surgery = $surgery;
  76.         $this->docTelNo = $docTelNo;
  77.         $this->allergies = $allergies;
  78.         $this->specialNeeds = $specialNeeds;
  79.     }
  80.    
  81.     function setOther($na, $ha, $giftAid, $giftAidPerson) {
  82.         $this->na = $na;
  83.         $this->ha = $ha;
  84.  
  85.         $this->giftAid = $giftAid;
  86.         $this->giftAidPerson = $giftAidPerson;
  87.     }
  88.    
  89.     function setNos($section, $pack, $six) {
  90.         $this->sectionNo = $section;
  91.         $this->packNo = $pack;
  92.         $this->sixNo = $six;
  93.     }
  94.    
  95.     function setCRB($crbNo, $crbDate) {
  96.         $this->crbNo = $crbNo;
  97.         $this->crbDate = $crbDate;
  98.     }
  99.    
  100.     function setSection($section) { $this->section = $section; }
  101.    
  102.     function setPack($pack) { $this->pack = $pack; }
  103.    
  104.     function setSix($six) { $this->six = $six; }
  105.    
  106.     function setJoiningDates($jd) { $this->joiningDates = $jd; }
  107.    
  108.     function addAddress($address) { $this->addresses[] = $address; }
  109.    
  110.     function addContact($contact) { $this->contacts[] = $contact; }
  111.    
  112.     function addPermission($permission) { $this->permissions[] = $permission; }
  113.    
  114.     function getMemID() { return $this->membershipID;
  115.    
  116.     function getUserName() { return $this->username; }
  117.    
  118.     function getFullName() { return $this->firstName . " " . $this->lastName; }
  119.    
  120.     function getFullNameReverse() { return $this->lastName . " " . $this->firstName; }
  121.    
  122.     function getSectionNo() { return $this->sectionNo; }
  123.    
  124.     function getFirstName() { return $this->firstName; }
  125.    
  126.     function getLastName() { return $this->lastName; }
  127.    
  128.     function getPackNo() { return $this->packNo; }
  129.    
  130.     function getSixNo() { return $this->sixNo; }
  131.    
  132.     function getSectionName() { return $this->section->getName(); }
  133.    
  134.     function getSectionNumber() { return $this->section->getSectionID(); }
  135.    
  136.     function getDOB() { return $this->dob; }
  137.    
  138.     function getGender() { return $this->gender;}
  139.    
  140.     function getSchool() { return $this->school; }
  141.    
  142.     function getReligion() { return $this->religion; }
  143.    
  144.     function getEthnicity() { return $this->ethnicity; }
  145.    
  146.     function getPhoto() { return $this->canPhoto; }
  147.    
  148.     function getSwim() { return $this->canSwim; }
  149.    
  150.     function getHomeTelNo() { return $this->homeTelNo; }
  151.    
  152.     function getAddressList() {
  153.         foreach ($this->addresses as $address) {
  154.             $adds .= $address->getAddressForSelect();
  155.         }
  156.         return $adds;
  157.     }
  158.    
  159.     function getContactList() {
  160.         foreach ($this->contacts as $contact) {
  161.             $cons .= $contact->getContactForSelect();
  162.         }
  163.         return $cons;
  164.     }
  165.    
  166.     function getDoctor() { return $this->doctor; }
  167.    
  168.     function getSurgery() { return $this->surgery; }
  169.    
  170.     function getDocTelNo() { return $this->docTelNo; }
  171.    
  172.     function getAllergies() { return $this->allergies; }
  173.    
  174.     function getBehavour() { return $this->specialNeeds; }
  175.    
  176.     function getJoinedScouting() { return $this->joiningDates->getScouting(); }
  177.    
  178.     function getJoinedBeaver() { return $this->joiningDates->getBeaver(); }
  179.    
  180.     function getJoinedCub() { return $this->joiningDates->getCub(); }
  181.    
  182.     function getJoinedScout() { return $this->joiningDates->getScout(); }
  183.    
  184.     function getJoinedLeader() { return $this->joiningDates->getLeader(); }
  185.    
  186.     function getJoinedYoungLeader() { return $this->joiningDates->getYoungLeader(); }
  187.    
  188.     function getJoinedHelper() { return $this->joiningDates->getHelper(); }
  189.    
  190.     function getJoinedParent() { return $this->joiningDates->getParents(); }
  191.    
  192.     function getCRBNo() { return $this->crbNo; }
  193.    
  194.     function getCRBDate() { return $this->crbDate; }
  195.    
  196.     function printAddresses() {
  197.         foreach ( $this->addresses as $address) {
  198.             print $address->getAddress();
  199.         }
  200.     }
  201.    
  202.     function calculateAge() {
  203.         $ageDate = strtotime($this->dob);
  204.         $endDate = time();
  205.         $dif = $endDate - $ageDate;
  206.  
  207.         $years = date('Y', $dif) - 1970;
  208.         $months = date('n', $dif) - 1;
  209.        
  210.         return $years . " years and " . $months . " months old";
  211.     }
  212.    
  213.     function hasPermission($perm) {
  214.         $permission = $this->pm->getPermissionByName($perm);
  215.        
  216.         foreach ($this->permissions as $perm) {
  217.             if($perm->getID() == $permission->getID())
  218.                 return 1;
  219.         }
  220.         return 0;
  221.     }
  222.    
  223. }
  224.  
  225. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement