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

source: OpenPNE3/trunk/lib/form/InviteForm.class.php @ 9593

Last change on this file since 9593 was 9593, checked in by ebihara, 12 years ago

fixed a member doesn't link with another one is invited from he/she

File size: 1.7 KB
Line 
1<?php
2
3/**
4 * Invite form.
5 *
6 * @package    OpenPNE
7 * @subpackage form
8 * @author     Kousuke Ebihara <ebihara@tejimaya.com>
9 */
10class InviteForm extends MemberConfigPcAddressForm
11{
12  public function configure()
13  {
14    parent::configure();
15    $this->isAutoGenerate = false;
16    $this->memberConfigSettings['pc_address']['IsConfirm'] = false;
17    $this->setMemberConfigWidget('pc_address');
18  }
19
20  public function getToken()
21  {
22    $memberConfig = MemberConfigPeer::retrieveByNameAndMemberId('pc_address_token', $this->member->getId());
23    if ($memberConfig) {
24      return $memberConfig->getValue();
25    }
26  }
27
28  public function getMailAddress()
29  {
30    $memberConfig = MemberConfigPeer::retrieveByNameAndMemberId('pc_address_pre', $this->member->getId());
31    if ($memberConfig) {
32      return $memberConfig->getValue();
33    }
34  }
35
36  protected function sendConfirmMail($token, $to, $params = array())
37  {
38    $mail = new sfOpenPNEMailSend();
39    $mail->setSubject(OpenPNEConfig::get('sns_name').'の招待状が届いています');
40    $mail->setTemplate('global/requestRegisterURLMail', array('token' => $token));
41    $mail->send($to, OpenPNEConfig::get('admin_mail_address'));
42  }
43
44  public function save()
45  {
46    parent::save();
47
48    if ($this->getOption('is_link'))
49    {
50      $fromMemberId = sfContext::getInstance()->getUser()->getMemberId();
51      $toMemberId = $this->member->getId();
52      $relation = MemberRelationshipPeer::retrieveByFromAndTo($fromMemberId, $toMemberId);
53      if (!$relation)
54      {
55        $relation = new MemberRelationship();
56        $relation->setMemberIdFrom($fromMemberId);
57        $relation->setMemberIdTo($toMemberId);
58      }
59      $relation->setFriend();
60    }
61  }
62}
Note: See TracBrowser for help on using the repository browser.