BLUE DRAGON PHP SDK
All Classes Functions Variables Pages
RVP_PHP_SDK_User Class Reference
Inheritance diagram for RVP_PHP_SDK_User:
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)
 
 security_tokens ()
 
 surname ()
 
 set_surname ( $in_new_string_value)
 
 middle_name ()
 
 set_middle_name ( $in_new_string_value)
 
 given_name ()
 
 set_given_name ( $in_new_string_value)
 
 nickname ()
 
 set_nickname ( $in_new_string_value)
 
 prefix ()
 
 set_prefix ( $in_new_string_value)
 
 suffix ()
 
 set_suffix ( $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)
 
 associated_login_id ()
 
 set_associated_login_id ( $in_new_integer_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_user.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_user.class.php.

131  {
132  parent::__construct($in_sdk_object, $in_id, $in_data, $in_detailed_data, 'people/people');
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_user.class.php.

42  {
43  $to_set = [
44  'surname' => (isset($this->_object_data->surname) ? $this->_object_data->surname : NULL),
45  'middle_name' => (isset($this->_object_data->middle_name) ? $this->_object_data->middle_name : NULL),
46  'given_name' => (isset($this->_object_data->given_name) ? $this->_object_data->given_name : NULL),
47  'nickname' => (isset($this->_object_data->nickname) ? $this->_object_data->nickname : NULL),
48  'prefix' => (isset($this->_object_data->prefix) ? $this->_object_data->prefix : NULL),
49  'suffix' => (isset($this->_object_data->suffix) ? $this->_object_data->suffix : NULL),
50  'tag7' => (isset($this->_object_data->tag7) ? $this->_object_data->tag7 : NULL),
51  'tag8' => (isset($this->_object_data->tag8) ? $this->_object_data->tag8 : NULL),
52  'tag9' => (isset($this->_object_data->tag9) ? $this->_object_data->tag9 : NULL),
53  ];
54 
55  // Only God can change login IDs.
56  if ($this->_sdk_object->is_main_admin()) {
57  if (isset($this->_object_data->associated_login_id)) {
58  $to_set['login_id'] = intval($this->_object_data->associated_login_id);
59  }
60  }
61 
62  $put_args = '';
63 
64  foreach ($to_set as $key => $value) {
65  if (isset($key) && isset($value)) {
66  $put_args .= '&'.$key.'='.urlencode(trim(strval($value)));
67  }
68  }
69 
70  $ret = parent::_save_data($put_args.$in_args, NULL, NULL);
71 
72  return $ret;
73  }

◆ _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 81 of file rvp_php_sdk_user.class.php.

82  {
83  $ret = false;
84  if (isset($in_change_record_object->people->people) && isset($in_change_record_object->people->people->changed_users) && is_array($in_change_record_object->people->people->changed_users) && count($in_change_record_object->people->people->changed_users)) {
85  foreach ($in_change_record_object->people->people->changed_users as $changed_person) {
86  if ($before = $changed_person->before) {
87  $this->_changed_states[] = new RVP_PHP_SDK_User($this->_sdk_object, $before->id, $before, true);
88  $ret = true;
89  }
90  }
91  }
92 
93  return $ret;
94  }

◆ _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 102 of file rvp_php_sdk_user.class.php.

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

◆ security_tokens()

security_tokens ( )

This requires a "detailed" load.

Returns
an array of integer (security tokens) that comprise the "pool" for this user (assuming it has a login).

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

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

◆ surname()

surname ( )

This requires a "detailed" load.

Returns
a string, with the user surname.

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

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

◆ set_surname()

set_surname (   $in_new_string_value)

This requires a "detailed" load.

Returns
true, if the operation succeeded.
Parameters
$in_new_string_valueREQUIRED: The new value

Definition at line 176 of file rvp_php_sdk_user.class.php.

177  {
178  $ret = false;
179 
180  $this->_load_data(false, true);
181 
182  if (isset($this->_object_data)) {
183  $this->_object_data->surname = trim(strval($in_new_string_value));
184  $ret = $this->save_data();
185  }
186 
187  return $ret;
188  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ middle_name()

middle_name ( )

This requires a "detailed" load.

Returns
a string, with the user middle name.

Definition at line 196 of file rvp_php_sdk_user.class.php.

196  {
197  $ret = NULL;
198 
199  $this->_load_data(false, true);
200  if (isset($this->_object_data) && isset($this->_object_data->middle_name)) {
201  $ret = trim($this->_object_data->middle_name);
202  }
203 
204  return $ret;
205  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_middle_name()

set_middle_name (   $in_new_string_value)

This requires a "detailed" load.

Returns
true, if the operation succeeded.
Parameters
$in_new_string_valueREQUIRED: The new value

Definition at line 213 of file rvp_php_sdk_user.class.php.

214  {
215  $ret = false;
216 
217  $this->_load_data(false, true);
218 
219  if (isset($this->_object_data)) {
220  $this->_object_data->middle_name = trim(strval($in_new_string_value));
221  $ret = $this->save_data();
222  }
223 
224  return $ret;
225  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ given_name()

given_name ( )

This requires a "detailed" load.

Returns
a string, with the user given (first) name.

Definition at line 233 of file rvp_php_sdk_user.class.php.

233  {
234  $ret = NULL;
235 
236  $this->_load_data(false, true);
237  if (isset($this->_object_data) && isset($this->_object_data->given_name)) {
238  $ret = trim($this->_object_data->given_name);
239  }
240 
241  return $ret;
242  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_given_name()

set_given_name (   $in_new_string_value)

This requires a "detailed" load.

Returns
true, if the operation succeeded.
Parameters
$in_new_string_valueREQUIRED: The new value

Definition at line 250 of file rvp_php_sdk_user.class.php.

251  {
252  $ret = false;
253 
254  $this->_load_data(false, true);
255 
256  if (isset($this->_object_data)) {
257  $this->_object_data->given_name = trim(strval($in_new_string_value));
258  $ret = $this->save_data();
259  }
260 
261  return $ret;
262  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ nickname()

nickname ( )

This requires a "detailed" load.

Returns
a string, with the user nickname.

Definition at line 270 of file rvp_php_sdk_user.class.php.

270  {
271  $ret = NULL;
272 
273  $this->_load_data(false, true);
274  if (isset($this->_object_data) && isset($this->_object_data->nickname)) {
275  $ret = trim($this->_object_data->nickname);
276  }
277 
278  return $ret;
279  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_nickname()

set_nickname (   $in_new_string_value)

This requires a "detailed" load.

Returns
true, if the operation succeeded.
Parameters
$in_new_string_valueREQUIRED: The new value

Definition at line 287 of file rvp_php_sdk_user.class.php.

288  {
289  $ret = false;
290 
291  $this->_load_data(false, true);
292 
293  if (isset($this->_object_data)) {
294  $this->_object_data->nickname = trim(strval($in_new_string_value));
295  $ret = $this->save_data();
296  }
297 
298  return $ret;
299  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ prefix()

prefix ( )

This requires a "detailed" load.

Returns
a string, with the user prefix.

Definition at line 307 of file rvp_php_sdk_user.class.php.

307  {
308  $ret = NULL;
309 
310  $this->_load_data(false, true);
311  if (isset($this->_object_data) && isset($this->_object_data->prefix)) {
312  $ret = trim($this->_object_data->prefix);
313  }
314 
315  return $ret;
316  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_prefix()

set_prefix (   $in_new_string_value)

This requires a "detailed" load.

Returns
true, if the operation succeeded.
Parameters
$in_new_string_valueREQUIRED: The new value

Definition at line 324 of file rvp_php_sdk_user.class.php.

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

◆ suffix()

suffix ( )

This requires a "detailed" load.

Returns
a string, with the user suffix.

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

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

◆ set_suffix()

set_suffix (   $in_new_string_value)

This requires a "detailed" load.

Returns
true, if the operation succeeded.
Parameters
$in_new_string_valueREQUIRED: The new value

Definition at line 361 of file rvp_php_sdk_user.class.php.

362  {
363  $ret = false;
364 
365  $this->_load_data(false, true);
366 
367  if (isset($this->_object_data)) {
368  $this->_object_data->suffix = trim(strval($in_new_string_value));
369  $ret = $this->save_data();
370  }
371 
372  return $ret;
373  }
_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 381 of file rvp_php_sdk_user.class.php.

381  {
382  $ret = NULL;
383 
384  $this->_load_data(false, true);
385 
386  if (isset($this->_object_data)) {
387  $ret = $this->_object_data->tag7;
388  }
389 
390  return $ret;
391  }
_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 399 of file rvp_php_sdk_user.class.php.

400  {
401  $ret = false;
402 
403  $this->_load_data(false, true);
404 
405  if (isset($this->_object_data)) {
406  $this->_object_data->tag7 = trim(strval($in_new_string_value));
407  $ret = $this->save_data();
408  }
409 
410  return $ret;
411  }
_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 419 of file rvp_php_sdk_user.class.php.

419  {
420  $ret = NULL;
421 
422  $this->_load_data(false, true);
423 
424  if (isset($this->_object_data)) {
425  $ret = $this->_object_data->tag8;
426  }
427 
428  return $ret;
429  }
_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 437 of file rvp_php_sdk_user.class.php.

438  {
439  $ret = false;
440 
441  $this->_load_data(false, true);
442 
443  if (isset($this->_object_data)) {
444  $this->_object_data->tag8 = trim(strval($in_new_string_value));
445  $ret = $this->save_data();
446  }
447 
448  return $ret;
449  }
_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 457 of file rvp_php_sdk_user.class.php.

457  {
458  $ret = NULL;
459 
460  $this->_load_data(false, true);
461 
462  if (isset($this->_object_data)) {
463  $ret = $this->_object_data->tag9;
464  }
465 
466  return $ret;
467  }
_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 475 of file rvp_php_sdk_user.class.php.

476  {
477  $ret = false;
478 
479  $this->_load_data(false, true);
480 
481  if (isset($this->_object_data)) {
482  $this->_object_data->tag9 = trim(strval($in_new_string_value));
483  $ret = $this->save_data();
484  }
485 
486  return $ret;
487  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ associated_login_id()

associated_login_id ( )

This requires a detailed string load.

NOTE: It is possible for the user data to actually have the entire associated login as part of its data, so, in that case, we extract the login ID directly from that data.

Returns
an integer, with the associated login ID, or NULL.

Definition at line 497 of file rvp_php_sdk_user.class.php.

497  {
498  $ret = NULL;
499 
500  $this->_load_data(false, true);
501 
502  if (isset($this->_object_data) && isset($this->_object_data->associated_login->id)) {
503  $ret = intval($this->_object_data->associated_login->id);
504  } elseif (isset($this->_object_data) && isset($this->_object_data->associated_login_id)) {
505  $ret = intval($this->_object_data->associated_login_id);
506  }
507 
508  return $ret;
509  }
_load_data( $in_force=false, $in_details=false, $in_parents=false)

◆ set_associated_login_id()

set_associated_login_id (   $in_new_integer_value)

This sets the value of the associated login ID.

Returns
true, if the operation suceeded.
Parameters
$in_new_integer_valueREQUIRED: The new login ID value.

Definition at line 517 of file rvp_php_sdk_user.class.php.

518  {
519  $ret = false;
520 
521  if ($this->_sdk_object->is_main_admin()) { // Only God can change login IDs.
522  $login_object = $this->_sdk_object->get_login_info($in_new_integer_value);
523 
524  if ($login_object instanceof RVP_PHP_SDK_Login) {
525  if (0 == $login_object->user_object_id()) { // We can only associate a login that is not associated with another user.
526  $this->_load_data(false, true);
527 
528  if (isset($this->_object_data)) {
529  $this->_object_data->associated_login_id = intval($in_new_integer_value);
530  $ret = $this->save_data();
531  }
532  } else {
533  $this->_sdk_object->set_error(_ERR_LOGIN_HAS_USER__);
534  }
535  } else {
536  $this->_sdk_object->set_error(_ERR_INVALID_PARAMETERS__);
537  }
538  } else {
539  $this->_sdk_object->set_error(_ERR_NOT_AUTHORIZED__);
540  }
541 
542  return $ret;
543  }
_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: