61 $locator = $DIC[
'ilLocator'];
67 $this->parent_object = $a_parent_obj;
68 $this->obj_id = $a_parent_obj->obj_id;
69 $this->table_id =
$_GET[
'table_id'];
72 $this->ctrl->saveParameter($this,
'table_id');
73 $locator->addItem($this->table->getTitle(), $this->ctrl->getLinkTarget($this,
'edit'));
74 $this->tpl->setLocator();
78 $this->ctrl->redirectByClass(
'ildclrecordlistgui',
'listRecords');
88 $cmd = $this->ctrl->getCmd();
92 $this->
save(
"update");
110 $this->tpl->setContent($this->form->getHTML());
119 if (!$this->table_id) {
120 $this->ctrl->redirectByClass(
"ildclfieldeditgui",
"listFields");
128 $this->tpl->setContent($this->form->getHTML());
138 'title' => $this->table->getTitle(),
139 'add_perm' => (int) $this->table->getAddPerm(),
140 'edit_perm' => (int) $this->table->getEditPerm(),
141 'edit_perm_mode' => $this->table->getEditByOwner() ?
'own' :
'all',
142 'delete_perm' => (int) $this->table->getDeletePerm(),
143 'delete_perm_mode' => $this->table->getDeleteByOwner() ?
'own' :
'all',
144 'export_enabled' => $this->table->getExportEnabled(),
145 'import_enabled' => $this->table->getImportEnabled(),
146 'limited' => $this->table->getLimited(),
147 'limit_start' => substr($this->table->getLimitStart(), 0, 10) .
" " . substr($this->table->getLimitStart(), -8),
148 'limit_end' => substr($this->table->getLimitEnd(), 0, 10) .
" " . substr($this->table->getLimitEnd(), -8),
149 'default_sort_field' => $this->table->getDefaultSortField(),
150 'default_sort_field_order' => $this->table->getDefaultSortFieldOrder(),
151 'description' => $this->table->getDescription(),
152 'view_own_records_perm' => $this->table->getViewOwnRecordsPerm(),
153 'save_confirmation' => $this->table->getSaveConfirmation(),
155 if (!$this->table->getLimitStart()) {
158 if (!$this->table->getLimitEnd()) {
161 $this->form->setValuesByArray(
$values);
174 'edit_perm_mode' =>
'own',
175 'delete_perm_mode' =>
'own',
177 'edit_by_owner' => 1,
178 'export_enabled' => 0,
179 'import_enabled' => 0,
181 'limit_start' => null,
184 $this->form->setValuesByArray(
$values);
193 $this->ctrl->redirectByClass(
"ilDclTableListGUI",
"listTables");
204 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
209 $this->form->addItem($item);
212 if ($a_mode !=
'create') {
215 $item =
new ilSelectInputGUI($this->lng->txt(
'dcl_default_sort_field'),
'default_sort_field');
216 $item->
setInfo($this->lng->txt(
'dcl_default_sort_field_desc'));
217 $fields = $this->table->getFields();
218 $options = array(0 => $this->lng->txt(
'dcl_please_select'));
219 foreach ($fields as $field) {
220 if ($field->getId() ==
'comments') {
223 $options[$field->getId()] = $field->getTitle();
226 $this->form->addItem($item);
228 $item =
new ilSelectInputGUI($this->lng->txt(
'dcl_default_sort_field_order'),
'default_sort_field_order');
229 $options = array(
'asc' => $this->lng->txt(
'dcl_asc'),
'desc' => $this->lng->txt(
'dcl_desc'));
230 $item->setOptions($options);
231 $this->form->addItem($item);
236 $item->setInfo($this->lng->txt(
'dcl_additional_info_desc'));
238 $item->setRteTagSet(
'mini');
239 $this->form->addItem($item);
242 $section->setTitle($this->lng->txt(
'dcl_permissions_form'));
246 $item->setHtml($this->lng->txt(
'dcl_table_info'));
247 $item->setTitle($this->lng->txt(
'dcl_table_info_title'));
248 $this->form->addItem($item);
251 $item->
setInfo($this->lng->txt(
"dcl_add_perm_desc"));
252 $this->form->addItem($item);
254 $item =
new ilCheckboxInputGUI($this->lng->txt(
'dcl_save_confirmation'),
'save_confirmation');
255 $item->
setInfo($this->lng->txt(
'dcl_save_confirmation_desc'));
256 $this->form->addItem($item);
260 $this->form->addItem($item);
263 $radios->addOption(
new ilRadioOption($this->lng->txt(
'dcl_all_entries'),
'all'));
264 $radios->addOption(
new ilRadioOption($this->lng->txt(
'dcl_own_entries'),
'own'));
265 $item->addSubItem($radios);
269 $this->form->addItem($item);
272 $radios->addOption(
new ilRadioOption($this->lng->txt(
'dcl_all_entries'),
'all'));
273 $radios->addOption(
new ilRadioOption($this->lng->txt(
'dcl_own_entries'),
'own'));
274 $item->addSubItem($radios);
276 $item =
new ilCheckboxInputGUI($this->lng->txt(
'dcl_view_own_records_perm'),
'view_own_records_perm');
278 $this->form->addItem($item);
280 $item =
new ilCheckboxInputGUI($this->lng->txt(
'dcl_export_enabled'),
'export_enabled');
281 $item->
setInfo($this->lng->txt(
'dcl_export_enabled_desc'));
282 $this->form->addItem($item);
284 $item =
new ilCheckboxInputGUI($this->lng->txt(
'dcl_import_enabled'),
'import_enabled');
285 $item->
setInfo($this->lng->txt(
'dcl_import_enabled_desc'));
286 $this->form->addItem($item);
290 $sitem1->setShowTime(
true);
293 $item->setInfo($this->lng->txt(
"dcl_limited_desc"));
294 $item->addSubItem($sitem1);
295 $item->addSubItem($sitem2);
296 $this->form->addItem($item);
298 if ($a_mode ==
"edit") {
299 $this->form->addCommandButton(
'update', $this->lng->txt(
'dcl_table_' . $a_mode));
301 $this->form->addCommandButton(
'save', $this->lng->txt(
'dcl_table_' . $a_mode));
304 $this->form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
305 $this->form->setFormAction($this->ctrl->getFormAction($this, $a_mode));
306 if ($a_mode ==
"edit") {
307 $this->form->setTitle($this->lng->txt(
'dcl_edit_table'));
309 $this->form->setTitle($this->lng->txt(
'dcl_new_table'));
319 $this->ctrl->setParameter($this,
"table_id",
$_POST[
'table_id']);
320 $this->ctrl->redirect($this,
"edit");
329 public function save($a_mode =
"create")
332 $ilTabs = $DIC[
'ilTabs'];
340 $ilTabs->activateTab(
"id_fields");
344 if ($a_mode !=
"update") {
346 } elseif ($this->table_id) {
349 $this->ctrl->redirectByClass(
"ildclfieldeditgui",
"listFields");
352 $this->table->setTitle($this->form->getInput(
"title"));
353 $this->table->setObjId($this->obj_id);
354 $this->table->setSaveConfirmation((
bool) $this->form->getInput(
'save_confirmation'));
355 $this->table->setAddPerm((
bool) $this->form->getInput(
"add_perm"));
356 $this->table->setEditPerm((
bool) $this->form->getInput(
"edit_perm"));
357 if ($this->table->getEditPerm()) {
358 $edit_by_owner = ($this->form->getInput(
'edit_perm_mode') ==
'own');
359 $this->table->setEditByOwner($edit_by_owner);
361 $this->table->setDeletePerm((
bool) $this->form->getInput(
"delete_perm"));
362 if ($this->table->getDeletePerm()) {
363 $delete_by_owner = ($this->form->getInput(
'delete_perm_mode') ==
'own');
364 $this->table->setDeleteByOwner($delete_by_owner);
366 $this->table->setViewOwnRecordsPerm($this->form->getInput(
'view_own_records_perm'));
367 $this->table->setExportEnabled($this->form->getInput(
"export_enabled"));
368 $this->table->setImportEnabled($this->form->getInput(
"import_enabled"));
369 $this->table->setDefaultSortField($this->form->getInput(
"default_sort_field"));
370 $this->table->setDefaultSortFieldOrder($this->form->getInput(
"default_sort_field_order"));
371 $this->table->setLimited($this->form->getInput(
"limited"));
372 $this->table->setDescription($this->form->getInput(
'description'));
373 $limit_start = $this->form->getInput(
"limit_start");
374 $limit_end = $this->form->getInput(
"limit_end");
375 $this->table->setLimitStart($limit_start);
376 $this->table->setLimitEnd($limit_end);
377 if ($a_mode ==
"update") {
378 $this->table->doUpdate();
379 ilUtil::sendSuccess($this->lng->txt(
"dcl_msg_table_edited"),
true);
380 $this->ctrl->redirectByClass(
"ildcltableeditgui",
"edit");
382 $this->table->doCreate();
383 ilUtil::sendSuccess($this->lng->txt(
"dcl_msg_table_created"),
true);
384 $this->ctrl->setParameterByClass(
"ildclfieldlistgui",
"table_id", $this->table->getId());
385 $this->ctrl->redirectByClass(
"ildclfieldlistgui",
"listFields");
388 $this->form->setValuesByPost();
389 $this->tpl->setContent($this->form->getHTML());
403 $return = $this->form->checkInput();
406 if ($a_mode ==
'create') {
407 if (
$title = $this->form->getInput(
'title')) {
409 $inputObj = $this->form->getItemByPostVar(
'title');
410 $inputObj->setAlert($this->lng->txt(
"dcl_table_title_unique"));
429 $this->tpl->setContent(
"Access denied.");
438 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
440 $conf->setFormAction($this->ctrl->getFormAction($this));
441 $conf->setHeaderText($this->lng->txt(
'dcl_confirm_delete_table'));
443 $conf->addItem(
'table', (
int) $this->table->getId(), $this->table->getTitle());
445 $conf->setConfirm($this->lng->txt(
'delete'),
'delete');
446 $conf->setCancel($this->lng->txt(
'cancel'),
'cancelDelete');
448 $this->tpl->setContent($conf->getHTML());
457 $this->ctrl->redirectByClass(
"ilDclTableListGUI",
"listTables");
464 public function delete()
466 if (count($this->table->getCollectionObject()->getTables()) < 2) {
468 $this->table->doDelete(
true);
470 $this->table->doDelete(
false);
473 $this->ctrl->redirectByClass(
"ildcltablelistgui",
"listtables");
482 $ref_id = $this->parent_object->getDataCollectionObject()->getRefId();
495 $tables = $this->parent_object->getDataCollectionObject()->getTables();
497 foreach ($tables as
$table) {
498 $options[$table->getId()] = $table->getTitle();
500 include_once
'./Services/Form/classes/class.ilSelectInputGUI.php';
502 $table_selection->setOptions(
$options);
503 $table_selection->setValue($this->table->getId());
505 $this->toolbar->setFormAction($this->ctrl->getFormActionByClass(
"ilDclTableEditGUI",
"doTableSwitch"));
506 $this->toolbar->addText($this->lng->txt(
"dcl_select"));
507 $this->toolbar->addInputItem($table_selection);
509 $button->setCommand(
"doTableSwitch");
510 $button->setCaption(
'change');
511 $this->toolbar->addButtonInstance($button);
initForm($a_mode="create")
initEditCustomForm
This class represents an option in a radio group.
confirmDelete()
confirmDelete
create()
create table add form
setUseRte($a_usert, $version='')
Set Use Rich Text Editing.
getStandardValues()
getStandardValues
checkInput($a_mode)
Custom checks for the form input.
static hasAccessToEditTable($ref_id, $table_id)
static getTableCache($table_id=0)
cancelDelete()
cancelDelete
executeCommand()
execute command
save($a_mode="create")
save
static hasWriteAccess($ref, $user_id=0)
This class represents a text property in a property form.
static _hasTableByTitle($title, $obj_id)
Checks if a DataCollection has a table with a given title.
__construct(ilDclTableListGUI $a_parent_obj)
Constructor.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getValues()
getFieldValues
This class represents a text area property in a property form.
edit()
create field edit form
static checkActionForObjId($action, $obj_id)
Class ilDclBaseFieldModel.
Confirmation screen class.