ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilQuestionUsagesTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Table/classes/class.ilTable2GUI.php';
5require_once 'Services/Tree/classes/class.ilPathGUI.php';
6require_once 'Services/Link/classes/class.ilLink.php';
7
13{
17 protected $question;
18
25 public function __construct($controller, $cmd, $template_context, assQuestion $question)
26 {
27 $this->question = $question;
28 $this->setId('qst_usage_' . $question->getId());
29 parent::__construct($controller, $cmd);
30
31 $this->setRowTemplate('tpl.il_as_qpl_question_usage_table_row.html', 'Modules/TestQuestionPool');
32 $this->setLimit(PHP_INT_MAX);
33
34 $this->setDefaultOrderField('title');
35 $this->setDefaultOrderDirection('ASC');
36
37 $this->setTitle($this->lng->txt('question_instances_title'));
38
39 $this->disable('sort');
40 $this->disable('hits');
41 $this->disable('numinfo');
42
43 $this->initColumns();
44 $this->initData();
45 }
46
50 protected function initColumns()
51 {
52 $this->addColumn($this->lng->txt('title'), 'title');
53 $this->addColumn($this->lng->txt('author'), 'author');
54 $this->addColumn($this->lng->txt('path'), '');
55 }
56
60 protected function initData()
61 {
65 global $DIC;
66 $tree = $DIC['tree'];
67
68 $path = new ilPathGUI();
69
70 $rows = array();
71 foreach ($this->question->getInstances() as $instance) {
72 foreach ($instance['refs'] as $ref_id) {
73 $trashed = $tree->isDeleted($ref_id);
74 $rows[] = array(
75 'title' => $instance['title'],
76 'author' => $instance['author'],
77 'ref_id' => $ref_id,
78 'is_trashed' => $trashed,
79 'path' => $trashed ? $this->lng->txt('deleted') : $path->getPath(ROOT_FOLDER_ID, $ref_id)
80 );
81 }
82 }
83 $this->setData($rows);
84 }
85
89 public function fillRow($row)
90 {
94 global $DIC;
95 $ilAccess = $DIC['ilAccess'];
96
97 $this->tpl->setVariable('USAGE_INSTANCE_TITLE', $row['title']);
98 $this->tpl->setVariable('USAGE_AUTHOR', $row['author']);
99 $this->tpl->setVariable('USAGE_PATH', $row['path']);
100
101 if ($ilAccess->checkAccess('read', '', $row['ref_id']) && !$row['is_trashed']) {
102 $link = new ilLink();
103
104 $this->tpl->setVariable('USAGE_INSTANCE_LINKTED_TITLE', $row['title']);
105 $this->tpl->setVariable('USAGE_INSTANCE_HREF', $link->_getStaticLink($row['ref_id'], 'tst'));
106
107 $this->tpl->setCurrentBlock('linked_title_b');
108 $this->tpl->touchBlock('linked_title_b');
109 $this->tpl->parseCurrentBlock();
110 }
111 }
112}
An exception for terminatinating execution or to throw for unit testing.
Abstract basic class which is to be extended by the concrete assessment question type classes.
getId()
Gets the id of the assQuestion object.
Creates a path for a start and endnode.
Class ilQuestionUsagesTableGUI.
__construct($controller, $cmd, $template_context, assQuestion $question)
Class ilTable2GUI.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
fillRow($a_set)
Standard Version of Fill Row.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setLimit($a_limit=0, $a_default_limit=0)
set max.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
setId($a_val)
Set id.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
disable($a_module_name)
diesables particular modules of table
const ROOT_FOLDER_ID
Definition: constants.php:30
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$rows
Definition: xhr_table.php:10