4 require_once
'./Services/Table/classes/class.ilTable2GUI.php';
5 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
134 $this->
setId(
'qpl_brows_tabl_' . $this->testOBJ->getId());
141 $this->
setStyle(
'table',
'fullwidth');
143 $this->
addColumn($this->lng->txt(
"tst_question_title"),
'title',
'');
144 $this->
addColumn($this->lng->txt(
"description"),
'description',
'');
145 $this->
addColumn($this->lng->txt(
"tst_question_type"),
'ttype',
'');
146 $this->
addColumn($this->lng->txt(
"author"),
'author',
'');
147 $this->
addColumn($this->lng->txt(
'qst_lifecycle'),
'lifecycle',
'');
148 $this->
addColumn($this->lng->txt(
"create_date"),
'created',
'');
149 $this->
addColumn($this->lng->txt(
"last_update"),
'tstamp',
'');
151 $this->
addColumn($this->lng->txt(
"working_time"),
'working_time',
'');
153 $this->
setRowTemplate(
"tpl.il_as_tst_question_browser_row.html",
"Modules/Test");
161 $this->
enable(
'select_all');
168 $this->writeAccess = $value;
179 $this->
addMultiCommand(self::CMD_INSERT_QUESTIONS, $this->lng->txt(
'insert'));
188 switch ($this->ctrl->getNextClass($this)) {
189 case strtolower(__CLASS__):
192 $cmd = $this->ctrl->getCmd() .
'Cmd';
193 return $this->$cmd();
197 $this->ctrl->setReturn($this, self::CMD_BROWSE_QUESTIONS);
198 return parent::executeCommand();
206 $this->mainTpl->setContent($this->ctrl->getHTML($this));
212 $this->ctrl->redirect($this, self::CMD_BROWSE_QUESTIONS);
218 $this->ctrl->redirect($this, self::CMD_BROWSE_QUESTIONS);
223 $selected_array = (is_array(
$_POST[
'q_id'])) ?
$_POST[
'q_id'] : array();
224 if (!count($selected_array)) {
226 $this->ctrl->redirect($this, self::CMD_BROWSE_QUESTIONS);
229 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
235 foreach ($selected_array as $key => $value) {
236 $last_question_id = $this->testOBJ->insertQuestion($testQuestionSetConfig, $value);
243 $this->testOBJ->saveCompleteStatus($testQuestionSetConfig);
248 ilUtil::sendSuccess($this->lng->txt(
"tst_questions_inserted"),
true);
258 $this->ctrl->saveParameter($this, self::CONTEXT_PARAMETER);
259 if (isset(
$_GET[self::CONTEXT_PARAMETER])) {
261 } elseif (isset(
$_POST[self::CONTEXT_PARAMETER])) {
265 $this->ctrl->saveParameter($this, self::MODE_PARAMETER);
266 if (isset(
$_GET[self::MODE_PARAMETER])) {
268 } elseif (isset(
$_POST[self::MODE_PARAMETER])) {
275 if (isset(
$_POST[self::CONTEXT_PARAMETER])) {
276 return $_POST[self::CONTEXT_PARAMETER];
279 if (isset(
$_GET[self::CONTEXT_PARAMETER])) {
280 return $_GET[self::CONTEXT_PARAMETER];
288 if (isset(
$_POST[self::MODE_PARAMETER])) {
289 return $_POST[self::MODE_PARAMETER];
292 if (isset(
$_GET[self::MODE_PARAMETER])) {
293 return $_GET[self::MODE_PARAMETER];
301 $this->tabs->clearTargets();
302 $this->tabs->clearSubTabs();
304 $this->tabs->setBackTarget(
318 return $this->lng->txt(
'backtocallingtest');
323 return $this->ctrl->getLinkTargetByClass(
332 case self::CONTEXT_LIST_VIEW:
334 return 'ilObjTestGUI';
336 case self::CONTEXT_PAGE_VIEW:
338 return 'ilTestExpressPageObjectGUI';
347 case self::CONTEXT_LIST_VIEW:
351 case self::CONTEXT_PAGE_VIEW:
362 case self::MODE_BROWSE_POOLS:
364 return $this->lng->txt(
'tst_browse_for_qpl_questions');
366 case self::MODE_BROWSE_TESTS:
368 return $this->lng->txt(
'tst_browse_for_tst_questions');
376 return $this->ctrl->getLinkTarget($this, self::CMD_BROWSE_QUESTIONS);
382 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
383 $ti =
new ilTextInputGUI($this->lng->txt(
"tst_qbt_filter_question_title"),
"title");
384 $ti->setMaxLength(64);
386 $ti->setValidationRegexp(
'/(^[^%]+$)|(^$)/is');
388 $ti->readFromSession();
389 $this->
filter[
"title"] = $ti->getValue();
392 $ti =
new ilTextInputGUI($this->lng->txt(
"description"),
"description");
393 $ti->setMaxLength(64);
395 $ti->setValidationRegexp(
'/(^[^%]+$)|(^$)/is');
397 $ti->readFromSession();
398 $this->
filter[
"description"] = $ti->getValue();
402 $ti->setMaxLength(64);
405 $ti->setValidationRegexp(
'/(^[^%]+$)|(^$)/is');
406 $ti->readFromSession();
407 $this->
filter[
"author"] = $ti->getValue();
410 $lifecycleOptions = array_merge(
411 array(
'' => $this->lng->txt(
'qst_lifecycle_filter_all')),
414 $lifecycleInp =
new ilSelectInputGUI($this->lng->txt(
'qst_lifecycle'),
'lifecycle');
415 $lifecycleInp->setOptions($lifecycleOptions);
417 $lifecycleInp->readFromSession();
418 $this->
filter[
'lifecycle'] = $lifecycleInp->getValue();
421 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
422 include_once(
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
425 $options[
""] = $this->lng->txt(
'filter_all_question_types');
426 foreach ($types as $translation => $row) {
427 $options[$row[
'type_tag']] = $translation;
431 $si->setOptions($options);
433 $si->readFromSession();
438 $ti->setMaxLength(64);
440 $ti->setValidationRegexp(
'/(^[^%]+$)|(^$)/is');
442 $ti->readFromSession();
443 $this->
filter[
'parent_title'] = $ti->getValue();
446 require_once
'Services/Form/classes/class.ilRepositorySelectorInputGUI.php';
448 $ri->setHeaderMessage($this->lng->txt(
'question_browse_area_info'));
450 $ri->setClickableTypes(array(
'tst'));
452 $ri->setClickableTypes(array(
'qpl'));
455 $ri->readFromSession();
456 $this->
filter[
'repository_root_node'] = $ri->getValue();
462 case self::MODE_BROWSE_POOLS:
464 return $this->lng->txt(
'qpl');
466 case self::MODE_BROWSE_TESTS:
468 return $this->lng->txt(
'tst');
485 $this->tpl->setVariable(
"QUESTION_ID",
$data[
"question_id"]);
486 $this->tpl->setVariable(
"QUESTION_TITLE",
$data[
"title"]);
487 $this->tpl->setVariable(
"QUESTION_COMMENT",
$data[
"description"]);
488 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
490 $this->tpl->setVariable(
"QUESTION_AUTHOR",
$data[
"author"]);
494 $this->tpl->setVariable(
"QUESTION_POOL",
$data[
'parent_title']);
495 $this->tpl->setVariable(
496 "QUESTION_POOL_OR_TEST_TITLE",
498 (
int)
$data[
"obj_fi"],
499 $data[
"parent_title"]
502 $this->tpl->setVariable(
"WORKING_TIME", $data[
'working_time']);
508 case self::MODE_BROWSE_POOLS:
509 return $this->buildPossiblyLinkedQuestonPoolTitle(
519 case self::MODE_BROWSE_TESTS:
520 return $this->buildPossiblyLinkedTestTitle(
539 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
548 return $testQuestionSetConfigFactory->getQuestionSetConfig();
556 $questionList =
new ilAssQuestionList($this->db, $this->lng, $this->refinery, $this->pluginAdmin);
559 $questionList->setExcludeQuestionIdsFilter($this->testOBJ->getExistingQuestions());
561 $repositoryRootNode = self::REPOSITORY_ROOT_NODE_ID;
564 if ($item->getValue() !==
false) {
565 switch ($item->getPostVar()) {
573 $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
576 case 'repository_root_node':
578 $repositoryRootNode = $item->getValue();
585 if (!count($parentObjectIds)) {
589 $questionList->setParentObjIdsFilter($parentObjectIds);
592 $questionList->load();
594 return $questionList->getQuestionDataArray();
608 $parents = $this->tree->getSubTree(
609 $this->tree->getNodeData($repositoryRootNode),
614 $parentIds = array();
616 foreach ($parents as $nodeData) {
617 if ($nodeData[
'obj_id'] == $this->testOBJ->getId()) {
621 $parentIds[ $nodeData[
'obj_id'] ] = $nodeData[
'obj_id'];
624 $parentIds = array_map(
'intval', array_values($parentIds));
628 return array_intersect($parentIds, $available_pools);
631 return array_filter($parentIds,
function ($obj_id) {
633 $refId = current($refIds);
634 return $this->access->checkAccess(
'write',
'',
$refId);
getBrowseQuestionsTabUrl()
static _getAvailableQuestionpools($use_object_id=false, $equal_points=false, $could_be_offline=false, $showPath=false, $with_questioncount=false, $permission="read", $usr_id="")
Returns the available question pools for the active user.
static getInstance($identifier)
This class provides processing control methods.
getTranslatedLifecycle($lifecycle)
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
addHiddenInput($a_name, $a_value)
Add Hidden Input field.
setStyle($a_element, $a_style)
static _needsManualScoring($question_id)
getBrowseQuestionsTabLabel()
const REPOSITORY_ROOT_NODE_ID
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
getQuestionInstanceTypeFilter()
getQuestionParentObjectType()
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
const CMD_BROWSE_QUESTIONS
getParentCmd()
Get parent command.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static _getAllReferences($a_id)
get all reference ids of object
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
Administration class for plugins.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
buildPossiblyLinkedQuestonPoolOrTestTitle(int $obj_id, string $parent_title)
getQuestionParentObjIds($repositoryRootNode)
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
addMultiCommand($a_cmd, $a_text)
Add Command button.
enable($a_module_name)
enables particular modules of table
setRowTemplate($a_template, $a_template_dir="")
Set row template.
__construct(ilCtrl $ctrl, ilGlobalTemplateInterface $mainTpl, ilTabsGUI $tabs, ilLanguage $lng, ilTree $tree, ilDBInterface $db, ilPluginAdmin $pluginAdmin, ilObjTest $testOBJ, ilAccessHandler $access, Refinery $refinery, UIFactory $ui_factory, UIRenderer $ui_renderer)
ilTestQuestionBrowserTableGUI constructor.
writeFilterToSession()
Write filter values to session.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setFormName($a_formname="")
Set Form name.
__construct(Container $dic, ilPlugin $plugin)
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
getFilterItems($a_optionals=false)
Get filter items.
const QUESTION_INSTANCE_TYPE_ALL
resetFilter()
Reset filter.
static getDraftInstance()
const QUESTION_INSTANCE_TYPE_ORIGINALS
const CMD_INSERT_QUESTIONS
buildTestQuestionSetConfig()
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)
setFilterCommand($a_val, $a_caption=null)
Set filter command.