4 require_once
'./Services/Table/classes/class.ilTable2GUI.php';
5 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
110 $this->
setId(
'qpl_brows_tabl_' . $this->testOBJ->getId());
112 parent::__construct($this, self::CMD_BROWSE_QUESTIONS);
117 $this->
setStyle(
'table',
'fullwidth');
119 $this->
addColumn($this->lng->txt(
"tst_question_title"),
'title',
'');
120 $this->
addColumn($this->lng->txt(
"description"),
'description',
'');
121 $this->
addColumn($this->lng->txt(
"tst_question_type"),
'ttype',
'');
122 $this->
addColumn($this->lng->txt(
"author"),
'author',
'');
123 $this->
addColumn($this->lng->txt(
"create_date"),
'created',
'');
124 $this->
addColumn($this->lng->txt(
"last_update"),
'tstamp',
'');
126 $this->
addColumn($this->lng->txt(
"working_time"),
'working_time',
'');
128 $this->
setRowTemplate(
"tpl.il_as_tst_question_browser_row.html",
"Modules/Test");
136 $this->
enable(
'select_all');
143 $this->writeAccess = $value;
155 $this->
addMultiCommand(self::CMD_INSERT_QUESTIONS, $this->lng->txt(
'insert'));
164 switch( $this->ctrl->getNextClass($this) )
166 case strtolower(__CLASS__):
169 $cmd = $this->ctrl->getCmd().
'Cmd';
170 return $this->
$cmd();
174 $this->ctrl->setReturn($this, self::CMD_BROWSE_QUESTIONS);
175 return parent::executeCommand();
183 $this->mainTpl->setContent($this->ctrl->getHTML($this));
189 $this->ctrl->redirect($this, self::CMD_BROWSE_QUESTIONS);
195 $this->ctrl->redirect($this, self::CMD_BROWSE_QUESTIONS);
201 if (!count($selected_array))
204 $this->ctrl->redirect($this, self::CMD_BROWSE_QUESTIONS);
207 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
213 foreach ($selected_array as $key => $value)
215 $last_question_id = $this->testOBJ->insertQuestion($testQuestionSetConfig, $value);
223 $this->testOBJ->saveCompleteStatus($testQuestionSetConfig);
241 $this->ctrl->saveParameter($this, self::CONTEXT_PARAMETER);
242 if(isset(
$_GET[self::CONTEXT_PARAMETER]))
246 else if(isset(
$_POST[self::CONTEXT_PARAMETER]))
251 $this->ctrl->saveParameter($this, self::MODE_PARAMETER);
252 if(isset(
$_GET[self::MODE_PARAMETER]))
256 else if(isset(
$_POST[self::MODE_PARAMETER]))
264 if( isset(
$_POST[self::CONTEXT_PARAMETER]) )
266 return $_POST[self::CONTEXT_PARAMETER];
269 if( isset(
$_GET[self::CONTEXT_PARAMETER]) )
271 return $_GET[self::CONTEXT_PARAMETER];
279 if( isset(
$_POST[self::MODE_PARAMETER]) )
281 return $_POST[self::MODE_PARAMETER];
284 if( isset(
$_GET[self::MODE_PARAMETER]) )
286 return $_GET[self::MODE_PARAMETER];
294 $this->tabs->clearTargets();
295 $this->tabs->clearSubTabs();
297 $this->tabs->setBackTarget(
308 return $this->lng->txt(
'backtocallingtest');
313 return $this->ctrl->getLinkTargetByClass(
322 case self::CONTEXT_LIST_VIEW:
324 return 'ilObjTestGUI';
326 case self::CONTEXT_PAGE_VIEW:
328 return 'ilTestExpressPageObjectGUI';
338 case self::CONTEXT_LIST_VIEW:
342 case self::CONTEXT_PAGE_VIEW:
354 case self::MODE_BROWSE_POOLS:
356 return $this->lng->txt(
'tst_browse_for_qpl_questions');
358 case self::MODE_BROWSE_TESTS:
360 return $this->lng->txt(
'tst_browse_for_tst_questions');
368 return $this->ctrl->getLinkTarget($this, self::CMD_BROWSE_QUESTIONS);
374 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
375 $ti =
new ilTextInputGUI($this->lng->txt(
"tst_qbt_filter_question_title"),
"title");
378 $ti->setValidationRegexp(
'/(^[^%]+$)|(^$)/is');
380 $ti->readFromSession();
381 $this->filter[
"title"] = $ti->getValue();
384 $ti =
new ilTextInputGUI($this->lng->txt(
"description"),
"description");
387 $ti->setValidationRegexp(
'/(^[^%]+$)|(^$)/is');
389 $ti->readFromSession();
390 $this->filter[
"description"] = $ti->getValue();
393 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
394 include_once(
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
397 $options[
""] = $this->lng->txt(
'filter_all_question_types');
398 foreach ($types as $translation =>
$row)
406 $si->readFromSession();
407 $this->filter[
"type"] =
$si->getValue();
414 $ti->setValidationRegexp(
'/(^[^%]+$)|(^$)/is');
415 $ti->readFromSession();
416 $this->filter[
"author"] = $ti->getValue();
420 $ti->setMaxLength(64);
422 $ti->setValidationRegexp(
'/(^[^%]+$)|(^$)/is');
424 $ti->readFromSession();
425 $this->filter[
'parent_title'] = $ti->getValue();
428 require_once
'Services/Form/classes/class.ilRepositorySelectorInputGUI.php';
432 $ri->readFromSession();
433 $this->filter[
'repository_root_node'] = $ri->getValue();
440 case self::MODE_BROWSE_POOLS:
442 return $this->lng->txt(
'qpl');
444 case self::MODE_BROWSE_TESTS:
446 return $this->lng->txt(
'tst');
454 $this->tpl->setVariable(
"QUESTION_ID",
$data[
"question_id"]);
455 $this->tpl->setVariable(
"QUESTION_TITLE",
$data[
"title"]);
456 $this->tpl->setVariable(
"QUESTION_COMMENT",
$data[
"description"]);
457 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
459 $this->tpl->setVariable(
"QUESTION_AUTHOR",
$data[
"author"]);
462 $this->tpl->setVariable(
"QUESTION_POOL",
$data[
'parent_title']);
463 $this->tpl->setVariable(
"WORKING_TIME",
$data[
'working_time']);
471 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
474 $this->tree, $this->db, $this->pluginAdmin, $this->testOBJ
477 return $testQuestionSetConfigFactory->getQuestionSetConfig();
485 $questionList =
new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin);
488 $questionList->setExcludeQuestionIdsFilter($this->testOBJ->getExistingQuestions());
490 $repositoryRootNode = self::REPOSITORY_ROOT_NODE_ID;
494 if($item->getValue() !==
false)
496 switch( $item->getPostVar() )
504 $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
507 case 'repository_root_node':
509 $repositoryRootNode = $item->getValue();
516 if( !count($parentObjectIds) )
521 $questionList->setParentObjIdsFilter($parentObjectIds);
523 $questionList->load();
525 return $questionList->getQuestionDataArray();
540 $parents = $this->tree->getSubTree(
544 $parentIds =
array();
546 foreach($parents as $nodeData)
548 if( $nodeData[
'obj_id'] == $this->testOBJ->getId() )
553 $parentIds[ $nodeData[
'obj_id'] ] = $nodeData[
'obj_id'];
556 $parentIds = array_map(
'intval', array_values($parentIds));
561 return array_intersect($parentIds, $available_pools);
566 return array_filter($parentIds,
function($obj_id) {
568 $refId = current($refIds);
569 return $this->access->checkAccess(
'write',
'', $refId);
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
getBrowseQuestionsTabUrl()
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 _getQuestionTypes($all_tags=FALSE, $fixOrder=false)
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 _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.
getQuestionParentObjIds($repositoryRootNode)
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
if(!is_array($argv)) $options
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.
static formatDate(ilDateTime $date)
Format a date public.
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.
Create styles array
The data for the language used.
writeFilterToSession()
Write filter values to session.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setFormName($a_formname="")
Set Form name.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
getFilterItems($a_optionals=false)
Get filter items.
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.
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.
resetFilter()
Reset filter.
const QUESTION_INSTANCE_TYPE_ORIGINALS
const CMD_INSERT_QUESTIONS
buildTestQuestionSetConfig()
setFilterCommand($a_val, $a_caption=null)
Set filter command.