當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ilObjTest::getQuestionTitlesAndIndexes方法代碼示例

本文整理匯總了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());
 }
開發者ID:bheyser,項目名稱:qplskl,代碼行數:36,代碼來源:class.ilObjTestGUI.php

示例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);
 }
開發者ID:bheyser,項目名稱:qplskl,代碼行數:14,代碼來源:class.ilTestExpressPageObjectGUI.php

示例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);
 }
開發者ID:Walid-Synakene,項目名稱:ilias,代碼行數:17,代碼來源:class.ilTestExpressPageObjectGUI.php

示例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})";
開發者ID:bheyser,項目名稱:qplskl,代碼行數:67,代碼來源:class.ilTestExport.php


注:本文中的ilObjTest::getQuestionTitlesAndIndexes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。