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

source: OpenPNE3/trunk/lib/form/SnsConfigForm.class.php @ 10030

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

#3324:changed the SnsConfigForm? class to comformity the OpenPNEFormAutoGenerate class

File size: 1.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 * SnsConfig form.
13 *
14 * @package    OpenPNE
15 * @subpackage form
16 * @author     Kousuke Ebihara <ebihara@tejimaya.com>
17 */
18class SnsConfigForm extends OpenPNEFormAutoGenerate
19{
20  public function configure()
21  {
22    foreach (sfConfig::get('openpne_sns_config') as $key => $value)
23    {
24      $this->setWidget($key, $this->generateWidget($value));
25      $this->setValidator($key, $this->generateValidator($value));
26      $this->widgetSchema->setLabel($key, $value['Caption']);
27      $this->setDefault($key, opConfig::get($key));
28    }
29
30    $this->widgetSchema->setNameFormat('sns_config[%s]');
31  }
32
33  public function save()
34  {
35    $config = sfConfig::get('openpne_sns_config');
36    foreach ($this->getValues() as $key => $value)
37    {
38      $snsConfig = SnsConfigPeer::retrieveByName($key);
39      if (!$snsConfig)
40      {
41        $snsConfig = new SnsConfig();
42        $snsConfig->setName($key);
43      }
44      $snsConfig->setValue($value);
45      $snsConfig->save();
46    }
47  }
48}
Note: See TracBrowser for help on using the repository browser.