本文整理汇总了PHP中Member::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::getId方法的具体用法?PHP Member::getId怎么用?PHP Member::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Member
的用法示例。
在下文中一共展示了Member::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setNavigation
protected function setNavigation(Member $member)
{
if ($member->getId() !== $this->getUser()->getMemberId()) {
sfConfig::set('sf_nav_type', 'friend');
sfConfig::set('sf_nav_id', $member->getId());
}
}
示例2: getScheduleByThisDayAndMember
public function getScheduleByThisDayAndMember($year, $month, $day, Member $member)
{
$day = sprintf('%04d-%02d-%02d', (int) $year, (int) $month, (int) $day);
$scheduleIds = Doctrine::getTable('ScheduleMember')->getScheduleIdsByMemberId($member->getId());
$q = $this->createQuery()->select('id, title')->where('start_date <= ?', $day)->andWhere('end_date >= ?', $day);
if (!count($scheduleIds)) {
$q->andWhere('member_id = ?', (int) $member->getId());
} else {
$q->andWhere('member_id = ? OR id IN (' . implode(', ', $scheduleIds) . ')', (int) $member->getId());
}
return $q->execute();
}
示例3: execute
protected function execute($arguments = array(), $options = array())
{
$databaseManager = new sfDatabaseManager($this->configuration);
$n = (int)$options['number'];
$link = $options['link'];
if (!is_null($link))
{
$linkMember = Doctrine::getTable('Member')->find($link);
if (!$linkMember)
{
throw new Exception("not found member: ".$link);
}
}
for ($i = 0; $i < $n; $i++)
{
$member = new Member();
$member->setName('dummy');
$member->setIsActive(self::fetchRandomNotActive($options['notactivemember-rate'], $n));
$member->save();
$member->setName(sprintf($options['name-format'], $member->getId()));
$member->save();
$address = sprintf($options['mail-address-format'], $member->getId());
$member->setConfig('pc_address', $address);
$member->setConfig('mobile_address', $address);
$password = preg_replace("/%d/", $member->getId(), $options['password-format'], 1);
$member->setConfig('password', md5($password));
$this->logSection('member+', $member->getName());
if (isset($linkMember))
{
$memberRelationship1 = new MemberRelationship();
$memberRelationship1->setMember($member);
$memberRelationship1->setMemberRelatedByMemberIdFrom($linkMember);
$memberRelationship1->setIsFriend(true);
$memberRelationship1->save();
$memberRelationship2 = new MemberRelationship();
$memberRelationship2->setMember($linkMember);
$memberRelationship2->setMemberRelatedByMemberIdFrom($member);
$memberRelationship2->setIsFriend(true);
$memberRelationship2->save();
$this->logSection('friend link', sprintf("%s - %s", $linkMember->getId(), $member->getId()));
}
}
}
示例4: payAdvertisingFor
/**
* Distribute provisions for member signup.
*
* ATTENTION: This method does NOT save changes to $advertisedMember. The
* caller is required to save this object!
*
* @param Member $advertisedMember
* @param PropelPDO $con
*/
public function payAdvertisingFor(\Member $referrer, \Tbmt\MemberFee $memberFee, \Member $advertisedMember, $currency, $when, \PropelPDO $con)
{
$advertisedMemberId = $advertisedMember->getId();
$transfer = $referrer->getCurrentTransferBundle($currency, $con);
if ($referrer->getFundsLevel() === \Member::FUNDS_LEVEL1) {
// @see resources/snowball.txt - processes - P1
$transaction = $transfer->createTransactionForReason($referrer, \Transaction::REASON_ADVERTISED_LVL1, $advertisedMemberId, $when, $con);
$memberFee->subtract($transaction->getAmount(), \Transaction::REASON_ADVERTISED_LVL1);
$parent = $referrer->getMemberRelatedByParentId($con);
if ($parent) {
$parentTransfer = $parent->getCurrentTransferBundle($currency, $con);
$parentTransaction = $parentTransfer->createTransactionForReason($parent, \Transaction::REASON_ADVERTISED_INDIRECT, $advertisedMemberId, $when, $con);
$memberFee->subtract($parentTransaction->getAmount(), \Transaction::REASON_ADVERTISED_INDIRECT);
$parentTransfer->save($con);
$parent->save($con);
}
} else {
// if ( $this->getFundsLevel() >= Member::FUNDS_LEVEL2 ) {
// @see resources/snowball.txt - processes - P3
$transaction = $transfer->createTransactionForReason($referrer, \Transaction::REASON_ADVERTISED_LVL2, $advertisedMemberId, $when, $con);
$memberFee->subtract($transaction->getAmount(), \Transaction::REASON_ADVERTISED_LVL2);
}
$transfer->save($con);
\MemberBonusIds::payBonuses($memberFee, $advertisedMember, $currency, $when, $con);
}
示例5: execute
/**
* opDumpMemberTask::execute()
*
* @param array $arguments
* @param array $options
* @return
*/
protected function execute($arguments = array(), $options = array())
{
// initialize the database connection
$databaseManager = new sfDatabaseManager($this->configuration);
$connection = $databaseManager->getDatabase($options['connection'])->getConnection();
$doctrineConnection = $databaseManager->getDatabase($options['connection'])->getDoctrineConnection();
$fp = fopen(sfConfig::get('sf_data_dir') . '/memberlist.csv', 'w');
// gets member list(using pure SQL)
$sql = 'select * from member';
$members = $doctrineConnection->fetchAll($sql, array());
foreach ($members as $member) {
$line = array();
$memberObj = new Member();
$memberObj->fromArray($member);
// nickname is required
$name = $memberObj->getName();
if (empty($name)) {
continue;
}
$line[] = $memberObj->getId();
$line[] = $name;
$email = trim($memberObj->getConfig('pc_address'));
if (empty($email)) {
$email = $memberObj->getConfig('mobile_address');
}
if (empty($email)) {
continue;
}
$line[] = trim($email);
fputcsv($fp, $line, ',', '"');
}
fclose($fp);
}
示例6: createDefaultUserPermissions
static function createDefaultUserPermissions(Contact $user, Member $member, $remove_previous = true) {
$role_id = $user->getUserType();
$permission_group_id = $user->getPermissionGroupId();
$member_id = $member->getId();
try {
if ($remove_previous) {
ContactMemberPermissions::delete("permission_group_id = '$permission_group_id' AND member_id = $member_id");
}
$shtab_permissions = array();
$new_permissions = array();
$role_permissions = self::findAll(array('conditions' => 'role_id = '.$role_id));
foreach ($role_permissions as $role_perm) {
if ($member->canContainObject($role_perm->getObjectTypeId())) {
$cmp = new ContactMemberPermission();
$cmp->setPermissionGroupId($permission_group_id);
$cmp->setMemberId($member_id);
$cmp->setObjectTypeId($role_perm->getObjectTypeId());
$cmp->setCanDelete($role_perm->getCanDelete());
$cmp->setCanWrite($role_perm->getCanWrite());
$cmp->save();
$new_permissions[] = $cmp;
$perm = new stdClass();
$perm->m = $member_id;
$perm->r = 1;
$perm->w = $role_perm->getCanWrite();
$perm->d = $role_perm->getCanDelete();
$perm->o = $role_perm->getObjectTypeId();
$shtab_permissions[] = $perm;
}
}
if (count($shtab_permissions)) {
$cdp = ContactDimensionPermissions::instance()->findOne(array('conditions' => "permission_group_id = '$permission_group_id' AND dimension_id = ".$member->getDimensionId()));
if (!$cdp instanceof ContactDimensionPermission) {
$cdp = new ContactDimensionPermission();
$cdp->setPermissionGroupId($permission_group_id);
$cdp->setContactDimensionId($member->getDimensionId());
$cdp->setPermissionType('check');
$cdp->save();
} else {
if ($cdp->getPermissionType() == 'deny all') {
$cdp->setPermissionType('check');
$cdp->save();
}
}
$stCtrl = new SharingTableController();
$stCtrl->afterPermissionChanged($permission_group_id, $shtab_permissions);
}
return $new_permissions;
} catch (Exception $e) {
throw $e;
}
}
示例7: getSubmembers
static function getSubmembers(Member $member, $recursive = true) {
$members = Members::findAll(array('conditions' => '`parent_member_id` = ' . $member->getId()));
if ($recursive) {
foreach ($members as $m) {
$members = array_merge($members, self::getSubmembers($m, $recursive));
}
}
return $members;
}
示例8: payAdvertisingFor
/**
* Distribute provisions for member signup.
*
* ATTENTION: This method does NOT save changes to $advertisedMember. The
* caller is required to save this object!
*
* @param Member $advertisedMember
* @param PropelPDO $con
*/
public function payAdvertisingFor(\Member $referrer, \Tbmt\MemberFee $memberFee, \Member $advertisedMember, $currency, $when, $freeFromInvitation, \PropelPDO $con)
{
$advertisedMemberId = $advertisedMember->getId();
$transfer = $referrer->getCurrentTransferBundle($currency, $con);
$transaction = $transfer->createTransactionForReason($referrer, \Transaction::REASON_ADVERTISED_LVL1, $advertisedMemberId, $when, $con);
$memberFee->subtract($transaction->getAmount(), \Transaction::REASON_ADVERTISED_LVL1);
$transfer->save($con);
\MemberBonusIds::payBonuses($memberFee, $advertisedMember, $currency, $when, $con);
}
示例9: getInvitationHash
public static function getInvitationHash(\Member $member, $type, $salt)
{
$id = $member->getId();
$num = $member->getNum();
$typeKey = \Member::$INVITATION_BY_KEY[$type];
$data = $id . $num . $type . $typeKey;
return hash_hmac(self::ALGORITHM, $data, $salt . ':' . self::$salt) . $type;
// self::TYPE_ORGLEADER => Cryption::getInvitationHash($id.$num, self::INVITE_ORGLEADER).self::TYPE_ORGLEADER,
// self::TYPE_PROMOTER => Cryption::getInvitationHash($id.$num, self::INVITE_PROMOTER).self::TYPE_PROMOTER
}
示例10: activity_createBonusTransaction
public static function activity_createBonusTransaction(Member $login, Member $recipient, array $data, PropelPDO $con)
{
$currentTransfer = $recipient->getCurrentTransferBundle(self::$BASE_CURRENCY, $con);
$when = time();
$amount = $data['amount'];
$recipient->addOutstandingTotal($amount, self::$BASE_CURRENCY);
$transaction = $currentTransfer->addAmount($amount)->setReason(Transaction::REASON_CUSTOM_BONUS)->setPurpose($data['purpose'])->setRelatedId($login->getId())->setDate($when)->save($con);
$currentTransfer->save($con);
$recipient->save($con);
}
示例11: create
public static function create(Member $login, array $data, PropelPDO $con)
{
$type = $data['type'];
$hash = SystemStats::getIncreasedInvitationIncrementer($con);
$invitation = new Invitation();
if ($type === \Member::TYPE_SUB_PROMOTER) {
$invitation->setMeta(['promoter_num' => $data['promoter_num'], 'promoter_id' => $data['promoter_id']]);
}
$invitation->setHash($hash)->setMemberId($login->getId())->setType($type)->setFreeSignup(isset($data['free_signup']) && $data['free_signup'] ? 1 : 0)->setCreationDate(time())->save($con);
return $invitation;
}
示例12: executeTransaction
protected function executeTransaction($conn, $arguments = array(), $options = array())
{
$n = (int) $options['number'];
$link = $options['link'];
if (null !== $link) {
$linkMember = Doctrine::getTable('Member')->find($link);
if (!$linkMember) {
throw new Exception("not found member: " . $link);
}
}
for ($i = 0; $i < $n; $i++) {
$member = new Member();
$member->setName('dummy');
$member->setIsActive(true);
$member->save();
$member->setName(sprintf($options['name-format'], $member->getId()));
$member->save();
$address = sprintf($options['mail-address-format'], $member->getId());
self::setMemberConfig($member->id, 'pc_address', $address);
self::setMemberConfig($member->id, 'mobile_address', $address);
$password = preg_replace("/%d/", $member->getId(), $options['password-format'], 1);
self::setMemberConfig($member->id, 'password', md5($password));
$this->logSection('member+', $member->getName());
if (isset($linkMember)) {
$memberRelationship1 = new MemberRelationship();
$memberRelationship1->setMemberIdTo($member->id);
$memberRelationship1->setMemberIdFrom($linkMember->id);
$memberRelationship1->setIsFriend(true);
$memberRelationship1->save();
$memberRelationship1->free(true);
$memberRelationship2 = new MemberRelationship();
$memberRelationship2->setMemberIdTo($linkMember->id);
$memberRelationship2->setMemberIdFrom($member->id);
$memberRelationship2->setIsFriend(true);
$memberRelationship2->save();
$memberRelationship2->free(true);
$this->logSection('friend link', sprintf("%s - %s", $linkMember->getId(), $member->getId()));
}
$member->free(true);
}
}
示例13: createDefaultUserPermissions
static function createDefaultUserPermissions(Contact $user, Member $member, $remove_previous = true)
{
$role_id = $user->getUserType();
$permission_group_id = $user->getPermissionGroupId();
$member_id = $member->getId();
try {
DB::beginWork();
if ($remove_previous) {
ContactMemberPermissions::delete("permission_group_id = {$permission_group_id} AND member_id = {$member_id}");
}
$shtab_permissions = array();
$new_permissions = array();
$role_permissions = self::findAll(array('conditions' => 'role_id = ' . $role_id));
foreach ($role_permissions as $role_perm) {
if ($member->canContainObject($role_perm->getObjectTypeId())) {
$cmp = new ContactMemberPermission();
$cmp->setPermissionGroupId($permission_group_id);
$cmp->setMemberId($member_id);
$cmp->setObjectTypeId($role_perm->getObjectTypeId());
$cmp->setCanDelete($role_perm->getCanDelete());
$cmp->setCanWrite($role_perm->getCanWrite());
$cmp->save();
$new_permissions[] = $cmp;
$perm = new stdClass();
$perm->m = $member_id;
$perm->r = 1;
$perm->w = $role_perm->getCanWrite();
$perm->d = $role_perm->getCanDelete();
$perm->o = $role_perm->getObjectTypeId();
$shtab_permissions[] = $perm;
}
}
if (count($shtab_permissions)) {
$stCtrl = new SharingTableController();
$stCtrl->afterPermissionChanged($permission_group_id, $shtab_permissions);
}
DB::commit();
return $new_permissions;
} catch (Exception $e) {
DB::rollback();
throw $e;
}
}
示例14: getSubmembers
static function getSubmembers(Member $member, $recursive = true, $extra_conditions = "", $order_by = null, $order_dir = null, $offset = -1, $limit = -1)
{
if (is_null($order_by)) {
$order_by = "name";
}
if (is_null($order_dir)) {
$order_dir = "ASC";
}
$params = array('conditions' => '`parent_member_id` = ' . $member->getId() . ' ' . $extra_conditions, 'order' => "`{$order_by}` {$order_dir}");
if ($limit > 0 && $offset >= 0) {
$params['limit'] = $limit;
$params['offset'] = $offset;
}
$members = Members::findAll($params);
if ($recursive) {
foreach ($members as $m) {
$members = array_merge($members, self::getSubmembers($m, $recursive));
}
}
return $members;
}
示例15: createBonusTransaction
public static function createBonusTransaction(Member $login, Member $recipient, array $data, PropelPDO $con)
{
$currentTransfer = $recipient->getCurrentTransferBundle(self::$BASE_CURRENCY, $con);
$when = time();
if (!$con->beginTransaction()) {
throw new Exception('Could not begin transaction');
}
try {
$amount = $data['amount'];
$recipient->addOutstandingTotal($amount, self::$BASE_CURRENCY);
$transaction = $currentTransfer->addAmount($amount)->setReason(Transaction::REASON_CUSTOM_BONUS)->setPurpose($data['purpose'])->setRelatedId($login->getId())->setDate($when)->save($con);
$currentTransfer->save($con);
$recipient->save($con);
if (!$con->commit()) {
throw new Exception('Could not commit transaction');
}
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}