ILIAS  release_4-3 Revision
 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 ()

Private Attributes

 $table_id
 $table

Detailed Description

Constructor & Destructor Documentation

ilDataCollectionTableEditGUI::__construct ( ilObjDataCollectionGUI  $a_parent_obj)

Constructor.

Parameters
object$a_parent_obj

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

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

{
global $ilCtrl, $lng;
$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($lng->txt('permission_denied'), true);
$ilCtrl->redirectByClass('ildatacollectionrecordlistgui', 'listRecords');
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilDataCollectionTableEditGUI::accessDenied ( )

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

References $tpl.

Referenced by save().

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

+ Here is the caller graph for this function:

ilDataCollectionTableEditGUI::cancel ( )

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

References $ilCtrl.

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

cancelDelete

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

References $ilCtrl.

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

Custom checks for the form input.

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

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

References $lng, $title, ilObjDataCollection\_hasTableByTitle(), and ilUtil\sendFailure().

Referenced by save().

{
global $lng;
$return = $this->form->checkInput();
// Title of table must be unique in one DC
if ($a_mode == 'create') {
if ($title = $this->form->getInput('title')) {
$inputObj = $this->form->getItemByPostVar('title');
$inputObj->setAlert($lng->txt("dcl_table_title_unique"));
$return = false;
}
}
}
if (!$return) ilUtil::sendFailure($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 395 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 347 of file class.ilDataCollectionTableEditGUI.php.

References $ilCtrl, $lng, and $tpl.

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

create table add form

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

References $tpl, getStandardValues(), and initForm().

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

+ Here is the call graph for this function:

ilDataCollectionTableEditGUI::delete ( )

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

References $ilCtrl, $lng, and ilUtil\sendFailure().

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

+ Here is the call graph for this function:

ilDataCollectionTableEditGUI::edit ( )

create field edit form

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

References $ilCtrl, $tpl, ilDataCollectionCache\getTableCache(), getValues(), and initForm().

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

+ Here is the call graph for this function:

ilDataCollectionTableEditGUI::executeCommand ( )

execute command

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

References $cmd, $ilCtrl, $ilUser, $tpl, and save().

{
global $tpl, $ilCtrl, $ilUser;
$cmd = $ilCtrl->getCmd();
$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 132 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 108 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()
);
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 164 of file class.ilDataCollectionTableEditGUI.php.

References $ilCtrl, $ilErr, $lng, $section, ilSubEnabledFormPropertyGUI\addSubItem(), and ilFormPropertyGUI\setRequired().

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

{
global $ilCtrl, $ilErr, $lng;
include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
$this->form = new ilPropertyFormGUI();
$item = new ilTextInputGUI($lng->txt('title'),'title');
$item->setRequired(true);
$this->form->addItem($item);
$item = new ilCheckboxInputGUI($lng->txt('dcl_visible'),'is_visible');
$this->form->addItem($item);
$section->setTitle($lng->txt('dcl_permissions_form'));
$this->form->addItem($section);
$item = new ilCustomInputGUI();
$item->setHtml($lng->txt('dcl_table_info'));
$item->setTitle($lng->txt('dcl_table_info_title'));
$this->form->addItem($item);
$item = new ilCheckboxInputGUI($lng->txt('dcl_add_perm'),'add_perm');
// $item->setInfo($lng->txt("dcl_add_perm_info"));
$this->form->addItem($item);
$item = new ilCheckboxInputGUI($lng->txt('dcl_edit_perm'),'edit_perm');
// $item->setInfo($lng->txt("dcl_edit_perm_info"));
$this->form->addItem($item);
$item = new ilCheckboxInputGUI($lng->txt('dcl_delete_perm'),'delete_perm');
// $item->setInfo($lng->txt("dcl_delete_perm_info"));
$this->form->addItem($item);
$item = new ilCheckboxInputGUI($lng->txt('dcl_edit_by_owner'),'edit_by_owner');
// $item->setInfo($lng->txt("dcl_edit_by_owner_info"));
$this->form->addItem($item);
$item = new ilCheckboxInputGUI($lng->txt('dcl_export_enabled'), 'export_enabled');
$this->form->addItem($item);
$item = new ilCheckboxInputGUI($lng->txt('dcl_limited'),'limited');
$sitem1 = new ilDateTimeInputGUI($lng->txt('dcl_limit_start'),'limit_start');
$sitem2 = new ilDateTimeInputGUI($lng->txt('dcl_limit_end'),'limit_end');
// $item->setInfo($lng->txt("dcl_limited_info"));
$item->addSubItem($sitem1);
$item->addSubItem($sitem2);
$this->form->addItem($item);
if($a_mode == "edit")
{
$this->form->addCommandButton('update', $lng->txt('dcl_table_'.$a_mode));
}
else
{
$this->form->addCommandButton('save', $lng->txt('dcl_table_'.$a_mode));
}
$this->form->addCommandButton('cancel', $lng->txt('cancel'));
$this->form->setFormAction($ilCtrl->getFormAction($this, $a_mode));
if($a_mode == "edit")
{
$this->form->setTitle($lng->txt('dcl_edit_table'));
}
else
{
$this->form->setTitle($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 236 of file class.ilDataCollectionTableEditGUI.php.

References $ilCtrl, $lng, $tpl, ilObjDataCollection\_checkAccess(), accessDenied(), checkInput(), ilDataCollectionCache\getTableCache(), initForm(), and ilUtil\sendSuccess().

Referenced by executeCommand().

{
global $ilCtrl, $ilTabs, $lng;
{
$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
{
$ilCtrl->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->setExportEnabled($this->form->getInput("export_enabled"));
$this->table->setLimited($this->form->getInput("limited"));
$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($lng->txt("dcl_msg_table_edited"), true);
$ilCtrl->redirectByClass("ildatacollectiontableeditgui", "edit");
}
else
{
$this->table->doCreate();
ilUtil::sendSuccess($lng->txt("dcl_msg_table_created"), true);
$ilCtrl->setParameterByClass("ildatacollectionfieldlistgui","table_id", $this->table->getId());
$ilCtrl->redirectByClass("ildatacollectionfieldlistgui", "listFields");
}
}
else
{
global $tpl;
$this->form->setValuesByPost();
$tpl->setContent($this->form->getHTML());
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

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.


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