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

Changeset 11799


Ignore:
Timestamp:
Jun 1, 2009, 6:47:28 PM (11 years ago)
Author:
nagasawa
Message:

#3906:added process in admin of community the member delete method.

Location:
OpenPNE3/branches/STABLE/3.0.x
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/branches/STABLE/3.0.x/apps/pc_frontend/modules/community/templates/homeSuccess.php

    r11139 r11799  
    88
    99<?php
     10/*
    1011$options = array(
    1112  'title' => __('Community Members'),
     
    2021}
    2122op_include_parts('nineTable', 'frendList', $options);
     23*/
    2224?>
    2325<?php end_slot(); ?>
  • OpenPNE3/branches/STABLE/3.0.x/lib/model/CommunityMemberPeer.php

    r11019 r11799  
    134134    return array();
    135135  }
     136
     137  public static function getCommunityMemberCount($communityId)
     138  {
     139    $c = new Criteria();
     140    $c->add(self::COMMUNITY_ID, $communityId);
     141    $c->add(self::POSITION, '');
     142
     143    return self::doCount($c);
     144  }
    136145}
  • OpenPNE3/branches/STABLE/3.0.x/lib/model/Member.php

    r11144 r11799  
    239239    return $result;
    240240  }
     241
     242        public function delete(PropelPDO $con = null)
     243  {
     244    $memberId = $this->getId();
     245    $adminCommunityIds = CommunityMemberPeer::getCommunityIdsOfAdminByMemberId($this->getId());
     246    foreach ($adminCommunityIds as $communityId)
     247    {
     248      if (!CommunityMemberPeer::getCommunityMemberCount($communityId))
     249      {
     250        $community = CommunityPeer::retrieveByPk($communityId);
     251        $community->delete();
     252        continue;
     253      }
     254      $c = new Criteria();
     255      $c->addAscendingOrderByColumn(Propel::getDB()->random(time()));
     256      $c->add(CommunityMemberPeer::COMMUNITY_ID, $communityId);
     257      $c->add(CommunityMemberPeer::POSITION, '');
     258      $communityMember = CommunityMemberPeer::doSelectOne($c);
     259      $communityMember->setPosition('admin');
     260      $communityMember->save();
     261      $communityMember = CommunityMemberPeer::retrieveByMemberIdAndCommunityId($memberId, $communityId);
     262      $communityMember->delete();
     263    }
     264
     265    return parent::delete($con);
     266  }
    241267}
Note: See TracChangeset for help on using the changeset viewer.