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

Ignore:
Timestamp:
Dec 18, 2008, 6:47:56 PM (14 years ago)
Author:
masabon
Message:

#3028:added the defenition of community_config table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/lib/form/CommunityForm.class.php

    r7861 r9589  
    1212  public function configure()
    1313  {
     14    unset($this['created_at'], $this['updated_at']);
     15
     16    $this->setValidator('config', new sfValidatorPass());
    1417  }
    1518
     
    1720  {
    1821    $community = parent::save($con);
     22    $tainted_values = $this->getTaintedValues();
     23    $community_config_array = $tainted_values['config'];
    1924
    2025    if ($this->isNew()) {
     
    2429      $communityMember->setCommunityId($community->getId());
    2530      $communityMember->save();
     31
     32      foreach ($community_config_array as $community_config_key => $community_config_value)
     33      {
     34        $community_config = new CommunityConfig();
     35        $community_config->setCommunityId($community->getId());
     36        $community_config->setName($community_config_key);
     37        $community_config->setValue($community_config_value);
     38        $community_config->save();
     39      }
     40    }
     41    else
     42    {
     43      foreach ($community_config_array as $community_config_key => $community_config_value)
     44      {
     45        $community_config = CommunityConfigPeer::retrieveByNameAndCommunityId($community_config_key, $community->getId());
     46        $community_config->setValue($community_config_value);
     47        $community_config->save();
     48      }
    2649    }
    2750
Note: See TracChangeset for help on using the changeset viewer.