BLUE DRAGON PHP SDK
All Classes Functions Variables Pages
RVP_PHP_SDK_Thing Class Reference
Inheritance diagram for RVP_PHP_SDK_Thing:
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)
 
 key ()
 
 set_key ( $in_new_string_value)
 
 description ()
 
 set_description ( $in_new_string_value)
 
 tag2 ()
 
 set_tag2 ( $in_new_string_value)
 
 tag3 ()
 
 set_tag3 ( $in_new_string_value)
 
 tag4 ()
 
 set_tag4 ( $in_new_string_value)
 
 tag5 ()
 
 set_tag5 ( $in_new_string_value)
 
 tag6 ()
 
 set_tag6 ( $in_new_string_value)
 
 tag7 ()
 
 set_tag7 ( $in_new_string_value)
 
 tag8 ()
 
 set_tag8 ( $in_new_string_value)
 
 tag9 ()
 
 set_tag9 ( $in_new_string_value)
 
 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_thing.class.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $in_sdk_object,
  $in_id,
  $in_data = NULL,
  $in_detailed_data = false 
)
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 127 of file rvp_php_sdk_thing.class.php.

131  {
132  parent::__construct($in_sdk_object, $in_id, $in_data, $in_detailed_data, 'things');
133  }

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_thing.class.php.

