ILIAS  release_7 Revision v7.30-3-g800a261c036
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.

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 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $DIC
Definition: goto.php:24

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

+ 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.

229 {
230 $ref_id = $this->getDataCollectionObject()->getRefId();
231
233 }

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

Referenced by __construct().

+ 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 216 of file class.ilDclTableListGUI.php.

217 {
218 if ($delete_count >= count($this->getDataCollectionObject()->getTables())) {
219 ilUtil::sendFailure($this->lng->txt('dcl_msg_tables_delete_all'), true);
220 $this->ctrl->redirect($this, 'listTables');
221 }
222 }

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

Referenced by confirmDeleteTables().

+ 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 177 of file class.ilDclTableListGUI.php.

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

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

+ Here is the call graph for this function:

◆ deleteTables()

ilDclTableListGUI::deleteTables ( )
protected

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

201 {
202 $tables = isset($_POST['dcl_table_ids']) ? $_POST['dcl_table_ids'] : array();
203 foreach ($tables as $table_id) {
204 ilDclCache::getTableCache($table_id)->doDelete();
205 }
206 ilUtil::sendSuccess($this->lng->txt('dcl_msg_tables_deleted'), true);
207 $this->ctrl->redirect($this, 'listTables');
208 }

References $_POST, and ilDclCache\getTableCache().

+ Here is the call graph for this function:

◆ executeCommand()

ilDclTableListGUI::executeCommand ( )

execute command

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

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 $ilDclTableEditGUI = new ilDclTableEditGUI($this);
95 $this->ctrl->forwardCommand($ilDclTableEditGUI);
96 break;
97
98 case 'ildclfieldlistgui':
99 $this->tabs->clearTargets();
100 $this->setTabs('fields');
101 $ilDclFieldListGUI = new ilDclFieldListGUI($this);
102 $this->ctrl->forwardCommand($ilDclFieldListGUI);
103 break;
104
105 case "ildclfieldeditgui":
106 $this->tabs->clearTargets();
107 $this->setTabs("fields");
108 $ilDclFieldEditGUI = new ilDclFieldEditGUI($this);
109 $this->ctrl->forwardCommand($ilDclFieldEditGUI);
110 break;
111
112 case 'ildcltableviewgui':
113 $this->tabs->clearTargets();
114 $this->setTabs('tableviews');
115 $ilDclTableViewGUI = new ilDclTableViewGUI($this);
116 $this->ctrl->forwardCommand($ilDclTableViewGUI);
117 break;
118
119 default:
120 switch ($cmd) {
121 default:
122 $this->$cmd();
123 break;
124 }
125 }
126 }
$_GET["client_id"]
Class ilDclFieldEditGUI.
Class ilDclBaseFieldModel.
Class ilDclTableHelper.
Class ilDclTableViewGUI.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

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

+ Here is the call graph for this function:

◆ getDataCollectionObject()

ilDclTableListGUI::getDataCollectionObject ( )
Returns
ilObjDataCollection

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

240 {
241 return $this->parent_obj->getDataCollectionObject();
242 }

Referenced by checkAccess(), and checkTablesLeft().

+ Here is the caller graph for this function:

◆ listTables()

ilDclTableListGUI::listTables ( )

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

130 {
131 $add_new = ilLinkButton::getInstance();
132 $add_new->setPrimary(true);
133 $add_new->setCaption("dcl_add_new_table");
134 $add_new->setUrl($this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'create'));
135 $this->toolbar->addStickyItem($add_new);
136
137 $table_gui = new ilDclTableListTableGUI($this);
138 $this->tpl->setContent($table_gui->getHTML());
139 }
Class ilDclTableListTableGUI.
static getInstance()
Factory.

References ilLinkButton\getInstance().

+ Here is the call graph for this function:

◆ save()

ilDclTableListGUI::save ( )
protected

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

156 {
157 $comments = $_POST['comments'];
158 $visible = $_POST['visible'];
159 $orders = $_POST['order'];
160 asort($orders);
161 $order = 10;
162 foreach (array_keys($orders) as $table_id) {
163 $table = ilDclCache::getTableCache($table_id);
164 $table->setOrder($order);
165 $table->setPublicCommentsEnabled(isset($comments[$table_id]));
166 $table->setIsVisible(isset($visible[$table_id]));
167 $table->doUpdate();
168 $order += 10;
169 }
170 $this->ctrl->redirect($this);
171 }

References $_POST, and ilDclCache\getTableCache().

+ Here is the call graph for this function:

◆ setTabs()

ilDclTableListGUI::setTabs (   $active)
protected

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

143 {
144 $this->tabs->setBackTarget($this->lng->txt('dcl_tables'), $this->ctrl->getLinkTarget($this, 'listTables'));
145 $this->tabs->addTab('settings', $this->lng->txt('settings'), $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'edit'));
146 $this->tabs->addTab('fields', $this->lng->txt('dcl_list_fields'), $this->ctrl->getLinkTargetByClass('ilDclFieldListGUI', 'listFields'));
147 $this->tabs->addTab('tableviews', $this->lng->txt('dcl_tableviews'), $this->ctrl->getLinkTargetByClass('ilDclTableViewGUI'));
148 $this->tabs->setTabActive($active);
149 }

Referenced by executeCommand().

+ 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: