本文整理汇总了PHP中ilCourseParticipants::getDateTimeOfPassed方法的典型用法代码示例。如果您正苦于以下问题:PHP ilCourseParticipants::getDateTimeOfPassed方法的具体用法?PHP ilCourseParticipants::getDateTimeOfPassed怎么用?PHP ilCourseParticipants::getDateTimeOfPassed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilCourseParticipants
的用法示例。
在下文中一共展示了ilCourseParticipants::getDateTimeOfPassed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseLearningProgressPlaceholders
/**
* Return all Placeholders of Learning Progress data
*
* @param ilObjCourse $course
* @param ilObjUser $user
* @return array
*/
protected function parseLearningProgressPlaceholders(ilObjCourse $course, ilObjUser $user)
{
$passed_datetime = ilCourseParticipants::getDateTimeOfPassed($course->getId(), $user->getId());
$lp_fields = array('first_access', 'last_access', 'percentage', 'status', 'read_count', 'childs_spent_seconds');
$lp_data = ilTrQuery::getObjectsDataForUser($user->getId(), $course->getId(), $course->getRefId(), '', '', 0, 9999, null, $lp_fields);
$lp_avg = $this->buildAvgPercentageOfCourseObjects($lp_data);
$lp_crs = array();
$max_last_access = 0;
foreach ($lp_data['set'] as $v) {
if ($v['type'] == 'crs') {
$lp_crs = $v;
$lp_crs['first_access'] = strtotime($v['first_access']);
// First access is not stored as UNIX timestamp...
}
if ($v['last_access'] > $max_last_access) {
$max_last_access = $v['last_access'];
}
}
$lp_crs['last_access'] = $max_last_access;
// calculates spent time different for scorm modules if enabled in config
/** @var $cert_def srCertificateDefinition */
$cert_definition = $this->certificate->getDefinition();
if ($cert_definition->getScormTiming()) {
$spent_seconds = 0;
require_once './Services/Object/classes/class.ilObjectLP.php';
$ilScormLP = ilObjectLP::getInstance($course->getId());
/**
* @var $ilLPCollection ilLPCollection
*/
$ilLPCollection = $ilScormLP->getCollectionInstance();
if ($ilLPCollection instanceof ilLPCollection) {
foreach ($ilLPCollection->getItems() as $item) {
$spent_seconds += $this->getSpentSeconds(ilObject::_lookupObjectId($item), $user->getId());
}
}
$lp_crs['childs_spent_seconds'] = $spent_seconds;
}
$lp_spent_time = $this->buildLpSpentTime($lp_crs);
return array('DATE_COMPLETED' => $this->formatDate('DATE_COMPLETED', strtotime($passed_datetime)), 'DATETIME_COMPLETED' => $this->formatDateTime('DATETIME_COMPLETED', strtotime($passed_datetime)), 'LP_FIRST_ACCESS' => $this->formatDateTime('LP_FIRST_ACCESS', (int) $lp_crs['first_access']), 'LP_LAST_ACCESS' => $this->formatDateTime('LP_LAST_ACCESS', (int) $lp_crs['last_access']), 'LP_SPENT_TIME' => $lp_spent_time, 'LP_SPENT_SECONDS' => $lp_crs['childs_spent_seconds'], 'LP_READ_COUNT' => $lp_crs['read_count'], 'LP_STATUS' => $lp_crs['status'], 'LP_AVG_PERCENTAGE' => $lp_avg);
}
示例2: deliverCertificateObject
function deliverCertificateObject()
{
global $ilUser, $ilAccess;
$user_id = null;
if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
$user_id = $_REQUEST["member_id"];
}
if (!$user_id) {
$user_id = $ilUser->getId();
}
include_once "Services/Certificate/classes/class.ilCertificate.php";
if (!ilCertificate::isActive() || !ilCertificate::isObjectActive($this->object->getId()) || !ilCourseParticipants::getDateTimeOfPassed($this->object->getId(), $user_id)) {
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this);
}
include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php";
$certificate = new ilCertificate(new ilCourseCertificateAdapter($this->object));
$certificate->outCertificate(array("user_id" => $user_id), true);
}
示例3: _hasUserCertificate
/**
* Check if user has certificate for course
*
* Used in ilObjCourseListGUI
*
* @param int $a_usr_id
* @param int $a_obj_id
* @return bool
*/
static function _hasUserCertificate($a_usr_id, $a_obj_id)
{
if (isset(self::$has_certificate[$a_usr_id][$a_obj_id])) {
return self::$has_certificate[$a_usr_id][$a_obj_id];
}
// obsolete?
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
return ilCourseParticipants::getDateTimeOfPassed($a_obj_id, $a_usr_id);
}