Source for file classes_post.php

Documentation is available at classes_post.php

  1. <?php
  2.  
  3. class post extends b_object {
  4. //NOTE - object type definition "user types"
  5. var $title;
  6. var $post_date;
  7. var $text;
  8.  
  9. function post( $constructID = NULL ) {
  10. parent::b_object( $constructID, 'posts' );
  11. $this->post_date = toPhpDate( $this->post_date );
  12. }
  13. //NOTE: these functions are here to overload the base class functions if special data validation etc is needed
  14. //function &get_attribute( $attribute ) { }
  15. //function set_attribute( $attribute, $value ) { }
  16. //function set( $values ) { }
  17. //function set_db( $values ) { }
  18. //function set_object( $values ) { }
  19. //function delete() { }
  20. function get_contents( $navArray = NULL ) {
  21. //format navigation array
  22. //format object diplay fields
  23. $rawFieldArray = $this->type->get_attribute( 'type_object_field_list' );
  24. return parent::get_contents( $navArray, $rawFieldArray );
  25. }
  26.  
  27. function get_index() {
  28. if( $this->title ) {
  29. $objectIndex = $this->title;
  30. } else {
  31. $objectIndex = "new post";
  32. }
  33. return $objectIndex;
  34. }
  35.  
  36. function verify_set( $post ) {
  37. //verifies data before setting the object's values - returns an error array if problems are found
  38. $returnArray = array();
  39. if( !$post['title'] ) {
  40. $returnArray['title'] = 'no title given - please enter a title';
  41. }
  42. if( isset($post['post_date']) ) {
  43. if( $post['post_date'] ) {
  44. $post['post_date'] = toDbDate( $post['post_date'] );
  45. } else {
  46. $post['post_date'] = toDbDate( 'today' );
  47. }
  48. }
  49.  
  50. if( !count($returnArray) ) {
  51. //THIS IS CRITICAL if you want to be able to relate things to the object
  52. parent::verify_set( $post );
  53. } else {
  54. $GLOBALS['errorArray'] = $returnArray;
  55. $this->set_object( $post );
  56. }
  57. }
  58. }
  59.  
  60. ?>

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