ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 50 of file class.ilDclTableViewGUI.php.

51 {
52 global $DIC;
53 $ilCtrl = $DIC['ilCtrl'];
54 $lng = $DIC['lng'];
55 $ilToolbar = $DIC['ilToolbar'];
56 $tpl = $DIC['tpl'];
57 $ilTabs = $DIC['ilTabs'];
58 $locator = $DIC['ilLocator'];
59
60 if ($table_id == 0) {
61 $table_id = $_GET['table_id'];
62 }
63
64 $this->parent_obj = $a_parent_obj;
65 $this->ctrl = $ilCtrl;
66 $this->lng = $lng;
67 $this->tpl = $tpl;
68 $this->tabs = $ilTabs;
69 $this->toolbar = $ilToolbar;
70 $this->table = ilDclCache::getTableCache($table_id);
71
72 $this->ctrl->saveParameterByClass('ilDclTableEditGUI', 'table_id');
73 $locator->addItem($this->table->getTitle(), $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'edit'));
74 $this->tpl->setLocator();
75
76 if (!$this->checkAccess()) {
77 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
78 $this->ctrl->redirectByClass('ildclrecordlistgui', 'listRecords');
79 }
80 }
$_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
global $DIC
Definition: saml.php:7

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 111 of file class.ilDclTableViewGUI.php.

112 {
113 return ilObjDataCollectionAccess::hasAccessToEditTable($this->parent_obj->getDataCollectionObject()->getRefId(), $this->table->getId());
114 }
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 165 of file class.ilDclTableViewGUI.php.

166 {
167 //at least one view must exist
168 $tableviews = isset($_POST['dcl_tableview_ids']) ? $_POST['dcl_tableview_ids'] : array();
169 $this->checkViewsLeft(count($tableviews));
170
171 $this->tabs->clearSubTabs();
172 $conf = new ilConfirmationGUI();
173 $conf->setFormAction($this->ctrl->getFormAction($this));
174 $conf->setHeaderText($this->lng->txt('dcl_tableviews_confirm_delete'));
175
176 foreach ($tableviews as $tableview_id) {
177 $conf->addItem('dcl_tableview_ids[]', $tableview_id, ilDclTableView::find($tableview_id)->getTitle());
178 }
179 $conf->setConfirm($this->lng->txt('delete'), 'deleteTableviews');
180 $conf->setCancel($this->lng->txt('cancel'), 'show');
181 $this->tpl->setContent($conf->getHTML());
182 }
$_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 187 of file class.ilDclTableViewGUI.php.

188 {
189 $tableviews = isset($_POST['dcl_tableview_ids']) ? $_POST['dcl_tableview_ids'] : array();
190 foreach ($tableviews as $tableview_id) {
191 ilDclTableView::find($tableview_id)->delete();
192 }
193 $this->table->sortTableViews();
194 ilUtil::sendSuccess($this->lng->txt('dcl_msg_tableviews_deleted'), true);
195 $this->ctrl->redirect($this, 'show');
196 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References $_POST, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ doTableSwitch()

ilDclTableViewGUI::doTableSwitch ( )

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

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

References $_POST.

◆ executeCommand()

ilDclTableViewGUI::executeCommand ( )

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

87 {
88 $this->ctrl->saveParameter($this, 'table_id');
89 $cmd = $this->ctrl->getCmd("show");
90 $next_class = $this->ctrl->getNextClass($this);
91
92 switch ($next_class) {
93 case 'ildcltablevieweditgui':
94 $edit_gui = new ilDclTableViewEditGUI($this, $this->table, ilDclTableView::findOrGetInstance($_GET['tableview_id']));
95 $this->ctrl->saveParameter($edit_gui, 'tableview_id');
96 $this->ctrl->forwardCommand($edit_gui);
97 break;
98 default:
99 switch ($cmd) {
100 default:
101 $this->$cmd();
102 break;
103 }
104 break;
105 }
106 }
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 214 of file class.ilDclTableViewGUI.php.

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

References $_POST, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ show()

ilDclTableViewGUI::show ( )

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

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

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

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilDclTableViewGUI::$ctrl
protected

Definition at line 16 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 41 of file class.ilDclTableViewGUI.php.

Referenced by show().

◆ $tabs

ilDclTableViewGUI::$tabs
protected

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

◆ $toolbar

ilDclTableViewGUI::$toolbar
protected

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

◆ $tpl

ilDclTableViewGUI::$tpl
protected

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

Referenced by __construct().


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