4 require_once
'./Services/Table/classes/class.ilTable2GUI.php';
5 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
115 $this->
setId(
'qpl_brows_tabl_' . $this->testOBJ->getId());
117 parent::__construct($this, self::CMD_BROWSE_QUESTIONS);
122 $this->
setStyle(
'table',
'fullwidth');
124 $this->
addColumn($this->lng->txt(
"tst_question_title"),
'title',
'');
125 $this->
addColumn($this->lng->txt(
"description"),
'description',
'');
126 $this->
addColumn($this->lng->txt(
"tst_question_type"),
'ttype',
'');
127 $this->
addColumn($this->lng->txt(
"author"),
'author',
'');
128 $this->
addColumn($this->lng->txt(
"create_date"),
'created',
'');
129 $this->
addColumn($this->lng->txt(
"last_update"),
'tstamp',
'');
131 $this->
addColumn($this->lng->txt(
"working_time"),
'working_time',
'');
133 $this->
setRowTemplate(
"tpl.il_as_tst_question_browser_row.html",
"Modules/Test");
141 $this->
enable(
'select_all');
148 $this->writeAccess = $value;
159 $this->
addMultiCommand(self::CMD_INSERT_QUESTIONS, $this->lng->txt(
'insert'));
168 switch ($this->ctrl->getNextClass($this)) {
169 case strtolower(__CLASS__):
172 $cmd = $this->ctrl->getCmd() .
'Cmd';
173 return $this->$cmd();
177 $this->ctrl->setReturn($this, self::CMD_BROWSE_QUESTIONS);
178 return parent::executeCommand();
186 $this->mainTpl->setContent($this->ctrl->getHTML($this));
192 $this->ctrl->redirect($this, self::CMD_BROWSE_QUESTIONS);
198 $this->ctrl->redirect($this, self::CMD_BROWSE_QUESTIONS);
203 $selected_array = (is_array(
$_POST[
'q_id'])) ?
$_POST[
'q_id'] : array();
204 if (!count($selected_array)) {
206 $this->ctrl->redirect($this, self::CMD_BROWSE_QUESTIONS);
209 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
215 foreach ($selected_array as
$key => $value) {
216 $last_question_id = $this->testOBJ->insertQuestion($testQuestionSetConfig, $value);
223 $this->testOBJ->saveCompleteStatus($testQuestionSetConfig);
228 ilUtil::sendSuccess($this->lng->txt(
"tst_questions_inserted"),
true);
238 $this->ctrl->saveParameter($this, self::CONTEXT_PARAMETER);
239 if (isset(
$_GET[self::CONTEXT_PARAMETER])) {
241 } elseif (isset(
$_POST[self::CONTEXT_PARAMETER])) {
245 $this->ctrl->saveParameter($this, self::MODE_PARAMETER);
246 if (isset(
$_GET[self::MODE_PARAMETER])) {
248 } elseif (isset(
$_POST[self::MODE_PARAMETER])) {
255 if (isset(
$_POST[self::CONTEXT_PARAMETER])) {
256 return $_POST[self::CONTEXT_PARAMETER];
259 if (isset(
$_GET[self::CONTEXT_PARAMETER])) {
260 return $_GET[self::CONTEXT_PARAMETER];
268 if (isset(
$_POST[self::MODE_PARAMETER])) {
269 return $_POST[self::MODE_PARAMETER];
272 if (isset(
$_GET[self::MODE_PARAMETER])) {
273 return $_GET[self::MODE_PARAMETER];
281 $this->tabs->clearTargets();
282 $this->tabs->clearSubTabs();
284 $this->tabs->setBackTarget(
298 return $this->lng->txt(
'backtocallingtest');
303 return $this->ctrl->getLinkTargetByClass(
312 case self::CONTEXT_LIST_VIEW:
314 return 'ilObjTestGUI';
316 case self::CONTEXT_PAGE_VIEW:
318 return 'ilTestExpressPageObjectGUI';
327 case self::CONTEXT_LIST_VIEW:
331 case self::CONTEXT_PAGE_VIEW:
342 case self::MODE_BROWSE_POOLS:
344 return $this->lng->txt(
'tst_browse_for_qpl_questions');
346 case self::MODE_BROWSE_TESTS:
348 return $this->lng->txt(
'tst_browse_for_tst_questions');
356 return $this->ctrl->getLinkTarget($this, self::CMD_BROWSE_QUESTIONS);
362 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
363 $ti =
new ilTextInputGUI($this->lng->txt(
"tst_qbt_filter_question_title"),
"title");
366 $ti->setValidationRegexp(
'/(^[^%]+$)|(^$)/is');
368 $ti->readFromSession();
369 $this->filter[
"title"] = $ti->getValue();
372 $ti =
new ilTextInputGUI($this->lng->txt(
"description"),
"description");
375 $ti->setValidationRegexp(
'/(^[^%]+$)|(^$)/is');
377 $ti->readFromSession();
378 $this->filter[
"description"] = $ti->getValue();
381 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
382 include_once(
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
385 $options[
""] = $this->lng->txt(
'filter_all_question_types');
386 foreach ($types as $translation =>
$row) {
393 $si->readFromSession();
394 $this->filter[
"type"] =
$si->getValue();
401 $ti->setValidationRegexp(
'/(^[^%]+$)|(^$)/is');
402 $ti->readFromSession();
403 $this->filter[
"author"] = $ti->getValue();
407 $ti->setMaxLength(64);
409 $ti->setValidationRegexp(
'/(^[^%]+$)|(^$)/is');
411 $ti->readFromSession();
412 $this->filter[
'parent_title'] = $ti->getValue();
415 require_once
'Services/Form/classes/class.ilRepositorySelectorInputGUI.php';
418 $ri->setClickableTypes(array(
'qpl'));
420 $ri->readFromSession();
421 $this->filter[
'repository_root_node'] = $ri->getValue();
427 case self::MODE_BROWSE_POOLS:
429 return $this->lng->txt(
'qpl');
431 case self::MODE_BROWSE_TESTS:
433 return $this->lng->txt(
'tst');
441 $this->tpl->setVariable(
"QUESTION_ID",
$data[
"question_id"]);
442 $this->tpl->setVariable(
"QUESTION_TITLE",
$data[
"title"]);
443 $this->tpl->setVariable(
"QUESTION_COMMENT",
$data[
"description"]);
444 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
446 $this->tpl->setVariable(
"QUESTION_AUTHOR",
$data[
"author"]);
449 $this->tpl->setVariable(
"QUESTION_POOL",
$data[
'parent_title']);
450 $this->tpl->setVariable(
"WORKING_TIME",
$data[
'working_time']);
458 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
467 return $testQuestionSetConfigFactory->getQuestionSetConfig();
475 $questionList =
new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin);
478 $questionList->setExcludeQuestionIdsFilter($this->testOBJ->getExistingQuestions());
480 $repositoryRootNode = self::REPOSITORY_ROOT_NODE_ID;
483 if ($item->getValue() !==
false) {
484 switch ($item->getPostVar()) {
491 $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
494 case 'repository_root_node':
496 $repositoryRootNode = $item->getValue();
503 if (!count($parentObjectIds)) {
507 $questionList->setParentObjIdsFilter($parentObjectIds);
509 $questionList->load();
511 return $questionList->getQuestionDataArray();
525 $parents = $this->tree->getSubTree(
526 $this->tree->getNodeData($repositoryRootNode),
531 $parentIds = array();
533 foreach ($parents as $nodeData) {
534 if ($nodeData[
'obj_id'] == $this->testOBJ->getId()) {
538 $parentIds[ $nodeData[
'obj_id'] ] = $nodeData[
'obj_id'];
541 $parentIds = array_map(
'intval', array_values($parentIds));
545 return array_intersect($parentIds, $available_pools);
548 return array_filter($parentIds,
function ($obj_id) {
550 $refId = current($refIds);
551 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.
This class provides processing control methods.
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
const QUESTION_INSTANCE_TYPE_DUPLICATES
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.
Interface ilAccessHandler.
Administration class for plugins.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
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.
special template class to simplify handling of ITX/PEAR
addMultiCommand($a_cmd, $a_text)
Add Command button.
enable($a_module_name)
enables particular modules of table
This class represents a text property in a property form.
setMaxLength($a_maxlength)
Set Max Length.
__construct(ilCtrl $ctrl, ilTemplate $mainTpl, ilTabsGUI $tabs, ilLanguage $lng, ilTree $tree, ilDBInterface $db, ilPluginAdmin $pluginAdmin, ilObjTest $testOBJ, ilAccessHandler $access)
ilTestQuestionBrowserTableGUI constructor.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
setRowTemplate($a_template, $a_template_dir="")
Set row template.
writeFilterToSession()
Write filter values to session.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setFormName($a_formname="")
Set Form name.
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.
resetFilter()
Reset filter.
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.