当前位置: 首页>>代码示例>>PHP>>正文


PHP Subscription::updateSubscription方法代码示例

本文整理汇总了PHP中Subscription::updateSubscription方法的典型用法代码示例。如果您正苦于以下问题:PHP Subscription::updateSubscription方法的具体用法?PHP Subscription::updateSubscription怎么用?PHP Subscription::updateSubscription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subscription的用法示例。


在下文中一共展示了Subscription::updateSubscription方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setTerminatedStatusForInstance

 /**
  * Sets the terminated status for the passed courseId and courseInstanceId
  * It is usually called from user.php when the user has a subscried status
  * and the subscription_date + duration_subscription is in the past.
  *
  * @param number $courseId
  * @param number $courseInstanceId
  *
  * @return AMA_Error on error or true on success
  *
  * @access public
  *
  * @author giorgio 03/apr/2015
  */
 public function setTerminatedStatusForInstance($courseId, $courseInstanceId)
 {
     $common_dh = $GLOBALS['common_dh'];
     require_once ROOT_DIR . '/switcher/include/Subscription.inc.php';
     $s = new Subscription($this->getId(), $courseInstanceId);
     $s->setSubscriptionStatus(ADA_STATUS_TERMINATED);
     $s->setStartStudentLevel(null);
     // null means no level update
     // search the provider of the current iteration course
     $courseProv = $common_dh->get_tester_info_from_id_course($courseId);
     if (!AMA_DB::isError($courseProv) && is_array($courseProv) && isset($courseProv['puntatore'])) {
         // save the datahandler
         $savedDH = $GLOBALS['dh'];
         // set the datahandler to be used
         $GLOBALS['dh'] = AMA_DataHandler::instance(MultiPort::getDSN($courseProv['puntatore']));
         // update the subscription
         $retval = Subscription::updateSubscription($s);
         // restore the datahandler
         $GLOBALS['dh'] = $savedDH;
         $GLOBALS['dh']->disconnect();
     }
     return isset($retval) ? $retval : null;
 }
开发者ID:eguicciardi,项目名称:ada,代码行数:37,代码来源:ADAUser.inc.php

示例2: Subscription

            $mydh->disconnect();
            if ($conditionSet instanceof CompleteConditionSet) {
                // evaluate the conditionset for this instance ID and course ID
                $is_course_instance_complete = $conditionSet->evaluateSet(array($courseInstanceObj->getId(), $userObj->getId()));
            } else {
                $is_course_instance_complete = false;
            }
            // if course is complete, save this information to the db
            if ($is_course_instance_complete) {
                require_once ROOT_DIR . '/switcher/include/Subscription.inc.php';
                $s = new Subscription($userObj->getId(), $courseInstanceObj->getId());
                $s->setSubscriptionStatus(ADA_SERVICE_SUBSCRIPTION_STATUS_COMPLETED);
                if (isset($userObj->livello) && intval($userObj->livello) > 0) {
                    $s->setStartStudentLevel($userObj->livello);
                }
                $subscribedCount = Subscription::updateSubscription($s);
            }
        }
    }
}
/**
 * end service completeness
 */
/**
 * Authors can edit public courses assigned to themselves
 */
if ($id_profile == AMA_TYPE_AUTHOR && $courseObj instanceof Course && $courseObj->getIsPublic()) {
    $mod_enabled = $userObj->getId() == $courseObj->getAuthorId();
}
/**
 * Template Family
开发者ID:eguicciardi,项目名称:ada,代码行数:31,代码来源:browsing_functions.inc.php

示例3: array

 * Clear node and layout variable in $_SESSION
 */
$variableToClearAR = array('node', 'layout', 'course', 'course_instance');
/**
 * Users (types) allowed to access this module.
*/
$allowedUsersAr = array(AMA_TYPE_SWITCHER);
/**
 * Performs basic controls before entering this module
*/
$neededObjAr = array(AMA_TYPE_SWITCHER => array('layout'));
$trackPageToNavigationHistory = false;
require_once ROOT_DIR . '/include/module_init.inc.php';
//require_once 'include/switcher_functions.inc.php';
include_once '../include/Subscription.inc.php';
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $userStatus = $_POST['status'];
    $id_user = $_POST['id_user'];
    $id_instance = $_POST['id_instance'];
    $s = new Subscription($id_user, $id_instance);
    $s->setSubscriptionStatus($userStatus);
    $s->setStartStudentLevel(null);
    // null means no level update
    $result = Subscription::updateSubscription($s);
    if (AMA_DataHandler::isError($result)) {
        $retArray = array("status" => "ERROR", "msg" => translateFN("Problemi nell'aggiornamento dello stato dell'iscrizione"), "title" => translateFN('Notifica'));
    } else {
        $retArray = array("status" => "OK", "msg" => translateFN("Hai aggiornato correttamente lo stato dell'iscrizione"), "title" => translateFN('Notifica'));
    }
    echo json_encode($retArray);
}
开发者ID:eguicciardi,项目名称:ada,代码行数:31,代码来源:updateSubscription.php


注:本文中的Subscription::updateSubscription方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。