ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 10970


Ignore:
Timestamp:
Mar 10, 2009, 11:02:43 AM (11 years ago)
Author:
ShogoKawahara
Message:

added Member::getEmailAddress() and Member::getEmailAddresses()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/lib/model/Member.php

    r10706 r10970  
    174174    return MemberPeer::retrieveByPk($this->getInviteMemberId());
    175175  }
     176
     177  public function getEmailAddress($isPriorityMobile = null)
     178  {
     179    if(is_null($isPriorityMobile))
     180    {
     181      $isPriorityMobile = false;
     182      if (sfConfig::get('sf_app') == 'mobile_frontend')
     183      {
     184        $isPriorityMobile = true;
     185      }
     186    }
     187
     188    $memberPcAddressConfig = MemberConfigPeer::retrieveByNameAndMemberId('pc_address', $this->getId());
     189    $memberMobileAddressConfig = MemberConfigPeer::retrieveByNameAndMemberId('mobile_address', $this->getId());
     190
     191    if ($memberMobileAddressConfig && ($isPriorityMobile || !$memberPcAddressConfig))
     192    {
     193      return $memberMobileAddressConfig->getValue();
     194    }
     195
     196    if ($memberPcAddressConfig)
     197    {
     198      return $memberPcAddressConfig->getValue();
     199    }
     200
     201    return null;
     202  }
     203
     204  public function getEmailAddresses()
     205  {
     206    $result = array();
     207    $memberPcAddressConfig = MemberConfigPeer::retrieveByNameAndMemberId('pc_address', $this->getId());
     208    $memberMobileAddressConfig = MemberConfigPeer::retrieveByNameAndMemberId('mobile_address', $this->getId());
     209
     210    if ($memberPcAddressConfig)
     211    {
     212      $result[] = $memberPcAddressConfig->getValue();
     213    }
     214
     215    if ($memberMobileAddressConfig)
     216    {
     217      $result[] = $memberMobileAddressConfig->getValue();
     218    }
     219
     220    return $result;
     221  }
    176222}
Note: See TracChangeset for help on using the changeset viewer.