ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilDclTableListGUI Class Reference

Class ilDclTableListGUI. More...

+ Collaboration diagram for ilDclTableListGUI:

Public Member Functions

 __construct (ilObjDataCollectionGUI $a_parent_obj)
 ilDclTableListGUI constructor. More...
 
 executeCommand ()
 execute command More...
 
 listTables ()
 
 confirmDeleteTables ()
 Confirm deletion of multiple fields. More...
 
 checkTablesLeft ($delete_count)
 redirects if there are no tableviews left after deletion of {$delete_count} tableviews More...
 
 getDataCollectionObject ()
 

Protected Member Functions

 setTabs ($active)
 
 save ()
 
 deleteTables ()
 
 checkAccess ()
 

Protected Attributes

 $ctrl
 
 $lng
 
 $tpl
 
 $tabs
 
 $toolbar
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDclTableListGUI::__construct ( ilObjDataCollectionGUI  $a_parent_obj)

ilDclTableListGUI constructor.

Parameters
ilObjDataCollectionGUI$a_parent_obj

Definition at line 44 of file class.ilDclTableListGUI.php.

References $DIC, $ilCtrl, $lng, $tpl, checkAccess(), and ilUtil\sendFailure().

45  {
46  global $DIC;
47  $ilCtrl = $DIC['ilCtrl'];
48  $lng = $DIC['lng'];
49  $tpl = $DIC['tpl'];
50  $ilTabs = $DIC['ilTabs'];
51  $ilToolbar = $DIC['ilToolbar'];
52 
53 
54  $this->parent_obj = $a_parent_obj;
55  $this->obj_id = $a_parent_obj->obj_id;
56  $this->ctrl = $ilCtrl;
57  $this->lng = $lng;
58  $this->tpl = $tpl;
59  $this->tabs = $ilTabs;
60  $this->toolbar = $ilToolbar;
61 
62  if (!$this->checkAccess()) {
63  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
64  $this->ctrl->redirectByClass('ildclrecordlistgui', 'listRecords');
65  }
66  }
global $DIC
Definition: saml.php:7
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

Member Function Documentation

◆ checkAccess()

ilDclTableListGUI::checkAccess ( )
protected
Returns
bool

Definition at line 228 of file class.ilDclTableListGUI.php.

References getDataCollectionObject(), and ilObjDataCollectionAccess\hasWriteAccess().

Referenced by __construct().

