本文整理汇总了PHP中ilObjTest::isComplete方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjTest::isComplete方法的具体用法?PHP ilObjTest::isComplete怎么用?PHP ilObjTest::isComplete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjTest
的用法示例。
在下文中一共展示了ilObjTest::isComplete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ilObjTest
/**
* Returns true, if a test is complete for use
*
* @return boolean True, if the test is complete for use, otherwise false
* @access public
*/
function _isComplete($obj_id)
{
global $tree, $ilDB, $ilPluginAdmin;
$test = new ilObjTest($obj_id, false);
$test->loadFromDb();
require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
$testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $ilPluginAdmin, $test);
return $test->isComplete($testQuestionSetConfigFactory->getQuestionSetConfig());
}
示例2: buildPageViewToolbar
//.........这里部分代码省略.........
// if ($optionKeys[0] != $qid) {
// //$ilToolbar->addFormButton($lng->txt("test_prev_question"), "prevQuestion");
// $ilToolbar->addLink($lng->txt("test_prev_question"), $ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'prevQuestion'));
// $addSeparator = true;
// }
// else {
// $ilToolbar->addSpacer(45);
// }
//
// if ($optionKeys[count($optionKeys)-1] != $qid) {
// //$ilToolbar->addFormButton($lng->txt("test_next_question"), "nextQuestion");
// $ilToolbar->addLink($lng->txt("test_next_question"), $ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'nextQuestion'));
// $addSeparator = true;
// }
// else {
// $ilToolbar->addSpacer(45);
// }
//
// //if ($addSeparator) {
// $ilToolbar->addSeparator();
// //}
if (count($questions)) {
if (isset($show_separator) && $show_separator) {
$ilToolbar->addSeparator();
}
$btn = ilLinkButton::getInstance();
$btn->setCaption("test_prev_question");
$btn->setUrl($ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'prevQuestion'));
$ilToolbar->addButtonInstance($btn);
if (count($options) <= 1 || $optionKeys[0] == $qid) {
$btn->setDisabled(true);
}
$btn = ilLinkButton::getInstance();
$btn->setCaption("test_next_question");
$btn->setUrl($ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'nextQuestion'));
$ilToolbar->addButtonInstance($btn);
if (count($options) <= 1 || $optionKeys[count($optionKeys) - 1] == $qid) {
$btn->setDisabled(true);
}
}
if (count($questions) > 1) {
$ilToolbar->addSeparator();
include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
$si = new ilSelectInputGUI($lng->txt("test_jump_to"), "q_id");
$si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\"");
$si->setOptions($options);
if ($qid) {
$si->setValue($qid);
}
$ilToolbar->addInputItem($si, true);
}
$total = $this->object->evalTotalPersons();
/*if (count($options)) {
include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
$si = new ilSelectInputGUI($lng->txt("test_jump_to"), "q_id");
$si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\"");
$si->setOptions($options);
if ($qid) {
$si->setValue($qid);
}
$ilToolbar->addInputItem($si, true);
}*/
if (count($questions) && !$total) {
$ilCtrl->setParameter($this, 'q_id', $_REQUEST['q_id']);
$ilToolbar->addSeparator();
$ilToolbar->addButton($lng->txt("test_delete_page"), $ilCtrl->getLinkTarget($this, "removeQuestions"));
}
if (count($questions) > 1 && !$total) {
$ilToolbar->addSeparator();
$ilToolbar->addButton($lng->txt("test_move_page"), $ilCtrl->getLinkTarget($this, "movePageForm"));
}
global $ilAccess, $ilUser;
$online_access = false;
if ($this->object->getFixedParticipants()) {
include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
$online_access_result = ilObjTestAccess::_lookupOnlineTestAccess($this->object->getId(), $ilUser->getId());
if ($online_access_result === true) {
$online_access = true;
}
}
if ($this->object->isOnline() && $this->object->isComplete($this->testQuestionSetConfigFactory->getQuestionSetConfig())) {
if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id)) {
$testSession = $this->testSessionFactory->getSession();
$executable = $this->object->isExecutable($testSession, $ilUser->getId(), $allowPassIncrease = TRUE);
if ($executable["executable"]) {
$player_factory = new ilTestPlayerFactory($this->object);
$player_instance = $player_factory->getPlayerGUI();
if ($testSession->getActiveId() > 0) {
$ilToolbar->addSeparator();
$ilToolbar->addButton($lng->txt('tst_resume_test'), $ilCtrl->getLinkTarget($player_instance, 'resumePlayer'));
} else {
$ilToolbar->addSeparator();
$ilToolbar->addButton($lng->txt('tst_start_test'), $ilCtrl->getLinkTarget($player_instance, 'startTest'));
}
}
}
}
}
示例3: saveFormCmd
private function saveFormCmd($isConfirmedSave = false)
{
$form = $this->buildForm();
// form validation and initialisation
$errors = !$form->checkInput();
// ALWAYS CALL BEFORE setValuesByPost()
$form->setValuesByPost();
// NEVER CALL THIS BEFORE checkInput()
// Sarcasm? No. Because checkInput checks the form graph against the POST without
// actually setting the values into the form. Sounds ridiculous? Indeed, and it is.
// return to form when any form validation errors exist
if ($errors) {
ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
return $this->showFormCmd($form);
}
// return to form when online is to be set, but no questions are configured
$currentQuestionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfig();
if ($form->getItemByPostVar('online')->getChecked() && !$this->testOBJ->isComplete($currentQuestionSetConfig)) {
$form->getItemByPostVar('online')->setAlert($this->lng->txt("cannot_switch_to_online_no_questions_andor_no_mark_steps"));
ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
return $this->showFormCmd($form);
}
// solve conflicts with question set type setting with confirmation screen if required
// determine wether question set type relating data is to be removed (questions/pools)
$questionSetTypeRelatingDataCleanupRequired = false;
if ($form->getItemByPostVar('question_set_type') instanceof ilFormPropertyGUI) {
$oldQuestionSetType = $this->testOBJ->getQuestionSetType();
$newQuestionSetType = $form->getItemByPostVar('question_set_type')->getValue();
if (!$this->testOBJ->participantDataExist() && $newQuestionSetType != $oldQuestionSetType) {
$oldQuestionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfigByType($oldQuestionSetType);
if ($oldQuestionSetConfig->doesQuestionSetRelatedDataExist()) {
if (!$isConfirmedSave) {
if ($oldQuestionSetType == ilObjTest::QUESTION_SET_TYPE_FIXED) {
return $this->showConfirmation($form, $oldQuestionSetType, $newQuestionSetType, $this->testOBJ->hasQuestionsWithoutQuestionpool());
}
return $this->showConfirmation($form, $oldQuestionSetType, $newQuestionSetType, false);
}
$questionSetTypeRelatingDataCleanupRequired = true;
}
if ($form->getItemByPostVar('online')->getChecked()) {
$form->getItemByPostVar('online')->setChecked(false);
if ($this->testOBJ->isOnline()) {
$infoMsg = $this->lng->txt("tst_set_offline_due_to_switched_question_set_type_setting");
} else {
$infoMsg = $this->lng->txt("tst_cannot_online_due_to_switched_quest_set_type_setting");
}
ilUtil::sendInfo($infoMsg, true);
}
}
}
// adjust use previous answers setting due to desired question set type
if ($newQuestionSetType != ilObjTest::QUESTION_SET_TYPE_FIXED) {
$form->getItemByPostVar('chb_use_previous_answers')->setValue(0);
}
// perform saving the form data
$this->performSaveForm($form);
// clean up test mode relating configuration data (questions/questionpools)
if ($questionSetTypeRelatingDataCleanupRequired) {
$oldQuestionSetConfig->removeQuestionSetRelatedData();
}
// disinvite all invited users if required
if (!$this->testOBJ->participantDataExist() && !$this->testOBJ->getFixedParticipants()) {
foreach ($this->testOBJ->getInvitedUsers() as $usrId => $usrData) {
$this->testOBJ->disinviteUser($usrId);
}
}
// redirect to form output
ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
$this->ctrl->redirect($this, self::CMD_SHOW_FORM);
}
示例4: ilObjTest
/**
* Returns true, if a test is complete for use
*
* @return boolean True, if the test is complete for use, otherwise false
* @access public
*/
function _isComplete($obj_id)
{
$test = new ilObjTest($obj_id, false);
$test->loadFromDb();
return $test->isComplete();
}