Source for file classes_organization.php

Documentation is available at classes_organization.php

  1. <?php
  2. include_once( 'classes_people.php' );
  3.  
  4. class organization extends person {
  5. //NOTE - object type definition "organization"
  6. /*
  7. * still to work out:
  8. * phone number handling
  9. * verify relationships are working
  10. * verify new... works
  11. */
  12. //var $email;
  13. //var $firstName; ***
  14. //var $lastName; ***
  15. //var $userName;
  16. //var $password;
  17. //var $description;
  18. //var $sessionID; ***
  19. //var $sessionIP; ***
  20. //var $sessionTimestamp; ***
  21. var $URI;
  22. var $phone;
  23. var $fax;
  24. var $address;
  25.  
  26. function organization( $constructID = NULL ) {
  27. parent::b_object( $constructID, 'organizations' );
  28. //convert variables from serialized db format to working display format
  29. if( $this->phone ) {
  30. $this->phone = to_phone( $this->phone );
  31. }
  32. if( $this->fax ) {
  33. $this->fax = to_phone( $this->fax );
  34. }
  35. if( $this->address ) {
  36. $this->address = unserialize( $this->address );
  37. }
  38. }
  39. //NOTE: these functions are here to overload the base class functions if special data validation etc is needed
  40. //function &get_attribute( $attribute ) { }
  41. //function set_attribute( $attribute, $value ) { }
  42. //function set_db( $values ) { }
  43. //function set_object( $values ) { }
  44. //function delete() { }
  45. function get_index() {
  46. if( $this->name ) {
  47. $objectIndex = $this->name;
  48. } else if( $this->URI ) {
  49. $objectIndex = $this->URI;
  50. } else if( $this->username ) {
  51. $objectIndex = $this->username;
  52. } else {
  53. $objectIndex = "new organization";
  54. }
  55. return $objectIndex;
  56. }
  57. function verify_set( $post ) {
  58. //sepcial handling for phone numbers
  59. //NOTE: WRITE ME!!!
  60. $data = array();
  61. //special handling for addresses
  62. if( $keys = array_keys( $post ) ) {
  63. $address = array();
  64. foreach( $keys as $key ) {
  65. if( strstr( $key, 'address_' ) ) { $address[ substr( $key, 8 ) ] = $post[$key]; }
  66. else { $data[$key] = $post[$key]; }
  67. }
  68. $data['address'] = $address;
  69. }
  70. if( $post['phone'] ) {
  71. //strip whitespace, periods, dashes, parenthesis
  72. //format to be in 0.000.000.0000 style
  73. //set updated version to post variable
  74. }
  75. parent::verify_set( $data );
  76. }
  77. }
  78.  
  79. ?>

Documentation generated on Tue, 24 May 2005 03:57:10 -0400 by phpDocumentor 1.3.0RC3