ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilTestRandomQuestionSetNonAvailablePoolsTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Table/classes/class.ilTable2GUI.php';
5
13{
14 const IDENTIFIER = 'NonAvailPoolsTbl';
15
19 protected $ctrl = null;
20
24 protected $lng;
25
26 public function __construct(ilCtrl $ctrl, ilLanguage $lng, $parentGUI, $parentCMD)
27 {
28 parent::__construct($parentGUI, $parentCMD);
29
30 $this->ctrl = $ctrl;
31 $this->lng = $lng;
32 }
33
34 private function setTableIdentifiers()
35 {
36 $this->setId(self::IDENTIFIER);
37 $this->setPrefix(self::IDENTIFIER);
38 $this->setFormName(self::IDENTIFIER);
39 }
40
41 public function build()
42 {
43 $this->setTableIdentifiers();
44
45 $this->setTitle($this->lng->txt('tst_non_avail_pools_table'));
46
47 $this->setRowTemplate('tpl.il_tst_non_avail_pools_row.html', 'Modules/Test');
48
49 $this->enable('header');
50 $this->disable('sort');
51
52 $this->setExternalSegmentation(true);
53 $this->setLimit(PHP_INT_MAX);
54
55 $this->setFormAction($this->ctrl->getFormAction($this->parent_obj));
56
57 $this->addColumns();
58 }
59
60 protected function addColumns()
61 {
62 $this->addColumn($this->lng->txt('title'), '', '30%');
63 $this->addColumn($this->lng->txt('path'), '', '30%');
64 $this->addColumn($this->lng->txt('status'), '', '40%');
65 $this->addColumn($this->lng->txt('actions'), '', '');
66 }
67
68 public function init(ilTestRandomQuestionSetSourcePoolDefinitionList $sourcePoolDefinitionList)
69 {
70 $rows = array();
71
72 $pools = $sourcePoolDefinitionList->getNonAvailablePools();
73
74 foreach($pools as $nonAvailablePool)
75 {
78 $set = array();
79
80 $set['id'] = $nonAvailablePool->getId();
81 $set['title'] = $nonAvailablePool->getTitle();
82 $set['path'] = $nonAvailablePool->getPath();
83 $set['status'] = $nonAvailablePool->getUnavailabilityStatus();
84
85 $rows[] = $set;
86 }
87
88 $this->setData($rows);
89 }
90
91 protected function getDerivePoolLink($poolId)
92 {
93 $this->ctrl->setParameter($this->parent_obj, 'derive_pool_id', $poolId);
94
95 $link = $this->ctrl->getLinkTarget(
97 );
98
99 return $link;
100 }
101
102 public function fillRow($set)
103 {
105 {
106 $link = $this->getDerivePoolLink($set['id']);
107 $this->tpl->setCurrentBlock('single_action');
108 $this->tpl->setVariable('ACTION_HREF', $link);
109 $this->tpl->setVariable('ACTION_TEXT', $this->lng->txt('tst_derive_new_pool'));
110 $this->tpl->parseCurrentBlock();
111 }
112
113 $this->tpl->setVariable('TITLE', $set['title']);
114 $this->tpl->setVariable('PATH', $set['path']);
115 $this->tpl->setVariable('STATUS', $this->getStatusText($set['status']));
116 }
117
118 protected function getStatusText($status)
119 {
120 return $this->lng->txt('tst_non_avail_pool_msg_status_'.$status);
121 }
122}
An exception for terminatinating execution or to throw for unit testing.
This class provides processing control methods.
language handling
Class ilTable2GUI.
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.
setPrefix($a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
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.
setExternalSegmentation($a_val)
Set external segmentation.
setId($a_val)
Set id.
setFormName($a_formname="")
Set Form name.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
enable($a_module_name)
enables particular modules of table