本文整理汇总了PHP中ilObjTest::getQuestionTitlesAndIndexes方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjTest::getQuestionTitlesAndIndexes方法的具体用法?PHP ilObjTest::getQuestionTitlesAndIndexes怎么用?PHP ilObjTest::getQuestionTitlesAndIndexes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjTest
的用法示例。
在下文中一共展示了ilObjTest::getQuestionTitlesAndIndexes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: movePageFormObject
/**
* Move current page
*/
protected function movePageFormObject()
{
global $lng, $ilCtrl, $tpl;
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($ilCtrl->getFormAction($this, "movePage"));
$form->setTitle($lng->txt("test_move_page"));
$old_pos = new ilHiddenInputGUI("q_id");
$old_pos->setValue($_REQUEST['q_id']);
$form->addItem($old_pos);
$questions = $this->object->getQuestionTitlesAndIndexes();
if (!is_array($questions)) {
$questions = array();
}
foreach ($questions as $k => $q) {
if ($k == $_REQUEST['q_id']) {
unset($questions[$k]);
continue;
}
$questions[$k] = $lng->txt('behind') . ' ' . $q;
}
#$questions['0'] = $lng->txt('first');
$options = array(0 => $lng->txt('first'));
foreach ($questions as $k => $q) {
$options[$k] = $q . ' [' . $this->lng->txt('question_id_short') . ': ' . $k . ']';
}
$pos = new ilSelectInputGUI($lng->txt("position"), "position_after");
$pos->setOptions($options);
$form->addItem($pos);
$form->addCommandButton("movePage", $lng->txt("submit"));
$form->addCommandButton("showPage", $lng->txt("cancel"));
return $tpl->setContent($form->getHTML());
}
示例2: prevQuestion
public function prevQuestion()
{
$obj = new ilObjTest($_REQUEST['ref_id']);
$questions = array_keys($obj->getQuestionTitlesAndIndexes());
$pos = array_search($_REQUEST['q_id'], $questions);
if ($pos !== false) {
$next = $questions[$pos - 1];
} else {
$next = $questions[0];
}
$this->ctrl->setParameter($this, 'q_id', $next);
$link = $this->ctrl->getLinkTarget($this, 'edit', '', '', false);
ilUtil::redirect($link);
}
示例3: prevQuestion
public function prevQuestion()
{
$obj = new ilObjTest($_REQUEST['ref_id']);
$questions = array_keys($obj->getQuestionTitlesAndIndexes());
$pos = array_search($_REQUEST['q_id'], $questions);
if ($pos == 0) {
ilUtil::sendInfo('test_express_start_reached_moved_to_last', true);
$next = $questions[count($questions) - 1];
} elseif ($pos !== false) {
$next = $questions[$pos - 1];
} else {
$next = $questions[0];
}
$this->ctrl->setParameter($this, 'q_id', $next);
$link = $this->ctrl->getLinkTarget($this, 'edit', '', '', false);
ilUtil::redirect($link);
}
示例4: exportToExcel
//.........这里部分代码省略.........
for ($pass = 0; $pass <= $data->getParticipant($active_id)->getLastPass(); $pass++) {
$col = $startcol;
$finishdate = $this->test_obj->getPassFinishDate($active_id, $pass);
if ($finishdate > 0) {
if ($pass > 0) {
$row++;
if ($this->test_obj->isRandomTest() || $this->test_obj->getShuffleQuestions()) {
$row++;
}
}
$worksheet->write($row, $col++, ilExcelUtils::_convert_text($pass + 1));
if (is_object($data->getParticipant($active_id)) && is_array($data->getParticipant($active_id)->getQuestions($pass))) {
foreach ($data->getParticipant($active_id)->getQuestions($pass) as $question) {
$question_data = $data->getParticipant($active_id)->getPass($pass)->getAnsweredQuestionByQuestionId($question["id"]);
$worksheet->write($row, $col, ilExcelUtils::_convert_text($question_data["reached"]));
if ($this->test_obj->isRandomTest() || $this->test_obj->getShuffleQuestions()) {
$worksheet->write($row - 1, $col, ilExcelUtils::_convert_text(preg_replace("/<.*?>/", "", $data->getQuestionTitle($question["id"]))), $format_title);
} else {
if ($pass == 0 && !$firstrowwritten) {
$worksheet->write(0, $col, ilExcelUtils::_convert_text(preg_replace("/<.*?>/", "", $data->getQuestionTitle($question["id"]))), $format_title);
}
}
$col++;
}
$firstrowwritten = true;
}
}
}
$counter++;
}
}
if ($this->test_obj->getExportSettingsSingleChoiceShort() && !$this->test_obj->isRandomTest() && $this->test_obj->hasSingleChoiceQuestions()) {
// special tab for single choice tests
$titles =& $this->test_obj->getQuestionTitlesAndIndexes();
$positions = array();
$pos = 0;
$row = 0;
foreach ($titles as $id => $title) {
$positions[$id] = $pos;
$pos++;
}
$usernames = array();
$participantcount = count($data->getParticipants());
$allusersheet = false;
$pages = 0;
$resultsheet =& $workbook->addWorksheet($this->lng->txt("eval_all_users"));
$col = 0;
$resultsheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt('name')), $format_title);
$resultsheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt('login')), $format_title);
if (count($additionalFields)) {
foreach ($additionalFields as $fieldname) {
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})";