本文整理汇总了PHP中ilLPStatusWrapper::_updateStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP ilLPStatusWrapper::_updateStatus方法的具体用法?PHP ilLPStatusWrapper::_updateStatus怎么用?PHP ilLPStatusWrapper::_updateStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilLPStatusWrapper
的用法示例。
在下文中一共展示了ilLPStatusWrapper::_updateStatus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateQuestionResult
/**
* update question result of run
* @param ilTestSession $session
* @param assQuestion $qst
*/
protected function updateQuestionResult(ilTestSession $session, assQuestion $qst)
{
foreach ($this->run as $run) {
if ($run->questionExists($qst->getId())) {
$GLOBALS['ilLog']->write(__METHOD__ . ': reached points are ' . $qst->getReachedPoints($session->getActiveId(), $session->getPass()));
$run->setQuestionResult($qst->getId(), $qst->getReachedPoints($session->getActiveId(), $session->getPass()));
$run->update();
$res = $run->getResult();
include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php';
$old_result = ilLOUserResults::lookupResult($this->container_id, $this->user_id, $run->getObjectiveId(), $this->getSettings()->getQualifiedTest() == $session->getRefId() ? ilLOUserResults::TYPE_QUALIFIED : ilLOUserResults::TYPE_INITIAL);
$ur = new ilLOUserResults($this->container_id, $this->user_id);
$ur->saveObjectiveResult($run->getObjectiveId(), $this->getSettings()->getQualifiedTest() == $session->getRefId() ? ilLOUserResults::TYPE_QUALIFIED : ilLOUserResults::TYPE_INITIAL, ilLOUtils::isCompleted($this->container_id, $session->getRefId(), $run->getObjectiveId(), $res['max'], $res['reached'], $old_result['limit_perc']) ? ilLOUserResults::STATUS_COMPLETED : ilLOUserResults::STATUS_FAILED, (int) $res['percentage'], $old_result['limit_perc'], $old_result['tries'], $old_result['is_final']);
$GLOBALS['ilLog']->write(__METHOD__ . ': ' . print_r($run->getResult(), true));
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilLPStatusWrapper::_updateStatus($this->container_id, $this->user_id);
}
}
return false;
}
示例2: 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");
}
示例3: __updatePassed
function __updatePassed($a_user_id, $objective_ids)
{
global $ilDB;
$passed = array();
$query = "SELECT COUNT(t1.crs_id) num,t1.crs_id FROM crs_objectives t1 " . "JOIN crs_objectives t2 WHERE t1.crs_id = t2.crs_id and " . $ilDB->in('t1.objective_id', $objective_ids, false, 'integer') . " " . "GROUP BY t1.crs_id";
$res = $ilDB->query($query);
$crs_ids = array();
while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
$query = "SELECT COUNT(cs.objective_id) num_passed FROM crs_objective_status cs " . "JOIN crs_objectives co ON cs.objective_id = co.objective_id " . "WHERE crs_id = " . $ilDB->quote($row->crs_id, 'integer') . " " . "AND user_id = " . $ilDB->quote($a_user_id, 'integer') . " ";
$user_res = $ilDB->query($query);
while ($user_row = $user_res->fetchRow(DB_FETCHMODE_OBJECT)) {
if ($user_row->num_passed == $row->num) {
$passed[] = $row->crs_id;
}
}
$crs_ids[$row->crs_id] = $row->crs_id;
}
if (count($passed)) {
foreach ($passed as $crs_id) {
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$members = ilCourseParticipants::_getInstanceByObjId($crs_id);
$members->updatePassed($a_user_id, true);
}
}
// update tracking status
foreach ($crs_ids as $cid) {
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilLPStatusWrapper::_updateStatus($cid, $a_user_id);
}
}
示例4: increase_attemptAndsave_module_version
/**
* Increases attempts by one and saves module_version for this package
*/
function increase_attemptAndsave_module_version()
{
global $ilDB, $ilUser;
$res = $ilDB->queryF('SELECT package_attempts,count(*) cnt FROM sahs_user WHERE obj_id = %s AND user_id = %s', array('integer', 'integer'), array($this->slm->getId(), $ilUser->getId()));
$val_rec = $ilDB->fetchAssoc($res);
if ($val_rec["cnt"] == 0) {
//offline_mode could be inserted
$attempts = 1;
$ilDB->manipulateF('INSERT INTO sahs_user (obj_id,user_id,package_attempts,module_version,last_access) VALUES(%s,%s,%s,%s,%s)', array('integer', 'integer', 'integer', 'integer', 'timestamp'), array($this->slm->getId(), $ilUser->getId(), $attempts, $this->slm->getModuleVersion(), date('Y-m-d H:i:s')));
} else {
$attempts = $val_rec["package_attempts"];
if ($attempts == null) {
$attempts = 0;
}
$attempts++;
$ilDB->manipulateF('UPDATE sahs_user SET package_attempts = %s, module_version = %s, last_access=%s WHERE obj_id = %s AND user_id = %s ', array('integer', 'integer', 'timestamp', 'integer', 'integer'), array($attempts, $this->slm->getModuleVersion(), date('Y-m-d H:i:s'), $this->slm->getId(), $ilUser->getId()));
}
//only SCORM 1.2, not 2004
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilLPStatusWrapper::_updateStatus($this->slm->getId(), $ilUser->getId());
}
示例5: _unregister
function _unregister($a_usr_id, $a_event_id)
{
global $ilDB;
$query = "SELECT * FROM event_participants " . "WHERE event_id = " . $ilDB->quote($a_event_id, 'integer') . " " . "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " ";
$res = $ilDB->query($query);
if ($res->numRows()) {
$query = "UPDATE event_participants " . "SET registered = 0 " . "WHERE event_id = " . $ilDB->quote($a_event_id, 'integer') . " " . "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " ";
$res = $ilDB->manipulate($query);
} else {
$query = "INSERT INTO event_participants (registered,participated,event_id,usr_id) " . "VALUES( " . "0, " . "0, " . $ilDB->quote($a_event_id, 'integer') . ", " . $ilDB->quote($a_usr_id, 'integer') . " " . ")";
$res = $ilDB->manipulate($query);
}
// refresh learning progress status after updating participant
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilLPStatusWrapper::_updateStatus($a_event_id, $a_usr_id);
return true;
}
示例6: __updateUser
function __updateUser($user_id, $obj_id)
{
$form = $this->initEditUserForm($user_id, $obj_id);
if ($form->checkInput()) {
include_once 'Services/Tracking/classes/class.ilLPMarks.php';
$marks = new ilLPMarks($obj_id, $user_id);
$marks->setMark($form->getInput("mark"));
$marks->setComment($form->getInput("comment"));
$do_lp = false;
// status/completed is optional
$status = $form->getItemByPostVar("completed");
if (is_object($status)) {
if ($marks->getCompleted() != $form->getInput("completed")) {
$marks->setCompleted($form->getInput("completed"));
$do_lp = true;
}
}
$marks->update();
// #11600
if ($do_lp) {
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilLPStatusWrapper::_updateStatus($obj_id, $user_id);
}
}
}
示例7: handleSubmission
/**
* This method is called after an user submitted one or more files.
* It should handle the setting "Completion by Submission" and, if enabled, set the status of
* the current user.
*
* @param integer
* @param integer
* @access protected
*/
protected function handleSubmission($active_id, $pass, $obligationsAnswered)
{
global $ilObjDataCache;
if ($this->isCompletionBySubmissionEnabled()) {
$maxpoints = assQuestion::_getMaximumPoints($this->getId());
if ($this->getUploadedFiles($active_id, $pass)) {
$points = $maxpoints;
} else {
$points = 0;
}
assQuestion::_setReachedPoints($active_id, $this->getId(), $points, $maxpoints, $pass, 1, $obligationsAnswered);
// update learning progress
include_once 'Modules/Test/classes/class.ilObjTestAccess.php';
include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
ilLPStatusWrapper::_updateStatus(ilObjTest::_getObjectIDFromActiveID((int) $active_id), ilObjTestAccess::_getParticipantId((int) $active_id));
}
}
示例8: saveManScoringByQuestion
public function saveManScoringByQuestion()
{
/**
* @var $ilAccess ilAccessHandler
*/
global $ilAccess, $lng;
if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
ilUtil::sendInfo($this->lng->txt('cannot_edit_test'), true);
$this->ctrl->redirectByClass('ilobjtestgui', 'infoScreen');
}
if (!isset($_POST['scoring']) || !is_array($_POST['scoring'])) {
ilUtil::sendFailure($this->lng->txt('tst_save_manscoring_failed_unknown'));
$this->showManScoringByQuestionParticipantsTable();
return;
}
include_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
include_once 'Modules/Test/classes/class.ilObjTestAccess.php';
include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
$oneExceededMaxPoints = false;
$manPointsPost = array();
$skipParticipant = array();
$maxPointsByQuestionId = array();
foreach ($_POST['scoring'] as $pass => $active_ids) {
foreach ((array) $active_ids as $active_id => $questions) {
// check for existing test result data
if (!$this->object->getTestResult($active_id, $pass)) {
if (!isset($skipParticipant[$pass])) {
$skipParticipant[$pass] = array();
}
$skipParticipant[$pass][$active_id] = true;
continue;
}
foreach ((array) $questions as $qst_id => $reached_points) {
if (!isset($manPointsPost[$pass])) {
$manPointsPost[$pass] = array();
}
if (!isset($manPointsPost[$pass][$active_id])) {
$manPointsPost[$pass][$active_id] = array();
}
$maxPointsByQuestionId[$qst_id] = assQuestion::_getMaximumPoints($qst_id);
if ($reached_points > $maxPointsByQuestionId[$qst_id]) {
$oneExceededMaxPoints = true;
}
$manPointsPost[$pass][$active_id][$qst_id] = $reached_points;
}
}
}
if ($oneExceededMaxPoints) {
ilUtil::sendFailure(sprintf($this->lng->txt('tst_save_manscoring_failed'), $pass + 1));
$this->showManScoringByQuestionParticipantsTable($manPointsPost);
return;
}
$changed_one = false;
foreach ($_POST['scoring'] as $pass => $active_ids) {
foreach ((array) $active_ids as $active_id => $questions) {
$update_participant = false;
if ($skipParticipant[$pass][$active_id]) {
continue;
}
foreach ((array) $questions as $qst_id => $reached_points) {
$update_participant = assQuestion::_setReachedPoints($active_id, $qst_id, $reached_points, $maxPointsByQuestionId[$qst_id], $pass, 1, $this->object->areObligationsEnabled());
}
if ($update_participant) {
$changed_one = true;
ilLPStatusWrapper::_updateStatus($this->object->getId(), ilObjTestAccess::_getParticipantId($active_id));
}
}
}
if ($changed_one) {
if ($this->object->getAnonymity() == 0) {
$user_name = $user_name = ilObjUser::_lookupName(ilObjTestAccess::_getParticipantId($active_id));
$name_real_or_anon = $user_name['firstname'] . ' ' . $user_name['lastname'];
} else {
$name_real_or_anon = $lng->txt('anonymous');
}
ilUtil::sendSuccess(sprintf($this->lng->txt('tst_saved_manscoring_successfully'), $pass + 1, $name_real_or_anon), true);
require_once './Modules/Test/classes/class.ilTestScoring.php';
$scorer = new ilTestScoring($this->object);
$scorer->setPreserveManualScores(true);
$scorer->recalculateSolutions();
if ($this->object->getEnableArchiving()) {
require_once 'Modules/Test/classes/class.ilTestArchiveService.php';
$archiveService = new ilTestArchiveService($this->object);
$archiveService->archivePassesByActives($scorer->getRecalculatedPassesByActives());
}
}
$this->showManScoringByQuestionParticipantsTable();
}
示例9: __updateUser
function __updateUser($user_id, $obj_id)
{
global $ilUser;
include_once 'Services/Tracking/classes/class.ilLPMarks.php';
$marks = new ilLPMarks($obj_id, $user_id);
$marks->setMark(ilUtil::stripSlashes($_POST['mark']));
$marks->setComment(ilUtil::stripSlashes($_POST['comment']));
$do_lp = false;
if ($marks->getCompleted() != (bool) $_POST['completed']) {
$marks->setCompleted((bool) $_POST['completed']);
$do_lp = true;
}
$marks->update();
// #11600
if ($do_lp) {
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilLPStatusWrapper::_updateStatus($obj_id, $user_id);
}
}
示例10: deleteTrackingDataOfUsers
function deleteTrackingDataOfUsers($a_users)
{
global $ilDB;
include_once "./Modules/Scorm2004/classes/class.ilSCORM2004DeleteData.php";
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
foreach ($a_users as $user) {
ilSCORM2004DeleteData::removeCMIDataForUserAndPackage($user, $this->getId());
ilLPStatusWrapper::_updateStatus($this->getId(), $user);
}
}
示例11: updateLPFromStatus
/**
* sync course status and lp status
*
* @param int $a_member_id
* @param bool $a_has_passed
*/
protected function updateLPFromStatus($a_member_id, $a_has_passed)
{
global $ilUser;
include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
if (ilObjUserTracking::_enabledLearningProgress() && $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
include_once './Services/Object/classes/class.ilObjectLP.php';
$olp = ilObjectLP::getInstance($this->object->getId());
if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR) {
include_once 'Services/Tracking/classes/class.ilLPMarks.php';
$marks = new ilLPMarks($this->object->getId(), $a_member_id);
// only if status has changed
if ($marks->getCompleted() != $a_has_passed) {
$marks->setCompleted($a_has_passed);
$marks->update();
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilLPStatusWrapper::_updateStatus($this->object->getId(), $a_member_id, null, false, true);
}
}
}
}
示例12: resetLPDataForUserIds
public final function resetLPDataForUserIds(array $a_user_ids, $a_recursive = true)
{
if ((bool) $a_recursive && method_exists($this, "getPossibleCollectionItems")) {
$subitems = $this->getPossibleCollectionItems();
if (is_array($subitems)) {
foreach ($subitems as $sub_ref_id) {
$olp = self::getInstance(ilObject::_lookupObjId($sub_ref_id));
$olp->resetLPDataForUserIds($a_user_ids, false);
}
}
}
$this->resetCustomLPDataForUserIds($a_user_ids, (bool) $a_recursive);
include_once "Services/Tracking/classes/class.ilLPMarks.php";
ilLPMarks::_deleteForUsers($this->obj_id, $a_user_ids);
include_once "Services/Tracking/classes/class.ilChangeEvent.php";
ilChangeEvent::_deleteReadEventsForUsers($this->obj_id, $a_user_ids);
// update LP status to get collections up-to-date
include_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
foreach ($a_user_ids as $user_id) {
ilLPStatusWrapper::_updateStatus($this->obj_id, $user_id);
}
}
示例13: updateLPFromStatus
/**
* sync course status and lp status
*
* @param int $a_member_id
* @param bool $a_has_passed
*/
protected function updateLPFromStatus($a_member_id, $a_has_passed)
{
include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
if (ilObjUserTracking::_enabledLearningProgress() && $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
include_once './Services/Tracking/classes/class.ilLPObjSettings.php';
$lp_settings = new ilLPObjSettings($this->object->getId());
if ($lp_settings->getMode() == LP_MODE_MANUAL_BY_TUTOR) {
include_once 'Services/Tracking/classes/class.ilLPMarks.php';
$marks = new ilLPMarks($this->object->getId(), $a_member_id);
$marks->setCompleted($a_has_passed);
$marks->update();
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilLPStatusWrapper::_updateStatus($this->object->getId(), $a_member_id, null, false, true);
}
}
}
示例14: confirmedDeleteTracking
/**
* Confirmed tracking deletion
*
*/
function confirmedDeleteTracking()
{
foreach ($_POST["user"] as $user) {
include_once "./Modules/Scorm2004/classes/class.ilSCORM2004DeleteData.php";
ilSCORM2004DeleteData::removeCMIDataForUserAndPackage($user, $this->object->getId());
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilLPStatusWrapper::_updateStatus($this->object->getId(), $user);
}
$this->ctrl->redirect($this, "modifyTrackingItems");
}
示例15: deleteTrackingDataOfUsers
function deleteTrackingDataOfUsers($a_users)
{
global $ilDB;
include_once "./Services/Tracking/classes/class.ilChangeEvent.php";
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilChangeEvent::_deleteReadEventsForUsers($this->getId(), $a_users);
foreach ($a_users as $user) {
$ilDB->manipulateF('
DELETE FROM scorm_tracking
WHERE user_id = %s
AND obj_id = %s', array('integer', 'integer'), array($user, $this->getID()));
$ilDB->manipulateF('
DELETE FROM sahs_user
WHERE user_id = %s
AND obj_id = %s', array('integer', 'integer'), array($user, $this->getID()));
ilLPStatusWrapper::_updateStatus($this->getId(), $user);
}
}