本文整理汇总了PHP中assQuestion::_setReachedPoints方法的典型用法代码示例。如果您正苦于以下问题:PHP assQuestion::_setReachedPoints方法的具体用法?PHP assQuestion::_setReachedPoints怎么用?PHP assQuestion::_setReachedPoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assQuestion
的用法示例。
在下文中一共展示了assQuestion::_setReachedPoints方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
}
示例2: saveManScoringParticipantScreen
private function saveManScoringParticipantScreen($redirect = true)
{
global $tpl, $ilCtrl, $lng;
$activeId = $this->fetchActiveIdParameter();
$pass = $this->fetchPassParameter($activeId);
$questionGuiList = $this->service->getManScoringQuestionGuiList($activeId, $pass);
$form = $this->buildManScoringParticipantForm($questionGuiList, $activeId, $pass, false);
$form->setValuesByPost();
if (!$form->checkInput()) {
ilUtil::sendFailure(sprintf($lng->txt('tst_save_manscoring_failed'), $pass + 1));
return $this->showManScoringParticipantScreen($form);
}
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$maxPointsByQuestionId = array();
$maxPointsExceeded = false;
foreach ($questionGuiList as $questionId => $questionGui) {
$reachedPoints = $form->getItemByPostVar("question__{$questionId}__points")->getValue();
$maxPoints = assQuestion::_getMaximumPoints($questionId);
if ($reachedPoints > $maxPoints) {
$maxPointsExceeded = true;
$form->getItemByPostVar("question__{$questionId}__points")->setAlert(sprintf($lng->txt('tst_manscoring_maxpoints_exceeded_input_alert'), $maxPoints));
}
$maxPointsByQuestionId[$questionId] = $maxPoints;
}
if ($maxPointsExceeded) {
ilUtil::sendFailure(sprintf($lng->txt('tst_save_manscoring_failed'), $pass + 1));
return $this->showManScoringParticipantScreen($form);
}
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
foreach ($questionGuiList as $questionId => $questionGui) {
$reachedPoints = $form->getItemByPostVar("question__{$questionId}__points")->getValue();
assQuestion::_setReachedPoints($activeId, $questionId, $reachedPoints, $maxPointsByQuestionId[$questionId], $pass, 1, $this->object->areObligationsEnabled());
$feedback = ilUtil::stripSlashes($form->getItemByPostVar("question__{$questionId}__feedback")->getValue(), false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment"));
$this->object->saveManualFeedback($activeId, $questionId, $pass, $feedback);
$notificationData[$questionId] = array('points' => $reachedPoints, 'feedback' => $feedback);
}
include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilLPStatusWrapper::_updateStatus($this->object->getId(), ilObjTestAccess::_getParticipantId($activeId));
$manScoringDone = $form->getItemByPostVar("manscoring_done")->getChecked();
ilTestService::setManScoringDone($activeId, $manScoringDone);
$manScoringNotify = $form->getItemByPostVar("manscoring_notify")->getChecked();
if ($manScoringNotify) {
require_once 'Modules/Test/classes/notifications/class.ilTestManScoringParticipantNotification.php';
$notification = new ilTestManScoringParticipantNotification($this->object->_getUserIdFromActiveId($activeId), $this->object->getRefId());
$notification->setAdditionalInformation(array('test_title' => $this->object->getTitle(), 'test_pass' => $pass + 1, 'questions_gui_list' => $questionGuiList, 'questions_scoring_data' => $notificationData));
$notification->send();
}
require_once './Modules/Test/classes/class.ilTestScoring.php';
$scorer = new ilTestScoring($this->object);
$scorer->setPreserveManualScores(true);
$scorer->recalculateSolutions();
if ($this->object->getAnonymity() == 0) {
$user_name = ilObjUser::_lookupName(ilObjTestAccess::_getParticipantId($activeId));
$name_real_or_anon = $user_name['firstname'] . ' ' . $user_name['lastname'];
} else {
$name_real_or_anon = $lng->txt('anonymous');
}
ilUtil::sendSuccess(sprintf($lng->txt('tst_saved_manscoring_successfully'), $pass + 1, $name_real_or_anon), true);
if ($redirect == true) {
$ilCtrl->redirect($this, 'showManScoringParticipantScreen');
} else {
return;
}
}
示例3: recalculateQuestionScore
/**
* @param $question_gui
* @param $active_id
* @param $pass
* @param $questiondata
*/
public function recalculateQuestionScore($question_gui, $active_id, $pass, $questiondata)
{
if (is_object($question_gui)) {
$reached = $question_gui->object->calculateReachedPoints($active_id, $pass);
$actual_reached = $question_gui->object->adjustReachedPointsByScoringOptions($reached, $active_id, $pass);
assQuestion::_setReachedPoints($active_id, $questiondata['id'], $actual_reached, $question_gui->object->getMaximumPoints(), $pass, false, true);
}
}
示例4: 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();
}
示例5: recalculateQuestionScore
/**
* @param $question_gui
* @param $active_id
* @param $pass
* @param $questiondata
*/
public function recalculateQuestionScore($question_gui, $active_id, $pass, $questiondata)
{
/** @var assQuestion $question_gui */
if (is_object($question_gui)) {
$reached = $question_gui->object->calculateReachedPoints($active_id, $pass);
$actual_reached = $question_gui->object->adjustReachedPointsByScoringOptions($reached, $active_id, $pass);
if ($this->preserve_manual_scores == true && $questiondata['manual'] == '1') {
// Do we need processing here?
} else {
assQuestion::_setReachedPoints($active_id, $questiondata['id'], $actual_reached, $question_gui->object->getMaximumPoints(), $pass, false, true);
}
}
}