ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
4 require_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) {
77  $set = array();
78 
79  $set['id'] = $nonAvailablePool->getId();
80  $set['title'] = $nonAvailablePool->getTitle();
81  $set['path'] = $nonAvailablePool->getPath();
82  $set['status'] = $nonAvailablePool->getUnavailabilityStatus();
83 
84  $rows[] = $set;
85  }
86 
87  $this->setData($rows);
88  }
89 
90  protected function getDerivePoolLink($poolId)
91  {
92  $this->ctrl->setParameter($this->parent_obj, 'derive_pool_id', $poolId);
93 
94  $link = $this->ctrl->getLinkTarget(
95  $this->parent_obj,
97  );
98 
99  return $link;
100  }
101 
102  public function fillRow($set)
103  {
105  $link = $this->getDerivePoolLink($set['id']);
106  $this->tpl->setCurrentBlock('single_action');
107  $this->tpl->setVariable('ACTION_HREF', $link);
108  $this->tpl->setVariable('ACTION_TEXT', $this->lng->txt('tst_derive_new_pool'));
109  $this->tpl->parseCurrentBlock();
110  }
111 
112  $this->tpl->setVariable('TITLE', $set['title']);
113  $this->tpl->setVariable('PATH', $set['path']);
114  $this->tpl->setVariable('STATUS', $this->getStatusText($set['status']));
115  }
116 
117  protected function getStatusText($status)
118  {
119  return $this->lng->txt('tst_non_avail_pool_msg_status_' . $status);
120  }
121 }
This class provides processing control methods.
setExternalSegmentation($a_val)
Set external segmentation.
setId($a_val)
Set id.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
enable($a_module_name)
enables particular modules of table
setPrefix($a_prefix)
setRowTemplate($a_template, $a_template_dir="")
Set row template.
$rows
Definition: xhr_table.php:10
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
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.
language handling
while(count($oldTaskList) > 0) foreach(array_keys($newTaskList) as $task) init()
Definition: build.php:77
setLimit($a_limit=0, $a_default_limit=0)