ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 45 of file class.ilDclTableListGUI.php.

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

References $DIC, $ilCtrl, $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.

References $ref_id, 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 {
220 ilUtil::sendFailure($this->lng->txt('dcl_msg_tables_delete_all'), true);
221 $this->ctrl->redirect($this, 'listTables');
222 }
223 }

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

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

202 {
203 $tables = isset($_POST['dcl_table_ids']) ? $_POST['dcl_table_ids'] : array();
204 foreach ($tables as $table_id) {
205 ilDclCache::getTableCache($table_id)->doDelete();
206 }
207 ilUtil::sendSuccess($this->lng->txt('dcl_msg_tables_deleted'), true);
208 $this->ctrl->redirect($this, 'listTables');
209 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

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

+ Here is the call graph for this function:

◆ executeCommand()

ilDclTableListGUI::executeCommand ( )

execute command

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

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

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

+ Here is the call graph for this function:

◆ getDataCollectionObject()

ilDclTableListGUI::getDataCollectionObject ( )
Returns
ilObjDataCollection

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

238 {
239 return $this->parent_obj->getDataCollectionObject();
240 }

Referenced by checkAccess(), and checkTablesLeft().

+ Here is the caller graph for this function:

◆ listTables()

ilDclTableListGUI::listTables ( )

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

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.
static getInstance()
Factory.

References ilLinkButton\getInstance().

+ Here is the call graph for this function:

◆ save()

ilDclTableListGUI::save ( )
protected

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

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

References $_POST, and ilDclCache\getTableCache().

+ Here is the call graph for this function:

◆ setTabs()

ilDclTableListGUI::setTabs (   $active)
protected

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

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 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilDclTableListGUI::$ctrl
protected

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

◆ $lng

ilDclTableListGUI::$lng
protected

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

Referenced by __construct().

◆ $tabs

ilDclTableListGUI::$tabs
protected

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

◆ $toolbar

ilDclTableListGUI::$toolbar
protected

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

◆ $tpl

ilDclTableListGUI::$tpl
protected

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

Referenced by __construct().


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