BLUE DRAGON PHP SDK
All Classes Functions Variables Pages
RVP_PHP_SDK_Place Class Reference
Inheritance diagram for RVP_PHP_SDK_Place:
A_RVP_PHP_SDK_Data_Object A_RVP_PHP_SDK_Object

Public Member Functions

 __construct ( $in_sdk_object, $in_id, $in_data=NULL, $in_detailed_data=false)
 
 basic_address ()
 
 address_elements ()
 
 set_address_elements ( $in_address_elements_array)
 
 tag8 ()
 
 tag9 ()
 
 set_tag8 ( $in_new_string_value)
 
 set_tag9 ( $in_new_string_value)
 
 geocode ()
 
 reverse_geocode ()
 
 coords ()
 
 set_coords ( $in_latitude, $in_longitude)
 
 distance ()
 
 is_fuzzy ()
 
 fuzz_factor ()
 
 set_fuzz_factor ( $in_new_factor)
 
 set_can_see_through_the_fuzz ( $in_token_id)
 
 raw_coords ()
 
 payload ()
 
 set_payload ( $in_payload_data)
 
 children_ids ()
 
 set_new_children_ids ( $in_child_ids)
 
 parent_ids ()
 
 get_hierarchy ()
 
 set_sdk_object ( $in_sdk_object)
 
 changes ()
 
 save_data ()
 
 id ()
 
 name ()
 
 set_name ( $in_new_value)
 
 lang ()
 
 set_lang ( $in_new_value)
 
 object_access ()
 
 set_object_access ( $in_new_read=NULL, $in_new_write=NULL)
 
 writeable ()
 
 last_access ()
 
 force_reload ( $in_parents=false)
 

Protected Member Functions

 _save_data ( $in_args='', $in_payload=NULL, $in_new_child_ids=NULL)
 
 _save_change_record ( $in_change_record_object)
 
 _load_data ( $in_force=false, $in_details=false, $in_parents=false)
 

Protected Attributes

 $_sdk_object
 This is the RVP_PHP_SDK object that "owns" this object.
 
 $_object_id
 This is the server unique ID of this object.
 
 $_object_data
 This is any data that was associated with this object (parsed JSON).
 
 $_details
 If true, then the last load was a "show details" load..
 
 $_plugin_path
 This is a string that is applied to fetches to get the object.
 
 $_changed_states
 This will contain an array of objects (of whatever class this is), that represent previous object states.
 

Detailed Description

Definition at line 31 of file rvp_php_sdk_place.class.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $in_sdk_object,
  $in_id,
  $in_data = NULL,
  $in_detailed_data = false 
)

The basic constructor for the class.

Parameters
$in_sdk_objectREQUIRED: The "owning" SDK object.
$in_idREQUIRED: The server ID of the object. An integer.
$in_dataOPTIONAL: Parsed JSON Data for the object. Default is NULL.
$in_detailed_dataOPTIONAL: Ignored if $in_data is NULL. Default is false. If true, then the data sent in was in "detailed" format.

Definition at line 122 of file rvp_php_sdk_place.class.php.

126  {
127  parent::__construct($in_sdk_object, $in_id, $in_data, $in_detailed_data, 'places');
128  }

Member Function Documentation

◆ _save_data()

_save_data (   $in_args = '',
  $in_payload = NULL,
  $in_new_child_ids = NULL 
)
protected
Returns
true, if the save was successful.
Parameters
$in_argsOPTIONAL: Default is an empty string. This is any previous arguments. This will be appeneded to the end of the list, so it should begin with an ampersand (&), and be url-encoded.
$in_payloadIGNORED. Just here to suppress PHP warnings.
$in_new_child_idsIGNORED. Just here to suppress PHP warnings.

Definition at line 39 of file rvp_php_sdk_place.class.php.

