BAOBAB
CO_Place_Collection Class Reference
Inheritance diagram for CO_Place_Collection:
Collaboration diagram for CO_Place_Collection:

Public Member Functions

 __construct ( $in_db_object=NULL, $in_db_result=NULL, $in_owner_id=NULL, $in_tags_array=NULL, $in_longitude=NULL, $in_latitude=NULL)
 
 load_from_db ( $in_db_result)
 
 delete_from_db ( $with_extreme_prejudice=false)
 
- Public Member Functions inherited from CO_Place
 set_address_elements ( $in_tags, $dont_save=false)
 
 set_address_element ( $in_index, $in_value, $dont_save=false)
 
 set_address_element_by_key ( $in_key, $in_value, $dont_save=false)
 
 get_address_element_by_index ( $in_index)
 
 lookup_address ()
 
 geocode_long_lat ()
 
 get_readable_address ( $with_venue=true)
 
 set_tags_from_address_elements ()
 
 get_address_elements ()
 
- Public Member Functions inherited from CO_LL_Location
 __construct ( $in_db_object=NULL, $in_db_result=NULL, $in_owner_id=NULL, $in_tags_array=NULL, $in_longitude=NULL, $in_latitude=NULL, $in_fuzz_factor=NULL, $in_can_see_through_the_fuzz=NULL)
 
 update_db ()
 
 set_longitude ( $in_new_value)
 
 set_latitude ( $in_new_value)
 
 fuzz_factor ()
 
 is_fuzzy ()
 
 set_fuzz_factor ( $in_new_value)
 
 raw_longitude ()
 
 raw_latitude ()
 
 longitude ()
 
 latitude ()
 
 set_can_see_through_the_fuzz ( $in_id)
 
 can_see_through_the_fuzz ()
 
 i_can_see_clearly_now ()
 
- Public Member Functions inherited from CO_Main_DB_Record
 __construct ( $in_db_object=NULL, $in_db_result=NULL, $in_owner_id=NULL, $in_tags_array=NULL)
 
 set_owner_id ( $in_new_id)
 
 set_tags ( $in_tags_array)
 
 set_tag ( $in_tag_index, $in_tag_value)
 
 get_payload ()
 
 set_payload ( $in_payload)
 
 owner_id ()
 
 tags ()
 
- Public Member Functions inherited from A_CO_DB_Table_Base
 __construct ( $in_db_object=NULL, $in_db_result=NULL)
 
 set_batch_mode ()
 
 clear_batch_mode ()
 
 id ()
 
 lock ()
 
 locked ()
 
 danger_will_robinson_danger_clear_id ()
 
 user_can_read ()
 
 user_can_write ()
 
 set_read_security_id ($in_new_id)
 
 set_write_security_id ($in_new_id)
 
 set_name ($in_new_value)
 
 delete_from_db ()
 
 reload_from_db ()
 
 get_access_object ()
 
 get_lang ()
 
 set_lang ( $in_lang_id=NULL)
 
- Public Member Functions inherited from tCO_Collection
 reload_collection ()
 
 insertElement ( $in_element, $in_before_index=-1, $dont_update=false)
 
 insertElements ( $in_element_array, $in_before_index=-1)
 
 deleteElements ( $in_first_index, $in_deletion_length)
 
 deleteElement ( $in_index)
 
 deleteThisElement ( $in_element)
 
 appendElement ( $in_element)
 
 appendElements ( $in_element_array)
 
 deleteAllChildren ()
 
 indexOfThisElement ( $in_element)
 
 whosYourDaddy ( $in_element)
 
 areYouMyDaddy ( $in_element, $full_hierachy=true)
 
 map ( $in_function)
 
 recursiveMap ( $in_function, $in_hierarchy_level=0, $in_parent_object=NULL, $loop_stopper=Array())
 
 count ( $is_recursive=false)
 
 children ()
 
 children_ids ( $in_raw=false)
 
 set_children_ids ( $in_new_ids)
 
 who_are_my_parents ()
 
 getHierarchy ( $loop_stopper=Array())
 

Additional Inherited Members

- Public Attributes inherited from CO_Place
 $address_elements = Array()
 These are the address elements we use for creating lookup addresses. More...
 
 $google_geocode_uri_prefix = NULL
 This is the Geocode URI for the Google Geocode. More...
 
 $google_lookup_uri_prefix = NULL
 This is the lookup URI for the Google reverse Geocode. More...
 
 $region_bias = NULL
 This can be set by subclasses in order to set a region bias. More...
 
- Public Attributes inherited from A_CO_DB_Table_Base
 $class_description
 This is a description of the class (not the instance). More...
 
 $instance_description
 This is a description that describes the instance. More...
 
 $last_access
 This is a UNIX epoch date that describes the last modification. The default is UNIX Day Two (in case of UTC timezone issues). More...
 
 $name
 This is the "object_name" string field. More...
 
 $read_security_id
 This is a single integer, defining the security ID required to view the record. If it is 0, then it is "open.". More...
 
 $write_security_id
 This is a single integer, defining the required security token to modify the record. If it is 0, then any logged-in user can modify. More...
 
 $context
 This is a mixed associative array, containing fields for the object. More...
 
 $error
 If there is an error, it is contained here, in a LGV_Error instance. More...
 
