5 require_once(
"./Modules/DataCollection/classes/Table/class.ilDclTable.php");
60 $locator = $DIC[
'ilLocator'];
66 $this->parent_object = $a_parent_obj;
67 $this->obj_id = $a_parent_obj->obj_id;
68 $this->table_id =
$_GET[
'table_id'];
71 $this->ctrl->saveParameter($this,
'table_id');
72 $locator->addItem($this->table->getTitle(), $this->ctrl->getLinkTarget($this,
'edit'));
73 $this->tpl->setLocator();
77 $this->ctrl->redirectByClass(
'ildclrecordlistgui',
'listRecords');
86 $cmd = $this->ctrl->getCmd();
90 $this->
save(
"update");
107 $this->tpl->setContent($this->form->getHTML());
115 if (!$this->table_id) {
116 $this->ctrl->redirectByClass(
"ildclfieldeditgui",
"listFields");
124 $this->tpl->setContent($this->form->getHTML());
133 'title' => $this->table->getTitle(),
134 'add_perm' => (int) $this->table->getAddPerm(),
135 'edit_perm' => (int) $this->table->getEditPerm(),
136 'edit_perm_mode' => $this->table->getEditByOwner() ?
'own' :
'all',
137 'delete_perm' => (int) $this->table->getDeletePerm(),
138 'delete_perm_mode' => $this->table->getDeleteByOwner() ?
'own' :
'all',
139 'export_enabled' => $this->table->getExportEnabled(),
140 'import_enabled' => $this->table->getImportEnabled(),
141 'limited' => $this->table->getLimited(),
142 'limit_start' => substr($this->table->getLimitStart(), 0, 10) .
" " . substr($this->table->getLimitStart(), - 8),
143 'limit_end' => substr($this->table->getLimitEnd(), 0, 10) .
" " . substr($this->table->getLimitEnd(), - 8),
144 'default_sort_field' => $this->table->getDefaultSortField(),
145 'default_sort_field_order' => $this->table->getDefaultSortFieldOrder(),
146 'description' => $this->table->getDescription(),
147 'view_own_records_perm' => $this->table->getViewOwnRecordsPerm(),
148 'save_confirmation' => $this->table->getSaveConfirmation(),
150 if (!$this->table->getLimitStart()) {
151 $values[
'limit_start'] = NULL;
153 if (!$this->table->getLimitEnd()) {
154 $values[
'limit_end'] = NULL;
156 $this->form->setValuesByArray($values);
168 'edit_perm_mode' =>
'own',
169 'delete_perm_mode' =>
'own',
171 'edit_by_owner' => 1,
172 'export_enabled' => 0,
173 'import_enabled' => 0,
175 'limit_start' => NULL,
178 $this->form->setValuesByArray($values);
186 $this->ctrl->redirectByClass(
"ilDclTableListGUI",
"listTables");
196 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
201 $this->form->addItem($item);
204 if ($a_mode !=
'create') {
207 $item =
new ilSelectInputGUI($this->lng->txt(
'dcl_default_sort_field'),
'default_sort_field');
208 $item->
setInfo($this->lng->txt(
'dcl_default_sort_field_desc'));
209 $fields = $this->table->getFields();
210 $options =
array( 0 => $this->lng->txt(
'dcl_please_select') );
211 foreach ($fields as $field) {
212 if ($field->getId() ==
'comments') {
215 $options[$field->getId()] = $field->getTitle();
218 $this->form->addItem($item);
220 $item =
new ilSelectInputGUI($this->lng->txt(
'dcl_default_sort_field_order'),
'default_sort_field_order');
221 $options =
array(
'asc' => $this->lng->txt(
'dcl_asc'),
'desc' => $this->lng->txt(
'dcl_desc') );
222 $item->setOptions($options);
223 $this->form->addItem($item);
228 $item->setInfo($this->lng->txt(
'dcl_additional_info_desc'));
230 $item->setRteTagSet(
'mini');
231 $this->form->addItem($item);
234 $section->setTitle($this->lng->txt(
'dcl_permissions_form'));
238 $item->setHtml($this->lng->txt(
'dcl_table_info'));
239 $item->setTitle($this->lng->txt(
'dcl_table_info_title'));
240 $this->form->addItem($item);
243 $item->
setInfo($this->lng->txt(
"dcl_add_perm_desc"));
244 $this->form->addItem($item);
246 $item =
new ilCheckboxInputGUI($this->lng->txt(
'dcl_save_confirmation'),
'save_confirmation');
247 $item->
setInfo($this->lng->txt(
'dcl_save_confirmation_desc'));
248 $this->form->addItem($item);
252 $this->form->addItem($item);
255 $radios->addOption(
new ilRadioOption($this->lng->txt(
'dcl_all_entries'),
'all'));
256 $radios->addOption(
new ilRadioOption($this->lng->txt(
'dcl_own_entries'),
'own'));
257 $item->addSubItem($radios);
261 $this->form->addItem($item);
264 $radios->addOption(
new ilRadioOption($this->lng->txt(
'dcl_all_entries'),
'all'));
265 $radios->addOption(
new ilRadioOption($this->lng->txt(
'dcl_own_entries'),
'own'));
266 $item->addSubItem($radios);
268 $item =
new ilCheckboxInputGUI($this->lng->txt(
'dcl_view_own_records_perm'),
'view_own_records_perm');
270 $this->form->addItem($item);
272 $item =
new ilCheckboxInputGUI($this->lng->txt(
'dcl_export_enabled'),
'export_enabled');
273 $item->
setInfo($this->lng->txt(
'dcl_export_enabled_desc'));
274 $this->form->addItem($item);
276 $item =
new ilCheckboxInputGUI($this->lng->txt(
'dcl_import_enabled'),
'import_enabled');
277 $item->
setInfo($this->lng->txt(
'dcl_import_enabled_desc'));
278 $this->form->addItem($item);
282 $sitem1->setShowTime(
true);
285 $item->setInfo($this->lng->txt(
"dcl_limited_desc"));
286 $item->addSubItem($sitem1);
287 $item->addSubItem($sitem2);
288 $this->form->addItem($item);
290 if ($a_mode ==
"edit") {
291 $this->form->addCommandButton(
'update', $this->lng->txt(
'dcl_table_' . $a_mode));
293 $this->form->addCommandButton(
'save', $this->lng->txt(
'dcl_table_' . $a_mode));
296 $this->form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
297 $this->form->setFormAction($this->ctrl->getFormAction($this, $a_mode));
298 if ($a_mode ==
"edit") {
299 $this->form->setTitle($this->lng->txt(
'dcl_edit_table'));
301 $this->form->setTitle($this->lng->txt(
'dcl_new_table'));
310 $this->ctrl->setParameter($this,
"table_id",
$_POST[
'table_id']);
311 $this->ctrl->redirect($this,
"edit");
319 public function save($a_mode =
"create") {
321 $ilTabs = $DIC[
'ilTabs'];
328 $ilTabs->activateTab(
"id_fields");
332 if ($a_mode !=
"update") {
334 } elseif ($this->table_id) {
337 $this->ctrl->redirectByClass(
"ildclfieldeditgui",
"listFields");
340 $this->table->setTitle($this->form->getInput(
"title"));
341 $this->table->setObjId($this->obj_id);
342 $this->table->setSaveConfirmation((
bool)$this->form->getInput(
'save_confirmation'));
343 $this->table->setAddPerm((
bool)$this->form->getInput(
"add_perm"));
344 $this->table->setEditPerm((
bool)$this->form->getInput(
"edit_perm"));
345 if ($this->table->getEditPerm()) {
346 $edit_by_owner = ($this->form->getInput(
'edit_perm_mode') ==
'own');
347 $this->table->setEditByOwner($edit_by_owner);
349 $this->table->setDeletePerm((
bool)$this->form->getInput(
"delete_perm"));
350 if ($this->table->getDeletePerm()) {
351 $delete_by_owner = ($this->form->getInput(
'delete_perm_mode') ==
'own');
352 $this->table->setDeleteByOwner($delete_by_owner);
354 $this->table->setViewOwnRecordsPerm($this->form->getInput(
'view_own_records_perm'));
355 $this->table->setExportEnabled($this->form->getInput(
"export_enabled"));
356 $this->table->setImportEnabled($this->form->getInput(
"import_enabled"));
357 $this->table->setDefaultSortField($this->form->getInput(
"default_sort_field"));
358 $this->table->setDefaultSortFieldOrder($this->form->getInput(
"default_sort_field_order"));
359 $this->table->setLimited($this->form->getInput(
"limited"));
360 $this->table->setDescription($this->form->getInput(
'description'));
361 $limit_start = $this->form->getInput(
"limit_start");
362 $limit_end = $this->form->getInput(
"limit_end");
363 $this->table->setLimitStart($limit_start);
364 $this->table->setLimitEnd($limit_end);
365 if ($a_mode ==
"update") {
366 $this->table->doUpdate();
368 $this->ctrl->redirectByClass(
"ildcltableeditgui",
"edit");
370 $this->table->doCreate();
372 $this->ctrl->setParameterByClass(
"ildclfieldlistgui",
"table_id", $this->table->getId());
373 $this->ctrl->redirectByClass(
"ildclfieldlistgui",
"listFields");
376 $this->form->setValuesByPost();
377 $this->tpl->setContent($this->form->getHTML());
390 $return = $this->form->checkInput();
393 if ($a_mode ==
'create') {
394 if (
$title = $this->form->getInput(
'title')) {
396 $inputObj = $this->form->getItemByPostVar(
'title');
397 $inputObj->setAlert($this->lng->txt(
"dcl_table_title_unique"));
415 $this->tpl->setContent(
"Access denied.");
423 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
425 $conf->setFormAction($this->ctrl->getFormAction($this));
426 $conf->setHeaderText($this->lng->txt(
'dcl_confirm_delete_table'));
428 $conf->addItem(
'table', (
int)$this->table->getId(), $this->table->getTitle());
430 $conf->setConfirm($this->lng->txt(
'delete'),
'delete');
431 $conf->setCancel($this->lng->txt(
'cancel'),
'cancelDelete');
433 $this->tpl->setContent($conf->getHTML());
441 $this->ctrl->redirectByClass(
"ilDclTableListGUI",
"listTables");
447 public function delete() {
448 if (count($this->table->getCollectionObject()->getTables()) < 2) {
450 $this->table->doDelete(
true);
452 $this->table->doDelete(
false);
455 $this->ctrl->redirectByClass(
"ildcltablelistgui",
"listtables");
463 $ref_id = $this->parent_object->getDataCollectionObject()->getRefId();
475 $tables = $this->parent_object->getDataCollectionObject()->getTables();
477 foreach ($tables as
$table) {
478 $options[$table->getId()] = $table->getTitle();
480 include_once
'./Services/Form/classes/class.ilSelectInputGUI.php';
482 $table_selection->setOptions(
$options);
483 $table_selection->setValue($this->table->getId());
485 $this->toolbar->setFormAction($this->ctrl->getFormActionByClass(
"ilDclTableEditGUI",
"doTableSwitch"));
486 $this->toolbar->addText($this->lng->txt(
"dcl_select"));
487 $this->toolbar->addInputItem($table_selection);
489 $button->setCommand(
"doTableSwitch");
490 $button->setCaption(
'change');
491 $this->toolbar->addButtonInstance($button);
initForm($a_mode="create")
initEditCustomForm
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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
if(!is_array($argv)) $options
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.
Create styles array
The data for the language used.
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.