当前位置: 首页>>代码示例>>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;未经允许,请勿转载。