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

Changeset 7872


Ignore:
Timestamp:
Jul 30, 2008, 2:33:49 AM (13 years ago)
Author:
ebihara
Message:

#2861:プロフィールを編集できるようにした

Location:
OpenPNE3/trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/apps/pc_frontend/modules/member/actions/actions.class.php

    r7871 r7872  
    127127    return sfView::SUCCESS;
    128128  }
     129
     130 /**
     131  * Executes editProfile action
     132  *
     133  * @param sfRequest $request A request object
     134  */
     135  public function executeEditProfile($request)
     136  {
     137    $profiles = $this->getUser()->getMember()->getProfiles();
     138    $this->form = new ProfileForm($profiles);
     139    $this->form->setConfigWidgets();
     140
     141    $profile = $request->getParameter('profile');
     142
     143    if ($profile) {
     144      $this->form->bind($profile);
     145      if ($this->form->isValid()) {
     146        $result = $this->form->save($this->getUser()->getMemberId());
     147        $this->redirectIf($result, 'member/profile');
     148      }
     149    }
     150
     151    return sfView::SUCCESS;
     152  }
    129153}
  • OpenPNE3/trunk/apps/pc_frontend/modules/member/templates/homeSuccess.php

    r7869 r7872  
    11あなたのホームです。(メンバーID:<?php echo $sf_user->getMemberId() ?>, ニックネーム:<?php echo $sf_user->getMember()->getProfile('nickname') ?>)
    22<ul>
     3<li><?php echo link_to('プロフィール確認', 'member/profile') ?></li>
    34<li><?php echo link_to('メンバー一覧', 'member/list') ?></li>
    45<li><?php echo link_to('コミュニティ追加', 'community/edit') ?></li>
  • OpenPNE3/trunk/apps/pc_frontend/modules/member/templates/profileSuccess.php

    r7871 r7872  
    1111</ul>
    1212
     13<ul>
    1314<?php if ($sf_user->getMemberId() != $member->getId()) : ?>
    14 <ul>
    1515<?php if (FriendPeer::isFriend($sf_user->getMemberId(), $member->getId())): ?>
    1616<li><?php echo link_to('フレンドをやめる', 'friend/unlink?id=' . $member->getId()) ?></li>
     
    1818<li><?php echo link_to('フレンドになる', 'friend/link?id=' . $member->getId()) ?></li>
    1919<?php endif; ?>
     20<?php else : ?>
     21<li><?php echo link_to('プロフィール編集', 'member/editProfile') ?></li>
     22<li><?php echo link_to('ホームに戻る', 'member/home') ?></li>
     23<?php endif; ?>
    2024</ul>
    21 <?php endif; ?>
  • OpenPNE3/trunk/lib/form/ProfileForm.class.php

    r7871 r7872  
    1010class ProfileForm extends sfForm
    1111{
     12  public function __construct($profileMember = null, $options = array(), $CSRFSecret = null)
     13  {
     14    parent::__construct(array(), $options, $CSRFSecret);
     15
     16    foreach ($profileMember as $profile) {
     17      $this->setDefault($profile->getName(), $profile->getValue());
     18    }
     19  }
     20
    1221  public function configure()
    1322  {
     
    4049      }
    4150
    42       if (!$memberProfile->save()) {
    43         return false;
    44       }
     51      $memberProfile->save();
    4552    }
    4653
     
    172179    return $result;
    173180  }
     181
     182  private function updateDefaultsFromObject($obj)
     183  {
     184    $this->setDefaults(array_merge($this->getDefaults(), $obj->toArray(BasePeer::TYPE_FIELDNAME)));
     185    var_dump($obj->toArray(BasePeer::TYPE_FIELDNAME));
     186  }
    174187}
  • OpenPNE3/trunk/lib/model/MemberProfile.php

    r7871 r7872  
    2323  }
    2424
     25  public function getValue()
     26  {
     27    if ($this->getProfileOptionId()) {
     28      return $this->getProfileOptionId();
     29    }
     30
     31    return parent::getValue();
     32  }
     33
    2534  public function hydrateProfiles($rs)
    2635  {
Note: See TracChangeset for help on using the changeset viewer.