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

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

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

119 {
120 return ilObjDataCollectionAccess::hasAccessToEditTable($this->parent_obj->getDataCollectionObject()->getRefId(), $this->table->getId());
121 }
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 211 of file class.ilDclTableViewGUI.php.

212 {
213 if ($delete_count >= count($this->table->getTableViews()))
214 {
215 ilUtil::sendFailure($this->lng->txt('dcl_msg_tableviews_delete_all'), true);
216 $this->ctrl->redirect($this, 'show');
217 }
218 }

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

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

196 {
197 $tableviews = isset($_POST['dcl_tableview_ids']) ? $_POST['dcl_tableview_ids'] : array();
198 foreach ($tableviews as $tableview_id) {
199 ilDclTableView::find($tableview_id)->delete();
200 }
201 $this->table->sortTableViews();
202 ilUtil::sendSuccess($this->lng->txt('dcl_msg_tableviews_deleted'), true);
203 $this->ctrl->redirect($this, 'show');
204 }
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 163 of file class.ilDclTableViewGUI.php.

164 {
165 $this->ctrl->setParameterByClass("ilDclTableViewGUI", "table_id", $_POST['table_id']);
166 $this->ctrl->redirectByClass("ilDclTableViewGUI", "show");
167 }

References $_POST.

◆ executeCommand()

ilDclTableViewGUI::executeCommand ( )

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

89 {
90 $this->ctrl->saveParameter($this, 'table_id');
91 $cmd = $this->ctrl->getCmd("show");
92 $next_class = $this->ctrl->getNextClass($this);
93
94 switch ($next_class)
95 {
96 case 'ildcltablevieweditgui':
97 require_once('./Modules/DataCollection/classes/TableView/class.ilDclTableViewEditGUI.php');
98 $edit_gui = new ilDclTableViewEditGUI($this, $this->table, ilDclTableView::findOrGetInstance($_GET['tableview_id']));
99 $this->ctrl->saveParameter($edit_gui, 'tableview_id');
100 $this->ctrl->forwardCommand($edit_gui);
101 break;
102 default:
103 switch($cmd)
104 {
105 default:
106 $this->$cmd();
107 break;
108 }
109 break;
110 }
111
112
113 }
static findOrGetInstance($primary_key, array $add_constructor_args=array())
Class ilDclTableViewEditGUI.
$cmd
Definition: sahs_server.php:35

References $_GET, $cmd, and ActiveRecord\findOrGetInstance().

+ Here is the call graph for this function:

◆ saveTableViewOrder()

ilDclTableViewGUI::saveTableViewOrder ( )

invoked by ilDclTableViewTableGUI

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

224 {
225 $orders = $_POST['order'];
226 asort($orders);
227 $tableviews = array();
228 foreach(array_keys($orders) as $tableview_id)
229 {
230 $tableviews[] = ilDclTableView::find($tableview_id);
231 }
232 $this->table->sortTableViews($tableviews);
233 ilUtil::sendSuccess($this->lng->txt('dcl_msg_tableviews_order_updated'));
234 $this->ctrl->redirect($this);
235 }

References $_POST, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ show()

ilDclTableViewGUI::show ( )

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

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

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

◆ $lng

ilDclTableViewGUI::$lng
protected

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

Referenced by __construct().

◆ $table

ilDclTableViewGUI::$table
protected

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

Referenced by show().

◆ $tabs

ilDclTableViewGUI::$tabs
protected

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

◆ $toolbar

ilDclTableViewGUI::$toolbar
protected

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

◆ $tpl

ilDclTableViewGUI::$tpl
protected

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

Referenced by __construct().


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