本文整理汇总了PHP中ilCourseParticipants::_updatePassed方法的典型用法代码示例。如果您正苦于以下问题:PHP ilCourseParticipants::_updatePassed方法的具体用法?PHP ilCourseParticipants::_updatePassed怎么用?PHP ilCourseParticipants::_updatePassed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilCourseParticipants
的用法示例。
在下文中一共展示了ilCourseParticipants::_updatePassed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleEvent
/**
* Handle an event in a listener.
*
* @param string $a_component component, e.g. "Modules/Forum" or "Services/User"
* @param string $a_event event e.g. "createUser", "updateUser", "deleteUser", ...
* @param array $a_parameter parameter array (assoc), array("name" => ..., "phone_office" => ...)
*/
static function handleEvent($a_component, $a_event, $a_parameter)
{
global $ilUser;
if ($a_component == "Services/Tracking" && $a_event == "updateStatus") {
// #13905
include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
if (!ilObjUserTracking::_enabledLearningProgress()) {
return;
}
$obj_id = $a_parameter["obj_id"];
$user_id = $a_parameter["usr_id"];
$status = $a_parameter["status"];
if ($obj_id && $user_id) {
if (ilObject::_lookupType($obj_id) != "crs") {
return;
}
// determine couse setting only once
if (!isset(self::$course_mode[$obj_id])) {
include_once "./Modules/Course/classes/class.ilObjCourse.php";
$crs = new ilObjCourse($obj_id, false);
if ($crs->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
include_once './Services/Object/classes/class.ilObjectLP.php';
$olp = ilObjectLP::getInstance($obj_id);
$mode = $olp->getCurrentMode();
} else {
$mode = false;
}
self::$course_mode[$obj_id] = $mode;
}
$is_completed = $status == ilLPStatus::LP_STATUS_COMPLETED_NUM;
// we are NOT using the members object because of performance issues
switch (self::$course_mode[$obj_id]) {
case ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR:
// #11600
include_once "Modules/Course/classes/class.ilCourseParticipants.php";
ilCourseParticipants::_updatePassed($obj_id, $user_id, $is_completed, true);
break;
case ilLPObjSettings::LP_MODE_COLLECTION:
case ilLPObjSettings::LP_MODE_OBJECTIVES:
// overwrites course passed status if it was set automatically (full sync)
// or toggle manually set passed status to completed (1-way-sync)
$do_update = $is_completed;
include_once "Modules/Course/classes/class.ilCourseParticipants.php";
if (!$do_update) {
$part = new ilCourseParticipants($obj_id);
$passed = $part->getPassedInfo($user_id);
if (!is_array($passed) || $passed["user_id"] == -1) {
$do_update = true;
}
}
if ($do_update) {
ilCourseParticipants::_updatePassed($obj_id, $user_id, $is_completed);
}
break;
}
}
}
}
示例2: handleEvent
/**
* Handle an event in a listener.
*
* @param string $a_component component, e.g. "Modules/Forum" or "Services/User"
* @param string $a_event event e.g. "createUser", "updateUser", "deleteUser", ...
* @param array $a_parameter parameter array (assoc), array("name" => ..., "phone_office" => ...)
*/
static function handleEvent($a_component, $a_event, $a_parameter)
{
global $ilUser;
if ($a_component == "Services/Tracking" && $a_event == "updateStatus") {
$obj_id = $a_parameter["obj_id"];
$user_id = $a_parameter["usr_id"];
$status = $a_parameter["status"];
if ($obj_id && $user_id) {
if (ilObject::_lookupType($obj_id) != "crs") {
return;
}
// determine couse setting only once
if (!isset(self::$course_mode[$obj_id])) {
include_once "./Modules/Course/classes/class.ilObjCourse.php";
$crs = new ilObjCourse($obj_id, false);
if ($crs->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
include_once './Services/Tracking/classes/class.ilLPObjSettings.php';
$lp_settings = new ilLPObjSettings($obj_id);
$mode = $lp_settings->getMode();
} else {
$mode = false;
}
self::$course_mode[$obj_id] = $mode;
}
$is_completed = $status == LP_STATUS_COMPLETED_NUM;
// we are NOT using the members object because of performance issues
switch (self::$course_mode[$obj_id]) {
case LP_MODE_MANUAL_BY_TUTOR:
include_once "Modules/Course/classes/class.ilCourseParticipants.php";
ilCourseParticipants::_updatePassed($obj_id, $user_id, $is_completed, $ilUser->getId());
break;
case LP_MODE_COLLECTION:
case LP_MODE_OBJECTIVES:
if ($is_completed) {
include_once "Modules/Course/classes/class.ilCourseParticipants.php";
ilCourseParticipants::_updatePassed($obj_id, $user_id, $is_completed, -1);
}
break;
}
}
}
}