ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 41 of file class.ilDclTableListGUI.php.

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

42  {
43  global $DIC;
44  $ilCtrl = $DIC['ilCtrl'];
45  $lng = $DIC['lng'];
46  $tpl = $DIC['tpl'];
47  $ilTabs = $DIC['ilTabs'];
48  $ilToolbar = $DIC['ilToolbar'];
49 
50  $this->parent_obj = $a_parent_obj;
51  $this->obj_id = $a_parent_obj->obj_id;
52  $this->ctrl = $ilCtrl;
53  $this->lng = $lng;
54  $this->tpl = $tpl;
55  $this->tabs = $ilTabs;
56  $this->toolbar = $ilToolbar;
57 
58  if (!$this->checkAccess()) {
59  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
60  $this->ctrl->redirectByClass('ildclrecordlistgui', 'listRecords');
61  }
62  }
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 232 of file class.ilDclTableListGUI.php.

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

Referenced by __construct().

233  {
234  $ref_id = $this->getDataCollectionObject()->getRefId();
235 
237  }
+ 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 220 of file class.ilDclTableListGUI.php.

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

Referenced by confirmDeleteTables().

221  {
222  if ($delete_count >= count($this->getDataCollectionObject()->getTables())) {
223  ilUtil::sendFailure($this->lng->txt('dcl_msg_tables_delete_all'), true);
224  $this->ctrl->redirect($this, 'listTables');
225  }
226  }
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 181 of file class.ilDclTableListGUI.php.

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

182  {
183  //at least one table must exist
184  $tables = isset($_POST['dcl_table_ids']) ? $_POST['dcl_table_ids'] : array();
185  $this->checkTablesLeft(count($tables));
186 
187  $this->tabs->clearSubTabs();
188  $conf = new ilConfirmationGUI();
189  $conf->setFormAction($this->ctrl->getFormAction($this));
190  $conf->setHeaderText($this->lng->txt('dcl_tables_confirm_delete'));
191 
192  foreach ($tables as $table_id) {
193  $conf->addItem('dcl_table_ids[]', $table_id, ilDclCache::getTableCache($table_id)->getTitle());
194  }
195  $conf->setConfirm($this->lng->txt('delete'), 'deleteTables');
196  $conf->setCancel($this->lng->txt('cancel'), 'listTables');
197  $this->tpl->setContent($conf->getHTML());
198  }
static getTableCache($table_id=0)
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 204 of file class.ilDclTableListGUI.php.

References $_POST, and ilDclCache\getTableCache().

205  {
206  $tables = isset($_POST['dcl_table_ids']) ? $_POST['dcl_table_ids'] : array();
207  foreach ($tables as $table_id) {
208  ilDclCache::getTableCache($table_id)->doDelete();
209  }
210  ilUtil::sendSuccess($this->lng->txt('dcl_msg_tables_deleted'), true);
211  $this->ctrl->redirect($this, 'listTables');
212  }
static getTableCache($table_id=0)
$_POST["username"]
+ Here is the call graph for this function:

◆ executeCommand()

ilDclTableListGUI::executeCommand ( )

execute command

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

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

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

Referenced by checkAccess(), and checkTablesLeft().

244  {
245  return $this->parent_obj->getDataCollectionObject();
246  }
+ Here is the caller graph for this function:

◆ listTables()

ilDclTableListGUI::listTables ( )

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

References ilLinkButton\getInstance().

134  {
135  $add_new = ilLinkButton::getInstance();
136  $add_new->setPrimary(true);
137  $add_new->setCaption("dcl_add_new_table");
138  $add_new->setUrl($this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'create'));
139  $this->toolbar->addStickyItem($add_new);
140 
141  $table_gui = new ilDclTableListTableGUI($this);
142  $this->tpl->setContent($table_gui->getHTML());
143  }
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 146 of file class.ilDclTableListGUI.php.

Referenced by executeCommand().

147  {
148  $this->tabs->setBackTarget($this->lng->txt('dcl_tables'), $this->ctrl->getLinkTarget($this, 'listTables'));
149  $this->tabs->addTab('settings', $this->lng->txt('settings'), $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'edit'));
150  $this->tabs->addTab('fields', $this->lng->txt('dcl_list_fields'), $this->ctrl->getLinkTargetByClass('ilDclFieldListGUI', 'listFields'));
151  $this->tabs->addTab('tableviews', $this->lng->txt('dcl_tableviews'), $this->ctrl->getLinkTargetByClass('ilDclTableViewGUI'));
152  $this->tabs->setTabActive($active);
153  }
+ 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 21 of file class.ilDclTableListGUI.php.

Referenced by __construct().

◆ $tabs

ilDclTableListGUI::$tabs
protected

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

◆ $toolbar

ilDclTableListGUI::$toolbar
protected

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

◆ $tpl

ilDclTableListGUI::$tpl
protected

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

Referenced by __construct().


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