Source for file Person.inc

Documentation is available at Person.inc

  1. <?php
  2. ################################################################
  3. # This file is part of SlidingDoors #
  4. # Copyright 2001-2002. Eric D. Nielsen, All rights reserverd #
  5. # SlidingDoors is availible for license under the GPL, see #
  6. # the COPYING file in the root directory of the install for #
  7. # the full terms of the GPL. #
  8. # #
  9. # File: Person.inc #
  10. # Author: Eric D. Nielsen #
  11. # Description: The person class #
  12. # Attributes: org -- linked to another storeable object #
  13. # Constructor: person #
  14. # Methods: validateInputs #
  15. # populateFromFormVars #
  16. # Accessors/Mutators: get/setFirstName #
  17. # get/setLastName #
  18. # get/setEmail #
  19. # get/setAffil #
  20. # Change Log: 6/12/01 -- created -- edn #
  21. # 7/02/02 -- GPL, PrepStep enabled -- edn #
  22. # 10/30/04 -- Temporalization -- edn
  23. ################################################################
  24.  
  25. class Person extends StoredObject
  26. {
  27.  
  28. var $org;
  29. var $address;
  30.  
  31. function Person($db=0, $id=0)
  32. ############################################################
  33. # Method: Person (constructor) #
  34. # Arguments: db -- the database to load/save this person #
  35. # id -- the id of the person, from the db #
  36. # Returns: the new person object #
  37. ############################################################
  38. {
  39. $this->primeField="id";
  40. $this->setID($id);
  41. StoredObject::StoredObject($db);
  42. GLOBAL $SD_elements;
  43.  
  44. if (in_array("Name",$SD_elements))
  45. $this->addTable("people",
  46. "peopleid","id",
  47. array("firstname","lastname"),
  48. array("firstname","lastname"));
  49. if (in_array("Affiliation",$SD_elements))
  50. {
  51. $this->addTable("people",
  52. "peopleid","id",
  53. array("organization"),
  54. array("organizationID"));
  55. $this->org = new Organization($this->db);
  56. }
  57. if (in_array("Email",$SD_elements))
  58. $this->addTable( "people_contact",
  59. "peopleid","id",
  60. array("emailday"),array("email"));
  61. if (in_array("Fee Category",$SD_elements))
  62. $this->addTable( "people_classification",
  63. "peopleid", "id",
  64. array("agelevel"),
  65. array("feeLevel"));
  66. if (in_array("Birth Year",$SD_elements))
  67. {
  68. $this->addTable("people_birthdays",
  69. "peopleid","id",
  70. array("year"),array("birthyear"));
  71. }
  72. if (in_array("Home Phone", $SD_elements))
  73. {
  74. $this->addTable("people_contact",
  75. "peopleid","id",
  76. array("phoneeve"),array("phonehome"));
  77. }
  78. if (in_array("Address", $SD_elements))
  79. {
  80. $this->addTable("people",
  81. "peopleid","id",
  82. array("address"),array("addressID"));
  83. $this->address= new Address($this->db);
  84. }
  85. if (in_array("USABDA Number", $SD_elements))
  86. {
  87. $this->addTable("people_id_numbers",
  88. "peopleid","id",
  89. array("organization","idnumber"),
  90. array("USABDANO","usabdaID"));
  91. }
  92. if (in_array("Package",$SD_elements))
  93. {
  94. $this->addTable("people_paying",
  95. "peopleid","id",
  96. array("org_pays","orgid"),
  97. array("orgPays","orgPaying"));
  98. $this->addTable("packages_purchased",
  99. "peopleid","id",
  100. array("packageid"),array("packageid"));
  101. }
  102. if ($id)
  103. $this->retrieve();
  104. }
  105. function retrieve()
  106. {
  107. global $SD_elements;
  108. StoredObject::retrieve();
  109. if (in_array("Affiliation",$SD_elements))
  110. {
  111. $this->org = new Organization($this->db);
  112. $this->org->setID($this->fields["organizationID"]);
  113. $this->org->retrieve();
  114. }
  115. if (in_array("Address",$SD_elements))
  116. {
  117. $this->address = new Address($this->db);
  118. $this->address->setID($this->fields["addressID"]);
  119. $this->address->retrieve();
  120. }
  121. }
  122.  
  123.  
  124. #############################################################
  125. # Function: validateInputs #
  126. # Arguements: formVars -- will contain the validated inputs #
  127. # along with error messages for #
  128. # invalid inputs #
  129. # type -- <PRIME | PARTNER | PRIME-UPDATE> #
  130. # used in determining which fields are #
  131. # required and where the inputs are #
  132. # stored #
  133. # Returns: TRUE iff the inputs are valid, FALSE otherwise #
  134. # Modifies: formVars #
  135. #############################################################
  136. function validateInputs(&$formVars,$type="PRIME")
  137. {
  138. GLOBAL $SD_elements;
  139. GLOBAL $SD_allow_TBAs;
  140. GLOBAL $SD_prime_is_always_leader;
  141. GLOBAL $SD_error_text_color;
  142.  
  143. switch ($type)
  144. {
  145. case "PRIME" : $prime=TRUE; $update=FALSE; $partner=FALSE;
  146. $prefix=""; $Prefix=""; $label="your "; break;
  147. case "PARTNER" : $prime=FALSE; $update=FALSE; $partner=TRUE;
  148. $prefix=""; $Prefix=""; $label= "your partner's ";
  149. break;
  150. case "PRIME-UPDATE" : $prime=TRUE; $update=TRUE; $partner=FALSE;
  151. $prefix="update";
  152. $label="your "; break;
  153. default : break;
  154. }
  155. $needsName = in_array("Name",$SD_elements);
  156. $needsEmail = in_array("Email",$SD_elements);
  157. $needsFee = in_array("Fee Category",$SD_elements);
  158. $needsPackage = in_array("Package",$SD_elements);
  159. $needsUsabda = in_array("USABDA Number",$SD_elements);
  160. $needsAffil = in_array("Affiliation",$SD_elements);
  161. $needsPhone = in_array("Home Phone",$SD_elements);
  162. $needsAddress = in_array("Address",$SD_elements);
  163. $needsBirthYear = in_array("Birth Year",$SD_elements);
  164. $tbaPost = $Prefix ."TBA";
  165. $tba = isset($_POST[$tbaPost]) ?
  166. $_POST[$tbaPost] : "";
  167. $role = isset($_POST["role"]) ? $_POST["role"] : "";
  168.  
  169. $firstNamePost = $prefix."FirstName";
  170. $firstNameMsg =$firstNamePost."Msg";
  171. $firstName = isset($_POST[$firstNamePost]) ?
  172. htmlspecialchars($_POST[$firstNamePost]) : "";
  173.  
  174. $lastNamePost = $prefix."LastName";
  175. $lastNameMsg =$lastNamePost."Msg";
  176. $lastName = isset($_POST[$lastNamePost])?
  177. htmlspecialchars($_POST[$lastNamePost]) : "";
  178. $newAffilPost = $prefix."NewAffil";
  179. $newAffilMsg =$newAffilPost."Msg";
  180. $newAffil = isset($_POST[$newAffilPost])?
  181. htmlspecialchars($_POST[$newAffilPost]) : "";
  182. $affilShortPost = $prefix."AffilShort";
  183. $affilShortMsg =$affilShortPost."Msg";
  184. $affilShort = isset($_POST[$affilShortPost]) ?
  185. htmlspecialchars($_POST[$affilShortPost]) : "";
  186. $affilIDPost = $prefix."AffilID";
  187. $affilIDMsg =$affilIDPost."Msg";
  188. $affilID = isset($_POST[$affilIDPost]) ?
  189. $_POST[$affilIDPost]:""; # id's from db
  190. $emailPost = $prefix."Email";
  191. $emailMsg =$emailPost."Msg";
  192. $email = isset($_POST[$emailPost])?
  193. strtolower(htmlspecialchars($_POST[$emailPost])) : "";
  194.  
  195. $feePost = $prefix."Fee";
  196. $feeMsg =$feePost."Msg";
  197. $fee = isset($_POST[$feePost])?
  198. $_POST["$feePost"] :"";
  199.  
  200. $packagePost = $prefix."Package";
  201. $packageMsg =$packagePost."Msg";
  202. $package = isset($_POST[$packagePost]) ?
  203. $_POST[$packagePost] : "";
  204. $birthyearPost = $prefix."Birthyear";
  205. $birthyearMsg = $birthyearPost."Msg";
  206. $birthyear = isset($_POST[$birthyearPost])?
  207. htmlspecialchars($_POST[$birthyearPost]) : "";
  208.  
  209. $homephonePost = $prefix."HomePhone";
  210. $homephoneMsg = $homephonePost."Msg";
  211. $homephone = isset($_POST[$homephonePost]) ?
  212. htmlspecialchars($_POST[$homephonePost]) : "";
  213.  
  214. $usabdaPost = $prefix."UsabdaNumber";
  215. $usabdaMsg = $usabdaPost."Msg";
  216. $usabda = isset($_POST[$usabdaPost]) ?
  217. htmlspecialchars($_POST[$usabdaPost]) :"";
  218.  
  219. $validated= TRUE;
  220.  
  221. # handle TBA special cases, over-ridden values are saved during the
  222. # regular processing of that field
  223. if ($SD_allow_TBAs)
  224. {
  225. if ($tba || $firstName=="TBA")
  226. {
  227. $tba=TRUE;
  228. if ($needsName)
  229. {
  230. $firstName="TBA";
  231. if (!is_num($lastName))
  232. $lastName = $this->db->getNextTBA();
  233. }
  234. else if ($needsEmail)
  235. $email = "TBA.".$this->db->getNextTBA();
  236. if ($needsAffil)
  237. $affilID=-1;
  238. }
  239. } else $tba=FALSE;
  240. # handle first/last names; save value if non empty. Names are required
  241. # to be filled out, even if TBA, above special case code ensures this
  242. if ($needsName)
  243. {
  244. if ($firstName!="")
  245. $formVars["$firstNamePost"]=$firstName;
  246. else
  247. {
  248. $formVars[$firstNameMsg]="<font color=\"$SD_error_text_color\">Please enter $label first name.</font><br />\n";
  249. $validated=FALSE;
  250. }
  251. if ($lastName!="")
  252. $formVars["$lastNamePost"]=$lastName;
  253. else
  254. {
  255. $formVars[$lastNameMsg]="<font color=\"$SD_error_text_color\">Please enter $label last name.</font><br />\n";
  256. $validated=FALSE;
  257. }
  258. }
  259. # handle email, does not validate or even regexp check, email may
  260. # be empty if tba and name used
  261. if ($needsEmail)
  262. if ($email!="")
  263. $formVars["$emailPost"]=$email;
  264. else if (!$tba)
  265. {
  266. $formVars[$emailMsg]="<font color=\"$SD_error_text_color\">Please enter $label email.</font><br />\n";
  267. $validated=FALSE;
  268. }
  269. if ($needsAddress)
  270. {
  271. $anAddress = new Address($this->db);
  272. $addressValid = $anAddress->validateInputs($formVars,$prefix,$tba);
  273. $validated= $validated && $addressValid;
  274. }
  275.  
  276.  
  277. if ($needsPhone)
  278. if ($homephone!="")
  279. $formVars["$homephonePost"]=$homephone;
  280. else if (!$tba)
  281. {
  282. $formVars[$homephoneMsg]="<font color=\"$SD_error_text_color\">Please enter $label home phone.</font><br />\n";
  283. $validated=FALSE;
  284. }
  285.  
  286. if ($needsUsabda)
  287. if ($usabda!="")
  288. $formVars["$usabdaPost"]=$usabda;
  289. else if (!$tba)
  290. {
  291. $formVars[$usabdaMsg]="<font color=\"$SD_error_text_color\">Please enter $label USABDA or enter \"Pending\".</font><br />\n";
  292. $validated=FALSE;
  293. }
  294.  
  295. # handle packages, should never be empty, but just in case
  296. if ($needsPackage)
  297. if ($package!="")
  298. $formVars["$packagePost"]=$package;
  299. else if (!$tba)
  300. {
  301. $formVars[$packageMsg]="<font color=\"$SD_error_text_color\">Please select $label registration package.</strong><br />\n";
  302. $validated=FALSE;
  303. }
  304. # handles fee category, should never be empty
  305. if ($needsFee)
  306. if ($fee!="")
  307. $formVars["$feePost"]=$fee;
  308. else
  309. {
  310. $formVars[$feeMsg]="<font color=\"$SD_error_text_color\">Please select $label fee category.</strong><br />\n";
  311. $validated=FALSE;
  312. }
  313. # handle the complicated affiliation cases
  314. if ($needsAffil)
  315. {
  316. if ($affilID=="choose")
  317. $affilID="";
  318. if ($affilID!="")
  319. $formVars["$affilIDPost"]=$affilID;
  320. if ($newAffil!="")
  321. $formVars["$newAffilPost"]=$newAffil;
  322. if ($affilShort!="")
  323. $formVars["$affilShortPost"]=$affilShort;
  324. $formVars[$affilIDMsg]="";
  325. $formVars[$newAffilMsg]="";
  326.  
  327. # user selected from drop down box and entered text
  328. if ($affilID!="" && ($newAffil!="" || $affilShort != ""))
  329. {
  330. $query = "SELECT * from organizations where name='$newAffil' AND orgid='$affilID';";
  331. $result = $this->db->query($query);
  332. if ($result->numrows()!=1)
  333. {
  334. $validated=FALSE;
  335. $formVars[$affilIDMsg]="<font color=\"$SD_error_text_color\">Please do not select an affiliation from the list box and also enter information into the \"New Affiliation\" boxes.</font><br />\n";
  336. }
  337. else
  338. {
  339. $newAffil=""; $affilShort="";
  340. }
  341. }
  342. # user didn't select nor enter text
  343. if ($affilID=="" && ($newAffil=="" || $affilShort == ""))
  344. {
  345. $validated=FALSE;
  346. $formVars[$affilIDMsg].="<font color=\"$SD_error_text_color\">Please either select an affiliation from the box, or enter a new one with long and short form in the text boxes below.</font><br />";
  347. }
  348. # user didn't select, but only entered 1 of 2 text entries
  349. if (($newAffil!="" && $affilShort=="") ||
  350. ($newAffil=="" && $affilShort!=""))
  351. {
  352. $validated = FALSE;
  353. $formVars[$newAffilMsg].="<font color=\"$SD_error_text_color\">Please provide both a long and short form of $label affiliation's name. Here are some examples:<br />Massachusetts Institute of Technology --> MIT<br />Harvard University --> Harvard<br />Fred Astaire Dance Studio, Boston --> FADS Boston<br /></font>";
  354. }
  355. if ($affilID=="" && $newAffil!="" && $affilShort!="")
  356. {
  357. $query = "SELECT abbreviation from abbreviations where fulltext='$newAffil';";
  358. $result = $this->db->query($query);
  359. if ($result->numrows()>0)
  360. {
  361. list($temp) = $result->getRowAt(0);
  362. $validated = FALSE;
  363. $formVars[$newAffilMsg].="<font color=\"$SD_error_text_color\">An affiliation with the name you entered already exists, please select it from the
  364. drop down select box, it is listed as '$temp'.</font></br>";
  365. }
  366. $query = "SELECT fulltext from abbreviations where abbreviation='$affilShort';";
  367. $result = $this->db->query($query);
  368. if ($result->numrows()>0)
  369. {
  370. list($tempName) = $result->getRowAt(0);
  371. $validated = FALSE;
  372. $formVars[$newAffilMsg].="<font color=\"$SD_error_text_color\">$tempName is already using that abbreviation. You will have to choose another.</font></br>";
  373. }
  374. $query = "SELECT orgid FROM organizations WHERE name = '$newAffil' or name LIKE '$newAffil%';";
  375. $result = $this->db->query($query);
  376. if ($result->numrows()>0)
  377. {
  378. list($tempName) = $result->getRowAt(0);
  379. $validated = FALSE;
  380. $formVars[$newAffilMsg].="<font color=\"$SD_error_text_color\">$tempName already exists in the database, please select it from the drop-down menu.</font></br>";
  381. }
  382.  
  383. }
  384. }
  385. $formVals["Role"]=$role;
  386.  
  387. if ($needsBirthYear)
  388. {
  389. $curYear = date('Y');
  390. if (($birthyear!="") && ($birthyear > $curYear-110) &&
  391. ($birthyear < $curYear))
  392. $formVars["$birthyearPost"]=$birthyear;
  393. else
  394. {
  395. $formVars[$birthyearMsg]="<font color=\"$SD_error_text_color\">Please enter a 4 digit birth year</font><br />\n";
  396. $validated=FALSE;
  397. }
  398. }
  399. return $validated;
  400. }
  401.  
  402. function populateFromFormVars($formVars,$prefix="")
  403. #############################################################
  404. # Function: populateFromFormVars #
  405. # Arguements: formVars -- contains the values to insert #
  406. # prefix -- an optional string to prefix to #
  407. # names in FormVars before matching #
  408. # with fields #
  409. # stored #
  410. # Returns: nothing #
  411. # Modifies: this #
  412. #############################################################
  413. {
  414. GLOBAL $SD_elements;
  415. if (in_array("Name",$SD_elements))
  416. {
  417. $this->setFirstName($formVars[$prefix . "FirstName"]);
  418. $this->setLastName($formVars[$prefix . "LastName"]);
  419. $tba = $this->getFirstName()=="TBA";
  420. }
  421.  
  422. if (in_array("Email",$SD_elements))
  423. $this->setEmail($formVars[$prefix . "Email"]);
  424. if (in_array("Fee Category",$SD_elements))
  425. $this->setFeeLevel($formVars[$prefix . "Fee"]);
  426. if (in_array("Package",$SD_elements))
  427. $this->setPackage($formVars[$prefix . "Package"]);
  428. if (in_array("Birth Year",$SD_elements))
  429. $this->setBirthyear($formVars[$prefix . "Birthyear"]);
  430. if (in_array("Home Phone",$SD_elements))
  431. $this->setHomePhone($formVars[$prefix . "HomePhone"]);
  432. if (in_array("Address",$SD_elements))
  433. {
  434. $anAddress = new Address($this->db);
  435. $addressID = $anAddress->populateFromFormVars($formVars,$prefix,
  436. $tba);
  437. $this->setAddressID($addressID);
  438. }
  439. if (in_array("USABDA Number",$SD_elements))
  440. $this->setUsabdaNumber($formVars[$prefix . "UsabdaNumber"]);
  441. if (in_array("Affiliation",$SD_elements))
  442. {
  443. $oldAffilID=$this->getAffilID();
  444. $oldPayingID=$this->getOrgPaying();
  445. $affilID= isset($formVars[$prefix."AffilID"])?
  446. $formVars[$prefix . "AffilID"] : "";
  447. if (!(($affilID=="") || ($affilID==-1)))
  448. {
  449. $this->setAffilID($affilID);
  450. if ($oldAffilID==$oldPayingID)
  451. $this->setOrgPaying($affilID);
  452. }
  453. else if ($formVars[$prefix."NewAffil"]=="")
  454. {
  455. $this->setAffilID(-1);
  456. $this->setOrgPays("FALSE");
  457. }
  458. }
  459. }
  460.  
  461. function getPackage()
  462. ############################################################
  463. # Function: getPackage #
  464. # Arguments: none #
  465. # Returns: packageID, if no packageID found returns "" #
  466. # Requires: nothing #
  467. # Modifies: nothing #
  468. ############################################################
  469. {
  470. return $this->getGeneralData("packageid");
  471. }
  472.  
  473. function setPackage($pid)
  474. ############################################################
  475. # Function: setPackage #
  476. # Arguments: pid #
  477. # Returns: nothing #
  478. # Requires: nothing #
  479. # Modifies: nothing #
  480. ############################################################
  481. {
  482. return $this->setGeneralData("packageid",$pid);
  483. }
  484.  
  485. function getFirstName()
  486. ############################################################
  487. # Function: getFirstName #
  488. # Arguments: none #
  489. # Returns: first name, if no first name found returns "" #
  490. # Requires: nothing #
  491. # Modifies: nothing #
  492. ############################################################
  493. {
  494. return $this->getGeneralData("firstname");
  495. }
  496.  
  497. function getLastName()
  498. ############################################################
  499. # Function: getLastName #
  500. # Arguments: none #
  501. # Returns: last name, if no last name found returns "" #
  502. # Requires: nothing #
  503. # Modifies: nothing #
  504. ############################################################
  505. {
  506. return $this->getGeneralData("lastname");
  507. }
  508.  
  509. function getAgeLevel()
  510. {
  511. $age = date("Y") - $this->getBirthYear();
  512. $query = "SELECT levelname FROM age_levels WHERE min_age<=$age AND max_age >=$age;";
  513. $result = $this->db->query($query);
  514. if ($result->numrows()>0)
  515. {
  516. list($ans) = $result->getRowAt(0);
  517. }
  518. else
  519. $ans="";
  520. return $ans;
  521. }
  522.  
  523.  
  524.  
  525.  
  526. function getEmail()
  527. ############################################################
  528. # Function: getEmail #
  529. # Arguments: none #
  530. # Returns: email, if no email found returns "" #
  531. # Requires: nothing #
  532. # Modifies: nothing #
  533. ############################################################
  534. {
  535. return $this->fields["email"];
  536. }
  537.  
  538. function getAffil()
  539. ############################################################
  540. # Function: getAffil #
  541. # Arguments: none #
  542. # Returns: affiliation, if no affiliation found returns "" #
  543. # Requires: nothing #
  544. # Modifies: nothing #
  545. ############################################################
  546. {
  547. return $this->org->getAbbrev();
  548. }
  549.  
  550. function getAffilID()
  551. ############################################################
  552. # Function: getAffil #
  553. # Arguments: none #
  554. # Returns: affiliation, if no affiliation found returns "" #
  555. # Requires: nothing #
  556. # Modifies: nothing #
  557. ############################################################
  558. {
  559. return $this->getGeneralData("organizationID");
  560. }
  561.  
  562. function getFeeLevel()
  563. ############################################################
  564. # Function: getFeeLevel #
  565. # Arguments: none #
  566. # Returns: fee level, if no level found returns "" #
  567. # Requires: nothing #
  568. # Modifies: nothing #
  569. ############################################################
  570. {
  571. return $this->getGeneralData("feeLevel");
  572. }
  573.  
  574.  
  575.  
  576. function getClass()
  577. ############################################################
  578. # Function: getClass #
  579. # Arguments: none #
  580. # Returns: classification, if no class found returns "" #
  581. # Requires: nothing #
  582. # Modifies: nothing #
  583. ############################################################
  584. {
  585. return $this->getGeneralData("class");
  586. }
  587.  
  588. function getOrgPays()
  589. {
  590. $temp = $this->getGeneralData("orgPays");
  591. return ($temp=="t"? TRUE : FALSE);
  592. }
  593.  
  594. function getOrgPaying()
  595. {
  596. return $this->getGeneralData("orgPaying");
  597. }
  598.  
  599. function setOrgPaying($data)
  600. {
  601. return $this->setGeneralData("orgPaying",$data);
  602. }
  603.  
  604. function getBirthyear()
  605. {
  606. return $this->getGeneralData("birthyear");
  607. }
  608.  
  609. function getHomePhone()
  610. {
  611. return $this->getGeneralData("phonehome");
  612. }
  613. function setHomePhone($data)
  614. {
  615. return $this->setGeneralData("phonehome",$data);
  616. }
  617.  
  618. function getAddressID()
  619. {
  620. return $this->getGeneralData("addressID");
  621. }
  622. function setAddressID($data)
  623. {
  624. $this->address->setID($data);
  625. $this->address->retrieve();
  626. return $this->setGeneralData("addressID",$data);
  627. }
  628.  
  629. function getUsabdaNumber()
  630. {
  631. return $this->getGeneralData("usabdaID");
  632. }
  633. function setUsabdaNumber($data)
  634. {
  635. global $SD_USABDA_ORG_ID;
  636. $this->setGeneralData("USABDANO",$SD_USABDA_ORG_ID);
  637. return $this->setGeneralData("usabdaID",$data);
  638. }
  639.  
  640. function setAgeLevel($ageLevel)
  641. ############################################################
  642. # Function: setAgeLevel #
  643. # Arguments: ageLevel -- the ageLevel to set #
  644. # Returns: 1 if set, 0 otherwise (never) #
  645. # Requires: nothing #
  646. # Modifies: nothing #
  647. ############################################################
  648. {
  649. return $this->setGeneralData("ageLevel",$ageLevel);
  650. }
  651.  
  652. function setFeeLevel($feeLevel)
  653. ############################################################
  654. # Function: setFeeLevel #
  655. # Arguments: feeLevel -- the feeLevel to set #
  656. # Returns: 1 if set, 0 otherwise (never) #
  657. # Requires: nothing #
  658. # Modifies: nothing #
  659. ############################################################
  660. {
  661. return $this->setGeneralData("feeLevel",$feeLevel);
  662. }
  663.  
  664.  
  665.  
  666. function setClass($class)
  667. ############################################################
  668. # Function: setClass #
  669. # Arguments: class -- the class to set #
  670. # Returns: 1 if set, 0 otherwise (never) #
  671. # Requires: nothing #
  672. # Modifies: nothing #
  673. ############################################################
  674. {
  675. return $this->setGeneralData("class",$class);
  676. }
  677.  
  678.  
  679. function setFirstName($firstName)
  680. ############################################################
  681. # Function: setFirstName #
  682. # Arguments: firstName -- the firstName to set #
  683. # Returns: 1 if set, 0 otherwise (never) #
  684. # Requires: nothing #
  685. # Modifies: nothing #
  686. ############################################################
  687. {
  688. return $this->setGeneralData("firstname",$firstName);
  689. }
  690.  
  691. function setLastName($lastName)
  692. ############################################################
  693. # Function: setLastName #
  694. # Arguments: lastName -- the last name to set #
  695. # Returns: 1 if set, 0 otherwise #
  696. # Requires: nothing #
  697. # Modifies: nothing #
  698. ############################################################
  699. {
  700. return $this->setGeneralData("lastname",$lastName);
  701. }
  702.  
  703. function setEmail($email)
  704. ############################################################
  705. # Function: setEmail #
  706. # Arguments: email -- the email to set #
  707. # Returns: 1 if set, 0 otherwise #
  708. # Requires: nothing #
  709. # Modifies: nothing #
  710. ############################################################
  711. {
  712. return $this->setGeneralData("email", $email);
  713. }
  714.  
  715. function setAffilID($affil)
  716. ############################################################
  717. # Function: setAffil #
  718. # Arguments: affil -- the affil to set #
  719. # Returns: 1 if set, 0 otherwise #
  720. # Requires: nothing #
  721. # Modifies: nothing #
  722. ############################################################
  723. {
  724. if ($this->fields["orgPays"]=="" && $affil!=-1 && $affil!="")
  725. {
  726. $query = "SELECT org_pays FROM registration_supplement ";
  727. $query.= "WHERE orgid=$affil;";
  728. $result = $this->db->query($query);
  729. if ($result->numRows())
  730. {
  731. list($orgPays) = $result->getRowAt(0);
  732. $orgPays = ($orgPays=="t");
  733. $this->setOrgPays($orgPays);
  734. if ($orgPays)
  735. $this->setOrgPaying($affil);
  736. else
  737. $this->setOrgPaying(0);
  738. }
  739. }
  740. else if ($affil==-1 || $affil=="")
  741. {
  742. $this->setOrgPays("FALSE");
  743. $this->setOrgPaying(0);
  744. }
  745. return $this->setGeneralData("organizationID",$affil);
  746. }
  747.  
  748. function setBirthyear($data)
  749. {
  750. return $this->setGeneralData("birthyear",$data);
  751. }
  752. function setOrgPays($data)
  753. {
  754. return $this->setGeneralData("orgPays",($data ? "TRUE" : "FALSE"));
  755. }
  756.  
  757.  
  758. }
  759. ?>

Documentation generated on Tue, 25 Apr 2006 13:07:41 -0400 by phpDocumentor 1.3.0RC3