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

Changeset 11063


Ignore:
Timestamp:
Mar 19, 2009, 4:51:47 PM (13 years ago)
Author:
ShogoKawahara
Message:

#3409:fixed ApplicationPeer::addApplication() for the internationalization

Location:
OpenPNE3/plugins/opOpenSocialPlugin/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/plugins/opOpenSocialPlugin/trunk/apps/pc_backend/modules/opOpenSocialPlugin/actions/actions.class.php

    r10832 r11063  
    9393        try
    9494        {
    95           $application = ApplicationPeer::addApplication($contact['application_url'], $this->getUser()->getCulture(),true);
     95          $application = ApplicationPeer::addApplication($contact['application_url'], true);
    9696        }
    9797        catch (Exception $e)
  • OpenPNE3/plugins/opOpenSocialPlugin/trunk/apps/pc_frontend/modules/application/actions/actions.class.php

    r10832 r11063  
    8989      try
    9090      {
    91         $application = ApplicationPeer::addApplication($contact['application_url'],$this->getUser()->getCulture());
     91        $application = ApplicationPeer::addApplication($contact['application_url']);
    9292      }
    9393      catch (Exception $e)
  • OpenPNE3/plugins/opOpenSocialPlugin/trunk/apps/pc_frontend/modules/application/actions/components.class.php

    r10840 r11063  
    113113    try
    114114    {
    115       $application = ApplicationPeer::addApplication($url, $this->getUser()->getCulture());
     115      $application = ApplicationPeer::addApplication($url);
    116116      if (!$application)
    117117      {
  • OpenPNE3/plugins/opOpenSocialPlugin/trunk/lib/model/Application.php

    r10261 r11063  
    1818class Application extends BaseApplication
    1919{
    20  /**
    21   * hasSetting
    22   *
    23   * @return boolean
    24   */
     20  public function hydrate($row, $startcol = 0, $rehydrate = false)
     21  {
     22    $result = parent::hydrate($row, $startcol, $rehydrate);
     23
     24    if ($this->getCurrentApplicationI18n()->isNew())
     25    {
     26      $this->setCulture(sfConfig::get('sf_default_culture'));
     27    }
     28
     29    return $result;
     30  }
     31
     32  /**
     33   * hasSetting
     34   *
     35   * @return boolean
     36   */
    2537  public function hasSetting()
    2638  {
     
    4052  }
    4153
    42  /**
    43   * getSettings
    44   *
    45   * @param  string $culture
    46   * @return array
    47   */
     54  /**
     55   * getSettings
     56   *
     57   * @param  string $culture
     58   * @return array
     59   */
    4860  public function getSettings($culture = null)
    4961  {
     
    5163  }
    5264
    53  /**
    54   * count installed member
    55   *
    56   * @return integer
    57   */
     65  /**
     66   * count installed member
     67   *
     68   * @return integer
     69   */
    5870  public function countInstalledMember()
    5971  {
    6072    $criteria = new Criteria();
    61     $criteria->add(MemberApplicationPeer::APPLICATION_ID, parent::getId());
    6273    $criteria->add(MemberApplicationPeer::IS_GADGET, false);
    63     return MemberApplicationPeer::doCount($criteria);
     74    return $this->countMemberApplications($criteria);
    6475  }
    6576}
     77
  • OpenPNE3/plugins/opOpenSocialPlugin/trunk/lib/model/ApplicationPeer.php

    r10832 r11063  
    4040   *
    4141   * @param string $url     gadget url
     42   * @param bool   $update
    4243   * @param string $culture culture
    43    * @param bool   $update
    4444   * @return Application application object 
    4545   */
    46   public static function addApplication($url, $culture = 'en_US', $update = false)
     46  public static function addApplication($url, $update = false, $culture = null)
    4747  {
     48    if (is_null($culture))
     49    {
     50      $culture = sfContext::getInstance()->getUser()->getCulture();
     51    }
     52
     53    if ($culture != sfConfig::get('sf_default_culture'))
     54    {
     55      self::addApplication($url, $update, sfConfig::get('sf_default_culture'));
     56    }
     57
    4858    $app = self::retrieveByUrl($url);
    49     if (!empty($app) && !$update)
     59    if (!$app)
     60    {
     61      $app = new Application();
     62    }
     63    $app->setCulture($culture);
     64
     65    if (!($app->getCurrentApplicationI18n()->isNew() || $update))
    5066    {
    5167      $ua = $app->getUpdatedAt('U');
     
    5874    $req = self::arrayToObject(array(
    5975      'context' => array(
    60         'country' => isset($cul[1]) ? $cul[1] : 'US',
     76        'country' => isset($cul[1]) ? $cul[1] : 'All',
    6177        'language' => $cul[0],
    6278        'view' => 'default',
     
    7793    }
    7894    $gadget = $response[0];
    79     if (empty($app))
    80     {
    81       $app = new Application();
    82     }
    8395    $app->setUrl($gadget['url']);
    84 
    8596    $app->setTitle($gadget['title']);
    8697    $app->setTitleUrl($gadget['titleUrl']);
     
    116127    }
    117128    $app->setHeight(! empty($gadget['height']) ? $gadget['height'] : '0');
    118     $iframe_url = $gadget['iframeUrl'];
    119     $iframe_params = array();
    120     parse_str($iframe_url, $iframe_params);
    121     $app->setVersion(isset($iframe_params['v']) ? $iframe_params['v'] : '');
    122129    $app->save();
    123130    return $app;
     
    160167   * @return Application The application instance
    161168   */
    162   public static function updateApplication($modId, $culture = 'en_US')
     169  public static function updateApplication($modId, $culture = null)
    163170  {
     171    if (is_null($culture))
     172    {
     173      $culture = sfContext::getInstance()->getUser()->getCulture();
     174    }
     175
    164176    $app = self::retrieveByPk($modId);
    165177    if (!$app)
     
    170182    try
    171183    {
    172       return self::addApplication($app->getUrl(), $culture, true);
     184      return self::addApplication($app->getUrl(), true, $culture);
    173185    }
    174186    catch (Exception $e)
  • OpenPNE3/plugins/opOpenSocialPlugin/trunk/lib/user/opJsonDbOpensocialService.class.php

    r10756 r11063  
    7272      }
    7373      $p['profileUrl']   = sfContext::getInstance()->getController()->genUrl("@member_profile?id=".$member->getId(),true);
    74       $memberProfiles = MemberProfilePeer::getProfileListByMemberId($member->getId());
     74      $memberProfiles = $member->getProfile(true, $token->getViewerId());
    7575      foreach ($memberProfiles as $memberProfile)
    7676      {
Note: See TracChangeset for help on using the changeset viewer.