本文整理汇总了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