42  {
43  $to_set = [
44  'address_venue' => (isset($this->_object_data->address_elements->venue) ? $this->_object_data->address_elements->venue : NULL),
45  'address_street_address' => (isset($this->_object_data->address_elements->street_address) ? $this->_object_data->address_elements->street_address : NULL),
46  'address_extra_information' => (isset($this->_object_data->address_elements->extra_information) ? $this->_object_data->address_elements->extra_information : NULL),
47  'address_town' => (isset($this->_object_data->address_elements->town) ? $this->_object_data->address_elements->town : NULL),
48  'address_county' => (isset($this->_object_data->address_elements->county) ? $this->_object_data->address_elements->county : NULL),
49  'address_state' => (isset($this->_object_data->address_elements->state) ? $this->_object_data->address_elements->state : NULL),
50  'address_postal_code' => (isset($this->_object_data->address_elements->postal_code) ? $this->_object_data->address_elements->postal_code : NULL),
51  'address_nation' => (isset($this->_object_data->address_elements->nation) ? $this->_object_data->address_elements->nation : NULL),
52  'tag8' => (isset($this->_object_data->tag8) ? $this->_object_data->tag8 : NULL),
53  'tag9' => (isset($this->_object_data->tag9) ? $this->_object_data->tag9 : NULL)
54  ];
55 
56  $put_args = '';
57 
58  foreach ($to_set as $key => $value) {
59  if (isset($key) && isset($value)) {
60  $put_args .= '&'.$key.'='.urlencode(trim(strval($value)));
61  }
62  }
63 
64  $ret = parent::_save_data($put_args.$in_args, NULL, NULL);
65 
66  return $ret;
67  }

◆ _save_change_record()

_save_change_record (   $in_change_record_object)
protected

This is called after a successful save. It has the change record[s], and we will parse them to save the "before" object.

Returns
true, if the save was successful.
Parameters
$in_change_record_objectREQUIRED: The change response, as a parsed object.

Definition at line 75 of file rvp_php_sdk_place.class.php.

76  {
77  $ret = false;
78 
79  if (isset($in_change_record_object->places) && isset($in_change_record_object->places->changed_places) && is_array($in_change_record_object->places->changed_places) && count($in_change_record_object->places->changed_places)) {
80  foreach ($in_change_record_object->places->changed_places as $changed_place) {
81  if ($before = $changed_place->before) {
82  $this->_changed_states[] = new RVP_PHP_SDK_Place($this->_sdk_object, $before->id, $before, true);
83  $ret = true;
84  }
85  }
86  }
87 
88  return $ret;
89  }

◆ _load_data()

_load_data (   $in_force = false,
  $in_details = false,
  $in_parents = false 
)
protected

This is the specific "load some data" method. It will send a GET REST request to the API in order to fetch information about this object.

Returns
true, if it loaded the data.
Parameters
$in_forceOPTIONAL: If true (default is false), then the load will happen, even if we already have the data.
$in_detailsOPTIONAL: Default is false. If true, then the load will be a "show details" load, which could bring in a great deal more data.
$in_parentsOPTIONAL: Default is false. If true, then the load will be a "show details" load, AND it will get the "parents," which can be a time-consuming operation. This will also "force" a load.

Definition at line 97 of file rvp_php_sdk_place.class.php.

100  {
101  $ret = parent::_load_data($in_force, $in_details, $in_parents);
102 
103  if ($ret) {
104  if (isset($this->_object_data) && isset($this->_object_data->places) && isset($this->_object_data->places->results) && is_array($this->_object_data->places->results) && (1 == count($this->_object_data->places->results))) {
105  $this->_object_data = $this->_object_data->places->results[0];
106  } else {
107  $this->_object_data = NULL;
108  $this->_details = false;
109  }
110  }
111  return $ret;
112  }

◆ basic_address()

basic_address ( )

This requires a load, but not a "detailed" load.

Returns
a string, containing the basic "readable" address of the place.

Definition at line 136 of file rvp_php_sdk_place.class.php.

