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

source: OpenPNE3/trunk/apps/pc_backend/modules/member/actions/actions.class.php @ 10144

Last change on this file since 10144 was 10144, checked in by ebihara, 11 years ago

#3308:added ability to register blacklist from the member list

File size: 3.2 KB
Line 
1<?php
2
3/**
4 * This file is part of the OpenPNE package.
5 * (c) OpenPNE Project (http://www.openpne.jp/)
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file and the NOTICE file that were distributed with this source code.
9 */
10
11/**
12 * member actions.
13 *
14 * @package    OpenPNE
15 * @subpackage member
16 * @author     Kousuke Ebihara <ebihara@tejimaya.com>
17 */
18class memberActions extends sfActions
19{
20 /**
21  * Executes index action
22  *
23  * @param sfRequest $request A request object
24  */
25  public function executeIndex(sfWebRequest $request)
26  {
27    $this->forward('member', 'list');
28  }
29
30 /**
31  * Executes list action
32  *
33  * @param sfRequest $request A request object
34  */
35  public function executeList(sfWebRequest $request)
36  {
37    $params = $request->getParameter('member', array());
38
39    $this->form = new opMemberProfileSearchForm();
40    $this->form->bind($params);
41
42    $this->pager = new sfPropelPager('Member', 20);
43    if ($params)
44    {
45      $this->pager->setCriteria($this->form->getCriteria());
46    }
47    $this->pager->setPage($request->getParameter('page', 1));
48    $this->pager->init();
49
50    $this->profiles = ProfilePeer::retrievesAll();
51
52    return sfView::SUCCESS;
53  }
54
55 /**
56  * Executes invite action
57  *
58  * @param sfRequest $request A request object
59  */
60  public function executeInvite(sfWebRequest $request)
61  {
62    $this->plugins = opInstalledPluginManager::getAdminInviteAuthPlugins();
63    if (empty($this->plugins))
64    {
65      return sfView::ERROR;
66    }
67
68    $options = array(
69      'authModes' => $this->plugins,
70      'is_link' => false,
71    );
72    $this->form = new AdminInviteForm(null, $options);
73
74    if ($request->isMethod(sfWebRequest::POST))
75    {
76      $this->form->bind($request->getParameter('member_config'));
77      if ($this->form->isValid())
78      {
79        $this->form->save();
80        $this->redirect('member/invite');
81      }
82    }
83
84    return sfView::SUCCESS;
85  }
86
87 /**
88  * Executes blacklist action
89  *
90  * @param sfRequest $request A request object
91  */
92  public function executeBlacklist(sfWebRequest $request)
93  {
94    $uid = $request->getParameter('uid');
95
96    $this->pager = new sfPropelPager('Blacklist', 20);
97    $this->pager->setPage($request->getParameter('page', 1));
98    $this->pager->init();
99
100    $this->form = new BlacklistForm();
101    if ($uid)
102    {
103      $this->form->setDefault('uid', $uid);
104    }
105    if ($request->isMethod(sfWebRequest::POST))
106    {
107      $result = $this->form->bindAndSave($request->getParameter('blacklist'));
108      $this->redirectIf($result, 'member/blacklist');
109    }
110
111    return sfView::SUCCESS;
112  }
113
114 /**
115  * Executes blacklistDelete action
116  *
117  * @param sfRequest $request A request object
118  */
119  public function executeBlacklistDelete(sfWebRequest $request)
120  {
121    $this->blacklist = BlacklistPeer::retrieveByPK($request->getParameter('id'));
122    $this->forward404Unless($this->blacklist);
123
124    $this->form = new sfForm();
125    if ($request->isMethod(sfWebRequest::POST))
126    {
127      $field = sfForm::getCSRFFieldName();
128      $this->form->bind(array($field => $request->getParameter($field)));
129      if ($this->form->isValid())
130      {
131        $this->blacklist->delete();
132        $this->redirect('member/blacklist');
133      }
134    }
135
136    return sfView::SUCCESS;
137  }
138}
Note: See TracBrowser for help on using the repository browser.