- Static Public Attributes inherited from CO_Main_DB_Record
static $s_table_name = 'co_data_nodes'
 
- Protected Member Functions inherited from CO_Place
 _get_address_element_labels ()
 
- Protected Member Functions inherited from CO_LL_Location
 _default_setup ()
 
 _build_parameter_array ()
 
 _km_per_degree ()
 
 _fuzz_me ()
 
- Protected Member Functions inherited from A_CO_DB_Table_Base
 _badger_serialize ( $in_data)
 
 _badger_unserialize ( $in_data)
 
 _write_to_db ()
 
 _seppuku ()
 
- Protected Member Functions inherited from tCO_Collection
 _scrub ()
 
 _set_up_container ()
 
- Protected Attributes inherited from CO_LL_Location
 $_longitude
 
 $_latitude
 
- Protected Attributes inherited from CO_Main_DB_Record
 $_owner_id
 
 $_tags
 
- Protected Attributes inherited from A_CO_DB_Table_Base
 $_db_object
 This is the actual database object that "owns" this instance. It should not be exposed beyond this class or subclasses, thereof. More...
 
 $_id
 This is the within-table unique ID of this record. More...
 
 $_batch_mode
 If this is true, then the write_record call will not be made in update_db. It will be done when clear_batch_mode() is called, instead. More...
 
- Protected Attributes inherited from tCO_Collection
 $_container
 This contains instances of the records referenced by the IDs stored in the object. More...
 

Detailed Description

This is a specialization of the US Place class. It acts as a collection, so it's a "place of places."

Definition at line 35 of file co_place_collection.class.php.

Constructor & Destructor Documentation

◆ __construct()

CO_Place_Collection::__construct (   $in_db_object = NULL,
  $in_db_result = NULL,
  $in_owner_id = NULL,
  $in_tags_array = NULL,
  $in_longitude = NULL,
  $in_latitude = NULL 
)

Constructor (Initializer)

Parameters
$in_db_objectThe database object for this instance.
$in_db_resultThe database row for this instance (associative array, with database keys).
$in_owner_idThe ID of the object (in the database) that "owns" this instance.
$in_tags_arrayAn array of up to 10 strings, with address information in the first 8. Order is important:
  • 0: Venue
  • 1: Street Address
  • 2: Extra Information
  • 3: Town
  • 4: County
  • 5: State
  • 6: ZIP Code
  • 7: Nation

Associative keys are not used. The array should be in that exact order.

Parameters
$in_longitudeAn initial longitude value.
$in_latitudeAn initial latitude value.

Reimplemented from CO_Place.

Definition at line 42 of file co_place_collection.class.php.

60  {
61 
62  $this->_container = Array();
63 
64  parent::__construct($in_db_object, $in_db_result, $in_owner_id, $in_tags_array, $in_longitude, $in_latitude);
65  $this->class_description = "This is a 'Place Collection' Class for Addresses.";
66 
67  $count = 0;
68  if (isset($this->context['children_ids']) && is_array($this->context['children_ids'])) {
69  $count = count($this->context['children_ids']);
70  }
71 
72  $this->instance_description = isset($this->name) && $this->name ? "$this->name ($this->_longitude, $this->_latitude - $count children objects)" : "($this->_longitude, $this->_latitude - $count children objects)";
count( $is_recursive=false)

Member Function Documentation

◆ delete_from_db()

CO_Place_Collection::delete_from_db (   $with_extreme_prejudice = false)

We override this, because we want to see if we can possibly delete children objects.

Returns
true, if the deletion was successful.
Parameters
$with_extreme_prejudiceIf true (Default is false), then we will attempt to delete all contained children. Remember that this could cause problems if other collections can see the children!

Definition at line 98 of file co_place_collection.class.php.

100  {
101  if ($with_extreme_prejudice && $this->user_can_write()) {
102  // We don't error-check this on purpose, as it's a given that there might be issues, here. This is a "due dilligence" thing.
103  $user_items_to_delete = $this->children();
104 
105  foreach ($user_items_to_delete as $child) {
106  if ($child->user_can_write()) {
107  $child->delete_from_db();
108  }
109  }
110  }
111 
112  return parent::delete_from_db();

◆ load_from_db()

CO_Place_Collection::load_from_db (   $in_db_result)

This function sets up this instance, according to the DB-formatted associative array passed in.

Returns
true, if the instance was able to set itself up to the provided array.
Parameters
$in_db_resultThis is an associative array, formatted as a database row response.

Reimplemented from CO_LL_Location.

Definition at line 80 of file co_place_collection.class.php.

82  {
83  $ret = parent::load_from_db($in_db_result);
84 
85  $count = 0;
86  if (isset($this->context['children_ids']) && is_array($this->context['children_ids'])) {
87  $count = count($this->context['children_ids']);
88  }
89 
90  $this->class_description = "This is a 'Place Collection' Class for Addresses.";
91  $this->instance_description = isset($this->name) && $this->name ? "$this->name ($this->_longitude, $this->_latitude - $count children objects)" : "($this->_longitude, $this->_latitude - $count children objects)";