136  {
137  $ret = NULL;
138 
139  $this->_load_data();
140 
141  if (isset($this->_object_data) && isset($this->_object_data->address)) {
142  $ret = $this->_object_data->address;
143  }
144 
145  return $ret;
146  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ address_elements()

address_elements ( )

This requires a detailed string load.

Returns
an associative array of string, containing the individual address elements. This can contain:
  • 'venue' This is the name of the venue/building.
  • 'street_address' This is the number, street and any apartment/suite/other information.
  • 'extra_information' This is "extra information," like "Behind the bridge entrance," etc.
  • 'town' This is the municipality/city/town.
  • 'county' The county or sub-province.
  • 'state' The state or province.
  • 'postal_code' The postal or ZIP code.
  • 'nation' The nation. Not all elements need to be present. If an element is not represented, then that means that it is empty in the record.

Definition at line 163 of file rvp_php_sdk_place.class.php.

163  {
164  $ret = NULL;
165 
166  $this->_load_data(false, true);
167 
168  if (isset($this->_object_data) && isset($this->_object_data->address_elements)) {
169  $ret = (array)$this->_object_data->address_elements;
170  }
171 
172  return $ret;
173  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_address_elements()

set_address_elements (   $in_address_elements_array)

This sets the address elements of the place.

Returns
true, if the operation suceeded.
Parameters
$in_address_elements_arrayREQUIRED: This is an associative array, with the new values:
  • 'venue' This is the name of the venue/building.
  • 'street_address' This is the number, street and any apartment/suite/other information.
  • 'extra_information' This is "extra information," like "Behind the bridge entrance," etc.
  • 'town' This is the municipality/city/town.
  • 'county' The county or sub-province.
  • 'state' The state or province.
  • 'postal_code' The postal or ZIP code.
  • 'nation' The nation.

If an array element is not present, then that part of the address will not be affected. If an array element is present, but contains an empty string, then the corresponding address element will be removed.

Definition at line 181 of file rvp_php_sdk_place.class.php.

194  {
195 
196  $ret = false;
197 
198  $this->_load_data(false, true);
199 
200  if (isset($this->_object_data)) {
201  foreach($in_address_elements_array as $key => $value) {
202  $key = strtolower(trim(strval($key)));
203  $value = trim(strval($value));
204  $this->_object_data->address_elements->$key = $value;
205  }
206 
207  $ret = $this->save_data();
208 
209  $this->_load_data(true, true); // Force a reload.
210  }
211 
212  return $ret;
213  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ tag8()

tag8 ( )

This requires a detailed string load.

Returns
the string value of Tag 8, or NULL.

Definition at line 221 of file rvp_php_sdk_place.class.php.

221  {
222  $ret = NULL;
223 
224  $this->_load_data(false, true);
225 
226  if (isset($this->_object_data)) {
227  $ret = $this->_object_data->tag8;
228  }
229 
230  return $ret;
231  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ tag9()

tag9 ( )

This requires a detailed string load.

Returns
the string value of Tag 9, or NULL.

Definition at line 239 of file rvp_php_sdk_place.class.php.

239  {
240  $ret = NULL;
241 
242  $this->_load_data(false, true);
243 
244  if (isset($this->_object_data)) {
245  $ret = $this->_object_data->tag9;
246  }
247 
248  return $ret;
249  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_tag8()

set_tag8 (   $in_new_string_value)

This sets the value of tag 8.

Returns
true, if the operation suceeded.
Parameters
$in_new_string_valueREQUIRED: The new string value to be set. If empty, then the tag is cleared.

Definition at line 257 of file rvp_php_sdk_place.class.php.

258  {
259  $ret = false;
260 
261  $this->_load_data(false, true);
262 
263  if (isset($this->_object_data)) {
264  $this->_object_data->tag8 = trim(strval($in_new_string_value));
265  $ret = $this->save_data();
266  }
267 
268  return $ret;
269  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_tag9()

set_tag9 (   $in_new_string_value)

This sets the value of tag 9.

Returns
true, if the operation suceeded.
Parameters
$in_new_string_valueREQUIRED: The new string value to be set. If empty, then the tag is cleared.

Definition at line 277 of file rvp_php_sdk_place.class.php.

278  {
279  $ret = false;
280 
281  $this->_load_data(false, true);
282 
283  if (isset($this->_object_data)) {
284  $this->_object_data->tag9 = trim(strval($in_new_string_value));
285  $ret = $this->save_data();
286  }
287 
288  return $ret;
289  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ geocode()

geocode ( )

This requires a forced detailed string load if successful.

This method will force the server to look up a new longitude and latitude for the current address information.

This requires that the server be configured to support the operation (has an API key, and allows the current user to perform lookups).

Returns
true, if the operation succeeded. This reloads the object after completion.

Definition at line 301 of file rvp_php_sdk_place.class.php.

301  {
302  $ret = false;
303 
304  $result = json_decode($this->_sdk_object->put_data('/json/'.$this->_plugin_path.'/'.$this->id(), 'geocode'));
305 
306  if (isset($result) && $result) {
307  $this->_save_change_record($result);
308  }
309 
310  $this->_load_data(true, true);
311 
312  return $ret;
313  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)
_save_change_record( $in_change_record_object)

◆ reverse_geocode()

reverse_geocode ( )

This requires a forced detailed string load if successful.

This method will force the server to look up a new address for the current longitude and latitude.

This requires that the server be configured to support the operation (has an API key, and allows the current user to perform lookups).

Returns
true, if the operation succeeded. This reloads the object after completion.

Definition at line 325 of file rvp_php_sdk_place.class.php.

325  {
326  $ret = false;
327 
328  $result = json_decode($this->_sdk_object->put_data('/json/'.$this->_plugin_path.'/'.$this->id(), 'reverse-geocode'));
329 
330  if (isset($result) && $result) {
331  $this->_save_change_record($result);
332  }
333 
334  $this->_load_data(true, true);
335 
336  return $ret;
337  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)
_save_change_record( $in_change_record_object)

◆ coords()

coords ( )
inherited

This requires a load, but not a "detailed" load.

Returns
an associative array ('latitude' => float, 'longitude' => float), with the long/lat coordinates of the object, or NULL, if there are no long/lat coordinates.

Definition at line 91 of file a_rvp_php_sdk_data_object.class.php.

91  {
92  $ret = NULL;
93 
94  $this->_load_data();
95 
96  if (isset($this->_object_data) && isset($this->_object_data->coords)) {
97  $temp = explode(',', $this->_object_data->coords);
98  if (isset($temp) && is_array($temp) && (1 < count($temp))) {
99  $ret = [];
100  $ret['latitude'] = floatval($temp[0]);
101  $ret['longitude'] = floatval($temp[1]);
102  }
103  }
104 
105  return $ret;
106  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_coords()

set_coords (   $in_latitude,
  $in_longitude 
)
inherited

This sets the new long/lat value. This sets the "real" value (or "raw" value), if the record is "fuzzed," so subsequent checks of the regular long/lat may show different results.

Returns
true, if it worked.
Parameters
$in_latitudeREQUIRED: The new latitude value, in degrees.
$in_longitudeREQUIRED: The new longitude value, in degrees.

Definition at line 114 of file a_rvp_php_sdk_data_object.class.php.

116  {
117  $ret = false;
118 
119  $this->_load_data(false, true);
120 
121  if (isset($this->_object_data)) {
122  if ((isset($this->_object_data->raw_latitude) && isset($this->_object_data->raw_longitude)) || (isset($this->_object_data->fuzzy) && $this->_object_data->fuzzy)) {
123  $this->_object_data->raw_latitude = $in_latitude;
124  $this->_object_data->raw_longitude = $in_longitude;
125  } else {
126  $this->_object_data->latitude = $in_latitude;
127  $this->_object_data->longitude = $in_longitude;
128  }
129 
130  $ret = $this->save_data();
131  }
132 
133  return $ret;
134  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ distance()

distance ( )
inherited

This requires a a "detailed" load.

Returns
the distance, if provided. Otherwise, it returns 0.

Definition at line 142 of file a_rvp_php_sdk_data_object.class.php.

142  {
143  $ret = 0;
144 
145  $this->_load_data(false, true);
146 
147  if (isset($this->_object_data) && isset($this->_object_data->distance_in_km)) {
148  $ret = floatval($this->_object_data->distance_in_km);
149  }
150 
151  return $ret;
152  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ is_fuzzy()

is_fuzzy ( )
inherited

This requires a "detailed" load.

Returns
true, if the object declares that it is "fuzzy" (has location obfuscation).

Definition at line 160 of file a_rvp_php_sdk_data_object.class.php.

160  {
161  $ret = false;
162 
163  $this->_load_data(false, true);
164 
165  if (isset($this->_object_data) && isset($this->_object_data->fuzzy) && $this->_object_data->fuzzy) {
166  $ret = true;
167  }
168 
169  return $ret;
170  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ fuzz_factor()

fuzz_factor ( )
inherited

This requires a "detailed" load.

Returns
a floating-point value, with the "fuzz factor" (in kilometers). You need to be logged in as an ID that has either write or "can see through the fuzz" capability on this record, or you get 0.

Definition at line 178 of file a_rvp_php_sdk_data_object.class.php.

178  {
179  $ret = 0;
180 
181  $this->_load_data(false, true);
182 
183  if (isset($this->_object_data) && isset($this->_object_data->fuzz_factor) && floatval($this->_object_data->fuzz_factor)) {
184  $ret = floatval($this->_object_data->fuzz_factor);
185  }
186 
187  return $ret;
188  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_fuzz_factor()

set_fuzz_factor (   $in_new_factor)
inherited

Sets a new "fuzz factor." Setting to 0 or NULL turns off location obfuscation. Any positive floating-point number is the "fuzz radius," in kilometers, of the obfuscation. Long/lat returned in the normal coords() call will be obfuscated. If the user has the rights to "see through the fuzz," calls to raw_coords() will return accurate results (otherwise, they will return NULL).

Returns
true, if it worked.
Parameters
$in_new_factorREQUIRED: The new "fuzz factor" value. 0 or NULL will turn off location obfuscation.

Definition at line 198 of file a_rvp_php_sdk_data_object.class.php.

199  {
200  $this->_load_data(false, true);
201 
202  $this->_object_data->fuzz_factor = $in_new_factor;
203 
204  $ret = $this->save_data();
205 
206  if ($ret) { // We force a reload, because fuzz.
207  $this->_load_data(true, true);
208  }
209 
210  return $ret;
211  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_can_see_through_the_fuzz()

set_can_see_through_the_fuzz (   $in_token_id)
inherited

Sets a new "fuzz factor." Setting to 0 or NULL turns off location obfuscation. Any positive floating-point number is the "fuzz radius," in kilometers, of the obfuscation. Long/lat returned in the normal coords() call will be obfuscated. If the user has the rights to "see through the fuzz," calls to raw_coords() will return accurate results (otherwise, they will return NULL).

Returns
true, if it worked.
Parameters
$in_token_idREQUIRED: The new token for the "see clearly" IDs. 0 will clear this field.

Definition at line 221 of file a_rvp_php_sdk_data_object.class.php.

222  {
223  $this->_load_data(false, true);
224 
225  $this->_object_data->can_see_through_the_fuzz = $in_token_id;
226 
227  $ret = $this->save_data();
228 
229  if ($ret) { // We force a reload, because fuzz.
230  $this->_load_data(true, true);
231  }
232 
233  return $ret;
234  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ raw_coords()

raw_coords ( )
inherited

This requires a "detailed" load.

Returns
the "raw" coordinates for a "fuzzy" location, assuming the current login has rights to them. If not, it returns NULL.

Definition at line 242 of file a_rvp_php_sdk_data_object.class.php.

242  {
243  $ret = NULL;
244 
245  $this->_load_data(false, true);
246 
247  if (isset($this->_object_data) && isset($this->_object_data->raw_latitude) && isset($this->_object_data->raw_longitude)) {
248  $ret = [];
249  $ret['latitude'] = floatval($this->_object_data->raw_latitude);
250  $ret['longitude'] = floatval($this->_object_data->raw_longitude);
251  }
252 
253  return $ret;
254  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ payload()

payload ( )
inherited

This requires a "detailed" load.

Returns
an associative array ('data' => binary data string, 'type' => string MIME type), containing the data in the payload, and its type. The data is not Base64-encoded.

Definition at line 262 of file a_rvp_php_sdk_data_object.class.php.

262  {
263  $ret = NULL;
264 
265  $this->_load_data(false, true);
266 
267  if (isset($this->_object_data) && isset($this->_object_data->payload)) {
268  $payload_data = base64_decode($this->_object_data->payload);
269 
270  // We make sure that this was already Base64 before decoding.
271  if (base64_encode(base64_decode($payload_data)) == $payload_data) {
272  $payload_data = base64_decode($payload_data);
273  }
274 
275  $ret = ['data' => $payload_data];
276 
277  if (isset($this->_object_data->payload_type)) {
278  $ret['type'] = str_replace(';base64', '', $this->_object_data->payload_type);
279  }
280  }
281 
282  return $ret;
283  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_payload()

set_payload (   $in_payload_data)
inherited

This adds (or removes) a payload from this object. It figures out the data type on its own.

Returns
true, if the operation succeeds.
Parameters
$in_payload_dataREQUIRED (can be NULL). This is the data to set as the instance payload. It should NOT be Base64 encoded.

Definition at line 291 of file a_rvp_php_sdk_data_object.class.php.

292  {
293  $payload = NULL;
294  $args = '';
295 
296  // We figure out the payload type by uploading to a file, then checking the file type.
297  if ($in_payload_data) {
298  $temp_file = tempnam(sys_get_temp_dir(), 'RVP');
299  file_put_contents($temp_file , $in_payload_data);
300  $finfo = finfo_open(FILEINFO_MIME_TYPE);
301  $content_type = finfo_file($finfo, $temp_file);
302  unlink($temp_file);
303  $this->_object_data->payload_type = $content_type;
304  $payload = ['data' => $in_payload_data, 'type' => $content_type];
305  } else {
306  $args = '&remove_payload';
307  }
308 
309  // We circumvent our caller for this one.
310  $ret = $this->_save_change_record(self::_save_data($args, $payload));
311 
312  if ($ret) {
313  $ret = $this->_load_data(true, true);
314  } else {
315  $this->_load_data(true, true);
316  }
317 
318  return $ret;
319  }
_save_change_record( $in_change_record_object)
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ children_ids()

children_ids ( )
inherited

This requires a "detailed" load.

Returns
an associative array ('people' => integer array of IDs, 'places' => integer array of IDs, and 'things' => integer array of IDs), containing the IDs of any "child" objects for this object.

Definition at line 327 of file a_rvp_php_sdk_data_object.class.php.

327  {
328  $ret = [];
329 
330  $this->_load_data(false, true);
331 
332  if (isset($this->_object_data) && isset($this->_object_data->children)) {
333  $child_data = (array)$this->_object_data->children;
334 
335  if (count($child_data)) {
336  $ret = $child_data;
337  }
338  }
339 
340  return $ret;
341  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_new_children_ids()

set_new_children_ids (   $in_child_ids)
inherited

This sets new child object IDs for this object.

Returns
true, if the operation succeeded.
Parameters
$in_child_idsREQUIRED: The new children IDs. We do not separate these into different classes of ID. It's a simple integer array. This is a "delta" array. That means that what it contains are CHANGES. You ADD children by indicating positive integers. You DELETE children by indicating negative integers. If your login does not have the ability to read (write is not necessary) the child ID, then that ID is ignored. If the ID to be deleted is not in the record, then it is ignored.

Definition at line 349 of file a_rvp_php_sdk_data_object.class.php.

356  {
357  $ret = false;
358  // We circumvent our caller for this one.
359  $ret = $this->_save_change_record(self::_save_data('', NULL, $in_child_ids));
360 
361  if ($ret) {
362  $ret = $this->force_reload();
363  } else { // If there was an error, then we don't send back the result (it may also be an error).
364  $this->force_reload();
365  }
366  return $ret;
367  }
_save_change_record( $in_change_record_object)

◆ parent_ids()

parent_ids ( )
inherited

This requires a "detailed and parents" load.

NOTE:** Calling this can incur a fairly significant performance penalty!

Returns
an associative array ('people' => integer array of IDs, 'places' => integer array of IDs, and 'things' => integer array of IDs), containing the IDs of any "parent" objects for this object.

Definition at line 377 of file a_rvp_php_sdk_data_object.class.php.

377  {
378  $ret = NULL;
379 
380  $this->_load_data(false, true, true);
381 
382  if (isset($this->_object_data) && isset($this->_object_data->parents)) {
383  $parent_data = $this->_object_data->parents;
384 
385  if (isset($parent_data) && is_array($parent_data) && count($parent_data)) {
386  $ret = $parent_data;
387  }
388  }
389 
390  return $ret;
391  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ get_hierarchy()

get_hierarchy ( )
inherited

This requires a detailed data load.

This returns a recursive hierarchy of instances for this object. It returns actual object instances; not IDs, using a simple tuple.

Returns
an associative array. One element will be 'object', and will refer to this object. If the object has child objects, then there will be a 'children' array of more of these nodes. Leaf nodes will contain only 'object' elements.

Definition at line 401 of file a_rvp_php_sdk_data_object.class.php.

401  {
402  $ret = ['object' => $this];
403 
404  $this->_load_data(false, true);
405 
406  if (isset($this->_object_data) && isset($this->_object_data->children)) {
407  $child_data = (array)$this->_object_data->children;
408 
409  if (count($child_data)) {
410  $ret['children'] = [];
411  foreach ($child_data as $plugin) {
412  if (count($plugin)) {
413  $objects = $this->_sdk_object->get_objects($plugin);
414 
415  if (is_array($objects) && count($objects)) {
416  foreach ($objects as $object) {
417  if (method_exists($object, 'get_hierarchy')) {
418  $ret['children'][] = $object->get_hierarchy();
419  }
420  }
421  }
422  }
423  }
424  }
425  }
426 
427  return $ret;
428  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_sdk_object()

set_sdk_object (   $in_sdk_object)
inherited

Simple accessor to set the "owning" SDK object.

Parameters
$in_sdk_objectREQUIRED: The "owning" SDK object.

Definition at line 148 of file a_rvp_php_sdk_object.class.php.

149  {
150  $this->_sdk_object = $in_sdk_object; // This is the RVP_PHP_SDK object that "owns" this user.
151  }

◆ changes()

changes ( )
inherited
Returns
an array of instances, representing the "before" state of this object, prior to any changes made. It should be noted that the lifetime of these changes are dependent on the lifetime of this instance.

Definition at line 157 of file a_rvp_php_sdk_object.class.php.

157  {
158  return isset($this->_changed_states) ? $this->_changed_states : [];
159  }

◆ save_data()

save_data ( )
inherited
Returns
true, if the save was successful.

Definition at line 165 of file a_rvp_php_sdk_object.class.php.

165  {
166  $ret = false;
167 
168  $ret = $this->_save_change_record($this->_save_data());
169 
170  return $ret;
171  }
_save_change_record( $in_change_record_object)
_save_data( $in_args='', $in_payload=NULL, $in_new_child_ids=NULL)

◆ id()

id ( )
inherited
Returns
the integer ID of the object; unique in the object's database.

Definition at line 177 of file a_rvp_php_sdk_object.class.php.

177  {
178  return $this->_object_id;
179  }
$_object_id
This is the server unique ID of this object.

◆ name()

name ( )
inherited

This requires a load, but not a "detailed" load.

Returns
the string name of the object. This is the generic "object_name" column that all records have.

Definition at line 187 of file a_rvp_php_sdk_object.class.php.

187  {
188  $ret = NULL;
189 
190  $this->_load_data();
191 
192  if (isset($this->_object_data) && isset($this->_object_data->name)) {
193  $ret = $this->_object_data->name;
194  }
195 
196  return $ret;
197  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_name()

set_name (   $in_new_value)
inherited

This sets the name of the object.

Returns
true, if the save worked.
Parameters
$in_new_valueREQUIRED: A new value for the name.

Definition at line 205 of file a_rvp_php_sdk_object.class.php.

206  {
207  $ret = false;
208 
209  $this->_load_data(false, true);
210 
211  if (isset($this->_object_data)) {
212  $this->_object_data->name = $in_new_value;
213 
214  $ret = $this->save_data();
215  }
216 
217  return $ret;
218  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ lang()

lang ( )
inherited

This requires a load, but not a "detailed" load.

Returns
the string for the object's "lang" (language code) field.

Definition at line 226 of file a_rvp_php_sdk_object.class.php.

226  {
227  $ret = NULL;
228 
229  $this->_load_data();
230 
231  if (isset($this->_object_data) && isset($this->_object_data->lang)) {
232  $ret = $this->_object_data->lang;
233  }
234 
235  return $ret;
236  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_lang()

set_lang (   $in_new_value)
inherited

This sets the language ID of the object.

Returns
true, if the save worked.
Parameters
$in_new_valueREQUIRED: A new value for the language ID.

Definition at line 244 of file a_rvp_php_sdk_object.class.php.

245  {
246  $ret = false;
247 
248  $this->_load_data(false, true);
249 
250  if (isset($this->_object_data)) {
251  $this->_object_data->lang = $in_new_value;
252 
253  $ret = $this->save_data();
254  }
255 
256  return $ret;
257  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ object_access()

object_access ( )
inherited

This requires a load, but not a "detailed" load.

Returns
an associative array ('read' => integer, 'write' => integer), with the tokens for the object. The tokens will only be available if they are visible to the current user, or NULL, if there are no tokens (should never happen).

Definition at line 265 of file a_rvp_php_sdk_object.class.php.

265  {
266  $ret = NULL;
267  $read_token = NULL;
268  $write_token = NULL;
269 
270  $this->_load_data();
271 
272  if (isset($this->_object_data) && isset($this->_object_data->read_token)) {
273  $read_token = intval($this->_object_data->read_token);
274  }
275 
276  if (isset($this->_object_data) && isset($this->_object_data->write_token)) {
277  $write_token = intval($this->_object_data->write_token);
278  }
279 
280  if ($read_token || $write_token) {
281  $ret = [];
282 
283  if ($read_token) {
284  $ret['read'] = $read_token;
285  }
286 
287  if ($write_token) {
288  $ret['write'] = $write_token;
289  }
290  }
291 
292  return $ret;
293  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_object_access()

set_object_access (   $in_new_read = NULL,
  $in_new_write = NULL 
)
inherited

This sets the read and write tokens of the object.

The current login must have at least read access to each of the tokens. If a token is NULL, then the token is not changed.

Returns
true, if the save worked.
Parameters
$in_new_readOPTIONAL: A new read token. Default is NULL (no change).
$in_new_writeOPTIONAL: A new write token. Default is NULL (no change).

Definition at line 303 of file a_rvp_php_sdk_object.class.php.

305  {
306  $ret = false;
307 
308  $this->_load_data(false, true);
309 
310  if (isset($this->_object_data)) {
311  $this->_object_data->read_token = isset($in_new_read) ? intval($in_new_read) : $this->_object_data->read_token;
312  $this->_object_data->write_token = isset($in_new_write) ? intval($in_new_write) : $this->_object_data->write_token;
313 
314  $ret = $this->save_data();
315  }
316 
317  return $ret;
318  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ writeable()

writeable ( )
inherited

This requires a load, but not a "detailed" load.

Returns
true, if the current login can write/modify this object.

Definition at line 326 of file a_rvp_php_sdk_object.class.php.

326  {
327  $ret = false;
328 
329  $this->_load_data();
330 
331  if (isset($this->_object_data) && isset($this->_object_data->writeable) && $this->_object_data->writeable) {
332  $ret = true;
333  }
334 
335  return $ret;
336  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ last_access()

last_access ( )
inherited

This requires a load, but not a "detailed" load.

Returns
the last access date, as a timedate integer.

Definition at line 344 of file a_rvp_php_sdk_object.class.php.

344  {
345  $ret = NULL;
346 
347  $this->_load_data();
348 
349  if (isset($this->_object_data) && isset($this->_object_data->last_access)) {
350  $ret = strtotime($this->_object_data->last_access);
351  }
352 
353  return $ret;
354  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ force_reload()

force_reload (   $in_parents = false)
inherited

This forces at least a detailed load.

This reloads the information, refreshing the object, if necessary.

Returns
true, if successful.
Parameters
$in_parentsOPTIONAL: Default is false. If true, then the parent info is also loaded.

Definition at line 364 of file a_rvp_php_sdk_object.class.php.

365  {
366  return $this->_load_data(true, true, $in_parents);
367  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

The documentation for this class was generated from the following file: