ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilDclTableViewGUI Class Reference

Class ilDclTableViewGUI. More...

+ Collaboration diagram for ilDclTableViewGUI:

Public Member Functions

 __construct (ilDclTableListGUI $a_parent_obj, $table_id=0)
 Constructor. More...
 
 executeCommand ()
 
 show ()
 
 doTableSwitch ()
 
 confirmDeleteTableviews ()
 Confirm deletion of multiple fields. More...
 
 checkViewsLeft ($delete_count)
 redirects if there are no tableviews left after deletion of {$delete_count} tableviews More...
 
 saveTableViewOrder ()
 invoked by ilDclTableViewTableGUI More...
 

Protected Member Functions

 checkAccess ()
 
 deleteTableviews ()
 

Protected Attributes

 $ctrl
 
 $lng
 
 $toolbar
 
 $tpl
 
 $tabs
 
 $table
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDclTableViewGUI::__construct ( ilDclTableListGUI  $a_parent_obj,
  $table_id = 0 
)

Constructor.

Parameters
ilDclTableListGUI$a_parent_obj
int$table_id

Definition at line 46 of file class.ilDclTableViewGUI.php.

47 {
48 global $DIC;
49 $ilCtrl = $DIC['ilCtrl'];
50 $lng = $DIC['lng'];
51 $ilToolbar = $DIC['ilToolbar'];
52 $tpl = $DIC['tpl'];
53 $ilTabs = $DIC['ilTabs'];
54 $locator = $DIC['ilLocator'];
55
56 if ($table_id == 0) {
57 $table_id = $_GET['table_id'];
58 }
59
60 $this->parent_obj = $a_parent_obj;
61 $this->ctrl = $ilCtrl;
62 $this->lng = $lng;
63 $this->tpl = $tpl;
64 $this->tabs = $ilTabs;
65 $this->toolbar = $ilToolbar;
66 $this->table = ilDclCache::getTableCache($table_id);
67
68 $this->ctrl->saveParameterByClass('ilDclTableEditGUI', 'table_id');
69 $locator->addItem($this->table->getTitle(), $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'edit'));
70 $this->tpl->setLocator();
71
72 if (!$this->checkAccess()) {
73 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
74 $this->ctrl->redirectByClass('ildclrecordlistgui', 'listRecords');
75 }
76 }
$_GET["client_id"]
static getTableCache($table_id=0)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilCtrl
Definition: ilias.php:18
$DIC
Definition: xapitoken.php:46

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

+ Here is the call graph for this function:

Member Function Documentation

◆ checkAccess()

ilDclTableViewGUI::checkAccess ( )
protected
Returns
bool

Definition at line 108 of file class.ilDclTableViewGUI.php.

109 {
110 return ilObjDataCollectionAccess::hasAccessToEditTable($this->parent_obj->getDataCollectionObject()->getRefId(), $this->table->getId());
111 }
static hasAccessToEditTable($ref_id, $table_id)

References ilObjDataCollectionAccess\hasAccessToEditTable().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkViewsLeft()

ilDclTableViewGUI::checkViewsLeft (   $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 203 of file class.ilDclTableViewGUI.php.

204 {
205 if ($delete_count >= count($this->table->getTableViews())) {
206 ilUtil::sendFailure($this->lng->txt('dcl_msg_tableviews_delete_all'), true);
207 $this->ctrl->redirect($this, 'show');
208 }
209 }

References ilUtil\sendFailure().

Referenced by confirmDeleteTableviews().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteTableviews()

ilDclTableViewGUI::confirmDeleteTableviews ( )

Confirm deletion of multiple fields.

Definition at line 163 of file class.ilDclTableViewGUI.php.

164 {
165 //at least one view must exist
166 $tableviews = isset($_POST['dcl_tableview_ids']) ? $_POST['dcl_tableview_ids'] : array();
167 $this->checkViewsLeft(count($tableviews));
168
169 $this->tabs->clearSubTabs();
170 $conf = new ilConfirmationGUI();
171 $conf->setFormAction($this->ctrl->getFormAction($this));
172 $conf->setHeaderText($this->lng->txt('dcl_tableviews_confirm_delete'));
173
174 foreach ($tableviews as $tableview_id) {
175 $conf->addItem('dcl_tableview_ids[]', $tableview_id, ilDclTableView::find($tableview_id)->getTitle());
176 }
177 $conf->setConfirm($this->lng->txt('delete'), 'deleteTableviews');
178 $conf->setCancel($this->lng->txt('cancel'), 'show');
179 $this->tpl->setContent($conf->getHTML());
180 }
$_POST["username"]
Confirmation screen class.
checkViewsLeft($delete_count)
redirects if there are no tableviews left after deletion of {$delete_count} tableviews

References $_POST, and checkViewsLeft().

+ Here is the call graph for this function:

◆ deleteTableviews()

ilDclTableViewGUI::deleteTableviews ( )
protected

Definition at line 186 of file class.ilDclTableViewGUI.php.

187 {
188 $tableviews = isset($_POST['dcl_tableview_ids']) ? $_POST['dcl_tableview_ids'] : array();
189 foreach ($tableviews as $tableview_id) {
190 ilDclTableView::find($tableview_id)->delete();
191 }
192 $this->table->sortTableViews();
193 ilUtil::sendSuccess($this->lng->txt('dcl_msg_tableviews_deleted'), true);
194 $this->ctrl->redirect($this, 'show');
195 }

References $_POST.

◆ doTableSwitch()

ilDclTableViewGUI::doTableSwitch ( )

Definition at line 153 of file class.ilDclTableViewGUI.php.

154 {
155 $this->ctrl->setParameterByClass("ilDclTableViewGUI", "table_id", $_POST['table_id']);
156 $this->ctrl->redirectByClass("ilDclTableViewGUI", "show");
157 }

References $_POST.

◆ executeCommand()

ilDclTableViewGUI::executeCommand ( )

Definition at line 82 of file class.ilDclTableViewGUI.php.

83 {
84 $this->ctrl->saveParameter($this, 'table_id');
85 $cmd = $this->ctrl->getCmd("show");
86 $next_class = $this->ctrl->getNextClass($this);
87
88 switch ($next_class) {
89 case 'ildcltablevieweditgui':
90 $edit_gui = new ilDclTableViewEditGUI($this, $this->table, ilDclTableView::findOrGetInstance($_GET['tableview_id']));
91 $this->ctrl->saveParameter($edit_gui, 'tableview_id');
92 $this->ctrl->forwardCommand($edit_gui);
93 break;
94 default:
95 switch ($cmd) {
96 default:
97 $this->$cmd();
98 break;
99 }
100 break;
101 }
102 }
static findOrGetInstance($primary_key, array $add_constructor_args=array())
Class ilDclTableViewEditGUI.

References $_GET, and ActiveRecord\findOrGetInstance().

+ Here is the call graph for this function:

◆ saveTableViewOrder()

ilDclTableViewGUI::saveTableViewOrder ( )

invoked by ilDclTableViewTableGUI

Definition at line 215 of file class.ilDclTableViewGUI.php.

216 {
217 $orders = $_POST['order'];
218 asort($orders);
219 $tableviews = array();
220 foreach (array_keys($orders) as $tableview_id) {
221 $tableviews[] = ilDclTableView::find($tableview_id);
222 }
223 $this->table->sortTableViews($tableviews);
224 ilUtil::sendSuccess($this->lng->txt('dcl_msg_tableviews_order_updated'));
225 $this->ctrl->redirect($this);
226 }

References $_POST.

◆ show()

ilDclTableViewGUI::show ( )

Definition at line 117 of file class.ilDclTableViewGUI.php.

118 {
119 $add_new = ilLinkButton::getInstance();
120 $add_new->setPrimary(true);
121 $add_new->setCaption("dcl_add_new_view");
122 $add_new->setUrl($this->ctrl->getLinkTargetByClass('ilDclTableViewEditGUI', 'add'));
123 $this->toolbar->addStickyItem($add_new);
124
125 $this->toolbar->addSeparator();
126
127 // Show tables
128 $tables = $this->parent_obj->getDataCollectionObject()->getTables();
129
130 foreach ($tables as $table) {
131 $options[$table->getId()] = $table->getTitle();
132 }
133 $table_selection = new ilSelectInputGUI('', 'table_id');
134 $table_selection->setOptions($options);
135 $table_selection->setValue($this->table->getId());
136
137 $this->toolbar->setFormAction($this->ctrl->getFormActionByClass("ilDclTableViewGUI", "doTableSwitch"));
138 $this->toolbar->addText($this->lng->txt("dcl_select"));
139 $this->toolbar->addInputItem($table_selection);
140 $button = ilSubmitButton::getInstance();
141 $button->setCommand("doTableSwitch");
142 $button->setCaption('change');
143 $this->toolbar->addButtonInstance($button);
144
145 $table_gui = new ilDclTableViewTableGUI($this, 'show', $this->table);
146 $this->tpl->setContent($table_gui->getHTML());
147 }
Class ilDclTableViewTableGUI.
static getInstance()
Factory.
This class represents a selection list property in a property form.
static getInstance()
Factory.

References $table, ilLinkButton\getInstance(), and ilSubmitButton\getInstance().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilDclTableViewGUI::$ctrl
protected

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

◆ $lng

ilDclTableViewGUI::$lng
protected

Definition at line 21 of file class.ilDclTableViewGUI.php.

Referenced by __construct().

◆ $table

ilDclTableViewGUI::$table
protected

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

Referenced by show().

◆ $tabs

ilDclTableViewGUI::$tabs
protected

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

◆ $toolbar

ilDclTableViewGUI::$toolbar
protected

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

◆ $tpl

ilDclTableViewGUI::$tpl
protected

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

Referenced by __construct().


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