當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Subscription::setStatus方法代碼示例

本文整理匯總了PHP中Subscription::setStatus方法的典型用法代碼示例。如果您正苦於以下問題:PHP Subscription::setStatus方法的具體用法?PHP Subscription::setStatus怎麽用?PHP Subscription::setStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Subscription的用法示例。


在下文中一共展示了Subscription::setStatus方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: body

 protected function body()
 {
     if (!$this->userHasPrivileges(User::groupsJoinPrivate, User::groupsJoinPublic, User::groupsRequest)) {
         return false;
     }
     if (!$this->isInputValid(array('id' => 'isIndex'))) {
         return false;
     }
     $groupId = $this->getParams('id');
     /**
      * @var $group \Group
      */
     $group = Repositories::findEntity(Repositories::Group, $groupId);
     // Calculate privileges of the user
     $user = User::instance();
     $canJoinPrivate = User::instance()->hasPrivileges(User::groupsJoinPrivate);
     $groupIsPrivate = $group->getType() == \Group::TYPE_PRIVATE;
     $hasSufficientPrivileges = $groupIsPrivate && ($canJoinPrivate || $user->hasPrivileges(User::groupsRequest)) || !$groupIsPrivate && $user->hasPrivileges(User::groupsJoinPublic);
     if (!$hasSufficientPrivileges) {
         return $this->death(StringID::InsufficientPrivileges);
     }
     $status = $canJoinPrivate || !$groupIsPrivate ? \Subscription::STATUS_SUBSCRIBED : \Subscription::STATUS_REQUESTED;
     // Put into database
     $subscription = new \Subscription();
     $subscription->setGroup($group);
     $subscription->setUser(User::instance()->getEntity());
     $subscription->setStatus($status);
     Repositories::persistAndFlush($subscription);
     return true;
 }
開發者ID:pombredanne,項目名稱:xmlcheck-public,代碼行數:30,代碼來源:AddSubscription.php

示例2: index


//.........這裏部分代碼省略.........
             }
         }
         if (!empty($userid)) {
             foreach ($userid as $uid) {
                 $metaUser = new metaUser($uid);
                 $metaUser->establishFocus($plan);
                 $metaUser->focusSubscription->applyUsage($planid, 'none', 1);
                 $subscriptionid[] = $metaUser->focusSubscription->id;
             }
         }
         // Also show active users now
         if (!in_array('active', $groups)) {
             $groups[] = 'active';
         }
     }
     $set_status = trim(aecGetParam('set_status', null));
     $add_or_set_expiration = trim(aecGetParam('add_or_set_expiration', null));
     $set_time = trim(aecGetParam('set_time', null));
     $set_time_unit = trim(aecGetParam('set_time_unit', null));
     if ((!empty($set_status) || !empty($add_or_set_expiration)) && is_array($subscriptionid) && count($subscriptionid) > 0) {
         foreach ($subscriptionid as $k) {
             $subscriptionHandler = new Subscription();
             if (!empty($k)) {
                 $subscriptionHandler->load($k);
             } else {
                 $subscriptionHandler->createNew($k, '', 1);
             }
             if (strcmp($set_status, 'now') === 0) {
                 $subscriptionHandler->expire();
                 if (!in_array('expired', $groups)) {
                     $groups[] = 'expired';
                 }
             } elseif (strcmp($set_status, 'exclude') === 0) {
                 $subscriptionHandler->setStatus('Excluded');
                 if (!in_array('excluded', $groups)) {
                     $groups[] = 'excluded';
                 }
             } elseif (strcmp($set_status, 'close') === 0) {
                 $subscriptionHandler->setStatus('Closed');
                 if (!in_array('closed', $groups)) {
                     $groups[] = 'closed';
                 }
             } elseif (strcmp($set_status, 'hold') === 0) {
                 $subscriptionHandler->setStatus('Hold');
                 if (!in_array('hold', $groups)) {
                     $groups[] = 'hold';
                 }
             } elseif (strcmp($set_status, 'include') === 0) {
                 $subscriptionHandler->setStatus('Active');
                 if (!in_array('active', $groups)) {
                     $groups[] = 'active';
                 }
             } elseif (strcmp($set_status, 'lifetime') === 0) {
                 if (!$subscriptionHandler->isLifetime()) {
                     $subscriptionHandler->expiration = '9999-12-31 00:00:00';
                     $subscriptionHandler->lifetime = 1;
                 }
                 $subscriptionHandler->setStatus('Active');
                 if (!in_array('active', $groups)) {
                     $groups[] = 'active';
                 }
             }
             if ($set_status !== 'lifetime' && !empty($add_or_set_expiration) && !empty($set_time) && !empty($set_time_unit)) {
                 if ($add_or_set_expiration == 'set') {
                     $subscriptionHandler->setExpiration($set_time_unit, $set_time, 0);
                     $subscriptionHandler->lifetime = 0;
開發者ID:Ibrahim1,項目名稱:aec,代碼行數:67,代碼來源:admin.acctexp.php

示例3: handleRequest

 protected function handleRequest(\Subscription $subscriptionRequest)
 {
     $subscriptionRequest->setStatus(\Subscription::STATUS_SUBSCRIBED);
     Repositories::persistAndFlush($subscriptionRequest);
 }
開發者ID:pombredanne,項目名稱:xmlcheck-public,代碼行數:5,代碼來源:PermitSubscription.php


注:本文中的Subscription::setStatus方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。