229  {
230  $ref_id = $this->getDataCollectionObject()->getRefId();
232  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkTablesLeft()

ilDclTableListGUI::checkTablesLeft (   $delete_count)

redirects if there are no tableviews left after deletion of {$delete_count} tableviews

Parameters
$delete_countnumber of tableviews to delete

Definition at line 217 of file class.ilDclTableListGUI.php.

References getDataCollectionObject(), and ilUtil\sendFailure().

Referenced by confirmDeleteTables().

218  {
219  if ($delete_count >= count($this->getDataCollectionObject()->getTables())) {
220  ilUtil::sendFailure($this->lng->txt('dcl_msg_tables_delete_all'), true);
221  $this->ctrl->redirect($this, 'listTables');
222  }
223  }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteTables()

ilDclTableListGUI::confirmDeleteTables ( )

Confirm deletion of multiple fields.

Definition at line 180 of file class.ilDclTableListGUI.php.

References $_POST, array, checkTablesLeft(), and ilDclCache\getTableCache().

181  {
182  //at least one table must exist
183  $tables = isset($_POST['dcl_table_ids']) ? $_POST['dcl_table_ids'] : array();
184  $this->checkTablesLeft(count($tables));
185 
186  $this->tabs->clearSubTabs();
187  $conf = new ilConfirmationGUI();
188  $conf->setFormAction($this->ctrl->getFormAction($this));
189  $conf->setHeaderText($this->lng->txt('dcl_tables_confirm_delete'));
190 
191  foreach ($tables as $table_id) {
192  $conf->addItem('dcl_table_ids[]', $table_id, ilDclCache::getTableCache($table_id)->getTitle());
193  }
194  $conf->setConfirm($this->lng->txt('delete'), 'deleteTables');
195  $conf->setCancel($this->lng->txt('cancel'), 'listTables');
196  $this->tpl->setContent($conf->getHTML());
197  }
static getTableCache($table_id=0)
Create styles array
The data for the language used.
checkTablesLeft($delete_count)
redirects if there are no tableviews left after deletion of {$delete_count} tableviews ...
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ deleteTables()

ilDclTableListGUI::deleteTables ( )
protected

Definition at line 202 of file class.ilDclTableListGUI.php.

References $_POST, array, ilDclCache\getTableCache(), and ilUtil\sendSuccess().

203  {
204  $tables = isset($_POST['dcl_table_ids']) ? $_POST['dcl_table_ids'] : array();
205  foreach ($tables as $table_id) {
206  ilDclCache::getTableCache($table_id)->doDelete();
207  }
208  ilUtil::sendSuccess($this->lng->txt('dcl_msg_tables_deleted'), true);
209  $this->ctrl->redirect($this, 'listTables');
210  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getTableCache($table_id=0)
Create styles array
The data for the language used.
$_POST["username"]
+ Here is the call graph for this function:

◆ executeCommand()

ilDclTableListGUI::executeCommand ( )

execute command

Definition at line 71 of file class.ilDclTableListGUI.php.

References $_GET, $DIC, ilDclTableHelper\getRoleTitlesWithoutReadRightOnAnyStandardView(), ilUtil\sendInfo(), and setTabs().

72  {
73  global $DIC;
74  $cmd = $this->ctrl->getCmd('listTables');
75 
76  $next_class = $this->ctrl->getNextClass($this);
77 
78  /*
79  * see https://www.ilias.de/mantis/view.php?id=22775
80  */
81  $tableHelper = new ilDclTableHelper((int) $this->obj_id, (int) $_GET['ref_id'], $DIC->rbac()->review(), $DIC->user(), $DIC->database());
82  // send a warning if there are roles with rbac read access on the data collection but without read access on any standard view
83  $role_titles = $tableHelper->getRoleTitlesWithoutReadRightOnAnyStandardView();
84 
85  if (count($role_titles) > 0) {
86  ilUtil::sendInfo($DIC->language()->txt('dcl_rbac_roles_without_read_access_on_any_standard_view') . " " . implode(", ", $role_titles));
87  }
88 
89  switch ($next_class) {
90  case 'ildcltableeditgui':
91  $this->tabs->clearTargets();
92  if ($cmd != 'create') {
93  $this->setTabs('settings');
94  } else {
95  $this->tabs->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'listTables'));
96  }
97  require_once 'Modules/DataCollection/classes/Table/class.ilDclTableEditGUI.php';
98  $ilDclTableEditGUI = new ilDclTableEditGUI($this);
99  $this->ctrl->forwardCommand($ilDclTableEditGUI);
100  break;
101 
102  case 'ildclfieldlistgui':
103  $this->tabs->clearTargets();
104  $this->setTabs('fields');
105  require_once 'Modules/DataCollection/classes/Fields/class.ilDclFieldListGUI.php';
106  $ilDclFieldListGUI = new ilDclFieldListGUI($this);
107  $this->ctrl->forwardCommand($ilDclFieldListGUI);
108  break;
109 
110  case "ildclfieldeditgui":
111  $this->tabs->clearTargets();
112  $this->setTabs("fields");
113  require_once "Modules/DataCollection/classes/Fields/class.ilDclFieldEditGUI.php";
114  $ilDclFieldEditGUI = new ilDclFieldEditGUI($this);
115  $this->ctrl->forwardCommand($ilDclFieldEditGUI);
116  break;
117 
118  case 'ildcltableviewgui':
119  $this->tabs->clearTargets();
120  $this->setTabs('tableviews');
121  require_once 'Modules/DataCollection/classes/TableView/class.ilDclTableViewGUI.php';
122  $ilDclTableViewGUI = new ilDclTableViewGUI($this);
123  $this->ctrl->forwardCommand($ilDclTableViewGUI);
124  break;
125 
126  default:
127  switch ($cmd) {
128  default:
129  $this->$cmd();
130  break;
131  }
132  }
133  }
Class ilDclTableHelper.
Class ilDclTableViewGUI.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Class ilDclFieldEditGUI.
Class ilDclBaseFieldModel.
+ Here is the call graph for this function:

