本文整理汇总了PHP中Subscription::setSubscriptionStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP Subscription::setSubscriptionStatus方法的具体用法?PHP Subscription::setSubscriptionStatus怎么用?PHP Subscription::setSubscriptionStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subscription
的用法示例。
在下文中一共展示了Subscription::setSubscriptionStatus方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findSubscriptionsToClassRoom
/**
* Given a classroom identifier, retrieves all the presubscriptions to the
* classroom, if any.
*
* @param integer $classRoomId
* @return array an array of Subscriptions
*/
public static function findSubscriptionsToClassRoom($classRoomId)
{
$dh = $GLOBALS['dh'];
$result = $dh->get_students_for_course_instance($classRoomId);
if (AMA_DataHandler::isError($result)) {
return array();
} else {
$subscriptionsAr = array();
foreach ($result as $r) {
$subscription = new Subscription($r['id_utente'], $classRoomId, $r['data_iscrizione']);
$subscription->setSubscriberFullname($r['nome'] . ' ' . $r['cognome']);
$subscription->setSubscriptionStatus($r['status']);
if (defined('MODULES_CODEMAN') && MODULES_CODEMAN) {
$subscription->setSubscriptionCode($r['codice']);
}
$subscriptionsAr[] = $subscription;
}
return $subscriptionsAr;
}
}
示例2: Subscription
require_once MODULES_SERVICECOMPLETE_PATH . '/include/init.inc.php';
$mydh = AMACompleteDataHandler::instance(MultiPort::getDSN($_SESSION['sess_selected_tester']));
// load the conditionset for this course
$conditionSet = $mydh->get_linked_conditionset_for_course($courseObj->getId());
$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()) {
示例3: 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;
}
示例4: array
}
}
if ($canSubscribeUser) {
$courseProviderAr = $common_dh->get_tester_info_from_id_course($courseObj->getId());
if (!AMA_DB::isError($courseProviderAr) && is_array($courseProviderAr) && isset($courseProviderAr['puntatore'])) {
if (!in_array($courseProviderAr['puntatore'], $subscriberObj->getTesters())) {
// subscribe user to course provider
$canSubscribeUser = Multiport::setUser($subscriberObj, array($courseProviderAr['puntatore']));
if (!$canSubscribeUser) {
$data = new CText(translateFN('Problemi nell\'iscrizione utente al provider del corso.') . ' ' . translateFN('Utente non iscritto'));
}
}
if ($canSubscribeUser) {
$subscriptionDate = 0;
$s = new Subscription($subscriberObj->getId(), $courseInstanceId, $subscriptionDate, $startStudentLevel);
$s->setSubscriptionStatus(ADA_STATUS_SUBSCRIBED);
Subscription::addSubscription($s);
$data = new CText(translateFN('Utente iscritto'));
} else {
$data = new CText(translateFN('Problemi') . ' ' . translateFN('Utente non iscritto'));
}
} else {
$data = new CText(translateFN('Problemi nel recuperare il provider del corso.') . ' ' . translateFN('Utente non iscritto'));
}
} else {
$data = new CText(translateFN('Problemi') . ' ' . translateFN('Utente non iscritto'));
}
} else {
$data = new CText(translateFN('Dati inseriti non validi'));
}
} else {
示例5: 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);
}