ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDataCollectionTableEditGUI Class Reference

Class ilDataCollectionField. More...

+ Collaboration diagram for ilDataCollectionTableEditGUI:

Public Member Functions

 __construct (ilObjDataCollectionGUI $a_parent_obj)
 Constructor.
 executeCommand ()
 execute command
 create ()
 create table add form
 edit ()
 create field edit form
 getValues ()
 getFieldValues
 getStandardValues ()
 getStandardValues
 cancel ()
 initForm ($a_mode="create")
 initEditCustomForm
 save ($a_mode="create")
 save
 accessDenied ()
 confirmDelete ()
 confirmDelete
 cancelDelete ()
 cancelDelete
 delete ()

Protected Member Functions

 checkInput ($a_mode)
 Custom checks for the form input.
 checkPermission ()

Protected Attributes

 $lng
 $ctrl
 $tpl

Private Attributes

 $table_id
 $table

Detailed Description

Constructor & Destructor Documentation

ilDataCollectionTableEditGUI::__construct ( ilObjDataCollectionGUI  $a_parent_obj)

Constructor.

Parameters
ilObjDataCollectionGUI$a_parent_obj

Definition at line 47 of file class.ilDataCollectionTableEditGUI.php.

References $_GET, $ilCtrl, $lng, $tpl, checkPermission(), ilDataCollectionCache\getTableCache(), and ilUtil\sendFailure().

