Example #1
0
 public function getAge($viewableCheck = false, $myMemberId = null)
 {
     if (!$myMemberId) {
         $myMemberId = sfContext::getInstance()->getUser()->getMemberId();
     }
     $birthday = $this->getProfile('op_preset_birthday');
     if (!(string) $birthday) {
         return false;
     }
     $age = opToolkit::calculateAge($birthday);
     $publicFlag = $this->getConfig('age_public_flag');
     if (!$viewableCheck || $publicFlag == ProfileTable::PUBLIC_FLAG_SNS) {
         return $age;
     }
     $relation = Doctrine::getTable('MemberRelationship')->retrieveByFromAndTo($myMemberId, $this->id);
     if ($publicFlag == ProfileTable::PUBLIC_FLAG_FRIEND && ($this->id == $myMemberId || $relation && $relation->isFriend())) {
         return $age;
     }
     return false;
 }