forked from La_Bureautique/zeg1jeux
78 lines
1.4 KiB
PHP
78 lines
1.4 KiB
PHP
<?php
|
|
|
|
class GchangeUser {
|
|
|
|
public $userGchangeId;
|
|
|
|
public $userName;
|
|
|
|
private $lat = null;
|
|
|
|
private $lon = null;
|
|
|
|
private $avatarImgSrc = null;
|
|
|
|
|
|
public function __construct ($gchangeObject) {
|
|
|
|
$this->gchangeObject = $gchangeObject;
|
|
|
|
$this->userGchangeId = $gchangeObject->_id;
|
|
|
|
if (isset($gchangeObject->found) and $gchangeObject->found == false) {
|
|
|
|
$this->userName = substr($gchangeObject->_id, 0, 8);
|
|
|
|
} else {
|
|
|
|
if (isset($gchangeObject->_source->title)) {
|
|
|
|
$this->userName = $gchangeObject->_source->title;
|
|
|
|
}
|
|
|
|
if (isset($gchangeObject->_source->geoPoint->lat, $gchangeObject->_source->geoPoint->lon)) {
|
|
|
|
$this->lat = $gchangeObject->_source->geoPoint->lat;
|
|
$this->lon = $gchangeObject->_source->geoPoint->lon;
|
|
}
|
|
|
|
if (isset($gchangeObject->_source->avatar->_content) and
|
|
!empty($gchangeObject->_source->avatar->_content)) {
|
|
|
|
|
|
$this->avatarImgSrc = 'data:'. $gchangeObject->_source->avatar->_content_type .';base64,' . $gchangeObject->_source->avatar->_content;
|
|
}
|
|
}
|
|
}
|
|
|
|
public function getUserGchangeId () {
|
|
|
|
return $this->userGchangeId;
|
|
}
|
|
|
|
public function getUserName () {
|
|
|
|
return $this->userName;
|
|
}
|
|
|
|
public function getLat () {
|
|
|
|
return $this->lat;
|
|
}
|
|
|
|
public function getLon () {
|
|
|
|
return $this->lon;
|
|
}
|
|
|
|
public function getAvatarImgSrc () {
|
|
|
|
return $this->avatarImgSrc;
|
|
}
|
|
|
|
public function jsonify () {
|
|
|
|
return $this->gchangeObject;
|
|
}
|
|
} |