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

source: OpenPNE3/trunk/apps/pc_backend/modules/profile/actions/actions.class.php @ 8567

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

replaced my e-mail address with a new one.

File size: 2.7 KB
Line 
1<?php
2
3/**
4 * profile actions.
5 *
6 * @package    OpenPNE
7 * @subpackage profile
8 * @author     Kousuke Ebihara <ebihara@tejimaya.com>
9 * @version    SVN: $Id: actions.class.php 9301 2008-05-27 01:08:46Z dwhittle $
10 */
11class profileActions extends sfActions
12{
13 /**
14  * Executes list action
15  *
16  * @param sfRequest $request A request object
17  */
18  public function executeList($request)
19  {
20    $this->profiles = ProfilePeer::doSelect(new Criteria());
21    $this->option_form = array();
22    foreach ($this->profiles as $value) {
23      $this->option_form[$value->getId()] = array();
24      foreach ($value->getProfileOptions() as $option) {
25        $this->option_form[$value->getId()][$option->getId()] = new ProfileOptionForm(ProfileOptionPeer::retrieveByPk($option->getId()));
26      }
27      $newProfileOption = new ProfileOption();
28      $newProfileOption->setProfileId($value->getId());
29      $this->option_form[$value->getId()][] = new ProfileOptionForm($newProfileOption);
30    }
31  }
32
33 /**
34  * Executes edit action
35  *
36  * @param sfRequest $request A request object
37  */
38  public function executeEdit($request)
39  {
40    $this->profile = ProfilePeer::retrieveByPk($request->getParameter('id'));
41    $this->form = new ProfileForm($this->profile);
42
43    if ($request->isMethod('post')) {
44      $this->form->bind($request->getParameter('profile'));
45      if ($this->form->isValid()) {
46        $this->form->save();
47        $this->redirect('profile/list');
48      }
49    }
50  }
51
52 /**
53  * Executes editOption action
54  *
55  * @param sfRequest $request A request object
56  */
57  public function executeEditOption($request)
58  {
59    $this->profileOption = ProfileOptionPeer::retrieveByPk($request->getParameter('id'));
60    $this->form = new ProfileOptionForm($this->profileOption);
61
62    if ($request->isMethod('post')) {
63      $this->form->bind($request->getParameter('profile_option'));
64      if ($this->form->isValid()) {
65        $this->form->save();
66      }
67    }
68    $this->redirect('profile/list');
69  }
70
71 /**
72  * Executes delete action
73  *
74  * @param sfRequest $request A request object
75  */
76  public function executeDelete($request)
77  {
78    $this->profile = ProfilePeer::retrieveByPk($request->getParameter('id'));
79    $this->forward404Unless($this->profile);
80
81    if ($request->isMethod('post')) {
82      $this->profile->delete();
83      $this->redirect('profile/list');
84    }
85  }
86
87 /**
88  * Executes deleteOption action
89  *
90  * @param sfRequest $request A request object
91  */
92  public function executeDeleteOption($request)
93  {
94    $this->profileOption = ProfileOptionPeer::retrieveByPk($request->getParameter('id'));
95    $this->forward404Unless($this->profileOption);
96
97    if ($request->isMethod('post')) {
98      $this->profileOption->delete();
99    }
100    $this->redirect('profile/list');
101  }
102}
Note: See TracBrowser for help on using the repository browser.