Ejemplo n.º 1
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();
 }