本文整理匯總了PHP中Subscription::findSubscriptionsToClassRoom方法的典型用法代碼示例。如果您正苦於以下問題:PHP Subscription::findSubscriptionsToClassRoom方法的具體用法?PHP Subscription::findSubscriptionsToClassRoom怎麽用?PHP Subscription::findSubscriptionsToClassRoom使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Subscription
的用法示例。
在下文中一共展示了Subscription::findSubscriptionsToClassRoom方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _update_students_subscription_after_course_instance_set
/**
* update students subscription status in the passed instance to
* either SUBSCRIBED or TERMINATED as appropriate, checking if
* $duration_subscription + student subscription date is in the past or not
*
* @param number $instance_id
* @param number $duration_subscription
*
* @author giorgio 02/apr/2015
*/
private function _update_students_subscription_after_course_instance_set($instance_id, $duration_subscription)
{
require_once ROOT_DIR . '/switcher/include/Subscription.inc.php';
$subscriptions = Subscription::findSubscriptionsToClassRoom($instance_id);
if (!AMA_DB::isError($subscriptions) && is_array($subscriptions) && count($subscriptions) > 0) {
foreach ($subscriptions as $subscription) {
$updateSubscription = false;
$subscritionEndDate = $this->add_number_of_days($duration_subscription, intval($subscription->getSubscriptionDate()));
if ($subscription->getSubscriptionStatus() == ADA_STATUS_SUBSCRIBED && $subscritionEndDate <= time()) {
$subscription->setSubscriptionStatus(ADA_STATUS_TERMINATED);
$updateSubscription = true;
} else {
if ($subscription->getSubscriptionStatus() == ADA_STATUS_TERMINATED && $subscritionEndDate > time()) {
$subscription->setSubscriptionStatus(ADA_STATUS_SUBSCRIBED);
$updateSubscription = true;
}
}
if ($updateSubscription) {
$subscription->setStartStudentLevel(null);
// null means no level update
subscription::updateSubscription($subscription);
}
}
}
}
示例2: CText
/*
* 1. ottieni gli studenti iscritti a questa istanza
* 2. ottieni gli studenti preiscritti a questa istanza
*/
if (!$courseObj instanceof Course || !$courseObj->isFull()) {
$data = new CText(translateFN('Corso non trovato'));
$data = $data->getHtml();
} else {
if (!$courseInstanceObj instanceof Course_instance || !$courseInstanceObj->isFull()) {
$data = new CText(translateFN('Istanza corso non trovata'));
$data = $data->getHtml();
} else {
$courseId = $courseObj->getId();
$instanceId = $courseInstanceObj->getId();
$presubscriptions = Subscription::findPresubscriptionsToClassRoom($instanceId);
$subscriptions = Subscription::findSubscriptionsToClassRoom($instanceId);
if (count($presubscriptions) == 0 && count($subscriptions) == 0) {
$thead_data = array(translateFN('Notifica'));
$dataAr = array();
$result_table = BaseHtmlLib::tableElement('id:course_instance_Table', $thead_data, $dataAr);
$table = $result_table->getHtml();
} else {
//first: make associative arrays by ID of presubscription
$ids_student = array();
$tmp_presubscriptions = $presubscriptions;
$presubscriptions = array();
foreach ($tmp_presubscriptions as $k => $v) {
$ids_student[] = $v->getSubscriberId();
$presubscriptions[$v->getSubscriberId()] = $v;
}
//second: retrieve data for presubscription