本文整理汇总了PHP中ilLPStatusWrapper类的典型用法代码示例。如果您正苦于以下问题:PHP ilLPStatusWrapper类的具体用法?PHP ilLPStatusWrapper怎么用?PHP ilLPStatusWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ilLPStatusWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gatherCourseLPData
function gatherCourseLPData()
{
global $tree, $ilDB;
// process all courses
$all_courses = array_keys(ilObject::_getObjectsByType("crs"));
if ($all_courses) {
// gather objects in trash
$trashed_objects = $tree->getSavedNodeObjIds($all_courses);
include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
include_once "Modules/Course/classes/class.ilCourseParticipants.php";
include_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
foreach ($all_courses as $crs_id) {
// trashed objects will not change
if (!in_array($crs_id, $trashed_objects)) {
// only if LP is active
$mode = ilLPObjSettings::_lookupMode($crs_id);
if ($mode == LP_MODE_DEACTIVATED || $mode == LP_MODE_UNDEFINED) {
continue;
}
// only save once per day
$ilDB->manipulate("DELETE FROM obj_lp_stat WHERE" . " obj_id = " . $ilDB->quote($crs_id, "integer") . " AND fulldate = " . $ilDB->quote(date("Ymd", $this->date), "integer"));
$members = new ilCourseParticipants($crs_id);
$members = $members->getMembers();
$in_progress = count(ilLPStatusWrapper::_lookupInProgressForObject($crs_id, $members));
$completed = count(ilLPStatusWrapper::_lookupCompletedForObject($crs_id, $members));
$failed = count(ilLPStatusWrapper::_lookupFailedForObject($crs_id, $members));
// calculate with other values - there is not direct method
$not_attempted = count($members) - $in_progress - $completed - $failed;
$set = array("type" => array("text", "crs"), "obj_id" => array("integer", $crs_id), "yyyy" => array("integer", date("Y", $this->date)), "mm" => array("integer", date("m", $this->date)), "dd" => array("integer", date("d", $this->date)), "fulldate" => array("integer", date("Ymd", $this->date)), "mem_cnt" => array("integer", count($members)), "in_progress" => array("integer", $in_progress), "completed" => array("integer", $completed), "failed" => array("integer", $failed), "not_attempted" => array("integer", $not_attempted));
$ilDB->insert("obj_lp_stat", $set);
}
}
}
}
示例2: _getInProgress
function _getInProgress($a_obj_id)
{
include_once './Services/Tracking/classes/class.ilChangeEvent.php';
$users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
// Exclude all users with status completed.
$users = array_diff((array) $users, ilLPStatusWrapper::_getCompleted($a_obj_id));
return $users;
}
示例3: _getFailed
function _getFailed($a_obj_id)
{
$objective_results = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
$usr_ids = (array) $objective_results['user_status'][self::LP_STATUS_FAILED_NUM];
if ($usr_ids) {
// Exclude all non members
$usr_ids = array_intersect(self::getMembers($a_obj_id), (array) $usr_ids);
}
return $usr_ids ? $usr_ids : array();
}
示例4: _getFailed
function _getFailed($a_obj_id)
{
$status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
foreach ($status_info['results'] as $user_data) {
if ($user_data['failed']) {
$user_ids[] = $user_data['user_id'];
}
}
return $user_ids ? $user_ids : array();
}
示例5: _getInProgress
/**
* get in progress
*
* @access public
* @param int object id
* @return array int Array of user ids
*/
public function _getInProgress($a_obj_id)
{
include_once './Services/Tracking/classes/class.ilChangeEvent.php';
$users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
// Exclude all users with status completed.
$users = array_diff((array) $users, ilLPStatusWrapper::_getCompleted($a_obj_id));
if ($users) {
// Exclude all non members
$users = array_intersect(self::getMembers($a_obj_id), (array) $users);
}
return $users;
}
示例6: _getInProgress
function _getInProgress($a_obj_id)
{
include_once './Modules/Exercise/classes/class.ilExerciseMembers.php';
include_once './Services/Tracking/classes/class.ilChangeEvent.php';
$users = ilExerciseMembers::_getReturned($a_obj_id);
$all = ilChangeEvent::lookupUsersInProgress($a_obj_id);
$users = $users + $all;
$users = array_diff($users, ilLPStatusWrapper::_getCompleted($a_obj_id));
$users = array_diff($users, ilLPStatusWrapper::_getFailed($a_obj_id));
if ($users) {
// Exclude all non members
$users = array_intersect(self::getMembers($a_obj_id), (array) $users);
}
return $users;
}
示例7: _getCompleted
function _getCompleted($a_obj_id)
{
$usr_ids = array();
$status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
foreach ($status_info['objective_result'] as $user_id => $completed) {
if (count($completed) == $status_info['num_objectives']) {
$usr_ids[] = $user_id;
}
}
if ($usr_ids) {
// Exclude all non members
$usr_ids = array_intersect(self::getMembers($a_obj_id), (array) $usr_ids);
}
return $usr_ids ? $usr_ids : array();
}
示例8: _getCompleted
function _getCompleted($a_obj_id)
{
$status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
$counter = 0;
$users = array();
foreach ($status_info['items'] as $item_id) {
$tmp_users = $status_info['completed'][$item_id];
if (!$counter++) {
$users = $tmp_users;
} else {
$users = array_intersect($users, $tmp_users);
}
}
$users = array_unique($users);
return $users;
}
示例9: determineStatus
/**
* Determine status
*
* @param integer object id
* @param integer user id
* @param object object (optional depends on object type)
* @return integer status
*/
function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
{
global $ilObjDataCache, $ilDB;
$status = LP_STATUS_NOT_ATTEMPTED_NUM;
switch ($ilObjDataCache->lookupType($a_obj_id)) {
case 'lm':
if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
$status = LP_STATUS_IN_PROGRESS_NUM;
// completed?
$status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
$tlt = $status_info['tlt'];
include_once './Services/Tracking/classes/class.ilChangeEvent.php';
$re = ilChangeEvent::_lookupReadEvents($a_obj_id, $a_user_id);
if ($re[0]['spent_seconds'] >= $tlt) {
$status = LP_STATUS_COMPLETED_NUM;
}
}
break;
}
return $status;
}
示例10: saveProgress
function saveProgress()
{
global $ilUser;
include_once 'Services/Tracking/classes/class.ilLPMarks.php';
$lp_marks = new ilLPMarks($this->gui_object->object->getId(), $ilUser->getId());
$lp_marks->setCompleted((bool) $_POST['lp_edit']);
$lp_marks->update();
require_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
ilLPStatusWrapper::_updateStatus($this->gui_object->object->getId(), $ilUser->getId());
$this->lng->loadLanguageModule('trac');
ilUtil::sendSuccess($this->lng->txt('trac_updated_status'), true);
$this->ctrl->redirect($this, "");
// #14993
// $this->showSummary();
}
示例11: refreshStatus
function refreshStatus($a_obj_id)
{
parent::refreshStatus($a_obj_id);
// this is restricted to SCOs in the current collection
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
$in_progress = ilLPStatusWrapper::_getInProgress($a_obj_id);
$completed = ilLPStatusWrapper::_getCompleted($a_obj_id);
$failed = ilLPStatusWrapper::_getFailed($a_obj_id);
$all_active_users = array_unique(array_merge($in_progress, $completed, $failed));
// get all tracked users regardless of SCOs
include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
$subtype = ilObjSAHSLearningModule::_lookupSubType($a_obj_id);
if ($subtype != "scorm2004") {
include_once "./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php";
$all_tracked_users = ilObjSCORMTracking::_getTrackedUsers($a_obj_id);
} else {
include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php";
$all_tracked_users = ilSCORM2004Tracking::_getTrackedUsers($a_obj_id);
}
$not_attempted_users = array_diff($all_tracked_users, $all_active_users);
unset($all_tracked_users);
unset($all_active_users);
// reset all users which have no data for the current SCOs
if ($not_attempted_users) {
foreach ($not_attempted_users as $usr_id) {
// this will update any (parent) collections if necessary
ilLPStatus::writeStatus($a_obj_id, $usr_id, self::LP_STATUS_NOT_ATTEMPTED_NUM, 0);
}
}
}
示例12: confirmedDeleteTracking
/**
* Confirmed tracking deletion
*
* @todo alex, 14 Apr.: This does not confirm to our guidelines, please move DB access to application class
*/
function confirmedDeleteTracking()
{
global $ilDB, $ilUser;
$scos = array();
//get all SCO's of this object
$val_set = $ilDB->queryF('
SELECT cp_node_id FROM cp_node
WHERE nodename = %s
AND cp_node.slm_id = %s', array('text', 'integer'), array('item', $this->object->getId()));
while ($val_rec = $ilDB->fetchAssoc($val_set)) {
array_push($scos, $val_rec['cp_node_id']);
}
foreach ($_POST["user"] as $user) {
foreach ($scos as $sco) {
$ret = $ilDB->manipulateF('
DELETE FROM cmi_node
WHERE user_id = %s
AND cp_node_id = %s', array('integer', 'integer'), array($user, $sco));
}
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilLPStatusWrapper::_updateStatus($this->object->getId(), $user);
}
$this->ctrl->redirect($this, "showTrackingItems");
}
示例13: _insertTrackData
function _insertTrackData($a_sahs_id, $a_lval, $a_rval, $a_obj_id)
{
global $ilDB, $ilUser;
$ilDB->insert('scorm_tracking', array('obj_id' => array('integer', $a_obj_id), 'user_id' => array('integer', $ilUser->getId()), 'sco_id' => array('integer', $a_sahs_id), 'lvalue' => array('text', $a_lval), 'rvalue' => array('clob', $a_rval), 'c_timestamp' => array('timestamp', ilUtil::now())));
if ($a_lval == "cmi.core.lesson_status") {
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilLPStatusWrapper::_updateStatus($a_obj_id, $ilUser->getId());
}
}
示例14: importSuccess
function importSuccess($a_file)
{
global $ilDB, $ilUser;
$scos = array();
//get all SCO's of this object
$val_set = $ilDB->queryF('
SELECT cp_node.cp_node_id FROM cp_node,cp_resource,cp_item
WHERE cp_item.cp_node_id = cp_node.cp_node_id
AND cp_item.resourceid = cp_resource.id
AND scormtype = %s
AND nodename = %s
AND cp_node.slm_id = %s
GROUP BY cp_node.cp_node_id', array('text', 'text', 'integer'), array('sco', 'item', $this->getId()));
while ($val_rec = $ilDB->fetchAssoc($val_set)) {
array_push($scos, $val_rec['cp_node_id']);
}
$fhandle = fopen($a_file, "r");
$obj_id = $this->getID();
$users = array();
$fields = fgetcsv($fhandle, 4096, ';');
while (($csv_rows = fgetcsv($fhandle, 4096, ";")) !== FALSE) {
$data = array_combine($fields, $csv_rows);
//check the format
$statuscheck = 0;
if (count($csv_rows) == 6) {
$statuscheck = 1;
}
if ($this->get_user_id($data["Login"]) > 0) {
$user_id = $this->get_user_id($data["Login"]);
$import = $data["Status"];
if ($import == "") {
$import = 1;
}
//iterate over all SCO's
if ($import == 1) {
foreach ($scos as $sco) {
$sco_id = $sco;
$date = $data['Date'];
$res = $ilDB->queryF('
SELECT * FROM cmi_node
WHERE cp_node_id = %s
AND user_id = %s
AND completion_status = %s
AND success_status = %s
AND c_timestamp = %s', array('integer', 'integer', 'text', 'text', 'timestamp'), array($sco_id, $user_id, 'completed', 'passed', $data['Date']));
if (!$ilDB->numRows($res)) {
$nextId = $ilDB->nextId('cmi_node');
$val_set = $ilDB->manipulateF('
INSERT INTO cmi_node
(cp_node_id,user_id,completion_status,success_status,c_timestamp,cmi_node_id)
VALUES(%s,%s,%s,%s,%s,%s)', array('integer', 'integer', 'text', 'text', 'timestamp', 'integer'), array($sco_id, $user_id, 'completed', 'passed', $data['Date'], $nextId));
}
}
}
$users[] = $user_id;
} else {
//echo "Warning! User $csv_rows[0] does not exist in ILIAS. Data for this user was skipped.\n";
}
}
// update learning progress
foreach ($users as $user_id) {
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilLPStatusWrapper::_updateStatus($this->getId(), $user_id);
}
return 0;
}
示例15: importRaw
/**
* Import raw data
* @global ilDB $ilDB
* @global ilObjUser $ilUser
* @param string $a_file
* @return void
*/
private function importRaw($a_file)
{
global $ilDB, $ilUser;
$fhandle = fopen($a_file, "r");
$fields = fgetcsv($fhandle, pow(2, 16), ';');
$users = array();
while (($csv_rows = fgetcsv($fhandle, pow(2, 16), ";")) !== FALSE) {
$data = array_combine($fields, $csv_rows);
$user_id = $this->parseUserId($data['Userid']);
if (!$user_id) {
continue;
}
$il_sco_id = $this->lookupSCOId($data['Scoid']);
//do the actual import
if ($il_sco_id >= 0) {
$statement = $ilDB->queryF('
SELECT * FROM scorm_tracking
WHERE user_id = %s
AND sco_id = %s
AND lvalue = %s
AND obj_id = %s', array('integer', 'integer', 'text', 'integer'), array($user_id, $il_sco_id, $data['Key'], $this->getID()));
if ($ilDB->numRows($statement) > 0) {
$ilDB->update('scorm_tracking', array('rvalue' => array('clob', $data['Value']), 'c_timestamp' => array('timestamp', $data['Timestamp'])), array('user_id' => array('integer', $user_id), 'sco_id' => array('integer', $il_sco_id), 'lvalue' => array('text', $data['Key']), 'obj_id' => array('integer', $this->getId())));
} else {
$ilDB->insert('scorm_tracking', array('obj_id' => array('integer', $this->getId()), 'user_id' => array('integer', $user_id), 'sco_id' => array('integer', $il_sco_id), 'lvalue' => array('text', $data['Key']), 'rvalue' => array('clob', $data['Value']), 'c_timestamp' => array('timestamp', $data['Timestamp'])));
}
}
}
fclose($fhandle);
include_once './Services/Tracking/classes/class.ilLPStatusWrapper.php';
ilLPStatusWrapper::_refreshStatus($this->getId());
return 0;
}