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 | * Community form. |
---|
13 | * |
---|
14 | * @package OpenPNE |
---|
15 | * @subpackage form |
---|
16 | * @author Kousuke Ebihara <ebihara@tejimaya.com> |
---|
17 | */ |
---|
18 | class CommunityForm extends BaseCommunityForm |
---|
19 | { |
---|
20 | protected $configForm; |
---|
21 | |
---|
22 | public function configure() |
---|
23 | { |
---|
24 | unset($this['created_at'], $this['updated_at'], $this['file_id']); |
---|
25 | unset($this->widgetSchema['id']); |
---|
26 | |
---|
27 | $this->setValidator('name', new sfValidatorString(array('max_length' => 64, 'trim' => true))); |
---|
28 | |
---|
29 | $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('form_community'); |
---|
30 | } |
---|
31 | |
---|
32 | public function updateObject($values = null) |
---|
33 | { |
---|
34 | $object = parent::updateObject($values); |
---|
35 | |
---|
36 | $this->saveMember($object); |
---|
37 | |
---|
38 | return $object; |
---|
39 | } |
---|
40 | |
---|
41 | public function saveMember(Community $community) |
---|
42 | { |
---|
43 | if ($this->isNew()) |
---|
44 | { |
---|
45 | $member = new CommunityMember(); |
---|
46 | $member->setPosition('admin'); |
---|
47 | $member->setMemberId(sfContext::getInstance()->getUser()->getMemberId()); |
---|
48 | $member->setCommunity($community); |
---|
49 | } |
---|
50 | } |
---|
51 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.