本文整理汇总了PHP中assQuestion::_getMaximumPoints方法的典型用法代码示例。如果您正苦于以下问题:PHP assQuestion::_getMaximumPoints方法的具体用法?PHP assQuestion::_getMaximumPoints怎么用?PHP assQuestion::_getMaximumPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assQuestion
的用法示例。
在下文中一共展示了assQuestion::_getMaximumPoints方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initFilter
public function initFilter()
{
$this->setDisableFilterHiding(true);
include_once 'Services/Form/classes/class.ilSelectInputGUI.php';
$available_questions = new ilSelectInputGUI($this->lng->txt('question'), 'question');
$select_questions = array();
if (!$this->getParentObject()->object->isRandomTest()) {
$questions = $this->getParentObject()->object->getTestQuestions();
} else {
$questions = $this->getParentObject()->object->getPotentialRandomTestQuestions();
}
$scoring = ilObjAssessmentFolder::_getManualScoring();
foreach ($questions as $data) {
include_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
$info = assQuestion::_getQuestionInfo($data['question_id']);
$type = $info["question_type_fi"];
if (in_array($type, $scoring)) {
$maxpoints = assQuestion::_getMaximumPoints($data["question_id"]);
if ($maxpoints == 1) {
$maxpoints = ' (' . $maxpoints . ' ' . $this->lng->txt('point') . ')';
} else {
$maxpoints = ' (' . $maxpoints . ' ' . $this->lng->txt('points') . ')';
}
$select_questions[$data["question_id"]] = $data['title'] . $maxpoints . ' [' . $this->lng->txt('question_id_short') . ': ' . $data["question_id"] . ']';
}
}
if (!$select_questions) {
$select_questions[0] = $this->lng->txt('tst_no_scorable_qst_available');
}
$available_questions->setOptions(array('' => $this->lng->txt('please_choose')) + $select_questions);
$this->addFilterItem($available_questions);
$available_questions->readFromSession();
$this->filter['question'] = $available_questions->getValue();
$pass = new ilSelectInputGUI($this->lng->txt('pass'), 'pass');
$passes = array();
$max_pass = $this->getParentObject()->object->getMaxPassOfTest();
for ($i = 1; $i <= $max_pass; $i++) {
$passes[$i] = $i;
}
$pass->setOptions($passes);
$this->addFilterItem($pass);
$pass->readFromSession();
$this->filter['pass'] = $pass->getValue();
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:44,代码来源:class.ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI.php
示例2: 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));
}
}
示例3: _lookupMaximumPointsOfQuestion
/**
* lookup maximimum point
*
* @access public
* @param int question id
* @return
* @static
*/
public static function _lookupMaximumPointsOfQuestion($a_question_id)
{
include_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
return assQuestion::_getMaximumPoints($a_question_id);
}
示例4: buildManScoringParticipantForm
private function buildManScoringParticipantForm($questionGuiList, $activeId, $pass, $initValues = false)
{
global $ilCtrl, $lng;
require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
require_once 'Services/Form/classes/class.ilFormSectionHeaderGUI.php';
require_once 'Services/Form/classes/class.ilCustomInputGUI.php';
require_once 'Services/Form/classes/class.ilCheckboxInputGUI.php';
require_once 'Services/Form/classes/class.ilTextInputGUI.php';
require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php';
$ilCtrl->setParameter($this, 'active_id', $activeId);
$ilCtrl->setParameter($this, 'pass', $pass);
$form = new ilPropertyFormGUI();
$form->setFormAction($ilCtrl->getFormAction($this));
$form->setTitle(sprintf($lng->txt('manscoring_results_pass'), $pass + 1));
$form->setTableWidth('100%');
foreach ($questionGuiList as $questionId => $questionGUI) {
$questionHeader = sprintf($lng->txt('tst_manscoring_question_section_header'), $questionGUI->object->getTitle());
$questionSolution = $questionGUI->getSolutionOutput($activeId, $pass, false, false, true, false, false, true);
$bestSolution = $questionGUI->object->getSuggestedSolutionOutput();
$sect = new ilFormSectionHeaderGUI();
$sect->setTitle($questionHeader . ' [' . $this->lng->txt('question_id_short') . ': ' . $questionGUI->object->getId() . ']');
$form->addItem($sect);
$cust = new ilCustomInputGUI($lng->txt('tst_manscoring_input_question_and_user_solution'));
$cust->setHtml($questionSolution);
$form->addItem($cust);
$text = new ilTextInputGUI($lng->txt('tst_change_points_for_question'), "question__{$questionId}__points");
if ($initValues) {
$text->setValue(assQuestion::_getReachedPoints($activeId, $questionId, $pass));
}
$form->addItem($text);
$nonedit = new ilNonEditableValueGUI($lng->txt('tst_manscoring_input_max_points_for_question'), "question__{$questionId}__maxpoints");
if ($initValues) {
$nonedit->setValue(assQuestion::_getMaximumPoints($questionId));
}
$form->addItem($nonedit);
$area = new ilTextAreaInputGUI($lng->txt('set_manual_feedback'), "question__{$questionId}__feedback");
$area->setUseRTE(true);
if ($initValues) {
$area->setValue($this->object->getManualFeedback($activeId, $questionId, $pass));
}
$form->addItem($area);
if (strlen(trim($bestSolution))) {
$cust = new ilCustomInputGUI($lng->txt('tst_show_solution_suggested'));
$cust->setHtml($bestSolution);
$form->addItem($cust);
}
}
$sect = new ilFormSectionHeaderGUI();
$sect->setTitle($lng->txt('tst_participant'));
$form->addItem($sect);
$check = new ilCheckboxInputGUI($lng->txt('set_manscoring_done'), 'manscoring_done');
if ($initValues && ilTestService::isManScoringDone($activeId)) {
$check->setChecked(true);
}
$form->addItem($check);
$check = new ilCheckboxInputGUI($lng->txt('tst_manscoring_user_notification'), 'manscoring_notify');
$form->addItem($check);
$form->addCommandButton('saveManScoringParticipantScreen', $lng->txt('save'));
$form->addCommandButton('saveReturnManScoringParticipantScreen', $lng->txt('save_return'));
$form->addCommandButton('saveNextManScoringParticipantScreen', $lng->txt('save_and_next'));
return $form;
}
示例5: 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();
}
示例6: _getTotalRightAnswers
/**
* get number of answers for question id (static)
* note: do not use $this inside this method
*
* @param int $a_q_id question id
*/
public static function _getTotalRightAnswers($a_q_id)
{
global $ilDB;
$result = $ilDB->queryF("SELECT question_id FROM qpl_questions WHERE original_id = %s OR question_id = %s", array('integer', 'integer'), array($a_q_id, $a_q_id));
if ($result->numRows() == 0) {
return 0;
}
$found_id = array();
while ($row = $ilDB->fetchAssoc($result)) {
array_push($found_id, $row["question_id"]);
}
$result = $ilDB->query("SELECT * FROM tst_test_result WHERE " . $ilDB->in('question_fi', $found_id, false, 'integer'));
$answers = array();
while ($row = $ilDB->fetchAssoc($result)) {
$reached = $row["points"];
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$max = assQuestion::_getMaximumPoints($row["question_fi"]);
array_push($answers, array("reached" => $reached, "max" => $max));
}
$max = 0.0;
$reached = 0.0;
foreach ($answers as $key => $value) {
$max += $value["max"];
$reached += $value["reached"];
}
if ($max > 0) {
return $reached / $max;
} else {
return 0;
}
}