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

Changeset 9031


Ignore:
Timestamp:
Nov 7, 2008, 5:08:17 PM (11 years ago)
Author:
ebihara
Message:

#3123:consolidated duplicated action methods to sfOpenPNEMemberAction

Location:
OpenPNE3/trunk
Files:
2 added
2 edited

Legend:

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

    r8917 r9031  
    77 * @subpackage member
    88 * @author     Kousuke Ebihara <ebihara@tejimaya.com>
    9  * @version    SVN: $Id: actions.class.php 9301 2008-05-27 01:08:46Z dwhittle $
    109 */
    11 class memberActions extends sfActions
     10class memberActions extends sfOpenPNEMemberAction
    1211{
    13  /**
    14   * Executes login action
    15   *
    16   * @param sfRequest $request A request object
    17   */
    18   public function executeLogin($request)
    19   {
    20     $this->getUser()->logout();
    21 
    22     $this->forms = $this->getUser()->getAuthForms();
    23 
    24     if ($request->isMethod('post'))
    25     {
    26       $authForm = $this->getUser()->getAuthForm();
    27       $authForm->bind($request->getParameter('auth'.$authForm->getAuthMode()));
    28       if ($authForm->isValid())
    29       {
    30         $this->redirectIf($this->getUser()->login($authForm), 'member/home');
    31       }
    32       return sfView::ERROR;
    33     }
    34 
    35     return sfView::SUCCESS;
    36   }
    37 
    38  /**
    39   * Executes logout action
    40   *
    41   * @param sfRequest $request A request object
    42   */
    43   public function executeLogout($request)
    44   {
    45     $this->getUser()->logout();
    46     $this->redirect('member/login');
    47   }
    48 
    49  /**
    50   * Executes register action
    51   *
    52   * @param sfRequest $request A request object
    53   */
    54   public function executeRegisterInput($request)
    55   {
    56     $this->form = $this->getUser()->getAuthForm();
    57     $this->form->setForRegisterWidgets($this->getUser()->getMember());
    58 
    59     if ($request->isMethod('post')) {
    60       $this->form->bindAll($request);
    61       if ($this->form->isValidAll()) {
    62         $result = $this->getUser()->register($this->form);
    63         $this->redirectIf($result, $this->getUser()->getRegisterEndAction());
    64       }
    65     }
    66 
    67     return sfView::SUCCESS;
    68   }
    69 
    7012 /**
    7113  * Executes home action
     
    7618  {
    7719    $this->information = SnsConfigPeer::retrieveByName('mobile_home_information');
    78     return sfView::SUCCESS;
    79   }
    80 
    81  /**
    82   * Executes profile action
    83   *
    84   * @param sfRequest $request A request object
    85   */
    86   public function executeProfile($request)
    87   {
    88     $id = $this->getRequestParameter('id', $this->getUser()->getMemberId());
    89     $this->member = MemberPeer::retrieveByPk($id);
    90     $this->friends = FriendPeer::retrievesByMemberId($id);
    91     $this->communities = CommunityPeer::retrievesByMemberId($id);
    92     $this->forward404Unless($this->member, 'Undefined member.');
    93 
    94     return sfView::SUCCESS;
    95   }
    96 
    97  /**
    98   * Executes editProfile action
    99   *
    100   * @param sfRequest $request A request object
    101   */
    102   public function executeEditProfile($request)
    103   {
    104     $this->memberForm = new MemberForm($this->getUser()->getMember());
    105 
    106     $profiles = $this->getUser()->getMember()->getProfiles();
    107     $this->profileForm = new MemberProfileForm($profiles);
    108     $this->profileForm->setConfigWidgets();
    109 
    110     if ($request->isMethod('post')) {
    111       $this->memberForm->bind($request->getParameter('member'));
    112       $this->profileForm->bind($request->getParameter('profile'));
    113       if ($this->memberForm->isValid() && $this->profileForm->isValid()) {
    114         $this->memberForm->save();
    115         $this->profileForm->save($this->getUser()->getMemberId());
    116         $this->redirect('member/profile');
    117       }
    118     }
    119 
    120     return sfView::SUCCESS;
     20    return parent::executeHome($request);
    12121  }
    12222
  • OpenPNE3/trunk/apps/pc_frontend/modules/member/actions/actions.class.php

    r8917 r9031  
    77 * @subpackage member
    88 * @author     Kousuke Ebihara <ebihara@tejimaya.com>
    9  * @version    SVN: $Id: actions.class.php 9301 2008-05-27 01:08:46Z dwhittle $
    109 */
    11 class memberActions extends sfActions
     10class memberActions extends sfOpenPNEMemberAction
    1211{
    13  /**
    14   * Executes login action
    15   *
    16   * @param sfRequest $request A request object
    17   */
    18   public function executeLogin($request)
    19   {
    20     $this->getUser()->logout();
    21 
    22     $this->forms = $this->getUser()->getAuthForms();
    23 
    24     if ($request->isMethod('post'))
    25     {
    26       $authForm = $this->getUser()->getAuthForm();
    27       $authForm->bind($request->getParameter('auth'.$authForm->getAuthMode()));
    28       if ($authForm->isValid())
    29       {
    30         $this->redirectIf($this->getUser()->login($authForm), 'member/home');
    31       }
    32       return sfView::ERROR;
    33     }
    34 
    35     return sfView::SUCCESS;
    36   }
    37 
    38  /**
    39   * Executes logout action
    40   *
    41   * @param sfRequest $request A request object
    42   */
    43   public function executeLogout($request)
    44   {
    45     $this->getUser()->logout();
    46     $this->redirect('member/login');
    47   }
    48 
    49  /**
    50   * Executes register action
    51   *
    52   * @param sfRequest $request A request object
    53   */
    54   public function executeRegisterInput($request)
    55   {
    56     $this->form = $this->getUser()->getAuthForm();
    57     $this->form->setForRegisterWidgets($this->getUser()->getMember());
    58 
    59     if ($request->isMethod('post')) {
    60       $this->form->bindAll($request);
    61       if ($this->form->isValidAll()) {
    62         $result = $this->getUser()->register($this->form);
    63         $this->redirectIf($result, $this->getUser()->getRegisterEndAction());
    64       }
    65     }
    66 
    67     return sfView::SUCCESS;
    68   }
    69 
    7012 /**
    7113  * Executes home action
     
    7618  {
    7719    $this->information = SnsConfigPeer::retrieveByName('pc_home_information');
    78 
    79     return sfView::SUCCESS;
     20    return parent::executeHome($request);
    8021  }
    8122
     
    10142  public function executeProfile($request)
    10243  {
    103     $id = $this->getRequestParameter('id', $this->getUser()->getMemberId());
    104     $this->member = MemberPeer::retrieveByPk($id);
    105     $this->forward404Unless($this->member, 'Undefined member.');
    106 
    107     if ($request->hasParameter('id')) {
     44    if ($request->hasParameter('id') && $request->getParameter('id') != $this->getUser()->getMemberId())
     45    {
    10846      sfConfig::set('sf_navi_type', 'friend');
    10947    }
    11048
    111     return sfView::SUCCESS;
    112   }
    113 
    114  /**
    115   * Executes editProfile action
    116   *
    117   * @param sfRequest $request A request object
    118   */
    119   public function executeEditProfile($request)
    120   {
    121     $this->memberForm = new MemberForm($this->getUser()->getMember());
    122 
    123     $profiles = $this->getUser()->getMember()->getProfiles();
    124     $this->profileForm = new MemberProfileForm($profiles);
    125     $this->profileForm->setConfigWidgets();
    126 
    127     if ($request->isMethod('post')) {
    128       $this->memberForm->bind($request->getParameter('member'));
    129       $this->profileForm->bind($request->getParameter('profile'));
    130       if ($this->memberForm->isValid() && $this->profileForm->isValid()) {
    131         $this->memberForm->save();
    132         $this->profileForm->save($this->getUser()->getMemberId());
    133         $this->redirect('member/profile');
    134       }
    135     }
    136 
    137     return sfView::SUCCESS;
     49    return parent::executeProfile($request);
    13850  }
    13951
Note: See TracChangeset for help on using the changeset viewer.