Ejemplo n.º 1
0
 /**
  * complete the online-identity with the api json
  *
  * @param OnlineIdentity $pOnlineIdentity
  * @param Object $pObject
  */
 public function completeOnlineIdentity(&$pOnlineIdentity, $pProfileArray, $pUser)
 {
     $pOnlineIdentity->setName($pProfileArray['first-name'] . " " . $pProfileArray['last-name']);
     $pOnlineIdentity->setSocialPublishingEnabled(true);
     $pOnlineIdentity->setUserId($pUser->getId());
     if (isset($pProfileArray['date-of-birth']['year'])) {
         $pOnlineIdentity->setBirthdate($pProfileArray['date-of-birth']['year'] . '-' . $pProfileArray['date-of-birth']['month'] . '-' . $pProfileArray['date-of-birth']['day']);
     }
     $pOnlineIdentity->setLocationRaw($pProfileArray['location']['name']);
     $pOnlineIdentity->setPhoto($pProfileArray['pictureUrl']);
     $pOnlineIdentity->save();
     // update user's birthdate if it's not set yet and provided by this identity
     if (is_null($pUser->getBirthdate()) && $pOnlineIdentity->getBirthdate()) {
         $pUser->setBirthdate($pOnlineIdentity->getBirthdate());
         $pUser->save();
     }
 }
Ejemplo n.º 2
0
 /**
  * complete the online-identity with the api json
  *
  * @param OnlineIdentity $pOnlineIdentity
  * @param Object $pObject
  */
 public function completeOnlineIdentity(&$pOnlineIdentity, $pObject, $pUser, $pAuthIdentifier)
 {
     $pOnlineIdentity->setUserId($pUser->getId());
     $pOnlineIdentity->setAuthIdentifier($pAuthIdentifier);
     $pOnlineIdentity->setSocialPublishingEnabled(true);
     $pOnlineIdentity->setName($pObject->nickname);
     $pOnlineIdentity->setProfileUri($pAuthIdentifier);
     if (isset($pObject->gender)) {
         $pOnlineIdentity->setGender($pObject->gender);
     }
     if (isset($pObject->birthday)) {
         $pOnlineIdentity->setBirthdate($pObject->birthday);
     }
     $pOnlineIdentity->save();
 }
Ejemplo n.º 3
0
 /**
  * complete the online-identity with the api json
  *
  * @param OnlineIdentity $pOnlineIdentity
  * @param Object $pObject
  */
 public function completeOnlineIdentity(&$pOnlineIdentity, $pObject, $pUser, $pAuthIdentifier)
 {
     // delegate to ImportClient to avoid duplicate code
     /* signup,add new */
     $pOnlineIdentity->setUserId($pUser->getId());
     $pOnlineIdentity->setAuthIdentifier($pAuthIdentifier);
     $pOnlineIdentity->setName($pObject['display_name']);
     $pOnlineIdentity->setGender($pObject['gender']);
     // transform facebook format into
     $pOnlineIdentity->setBirthdate($pObject['birth_date']['year'] . '-' . $pObject['birth_date']['month'] . '-' . $pObject['birth_date']['day']);
     $pOnlineIdentity->setSocialPublishingEnabled(true);
     $pOnlineIdentity->setLocationRaw($pObject["business_address"]["city"]);
     $pOnlineIdentity->setPhoto($pObject["photo_urls"]["large"]);
     $pOnlineIdentity->save();
     $pUser->setRelationshipState($pOnlineIdentity->getRelationshipState());
     $pUser->setBirthdate($pOnlineIdentity->getBirthDate());
     $pUser->save();
 }
Ejemplo n.º 4
0
 /**
  * complete the online-identity with the api json
  *
  * @author Matthias Pfefferle
  * @refactored weyandch
  * @param OnlineIdentity $pOnlineIdentity
  * @param Object $pObject
  */
 public function completeOnlineIdentity(&$pOnlineIdentity, $pObject, $pUser, $pAuthIdentifier)
 {
     // delegate to ImportClient to avoid duplicate code
     /* signup,add new */
     $pOnlineIdentity->setUserId($pUser->getId());
     $pOnlineIdentity->setAuthIdentifier($pAuthIdentifier);
     $pOnlineIdentity->setName($pObject->name);
     $pOnlineIdentity->setGender($pObject->gender);
     // transform facebook format into
     $lBirthday = explode('/', $pObject->birthday);
     if (count($lBirthday == 3 && $lBirthday[2] > 0 && $lBirthday[0] != '0000')) {
         // 3 parts and year is set
         $pOnlineIdentity->setBirthdate($lBirthday[2] . '-' . $lBirthday[0] . '-' . $lBirthday[1]);
     }
     $pOnlineIdentity->setRelationshipState(IdentityHelper::tranformRelationshipStringToClasskey($pObject->relationship_status));
     $pOnlineIdentity->setSocialPublishingEnabled(true);
     $pOnlineIdentity->setLocationRaw($pObject->location->name);
     $pOnlineIdentity->setPhoto("https://graph.facebook.com/" . $pOnlineIdentity->getOriginalId() . "/picture");
     $pOnlineIdentity->setProfileUri($pObject->link);
     $pOnlineIdentity->save();
     $pUser->setRelationshipState($pOnlineIdentity->getRelationshipState());
     $pUser->setBirthdate($pOnlineIdentity->getBirthDate());
     $pUser->save();
 }