◆ getDataCollectionObject()

ilDclTableListGUI::getDataCollectionObject ( )
Returns
ilObjDataCollection

Definition at line 238 of file class.ilDclTableListGUI.php.

Referenced by checkAccess(), and checkTablesLeft().

239  {
240  return $this->parent_obj->getDataCollectionObject();
241  }
+ Here is the caller graph for this function:

◆ listTables()

ilDclTableListGUI::listTables ( )

Definition at line 135 of file class.ilDclTableListGUI.php.

References ilLinkButton\getInstance().

136  {
137  $add_new = ilLinkButton::getInstance();
138  $add_new->setPrimary(true);
139  $add_new->setCaption("dcl_add_new_table");
140  $add_new->setUrl($this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'create'));
141  $this->toolbar->addStickyItem($add_new);
142 
143  $table_gui = new ilDclTableListTableGUI($this);
144  $this->tpl->setContent($table_gui->getHTML());
145  }
Class ilDclTableListTableGUI.
+ Here is the call graph for this function:

◆ save()

ilDclTableListGUI::save ( )
protected

Definition at line 159 of file class.ilDclTableListGUI.php.

References $_POST, $table, and ilDclCache\getTableCache().

160  {
161  $comments = $_POST['comments'];
162  $visible = $_POST['visible'];
163  $orders = $_POST['order'];
164  asort($orders);
165  $order = 10;
166  foreach (array_keys($orders) as $table_id) {
167  $table = ilDclCache::getTableCache($table_id);
168  $table->setOrder($order);
169  $table->setPublicCommentsEnabled(isset($comments[$table_id]));
170  $table->setIsVisible(isset($visible[$table_id]));
171  $table->doUpdate();
172  $order += 10;
173  }
174  $this->ctrl->redirect($this);
175  }
static getTableCache($table_id=0)
if(empty($password)) $table
Definition: pwgen.php:24
$_POST["username"]
+ Here is the call graph for this function:

◆ setTabs()

ilDclTableListGUI::setTabs (   $active)
protected

Definition at line 147 of file class.ilDclTableListGUI.php.

Referenced by executeCommand().

148  {
149  $this->tabs->setBackTarget($this->lng->txt('dcl_tables'), $this->ctrl->getLinkTarget($this, 'listTables'));
150  $this->tabs->addTab('settings', $this->lng->txt('settings'), $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'edit'));
151  $this->tabs->addTab('fields', $this->lng->txt('dcl_list_fields'), $this->ctrl->getLinkTargetByClass('ilDclFieldListGUI', 'listFields'));
152  $this->tabs->addTab('tableviews', $this->lng->txt('dcl_tableviews'), $this->ctrl->getLinkTargetByClass('ilDclTableViewGUI'));
153  $this->tabs->setTabActive($active);
154  }
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilDclTableListGUI::$ctrl
protected

Definition at line 17 of file class.ilDclTableListGUI.php.

◆ $lng

ilDclTableListGUI::$lng
protected

Definition at line 22 of file class.ilDclTableListGUI.php.

Referenced by __construct().

◆ $tabs

ilDclTableListGUI::$tabs
protected

Definition at line 32 of file class.ilDclTableListGUI.php.

◆ $toolbar

ilDclTableListGUI::$toolbar
protected

Definition at line 37 of file class.ilDclTableListGUI.php.

◆ $tpl

ilDclTableListGUI::$tpl
protected

Definition at line 27 of file class.ilDclTableListGUI.php.

Referenced by __construct().


The documentation for this class was generated from the following file: