本文整理汇总了PHP中assQuestion类的典型用法代码示例。如果您正苦于以下问题:PHP assQuestion类的具体用法?PHP assQuestion怎么用?PHP assQuestion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了assQuestion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @access public
* @global ilCtrl $ilCtrl
* @global ilLanguage $lng
* @param assQuestion $questionOBJ
* @param ilAssQuestionHintList $questionHintList
* @param ilAssQuestionHintsGUI $parentGUI
* @param string $parentCmd
*/
public function __construct(assQuestion $questionOBJ, ilAssQuestionHintList $questionHintList, ilAssQuestionHintAbstractGUI $parentGUI, $parentCmd, $tableMode = self::TBL_MODE_TESTOUTPUT, ilAssQuestionHintsOrderingClipboard $hintOrderingClipboard = null)
{
global $ilCtrl, $lng;
$this->questionOBJ = $questionOBJ;
$this->tableMode = $tableMode;
$this->hintOrderingClipboard = $hintOrderingClipboard;
$this->setPrefix('tst_question_hints' . $tableMode);
$this->setId('tst_question_hints' . $tableMode);
parent::__construct($parentGUI, $parentCmd);
$this->setTitle(sprintf($lng->txt('tst_question_hints_table_header'), $questionOBJ->getTitle()));
$this->setNoEntriesText($lng->txt('tst_question_hints_table_no_items'));
// we don't take care about offset/limit values, so this avoids segmentation in general
// --> required for ordering via clipboard feature
$this->setExternalSegmentation(true);
$tableData = $questionHintList->getTableData();
$this->setData($tableData);
if ($this->tableMode == self::TBL_MODE_ADMINISTRATION) {
$this->setRowTemplate('tpl.tst_question_hints_administration_table_row.html', 'Modules/TestQuestionPool');
$this->setSelectAllCheckbox('hint_ids[]');
$rowCount = count($tableData);
$this->initAdministrationColumns($rowCount);
$this->initAdministrationCommands($rowCount);
} else {
$this->setRowTemplate('tpl.tst_question_hints_testoutput_table_row.html', 'Modules/TestQuestionPool');
$this->initTestoutputColumns();
$this->initTestoutputCommands();
}
}
示例2: deleteTestsParticipantsQuestionData
/**
* @param assQuestion $question
*/
private function deleteTestsParticipantsQuestionData(assQuestion $question)
{
$activeIds = $this->getActiveIds();
if (!count($activeIds)) {
return null;
}
$this->deleteTestsParticipantsResultsForQuestion($activeIds, $question->getId());
$this->deleteTestsParticipantsTrackingsForQuestion($activeIds, $question->getId());
}
示例3: __construct
/**
* Constructor
*
* @access public
* @param assQuestion $questionOBJ
*/
public function __construct(assQuestion $questionOBJ)
{
$this->questionId = $questionOBJ->getId();
if (!isset($_SESSION[__CLASS__])) {
$_SESSION[__CLASS__] = array();
}
if (!isset($_SESSION[__CLASS__][$this->questionId])) {
$_SESSION[__CLASS__][$this->questionId] = null;
}
}
示例4: initData
/**
*
*/
protected function initData()
{
$rows = array();
$total_of_answers = $this->question->getTotalAnswers();
if ($total_of_answers) {
$rows[] = array('result' => $this->lng->txt('qpl_assessment_total_of_answers'), 'value' => $total_of_answers);
$rows[] = array('result' => $this->lng->txt('qpl_assessment_total_of_right_answers'), 'value' => assQuestion::_getTotalRightAnswers($this->question->getId()) * 100.0);
} else {
$this->disable('header');
}
$this->setData($rows);
}
示例5: deleteTestsParticipantsResultsForQuestion
/**
* @param assQuestion $question
*/
public function deleteTestsParticipantsResultsForQuestion(assQuestion $question)
{
$activeIds = $this->getActiveIds();
if (!count($activeIds)) {
return null;
}
$inActiveIds = $this->db->in('active_fi', $activeIds, false, 'integer');
$this->db->manipulateF("DELETE FROM tst_solutions WHERE question_fi = %s AND {$inActiveIds}", array('integer'), array($question->getId()));
$this->db->manipulateF("DELETE FROM tst_qst_solved WHERE question_fi = %s AND {$inActiveIds}", array('integer'), array($question->getId()));
$this->db->manipulateF("DELETE FROM tst_test_result WHERE question_fi = %s AND {$inActiveIds}", array('integer'), array($question->getId()));
$this->db->manipulate("DELETE FROM tst_pass_result WHERE {$inActiveIds}");
$this->db->manipulate("DELETE FROM tst_result_cache WHERE {$inActiveIds}");
}
示例6: send
/**
* Send notifications
* @return
*/
public function send()
{
global $ilUser;
switch ($this->getType()) {
case self::TYPE_USER_BLOCKED:
foreach ($this->getRecipients() as $rcp) {
$this->initLanguage($rcp);
$this->initMail();
$this->setSubject(sprintf($this->getLanguageText('cont_user_blocked'), $this->getObjectTitle(true)));
$this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('cont_user_blocked2'));
$this->appendBody("\n");
$this->appendBody($this->getLanguageText('cont_user_blocked3') . " '" . $this->getLanguageText('objs_qst') . "' > '" . $this->getLanguageText('cont_blocked_users') . "'");
$this->appendBody("\n");
$this->appendBody($this->getLanguageText('obj_lm') . ": " . $this->getObjectTitle(true));
$this->appendBody("\n");
include_once "./Services/User/classes/class.ilUserUtil.php";
$this->appendBody($this->getLanguageText('user') . ": " . ilUserUtil::getNamePresentation($ilUser->getId(), false, false, ""));
$this->appendBody("\n");
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$this->appendBody($this->getLanguageText('question') . ": " . assQuestion::_getTitle($this->getQuestionId()));
$this->appendBody("\n");
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('cont_lm_mail_permanent_link'));
$this->appendBody("\n");
$this->appendBody($this->createPermanentLink(array(), ""));
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($rcp), array('system'));
}
break;
}
return true;
}
示例7: purgeQuestionIds
private function purgeQuestionIds($questionIds)
{
require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
foreach ($questionIds as $questionId) {
$question = assQuestion::_instantiateQuestion($questionId);
$question->delete($questionId);
}
}
示例8: getQuestion
/**
* @return iQuestionCondition
*/
public function getQuestion()
{
if ($this->question === null && $this->questionId) {
require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
$this->question = assQuestion::_instantiateQuestion($this->questionId);
}
return $this->question;
}
示例9: fetchAdditionalContentEditingModeInformation
/**
* fetches the "additional content editing mode" information from qti item
* and falls back to ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT when no or invalid information is given
*
* @final
* @access protected
* @param type $qtiItem
* @return string $additionalContentEditingMode
*/
protected final function fetchAdditionalContentEditingModeInformation($qtiItem)
{
$additionalContentEditingMode = $qtiItem->getMetadataEntry('additional_cont_edit_mode');
if (!$this->object->isValidAdditionalContentEditingMode($additionalContentEditingMode)) {
$additionalContentEditingMode = assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT;
}
return $additionalContentEditingMode;
}
示例10: stageQuestionsFromSourcePool
private function stageQuestionsFromSourcePool($sourcePoolId)
{
$questionIdMapping = array();
$query = 'SELECT question_id FROM qpl_questions WHERE obj_fi = %s AND complete = %s AND original_id IS NULL';
$res = $this->db->queryF($query, array('integer', 'text'), array($sourcePoolId, 1));
while ($row = $this->db->fetchAssoc($res)) {
$question = assQuestion::_instanciateQuestion($row['question_id']);
$duplicateId = $question->duplicate(true, null, null, null, $this->testOBJ->getId());
$nextId = $this->db->nextId('tst_rnd_cpy');
$this->db->insert('tst_rnd_cpy', array('copy_id' => array('integer', $nextId), 'tst_fi' => array('integer', $this->testOBJ->getTestId()), 'qst_fi' => array('integer', $duplicateId), 'qpl_fi' => array('integer', $sourcePoolId)));
$questionIdMapping[$row['question_id']] = $duplicateId;
}
return $questionIdMapping;
}
示例11: fillRow
/**
* fill row
*
* @access public
* @param
* @return
*/
public function fillRow($data)
{
$this->tpl->setVariable("DATE", ilDatePresentation::formatDate(new ilDate($data['tstamp'], IL_CAL_UNIX)));
$user = ilObjUser::_lookupName($data["user_fi"]);
$this->tpl->setVariable("USER", ilUtil::prepareFormOutput(trim($user["title"] . " " . $user["firstname"] . " " . $user["lastname"])));
$title = "";
if ($data["question_fi"] || $data["original_fi"]) {
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$title = assQuestion::_getQuestionTitle($data["question_fi"]);
if (strlen($title) == 0) {
$title = assQuestion::_getQuestionTitle($data["original_fi"]);
}
$title = $this->lng->txt("assessment_log_question") . ": " . $title;
}
$this->tpl->setVariable("MESSAGE", ilUtil::prepareFormOutput($data['logtext']) . (strlen($title) ? " (" . $title . ")" : ''));
}
示例12: isSyncAfterSaveRequired
/**
* returns the fact wether the presentation of the question sync2pool form
* is required after saving the form or not
*
* @access private
* @return boolean $isSyncAfterSaveRequired
*/
private function isSyncAfterSaveRequired()
{
global $ilUser;
if (!$_GET["calling_test"]) {
return false;
}
if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
return false;
}
if (!$this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id)) {
return false;
}
if (!assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) {
return false;
}
return true;
}
示例13: 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
示例14: copyPoolQuestionIntoPage
/**
* Copy question from pool into page
*
* @param
* @return
*/
function copyPoolQuestionIntoPage($a_q_id, $a_hier_id)
{
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
$question = assQuestion::_instanciateQuestion($a_q_id);
$duplicate_id = $question->copyObject(0, $question->getTitle());
$duplicate = assQuestion::_instanciateQuestion($duplicate_id);
$duplicate->setObjId(0);
// we remove everything not supported by the non-tiny self
// assessment question editor
$q = $duplicate->getQuestion();
// we try to save all latex tags
$try = true;
$ls = '<span class="latex">';
$le = '</span>';
while ($try) {
// search position of start tag
$pos1 = strpos($q, $ls);
if (is_int($pos1)) {
$pos2 = strpos($q, $le, $pos1);
if (is_int($pos2)) {
// both found: replace end tag
$q = substr($q, 0, $pos2) . "[/tex]" . substr($q, $pos2 + 7);
$q = substr($q, 0, $pos1) . "[tex]" . substr($q, $pos1 + 20);
} else {
$try = false;
}
} else {
$try = false;
}
}
$tags = assQuestionGUI::getSelfAssessmentTags();
$tstr = "";
foreach ($tags as $t) {
$tstr .= "<" . $t . ">";
}
$q = ilUtil::secureString($q, true, $tstr);
// self assessment uses nl2br, not p
$duplicate->setQuestion($q);
$duplicate->saveQuestionDataToDb();
$this->q_node->set_attribute("QRef", "il__qst_" . $duplicate_id);
}
示例15: cloneQuestionSetRelatedData
/**
* removes all question set config related data for cloned/copied test
*
* @param ilObjTest $cloneTestOBJ
*/
public function cloneQuestionSetRelatedData($cloneTestOBJ)
{
global $ilLog;
require_once 'Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
$cwo = ilCopyWizardOptions::_getInstance($cloneTestOBJ->getId());
foreach ($this->questions as $key => $question_id) {
$question = assQuestion::_instanciateQuestion($question_id);
$cloneTestOBJ->questions[$key] = $question->duplicate(true, null, null, null, $cloneTestOBJ->getId());
$original_id = assQuestion::_getOriginalId($question_id);
$question = assQuestion::_instanciateQuestion($cloneTestOBJ->questions[$key]);
$question->saveToDb($original_id);
// Save the mapping of old question id <-> new question id
// This will be used in class.ilObjCourse::cloneDependencies to copy learning objectives
$originalKey = $this->testOBJ->getRefId() . '_' . $question_id;
$mappedKey = $cloneTestOBJ->getRefId() . '_' . $cloneTestOBJ->questions[$key];
$cwo->appendMapping($originalKey, $mappedKey);
$ilLog->write(__METHOD__ . ": Added mapping {$originalKey} <-> {$mappedKey}");
}
}