本文整理汇总了PHP中assQuestion类的典型用法代码示例。如果您正苦于以下问题:PHP assQuestion类的具体用法?PHP assQuestion怎么用?PHP assQuestion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了assQuestion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
}
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:39,代码来源:class.ilAssQuestionHintsTableGUI.php
示例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());
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:12,代码来源:class.ilDynamicTestQuestionChangeListener.php
示例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;
}
}
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:16,代码来源:class.ilAssQuestionHintsOrderingClipboard.php
示例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);
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:15,代码来源:class.ilQuestionCumulatedStatisticsTableGUI.php
示例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}");
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:16,代码来源:class.ilDynamicTestQuestionChangeListener.php
示例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;
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:38,代码来源:class.ilLMMailNotification.php
示例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);
}
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:8,代码来源:class.ilAssIncompleteQuestionPurger.php
示例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;
}
开发者ID:bheyser,项目名称:qplskl,代码行数:11,代码来源:ilAssLacQuestionProvider.php
示例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;
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:17,代码来源:class.assQuestionImport.php
示例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;
}
开发者ID:bheyser,项目名称:qplskl,代码行数:14,代码来源:class.ilTestRandomQuestionSetStagingPoolBuilder.php
示例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 . ")" : ''));
}
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:23,代码来源:class.ilAssessmentFolderLogTableGUI.php
示例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;
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:24,代码来源:class.ilAssQuestionFeedbackEditingGUI.php
示例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);
}
开发者ID:bheyser,项目名称:qplskl,代码行数:48,代码来源:class.ilPCQuestion.php
示例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}");
}
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:25,代码来源:class.ilTestFixedQuestionSetConfig.php
示例16: fillRow
/**
* Fill table row
*/
protected function fillRow($a_set)
{
global $ilCtrl, $lng;
$this->tpl->setVariable("PAGE_TITLE", ilLMObject::_lookupTitle($a_set["page_id"]));
$this->tpl->setVariable("QUESTION", assQuestion::_getQuestionText($a_set["question_id"]));
include_once "./Services/COPage/classes/class.ilPageQuestionProcessor.php";
$stats = ilPageQuestionProcessor::getQuestionStatistics($a_set["question_id"]);
$this->tpl->setVariable("VAL_ANSWERED", (int) $stats["all"]);
if ($stats["all"] == 0) {
$this->tpl->setVariable("VAL_CORRECT_FIRST", 0);
$this->tpl->setVariable("VAL_CORRECT_SECOND", 0);
$this->tpl->setVariable("VAL_CORRECT_THIRD_OR_MORE", 0);
$this->tpl->setVariable("VAL_NEVER", 0);
} else {
$this->tpl->setVariable("VAL_CORRECT_FIRST", $stats["first"] . " (" . 100 / $stats["all"] * $stats["first"] . " %)");
$this->tpl->setVariable("VAL_CORRECT_SECOND", $stats["second"] . " (" . 100 / $stats["all"] * $stats["second"] . " %)");
$this->tpl->setVariable("VAL_CORRECT_THIRD_AND_MORE", $stats["third_or_more"] . " (" . 100 / $stats["all"] * $stats["third_or_more"] . " %)");
$nev = $stats["all"] - $stats["first"] - $stats["second"] - $stats["third_or_more"];
$this->tpl->setVariable("VAL_NEVER", $nev . " (" . 100 / $stats["all"] * $nev . " %)");
}
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:24,代码来源:class.ilLMQuestionListTableGUI.php
示例17: isAnswered
/**
* returns boolean wether the question
* is answered during test pass or not
*
* (overwrites method in class assQuestion)
*
* @param integer $active_id
* @param integer $pass
* @return boolean $answered
*/
public function isAnswered($active_id, $pass)
{
$answered = assQuestion::doesSolutionRecordsExist($active_id, $pass, $this->getId());
return $answered;
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:15,代码来源:class.assSingleChoice.php
示例18: saveFormCmd
/**
* saves the form on successfull validation and redirects to showForm command
*
* @access private
* @global ilCtrl $ilCtrl
* @global ilLanguage $lng
*/
private function saveFormCmd()
{
global $ilCtrl, $lng, $ilUser;
$form = $this->buildForm();
if ($form->checkInput()) {
$questionHint = new ilAssQuestionHint();
if ((int) $form->getInput('hint_id')) {
$questionHint->load((int) $form->getInput('hint_id'));
$hintJustCreated = false;
} else {
$questionHint->setQuestionId($this->questionOBJ->getId());
$questionHint->setIndex(ilAssQuestionHintList::getNextIndexByQuestionId($this->questionOBJ->getId()));
$hintJustCreated = true;
}
$questionHint->setText($form->getInput('hint_text'));
$questionHint->setPoints($form->getInput('hint_points'));
$questionHint->save();
ilUtil::sendSuccess($lng->txt('tst_question_hints_form_saved_msg'), true);
$originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
if ($_GET["calling_test"] && $originalexists && assQuestion::_isWriteable($this->questionOBJ->original_id, $ilUser->getId())) {
$ilCtrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_CONFIRM_SYNC);
}
if ($hintJustCreated && $this->questionOBJ->isAdditionalContentEditingModePageObject()) {
$ilCtrl->setParameterByClass('ilasshintpagegui', 'hint_id', $questionHint->getId());
$ilCtrl->redirectByClass('ilasshintpagegui', 'edit');
} else {
$ilCtrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST);
}
}
ilUtil::sendFailure($lng->txt('tst_question_hints_form_invalid_msg'));
$this->showFormCmd($form);
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:40,代码来源:class.ilAssQuestionHintGUI.php
示例19: setTabs
/**
* Set tabs
*/
function setTabs()
{
if ($this->getSelfAssessmentMode()) {
return;
}
global $ilTabs, $ilCtrl, $lng;
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
if ($this->content_obj != "") {
$q_ref = $this->content_obj->getQuestionReference();
}
if ($q_ref != "") {
$inst_id = ilInternalLink::_extractInstOfTarget($q_ref);
if (!($inst_id > 0)) {
$q_id = ilInternalLink::_extractObjIdOfTarget($q_ref);
}
}
$ilTabs->addTarget("question", $ilCtrl->getLinkTarget($this, "edit"), array("editQuestion", "save", "cancel", "addSuggestedSolution", "cancelExplorer", "linkChilds", "removeSuggestedSolution", "addPair", "addTerm", "delete", "deleteTerms", "editMode", "upload", "saveEdit", "uploadingImage", "uploadingImagemap", "addArea", "deletearea", "saveShape", "back", "saveEdit", "changeGapType", "createGaps", "addItem", "addYesNo", "addTrueFalse", "toggleGraphicalAnswers", "setMediaMode"), "");
if ($q_id > 0) {
if (assQuestion::_getQuestionType($q_id) != "assTextQuestion") {
require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
$tabCommands = assQuestionGUI::getCommandsFromClassConstants('ilAssQuestionFeedbackEditingGUI');
$tabLink = ilUtil::appendUrlParameterString($ilCtrl->getLinkTargetByClass('ilAssQuestionFeedbackEditingGUI', ilAssQuestionFeedbackEditingGUI::CMD_SHOW), "q_id=" . (int) $q_id);
$ilTabs->addTarget('feedback', $tabLink, $tabCommands, $ilCtrl->getCmdClass(), '');
}
}
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:30,代码来源:class.ilPCQuestionGUI.php
示例20: exportToExcel
//.........这里部分代码省略.........
if (strcmp($fieldname, "matriculation") == 0) {
$resultsheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt('matriculation')), $format_title);
}
}
}
$resultsheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt('test')), $format_title);
foreach ($titles as $title) {
$resultsheet->write($row, $col++, ilExcelUtils::_convert_text($title), $format_title);
}
$row++;
foreach ($data->getParticipants() as $active_id => $userdata) {
$username = !is_null($userdata) && ilExcelUtils::_convert_text($userdata->getName()) ? ilExcelUtils::_convert_text($userdata->getName()) : "ID {$active_id}";
if (array_key_exists($username, $usernames)) {
$usernames[$username]++;
$username .= " ({$i})";
} else {
$usernames[$username] = 1;
}
$col = 0;
$resultsheet->write($row, $col++, $username);
$resultsheet->write($row, $col++, $userdata->getLogin());
if (count($additionalFields)) {
$userfields = ilObjUser::_lookupFields($userdata->getUserID());
foreach ($additionalFields as $fieldname) {
if (strcmp($fieldname, "matriculation") == 0) {
if (strlen($userfields[$fieldname])) {
$resultsheet->write($row, $col++, ilExcelUtils::_convert_text($userfields[$fieldname]));
} else {
$col++;
}
}
}
}
$resultsheet->write($row, $col++, ilExcelUtils::_convert_text($this->test_obj->getTitle()));
$pass = $userdata->getScoredPass();
if (is_object($userdata) && is_array($userdata->getQuestions($pass))) {
foreach ($userdata->getQuestions($pass) as $question) {
$objQuestion =& $this->test_obj->_instanciateQuestion($question["aid"]);
if (is_object($objQuestion) && strcmp($objQuestion->getQuestionType(), 'assSingleChoice') == 0) {
$solution = $objQuestion->getSolutionValues($active_id, $pass);
$pos = $positions[$question["aid"]];
$selectedanswer = chr(65 + $solution[0]["value1"]);
$resultsheet->write($row, $col + $pos, ilExcelUtils::_convert_text($selectedanswer));
}
}
}
$row++;
}
}
} else {
// test participant result export
$usernames = array();
$participantcount = count($data->getParticipants());
$allusersheet = false;
$pages = 0;
$i = 0;
foreach ($data->getParticipants() as $active_id => $userdata) {
$i++;
$username = !is_null($userdata) && ilExcelUtils::_convert_text($userdata->getName()) ? ilExcelUtils::_convert_text($userdata->getName()) : "ID {$active_id}";
if (array_key_exists($username, $usernames)) {
$usernames[$username]++;
$username .= " ({$i})";
} else {
$usernames[$username] = 1;
}
if ($participantcount > 250) {
if (!$allusersheet || $pages - 1 < floor($row / 64000)) {
$resultsheet =& $workbook->addWorksheet($this->lng->txt("eval_all_users") . ($pages > 0 ? " (" . ($pages + 1) . ")" : ""));
$allusersheet = true;
$row = 0;
$pages++;
}
} else {
$resultsheet =& $workbook->addWorksheet($username);
}
if (method_exists($resultsheet, "writeString")) {
$pass = $userdata->getScoredPass();
$row = $allusersheet ? $row : 0;
$resultsheet->writeString($row, 0, ilExcelUtils::_convert_text(sprintf($this->lng->txt("tst_result_user_name_pass"), $pass + 1, $userdata->getName())), $format_bold);
$row += 2;
if (is_object($userdata) && is_array($userdata->getQuestions($pass))) {
foreach ($userdata->getQuestions($pass) as $question) {
require_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$question = assQuestion::_instanciateQuestion($question["id"]);
if (is_object($question)) {
$row = $question->setExportDetailsXLS($resultsheet, $row, $active_id, $pass, $format_title, $format_bold);
}
}
}
}
}
}
$workbook->close();
if ($deliver) {
ilUtil::deliverFile($excelfile, $testname, "application/vnd.ms-excel", false, true);
exit;
} else {
return $excelfile;
}
}
开发者ID:bheyser,项目名称:qplskl,代码行数:101,代码来源:class.ilTestExport.php
注:本文中的assQuestion类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论