{
global $ilCtrl, $lng, $tpl;
$this->ctrl = $ilCtrl;
$this->lng = $lng;
$this->tpl = $tpl;
$this->parent_object = $a_parent_obj;
$this->obj_id = $a_parent_obj->obj_id;
$this->table_id = $_GET['table_id'];
$this->table = ilDataCollectionCache::getTableCache($this->table_id);
if (! $this->checkPermission()) {
ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
$this->ctrl->redirectByClass('ildatacollectionrecordlistgui', 'listRecords');
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilDataCollectionTableEditGUI::accessDenied ( )

Definition at line 366 of file class.ilDataCollectionTableEditGUI.php.

Referenced by save().

{
$this->tpl->setContent("Access denied.");
}

+ Here is the caller graph for this function:

ilDataCollectionTableEditGUI::cancel ( )

Definition at line 165 of file class.ilDataCollectionTableEditGUI.php.

{
$this->ctrl->redirectByClass("ilDataCollectionFieldListGUI", "listFields");
}
ilDataCollectionTableEditGUI::cancelDelete ( )

cancelDelete

Definition at line 392 of file class.ilDataCollectionTableEditGUI.php.

{
$this->ctrl->redirectByClass("ildatacollectionfieldlistgui", "listFields");
}
ilDataCollectionTableEditGUI::checkInput (   $a_mode)
protected

Custom checks for the form input.

Parameters
$a_mode'create' | 'update'
Returns
bool

Definition at line 341 of file class.ilDataCollectionTableEditGUI.php.

References ilObjDataCollection\_hasTableByTitle(), and ilUtil\sendFailure().

Referenced by save().

{
$return = $this->form->checkInput();
// Title of table must be unique in one DC
if ($a_mode == 'create') {
if ($title = $this->form->getInput('title')) {
if (ilObjDataCollection::_hasTableByTitle($title, $this->obj_id)) {
$inputObj = $this->form->getItemByPostVar('title');
$inputObj->setAlert($this->lng->txt("dcl_table_title_unique"));
$return = false;
}
}
}
if (! $return) {
ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
}
return $return;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionTableEditGUI::checkPermission ( )
protected
Returns
bool

Definition at line 416 of file class.ilDataCollectionTableEditGUI.php.

References $ref_id, and ilObjDataCollection\_hasWriteAccess().

Referenced by __construct().

{
$ref_id = $this->parent_object->getDataCollectionObject()->getRefId();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionTableEditGUI::confirmDelete ( )

confirmDelete

Definition at line 374 of file class.ilDataCollectionTableEditGUI.php.

{
include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
$conf = new ilConfirmationGUI();
$conf->setFormAction($this->ctrl->getFormAction($this));
$conf->setHeaderText($this->lng->txt('dcl_confirm_delete_table'));
$conf->addItem('table', (int)$this->table->getId(), $this->table->getTitle());
$conf->setConfirm($this->lng->txt('delete'), 'delete');
$conf->setCancel($this->lng->txt('cancel'), 'cancelDelete');
$this->tpl->setContent($conf->getHTML());
}
ilDataCollectionTableEditGUI::create ( )

create table add form

Definition at line 87 of file class.ilDataCollectionTableEditGUI.php.

References getStandardValues(), and initForm().

{
$this->initForm();
$this->tpl->setContent($this->form->getHTML());
}

+ Here is the call graph for this function:

ilDataCollectionTableEditGUI::delete ( )

Definition at line 400 of file class.ilDataCollectionTableEditGUI.php.

References ilUtil\sendFailure().

{
$mainTableId = $this->table->getCollectionObject()->getMainTableId();
if ($mainTableId == $this->table->getId()) {
ilUtil::sendFailure($this->lng->txt("dcl_cant_delete_main_table"), true);
} else {
$this->ctrl->setParameterByClass("ildatacollectionfieldlistgui", "table_id", $mainTableId);
}
$this->table->doDelete();
$this->ctrl->redirectByClass("ildatacollectionfieldlistgui", "listFields");
}

+ Here is the call graph for this function:

ilDataCollectionTableEditGUI::edit ( )

create field edit form

Definition at line 97 of file class.ilDataCollectionTableEditGUI.php.

References ilDataCollectionCache\getTableCache(), getValues(), and initForm().

{
if (! $this->table_id) {
$this->ctrl->redirectByClass("ildatacollectionfieldeditgui", "listFields");
return;
} else {
$this->table = ilDataCollectionCache::getTableCache($this->table_id);
}
$this->initForm("edit");
$this->getValues();
$this->tpl->setContent($this->form->getHTML());
}

+ Here is the call graph for this function:

ilDataCollectionTableEditGUI::executeCommand ( )

execute command

Definition at line 67 of file class.ilDataCollectionTableEditGUI.php.

References $cmd, and save().

{
$cmd = $this->ctrl->getCmd();
$this->tpl->getStandardTemplate();
switch ($cmd) {
case 'update':
$this->save("update");
break;
default:
$this->$cmd();
break;
}
return true;
}

+ Here is the call graph for this function:

ilDataCollectionTableEditGUI::getStandardValues ( )

getStandardValues

Definition at line 145 of file class.ilDataCollectionTableEditGUI.php.

Referenced by create().

{
$values = array(
'title' => "",
'is_visible' => 1,
'add_perm' => 1,
'edit_perm' => 1,
'delete_perm' => 1,
'edit_by_owner' => 1,
'export_enabled' => 0,
'limited' => 0,
'limit_start' => NULL,
'limit_end' => NULL
);
$this->form->setValuesByArray($values);
}

+ Here is the caller graph for this function:

ilDataCollectionTableEditGUI::getValues ( )

getFieldValues

Definition at line 114 of file class.ilDataCollectionTableEditGUI.php.

Referenced by edit().

{
$values = array(
'title' => $this->table->getTitle(),
'add_perm' => $this->table->getAddPerm(),
'edit_perm' => $this->table->getEditPerm(),
'delete_perm' => $this->table->getDeletePerm(),
'edit_by_owner' => $this->table->getEditByOwner(),
'export_enabled' => $this->table->getExportEnabled(),
'limited' => $this->table->getLimited(),
'limit_start' => array( "date" => substr($this->table->getLimitStart(), 0, 10), "time" => substr($this->table->getLimitStart(), - 8) ),
'limit_end' => array( "date" => substr($this->table->getLimitEnd(), 0, 10), "time" => substr($this->table->getLimitEnd(), - 8) ),
'is_visible' => $this->table->getIsVisible(),
'default_sort_field' => $this->table->getDefaultSortField(),
'default_sort_field_order' => $this->table->getDefaultSortFieldOrder(),
'description' => $this->table->getDescription(),
'public_comments' => $this->table->getPublicCommentsEnabled(),
'view_own_records_perm' => $this->table->getViewOwnRecordsPerm(),
);
if (! $this->table->getLimitStart()) {
$values['limit_start'] = NULL;
}
if (! $this->table->getLimitEnd()) {
$values['limit_end'] = NULL;
}
$this->form->setValuesByArray($values);
}

+ Here is the caller graph for this function:

ilDataCollectionTableEditGUI::initForm (   $a_mode = "create")

initEditCustomForm

Parameters
string$a_mode

Definition at line 175 of file class.ilDataCollectionTableEditGUI.php.

References $options, $section, ilFormPropertyGUI\setRequired(), ilDateTimeInputGUI\setShowTime(), and ilTextAreaInputGUI\setUseRte().

Referenced by create(), edit(), and save().

{
include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
$this->form = new ilPropertyFormGUI();
$item = new ilTextInputGUI($this->lng->txt('title'), 'title');
$item->setRequired(true);
$this->form->addItem($item);
$item = new ilCheckboxInputGUI($this->lng->txt('dcl_visible'), 'is_visible');
$this->form->addItem($item);
// Show default order field and direction only in edit mode, because table id is not yet given and there are no fields to select
if ($a_mode != 'create') {
$item = new ilSelectInputGUI($this->lng->txt('dcl_default_sort_field'), 'default_sort_field');
$fields = $this->table->getVisibleFields();
$options = array( 0 => $this->lng->txt('dcl_please_select') );
foreach ($fields as $field) {
$options[$field->getId()] = $field->getTitle();
}
$item->setOptions($options);
$this->form->addItem($item);
$item = new ilSelectInputGUI($this->lng->txt('dcl_default_sort_field_order'), 'default_sort_field_order');
$options = array( 'asc' => $this->lng->txt('dcl_asc'), 'desc' => $this->lng->txt('dcl_desc') );
$item->setOptions($options);
$this->form->addItem($item);
}
$item = new ilTextAreaInputGUI($this->lng->txt('additional_info'), 'description');
$item->setUseRte(true);
// $item->setRTESupport($this->table->getId(), 'dcl', 'table_settings');
$item->setRteTagSet('mini');
$this->form->addItem($item);
$item = new ilCheckboxInputGUI($this->lng->txt('dcl_public_comments'), 'public_comments');
$this->form->addItem($item);
$section->setTitle($this->lng->txt('dcl_permissions_form'));
$this->form->addItem($section);
$item = new ilCustomInputGUI();
$item->setHtml($this->lng->txt('dcl_table_info'));
$item->setTitle($this->lng->txt('dcl_table_info_title'));
$this->form->addItem($item);
$item = new ilCheckboxInputGUI($this->lng->txt('dcl_add_perm'), 'add_perm');
// $item->setInfo($this->lng->txt("dcl_add_perm_info"));
$this->form->addItem($item);
$item = new ilCheckboxInputGUI($this->lng->txt('dcl_edit_perm'), 'edit_perm');
// $item->setInfo($this->lng->txt("dcl_edit_perm_info"));
$this->form->addItem($item);
$item = new ilCheckboxInputGUI($this->lng->txt('dcl_delete_perm'), 'delete_perm');
// $item->setInfo($this->lng->txt("dcl_delete_perm_info"));
$this->form->addItem($item);
$item = new ilCheckboxInputGUI($this->lng->txt('dcl_edit_by_owner'), 'edit_by_owner');
// $item->setInfo($this->lng->txt("dcl_edit_by_owner_info"));
$this->form->addItem($item);
$item = new ilCheckboxInputGUI($this->lng->txt('dcl_view_own_records_perm'), 'view_own_records_perm');
// $item->setInfo($this->lng->txt("dcl_edit_by_owner_info"));
$this->form->addItem($item);
$item = new ilCheckboxInputGUI($this->lng->txt('dcl_export_enabled'), 'export_enabled');
$this->form->addItem($item);
$item = new ilCheckboxInputGUI($this->lng->txt('dcl_limited'), 'limited');
$sitem1 = new ilDateTimeInputGUI($this->lng->txt('dcl_limit_start'), 'limit_start');
$sitem1->setShowTime(true);
$sitem2 = new ilDateTimeInputGUI($this->lng->txt('dcl_limit_end'), 'limit_end');
$sitem2->setShowTime(true);
// $item->setInfo($this->lng->txt("dcl_limited_info"));
$item->addSubItem($sitem1);
$item->addSubItem($sitem2);
$this->form->addItem($item);
if ($a_mode == "edit") {
$this->form->addCommandButton('update', $this->lng->txt('dcl_table_' . $a_mode));
} else {
$this->form->addCommandButton('save', $this->lng->txt('dcl_table_' . $a_mode));
}
$this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
$this->form->setFormAction($this->ctrl->getFormAction($this, $a_mode));
if ($a_mode == "edit") {
$this->form->setTitle($this->lng->txt('dcl_edit_table'));
} else {
$this->form->setTitle($this->lng->txt('dcl_new_table'));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionTableEditGUI::save (   $a_mode = "create")

save

Parameters
string$a_modevalues: create | edit

Definition at line 271 of file class.ilDataCollectionTableEditGUI.php.

References accessDenied(), ilObjDataCollectionAccess\checkActionForObjId(), checkInput(), ilDataCollectionCache\getTableCache(), initForm(), and ilUtil\sendSuccess().

Referenced by executeCommand().

{
global $ilTabs;
if (! ilObjDataCollectionAccess::checkActionForObjId('write', $this->obj_id)) {
$this->accessDenied();
return;
}
$ilTabs->activateTab("id_fields");
$this->initForm($a_mode);
if ($this->checkInput($a_mode)) {
if ($a_mode != "update") {
} elseif ($this->table_id) {
$this->table = ilDataCollectionCache::getTableCache($this->table_id);
} else {
$this->ctrl->redirectByClass("ildatacollectionfieldeditgui", "listFields");
}
$this->table->setTitle($this->form->getInput("title"));
$this->table->setObjId($this->obj_id);
$this->table->setIsVisible($this->form->getInput("is_visible"));
$this->table->setAddPerm($this->form->getInput("add_perm"));
$this->table->setEditPerm($this->form->getInput("edit_perm"));
$this->table->setDeletePerm($this->form->getInput("delete_perm"));
$this->table->setEditByOwner($this->form->getInput("edit_by_owner"));
$this->table->setViewOwnRecordsPerm($this->form->getInput('view_own_records_perm'));
$this->table->setExportEnabled($this->form->getInput("export_enabled"));
$this->table->setDefaultSortField($this->form->getInput("default_sort_field"));
$this->table->setDefaultSortFieldOrder($this->form->getInput("default_sort_field_order"));
$this->table->setPublicCommentsEnabled($this->form->getInput('public_comments'));
$this->table->setLimited($this->form->getInput("limited"));
$this->table->setDescription($this->form->getInput('description'));
$limit_start = $this->form->getInput("limit_start");
$limit_end = $this->form->getInput("limit_end");
$this->table->setLimitStart($limit_start["date"] . " " . $limit_start["time"]);
$this->table->setLimitEnd($limit_end["date"] . " " . $limit_end["time"]);
if (! $this->table->hasPermissionToAddTable($this->parent_object->ref_id)) {
$this->accessDenied();
return;
}
if ($a_mode == "update") {
$this->table->doUpdate();
ilUtil::sendSuccess($this->lng->txt("dcl_msg_table_edited"), true);
$this->ctrl->redirectByClass("ildatacollectiontableeditgui", "edit");
} else {
$this->table->doCreate();
ilUtil::sendSuccess($this->lng->txt("dcl_msg_table_created"), true);
$this->ctrl->setParameterByClass("ildatacollectionfieldlistgui", "table_id", $this->table->getId());
$this->ctrl->redirectByClass("ildatacollectionfieldlistgui", "listFields");
}
} else {
$this->form->setValuesByPost();
$this->tpl->setContent($this->form->getHTML());
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilDataCollectionTableEditGUI::$ctrl
protected

Definition at line 35 of file class.ilDataCollectionTableEditGUI.php.

ilDataCollectionTableEditGUI::$lng
protected

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

Referenced by __construct().

ilDataCollectionTableEditGUI::$table
private

Definition at line 27 of file class.ilDataCollectionTableEditGUI.php.

ilDataCollectionTableEditGUI::$table_id
private

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

ilDataCollectionTableEditGUI::$tpl
protected

Definition at line 39 of file class.ilDataCollectionTableEditGUI.php.

Referenced by __construct().


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