本文整理汇总了PHP中CBuser::unsetUsersNotNeeded方法的典型用法代码示例。如果您正苦于以下问题:PHP CBuser::unsetUsersNotNeeded方法的具体用法?PHP CBuser::unsetUsersNotNeeded怎么用?PHP CBuser::unsetUsersNotNeeded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBuser
的用法示例。
在下文中一共展示了CBuser::unsetUsersNotNeeded方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
//.........这里部分代码省略.........
$paidUserExtension = cbpaidUserExtension::getInstance($user->id);
$subscriptions = $paidUserExtension->getUserSubscriptions(null, false);
foreach ($subscriptions as $s) {
if ($s->parent_plan == $plan->get('parent') && $s->checkIfValid()) {
$sPlan = $s->getPlan();
if ($sPlan->get('exclusive') && $sPlan->get('item_type') == 'usersubscription') {
// check if any other exclusive subscription with same parent plan is active:
$incompatible = true;
break;
}
}
}
}
}
if (!$incompatible) {
if ($plan->get('parent')) {
$plansMgr = cbpaidPlansMgr::getInstance();
$parentPlan = $plansMgr->loadPlan($plan->get('parent'));
$parentSub = $parentPlan->loadLatestSomethingOfUser($user->id, null);
if (!$parentSub) {
$incompatible = true;
}
}
}
if ($incompatible) {
if (!in_array($user->id, $incompatibleUsersSubs)) {
$incompatibleUsersSubs[] = $user->id;
}
continue;
}
if (!$this->dryrun) {
$userFull = CBuser::getUserDataInstance($user->id);
$this->createSomething($plan, $userFull, $this->state, $subscriptionTime);
CBuser::unsetUsersNotNeeded(array((int) $user->id));
}
}
} else {
$cbpaidTimes = cbpaidTimes::getInstance();
$systemTimeZone = new DateTimeZone($cbpaidTimes->systemTimeZone());
foreach ($users as $user) {
@set_time_limit(60);
foreach ($planStateDate[(int) $user->id] as $psd) {
$plan = $plansMgr->loadPlan((int) $psd['plan']);
$status = $psd['status'];
if ($psd['date']) {
$date = DateTime::createFromFormat('Y-m-d H:i:s', $psd['date'], $systemTimeZone);
$subscriptionTime = $date->getTimestamp();
} else {
$subscriptionTime = $cbpaidTimes->startTime();
}
$incompatible = false;
if (in_array($user->id, $usersSubscribed)) {
if ($plan->get('exclusive') && $plan->get('item_type') == 'usersubscription') {
$paidUserExtension = cbpaidUserExtension::getInstance($user->id);
$subscriptions = $paidUserExtension->getUserSubscriptions(null, false);
foreach ($subscriptions as $s) {
if ($s->parent_plan == $plan->get('parent') && $s->checkIfValid()) {
$sPlan = $s->getPlan();
if ($sPlan->get('exclusive') && $sPlan->get('item_type') == 'usersubscription') {
// check if any other exclusive subscription with same parent plan is active:
$incompatible = true;
break;
}
}
}
}
示例2: renderInvoice
/**
* USED by XML interface ONLY !!! Renders invoice
*
* @param string $value
* @param ParamsInterface $params
* @return string HTML to display
*/
public function renderInvoice( $value, &$params ) {
global $_CB_framework;
if ( ( $_CB_framework->getUi() == 2 ) && ( $_CB_framework->myId() != 0 ) ) {
if ( cbpaidApp::getBaseClass() === null ) {
//TODO: check if this is even needed:
$pseudoPlugin = new getcbpaidsubscriptionsTab();
$pseudoPlugin->params =& $params;
cbpaidApp::getBaseClass( $pseudoPlugin );
}
$baseClass =& cbpaidApp::getBaseClass();
$itsmyself = true; // simulate user's view of invoice.
$baseClass->outputRegTemplate();
if ( strpos( cbGetParam( $_GET, 'invoice' ), ',') === false ) {
if ( $this->load( (int) $value ) ) {
$user = CBuser::getUserDataInstance( (int) $this->user_id );
}
return $this->displayInvoice( $user, $itsmyself, true );
} else {
$html = '<div class="cbregmultipage">';
foreach ( explode( ',', cbGetParam( $_GET, 'invoice' ) ) as $basketId ) {
$paymentBasket = new self();
if ( $paymentBasket->load( (int) $basketId ) ) {
$user = CBuser::getUserDataInstance( (int) $paymentBasket->user_id );
}
$html .= $paymentBasket->displayInvoice( $user, $itsmyself, false )
. '<hr class="cbregpagebreak" />';
if ( is_callable( array( 'CBuser', 'unsetUsersNotNeeded' ) ) ) {
// CB 1.8+:
CBuser::unsetUsersNotNeeded( array( (int) $paymentBasket->user_id ) );
}
unset( $paymentBasket, $user );
}
$html .= '</div>';
}
return $html;
}
return null;
}