42  {
43  $to_set = [
44  'key' => (isset($this->_object_data->key) ? trim($this->_object_data->key) : NULL),
45  'description' => (isset($this->_object_data->description) ? trim($this->_object_data->description) : NULL),
46  'tag2' => (isset($this->_object_data->tag2) ? $this->_object_data->tag2 : NULL),
47  'tag3' => (isset($this->_object_data->tag3) ? $this->_object_data->tag3 : NULL),
48  'tag4' => (isset($this->_object_data->tag4) ? $this->_object_data->tag4 : NULL),
49  'tag5' => (isset($this->_object_data->tag5) ? $this->_object_data->tag5 : NULL),
50  'tag6' => (isset($this->_object_data->tag6) ? $this->_object_data->tag6 : NULL),
51  'tag7' => (isset($this->_object_data->tag7) ? $this->_object_data->tag7 : 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_thing.class.php.

76  {
77  $ret = false;
78 
79  if (isset($in_change_record_object->things)) {
80  if (isset($in_change_record_object->things->changed_things)) {
81  if (is_array($in_change_record_object->things->changed_things)) {
82  if (count($in_change_record_object->things->changed_things)) {
83  foreach ($in_change_record_object->things->changed_things as $changed_thing) {
84  if ($before = $changed_thing->before) {
85  $this->_changed_states[] = new RVP_PHP_SDK_Thing($this->_sdk_object, $before->id, $before, true);
86  $ret = true;
87  }
88  }
89  }
90  }
91  }
92  }
93 
94  return $ret;
95  }

◆ _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 103 of file rvp_php_sdk_thing.class.php.

106  {
107  $ret = parent::_load_data($in_force, $in_details, $in_parents);
108 
109  if ($ret) {
110  if (isset($this->_object_data) && isset($this->_object_data->things) && is_array($this->_object_data->things) && (1 == count($this->_object_data->things))) {
111  $this->_object_data = $this->_object_data->things[0];
112  } else {
113  $this->_object_data = NULL;
114  $this->_details = false;
115  }
116  }
117 
118  return $ret;
119  }

◆ key()

key ( )

This requires a detailed load.

Returns
the key for this thing, as a string.

Definition at line 141 of file rvp_php_sdk_thing.class.php.

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

◆ set_key()

set_key (   $in_new_string_value)

Change/Set the key for this thing.

Returns
true, if the operation succeeds.
Parameters
$in_new_string_valueREQUIRED: A string, with the new key value

Definition at line 159 of file rvp_php_sdk_thing.class.php.

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

◆ description()

description ( )

This requires a detailed load.

Returns
the description for this thing, as a string.

Definition at line 179 of file rvp_php_sdk_thing.class.php.

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

◆ set_description()

set_description (   $in_new_string_value)

Change/Set the description for this thing.

Returns
true, if the operation succeeds.
Parameters
$in_new_string_valueREQUIRED: A string, with the new description value

Definition at line 197 of file rvp_php_sdk_thing.class.php.

198  {
199  $ret = false;
200 
201  $this->_load_data(false, true);
202 
203  if (isset($this->_object_data)) {
204  $this->_object_data->description = trim(strval($in_new_string_value));
205  $ret = $this->save_data();
206  }
207 
208  return $ret;
209  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ tag2()

tag2 ( )

This requires a detailed load.

Returns
the string value of Tag 2, or NULL.

Definition at line 217 of file rvp_php_sdk_thing.class.php.

217  {
218  $ret = NULL;
219 
220  $this->_load_data(false, true);
221 
222  if (isset($this->_object_data)) {
223  $ret = $this->_object_data->tag2;
224  }
225 
226  return $ret;
227  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_tag2()

set_tag2 (   $in_new_string_value)

This sets the value of tag 2.

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 235 of file rvp_php_sdk_thing.class.php.

236  {
237  $ret = false;
238 
239  $this->_load_data(false, true);
240 
241  if (isset($this->_object_data)) {
242  $this->_object_data->tag2 = trim(strval($in_new_string_value));
243  $ret = $this->save_data();
244  }
245 
246  return $ret;
247  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ tag3()

tag3 ( )

This requires a detailed string load.

Returns
the string value of Tag 3, or NULL.

Definition at line 255 of file rvp_php_sdk_thing.class.php.

255  {
256  $ret = NULL;
257 
258  $this->_load_data(false, true);
259 
260  if (isset($this->_object_data)) {
261  $ret = $this->_object_data->tag3;
262  }
263 
264  return $ret;
265  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_tag3()

set_tag3 (   $in_new_string_value)

This sets the value of tag 3.

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 273 of file rvp_php_sdk_thing.class.php.

274  {
275  $ret = false;
276 
277  $this->_load_data(false, true);
278 
279  if (isset($this->_object_data)) {
280  $this->_object_data->tag3 = trim(strval($in_new_string_value));
281  $ret = $this->save_data();
282  }
283 
284  return $ret;
285  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ tag4()

tag4 ( )

This requires a detailed string load.

Returns
the string value of Tag 4, or NULL.

Definition at line 293 of file rvp_php_sdk_thing.class.php.

293  {
294  $ret = NULL;
295 
296  $this->_load_data(false, true);
297 
298  if (isset($this->_object_data)) {
299  $ret = $this->_object_data->tag4;
300  }
301 
302  return $ret;
303  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_tag4()

set_tag4 (   $in_new_string_value)

This sets the value of tag 4.

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 311 of file rvp_php_sdk_thing.class.php.

312  {
313  $ret = false;
314 
315  $this->_load_data(false, true);
316 
317  if (isset($this->_object_data)) {
318  $this->_object_data->tag4 = trim(strval($in_new_string_value));
319  $ret = $this->save_data();
320  }
321 
322  return $ret;
323  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ tag5()

tag5 ( )

This requires a detailed string load.

Returns
the string value of Tag 5, or NULL.

Definition at line 331 of file rvp_php_sdk_thing.class.php.

331  {
332  $ret = NULL;
333 
334  $this->_load_data(false, true);
335 
336  if (isset($this->_object_data)) {
337  $ret = $this->_object_data->tag5;
338  }
339 
340  return $ret;
341  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_tag5()

set_tag5 (   $in_new_string_value)

This sets the value of tag 5.

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 349 of file rvp_php_sdk_thing.class.php.

350  {
351  $ret = false;
352 
353  $this->_load_data(false, true);
354 
355  if (isset($this->_object_data)) {
356  $this->_object_data->tag5 = trim(strval($in_new_string_value));
357  $ret = $this->save_data();
358  }
359 
360  return $ret;
361  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ tag6()

tag6 ( )

This requires a detailed string load.

Returns
the string value of Tag 6, or NULL.

Definition at line 369 of file rvp_php_sdk_thing.class.php.

369  {
370  $ret = NULL;
371 
372  $this->_load_data(false, true);
373 
374  if (isset($this->_object_data)) {
375  $ret = $this->_object_data->tag6;
376  }
377 
378  return $ret;
379  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_tag6()

set_tag6 (   $in_new_string_value)

This sets the value of tag 6.

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 387 of file rvp_php_sdk_thing.class.php.

388  {
389  $ret = false;
390 
391  $this->_load_data(false, true);
392 
393  if (isset($this->_object_data)) {
394  $this->_object_data->tag6 = trim(strval($in_new_string_value));
395  $ret = $this->save_data();
396  }
397 
398  return $ret;
399  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ tag7()

tag7 ( )

This requires a detailed string load.

Returns
the string value of Tag 7, or NULL.

Definition at line 407 of file rvp_php_sdk_thing.class.php.

407  {
408  $ret = NULL;
409 
410  $this->_load_data(false, true);
411 
412  if (isset($this->_object_data)) {
413  $ret = $this->_object_data->tag7;
414  }
415 
416  return $ret;
417  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_tag7()

set_tag7 (   $in_new_string_value)

This sets the value of tag 7.

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 425 of file rvp_php_sdk_thing.class.php.

426  {
427  $ret = false;
428 
429  $this->_load_data(false, true);
430 
431  if (isset($this->_object_data)) {
432  $this->_object_data->tag7 = trim(strval($in_new_string_value));
433  $ret = $this->save_data();
434  }
435 
436  return $ret;
437  }
_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 445 of file rvp_php_sdk_thing.class.php.

445  {
446  $ret = NULL;
447 
448  $this->_load_data(false, true);
449 
450  if (isset($this->_object_data)) {
451  $ret = $this->_object_data->tag8;
452  }
453 
454  return $ret;
455  }
_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 463 of file rvp_php_sdk_thing.class.php.

464  {
465  $ret = false;
466 
467  $this->_load_data(false, true);
468 
469  if (isset($this->_object_data)) {
470  $this->_object_data->tag8 = trim(strval($in_new_string_value));
471  $ret = $this->save_data();
472  }
473 
474  return $ret;
475  }
_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 483 of file rvp_php_sdk_thing.class.php.

483  {
484  $ret = NULL;
485 
486  $this->_load_data(false, true);
487 
488  if (isset($this->_object_data)) {
489  $ret = $this->_object_data->tag9;
490  }
491 
492  return $ret;
493  }
_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 501 of file rvp_php_sdk_thing.class.php.

502  {
503  $ret = false;
504 
505  $this->_load_data(false, true);
506 
507  if (isset($this->_object_data)) {
508  $this->_object_data->tag9 = trim(strval($in_new_string_value));
509  $ret = $this->save_data();
510  }
511 
512  return $ret;
513  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ 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: