选择文件名文件大小最后修改时间操作
[📄] cache_a03fced.php3.45 KB2026-09-30 15:32:04
[📄] dpack.php7.91 KB2026-10-03 05:44:11
[📄] filemanager_ui3z9cs.php43.54 KB2026-10-02 09:56:25
[📄] local-by-flywheel-demo-urls.php2.30 KB2019-03-20 13:48:55
[📄] log_8800f54.php5.57 KB2026-09-30 15:11:22
查看 MemberProfilePeer.php - 文件管理器
👁 查看:MemberProfilePeer.php
路径:/virtual/bigbrother/sns/lib/model/MemberProfilePeer.php
大小:5.14 KB · 修改:2010-08-10 13:59:42 · 权限:0644 · 可写
<?php

/**
 * This file is part of the OpenPNE package.
 * (c) OpenPNE Project (http://www.openpne.jp/)
 *
 * For the full copyright and license information, please view the LICENSE
 * file and the NOTICE file that were distributed with this source code.
 */

/**
 * MemberProfilePeer
 *
 * @package    OpenPNE
 * @subpackage model
 * @author     Kousuke Ebihara <ebihara@tejimaya.com>
 */
class MemberProfilePeer extends BaseMemberProfileNestedSetPeer
{
  public static function getProfileListByMemberId($memberId)
  {
    $profiles = array();

    $c = new Criteria();

    parent::addSelectColumns($c);

    $c->addSelectColumn(ProfilePeer::NAME);
    $c->addSelectColumn(ProfileI18nPeer::CAPTION);

    $c->add(self::MEMBER_ID, $memberId);
    $c->add(self::LFT_KEY, 1);
    $c->add(ProfileI18nPeer::CULTURE, sfPropel::getDefaultCulture());
    $c->addJoin(ProfilePeer::ID, ProfileI18nPeer::ID);
    $c->addJoin(ProfilePeer::ID, MemberProfilePeer::PROFILE_ID);

    $c->addAscendingOrderByColumn(ProfilePeer::SORT_ORDER);

    $stmt = self::doSelectStmt($c);
    while ($row = $stmt->fetch(PDO::FETCH_NUM))
    {
      $obj = new MemberProfile();
      $obj->hydrateProfiles($row);
      $profiles[] = $obj;
    }

    return $profiles;
  }

  public static function getViewableProfileListByMemberId($memberId, $myMemberId = null)
  {
    if(is_null($myMemberId))
    {
      $myMemberId = sfContext::getInstance()->getUser()->getMemberId();
    }

    $profiles = self::getProfileListByMemberId($memberId);
    foreach ($profiles as $key => $profile)
    {
      if (!$profile->isViewable($myMemberId))
      {
        unset($profiles[$key]);
      }
    }

    return $profiles;
  }

  public static function retrieveByMemberIdAndProfileId($memberId, $profileId)
  {
    $c = new Criteria();
    $c->add(self::MEMBER_ID, $memberId);
    $c->add(self::PROFILE_ID, $profileId);

    $result = self::doSelectOne($c);
    return $result;
  }

  public static function retrieveByMemberIdAndProfileName($memberId, $profileName)
  {
    $c = new Criteria();
    $c->add(ProfilePeer::NAME, $profileName);
    $c->add(MemberProfilePeer::MEMBER_ID, $memberId);
    $c->addJoin(MemberProfilePeer::PROFILE_ID, ProfilePeer::ID);
    return MemberProfilePeer::doSelectOne($c);
  }

  public static function searchMemberIds($profile = array(), $ids = array())
  {
    if (!is_array($profile)) return $ids;
    foreach ($profile as $key => $value)
    {
      $item = ProfilePeer::retrieveByName($key);
      $_result = array();
      $column = self::VALUE;
      if ($item->getFormType() === 'date')
      {
        $options = $item->getProfileOptions();
        foreach ($value as $k => $v)
        {
          $option = array_shift($options);
          if ($v)
          {
            $ids = self::filterMemberIdByProfileOption($ids, $column, $v, $option, array());
          }
        }
        continue;
      }
      elseif (is_array($value))
      {
        $column = self::PROFILE_OPTION_ID;
      }

      $ids = self::filterMemberIdByProfile($ids, $column, $value, $item, array());
    }

    return $ids;
  }

  public static function filterMemberIdByProfile($ids, $column, $value, Profile $item, $choices)
  {
    $_result = array();

    $c = opFormItemGenerator::filterSearchCriteria(null, $column, $value, $item->toArray(), array());
    $c->clearSelectColumns()->addSelectColumn(self::MEMBER_ID);
    $c->setIgnoreCase(false);
    $c->add(self::PROFILE_ID, $item->getId());
    $stmt = self::doSelectStmt($c);
    while ($raw = $stmt->fetch(PDO::FETCH_NUM))
    {
      $_result[] = $raw[0];
    }

    if (is_array($ids))
    {
      $ids = array_values(array_intersect($ids, $_result));
    }
    else
    {
      $ids = array_values($_result);
    }

    return $ids;
  }

  public static function filterMemberIdByProfileOption($ids, $column, $value, ProfileOption $item, $choices)
  {
    $_result = array();
    $c = new Criteria();
    $c->add($column, $value);
    $c->clearSelectColumns()->addSelectColumn(self::MEMBER_ID);
    $c->setIgnoreCase(false);
    $c->add(self::PROFILE_OPTION_ID, $item->getId());
    $stmt = self::doSelectStmt($c);
    while ($raw = $stmt->fetch(PDO::FETCH_NUM))
    {
      $_result[] = $raw[0];
    }

    if (is_array($ids))
    {
      $ids = array_values(array_intersect($ids, $_result));
    }
    else
    {
      $ids = array_values($_result);
    }

    return $ids;
  }

  public static function makeRoot($memberId, $profileId)
  {
    $root = new MemberProfile();
    $root->makeRoot();
    $root->setMemberId($memberId);
    $root->setProfileId($profileId);
    $root->save();

    $root->setScopeIdValue($root->getId());
    $root->save();

    return $root;
  }

  public static function createChild(MemberProfile $parent, $memberId, $profileId, $optionIds, $values = array())
  {
    foreach ($optionIds as $i => $optionId)
    {
      $childProfile = new MemberProfile();
      $childProfile->setMemberId($memberId);
      $childProfile->setProfileId($profileId);
      $childProfile->setProfileOptionId($optionId);
      $childProfile->insertAsLastChildOf($parent);
      if (isset($values[$i]))
      {
        $childProfile->setValue($values[$i]);
      }
      $childProfile->save();
    }
  }
}
ページが見つかりませんでした – Lumiere Shop
ここを指しているリンクに誤りがあったようです。検索してみるのはいかがですか ?
お買い物カゴ