4require_once(
"./Modules/DataCollection/classes/Fields/Base/class.ilDclBaseRecordModel.php");
 
    5require_once(
"./Modules/DataCollection/classes/Fields/Base/class.ilDclBaseFieldModel.php");
 
    6require_once(
"./Modules/DataCollection/classes/Table/class.ilDclTable.php");
 
    7require_once(
"./Modules/DataCollection/classes/Fields/Base/class.ilDclDatatype.php");
 
    8require_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
    9require_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
   10require_once(
'./Services/Utilities/classes/class.ilConfirmationGUI.php');
 
   11require_once(
'./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php');
 
   12require_once(
'./Modules/DataCollection/classes/Helpers/class.ilDclPropertyFormGUI.php');
 
   90                $this->record_id = $_REQUEST[
'record_id'];
 
   91                $this->table_id = $_REQUEST[
'table_id'];
 
   92                $this->tableview_id = $_REQUEST[
'tableview_id'];
 
  102                $cmd = $this->ctrl->getCmd();
 
  118                        $this->ctrl->saveParameter($this, 
'mode');
 
  119                        $this->ctrl->setParameterByClass(
"ildclrecordlistgui", 
"mode", 
$_GET[
'mode']);
 
  121                $this->ctrl->setParameterByClass(
'ildclrecordlistgui', 
'tableview_id', $this->tableview_id);
 
  122                $this->ctrl->saveParameter($this, 
'redirect');
 
  123                if ($this->record_id) {
 
  125                        if (!$this->record->hasPermissionToEdit($this->parent_obj->ref_id) OR !$this->record->hasPermissionToView($this->parent_obj->ref_id)) {
 
  128                        $this->table = $this->record->getTable();
 
  129                        $this->table_id = $this->table->getId();
 
  144                if ($this->ctrl->isAsynch()) {
 
  145                        echo $this->form->getHTML();
 
  149                                . $this->form->getHTML());
 
  162                if ($this->ctrl->isAsynch()) {
 
  163                        echo $this->form->getHTML();
 
  167                                . $this->form->getHTML());
 
  179                $conf->setFormAction($this->ctrl->getFormAction($this));
 
  180                $conf->setHeaderText($this->lng->txt(
'dcl_confirm_delete_record'));
 
  183                $all_fields = $this->table->getRecordFields();
 
  185                foreach($all_fields as $key=>$field) {
 
  189                        if($record_representation->getConfirmationHTML() !== 
false) {
 
  190                                $record_data .= $field->getTitle().
": ".$record_representation->getConfirmationHTML() .
"<br />";
 
  193                $conf->addItem(
'record_id', 
$record->getId(), $record_data);
 
  194                $conf->addHiddenItem(
'table_id', $this->table_id);
 
  195                $conf->addHiddenItem(
'tableview_id', $this->tableview_id);
 
  196                $conf->setConfirm($this->lng->txt(
'delete'), 
'delete');
 
  197                $conf->setCancel($this->lng->txt(
'cancel'), 
'cancelDelete');
 
  198                $this->tpl->setContent($conf->getHTML());
 
  206                $this->ctrl->redirectByClass(
"ildclrecordlistgui", 
"listRecords");
 
  213        public function delete() {
 
  216                if (!$this->table->hasPermissionToDeleteRecord($this->parent_obj->ref_id, 
$record)) {
 
  224                $this->ctrl->redirectByClass(
"ildclrecordlistgui", 
"listRecords");
 
  242                                $return = 
$record->getRecordFieldValues();
 
  245                if ($this->ctrl->isAsynch()) {
 
  246                        echo json_encode($return);
 
  261                $prefix = ($this->ctrl->isAsynch()) ? 
'dclajax' : 
'dcl'; 
 
  262                $this->form->setId($prefix . $this->table_id . $this->record_id);
 
  265                $hidden_prop->setValue($this->table_id);
 
  266                $this->form->addItem($hidden_prop);
 
  268                $hidden_prop->setValue($this->tableview_id);
 
  269                $this->form->addItem($hidden_prop);
 
  270                if ($this->record_id) {
 
  272                        $hidden_prop->setValue($this->record_id);
 
  273                        $this->form->addItem($hidden_prop);
 
  276                $this->ctrl->setParameter($this, 
"record_id", $this->record_id);
 
  277                $this->form->setFormAction($this->ctrl->getFormAction($this));
 
  278                $allFields = $this->table->getRecordFields();
 
  280                foreach ($allFields as $field) {
 
  282                        if ($item === NULL) {
 
  287                                $item->setDisabled(
true);
 
  289                        $this->form->addItem($item);
 
  292                $this->tpl->addInlineCss($inline_css);
 
  295                if ($this->record_id) {
 
  296                        $ownerField = $this->table->getField(
'owner');
 
  298                        $this->form->addItem($inputfield);
 
  303                if ($this->record_id) {
 
  304                        $this->form->setTitle($this->lng->txt(
"dcl_update_record"));
 
  305                        $this->form->addCommandButton(
"save", $this->lng->txt(
"dcl_update_record"));
 
  306                        if (!$this->ctrl->isAsynch()) {
 
  307                                $this->form->addCommandButton(
"cancelUpdate", $this->lng->txt(
"cancel"));
 
  310                        $this->form->setTitle($this->lng->txt(
"dcl_add_new_record"));
 
  311                        $this->form->addCommandButton(
"save", $this->lng->txt(
"save"));
 
  312                        if (!$this->ctrl->isAsynch()) {
 
  313                                $this->form->addCommandButton(
"cancelSave", $this->lng->txt(
"cancel"));
 
  316                $this->ctrl->setParameter($this, 
"tableview_id", $this->tableview_id);
 
  317                $this->ctrl->setParameter($this, 
"table_id", $this->table_id);
 
  318                $this->ctrl->setParameter($this, 
"record_id", $this->record_id);
 
  330                if ($record_obj->getId()) {
 
  332                        $allFields = $this->table->getFields();
 
  333                        foreach ($allFields as $field) {
 
  334                                $record_obj->fillRecordFieldFormInput($field->getId(), $this->form);
 
  337                        $this->form->setValuesByPost();
 
  363                        $all_fields = $this->table->getRecordFields();
 
  365                        $all_fields = $this->table->getEditableFields();
 
  374                $confirmation->setFormAction($this->ctrl->getFormAction($this));
 
  375                $header_text = $this->lng->txt(
'dcl_confirm_storing_records');
 
  377                        && !$this->table->getEditByOwner() && !$this->table->getEditPerm())
 
  379                        $header_text .= 
" ".$this->lng->txt(
'dcl_confirm_storing_records_no_permission');
 
  381                $confirmation->setHeaderText($header_text);
 
  383                $confirmation->setCancel($this->lng->txt(
'dcl_edit_record'), 
'edit');
 
  384                $confirmation->setConfirm($this->lng->txt(
'dcl_save_record'), 
'save');
 
  388                $empty_fileuploads = array();
 
  389                foreach($all_fields as $field) {
 
  392                        $record_field->addHiddenItemsToConfirmation($confirmation);
 
  395                                && $record_field->getValue() == 
null) {
 
  396                                $empty_fileuploads[
'field_'.$field->getId()] = array();
 
  400                        if($record_representation->getConfirmationHTML() !== 
false) {
 
  401                                $record_data .= $field->getTitle().
": ".$record_representation->getConfirmationHTML() .
"<br />";
 
  405                $confirmation->addHiddenItem(
'ilfilehash', $filehash);
 
  406                $confirmation->addHiddenItem(
'empty_fileuploads', htmlspecialchars(json_encode($empty_fileuploads)));
 
  407                $confirmation->addHiddenItem(
'table_id', $this->table_id);
 
  408                $confirmation->addHiddenItem(
'tableview_id', $this->tableview_id);
 
  409                $confirmation->addItem(
'save_confirmed', 1, $record_data);
 
  411                if ($this->ctrl->isAsynch()) {
 
  412                        echo $confirmation->getHTML();
 
  415                        $this->tpl->setContent($confirmation->getHTML());
 
  424                $ilAppEventHandler = 
$DIC[
'ilAppEventHandler'];
 
  430                if ($this->table->getSaveConfirmation() && isset(
$_POST[
'save_confirmed']) && isset(
$_POST[
'ilfilehash']) && !isset($this->record_id) && !$this->ctrl->isAsynch()) {
 
  434                        if (json_decode(
$_POST[
'empty_fileuploads']) && 
$_POST[
'empty_fileuploads'] != 
'') {
 
  435                                $_FILES = $_FILES + json_decode(
$_POST[
'empty_fileuploads'], 
true);
 
  441                $valid = $this->form->checkInput();
 
  444                $unchanged_obj = $record_obj;
 
  450                $create_mode = 
false;
 
  453                        $all_fields = $this->table->getRecordFields();
 
  455                        $all_fields = $this->table->getEditableFields();
 
  459                foreach ($all_fields as $field) {
 
  461                                $field->checkValidityFromForm($this->form, $this->record_id);
 
  464                                $item = $this->form->getItemByPostVar(
'field_'.$field->getId());
 
  470                        $this->
sendFailure($this->lng->txt(
'form_input_not_valid'));
 
  475                        if (!isset($this->record_id)) {
 
  482                                if ($this->table->getSaveConfirmation() && $this->form->getInput(
'save_confirmed') == 
null && !$this->ctrl->isAsynch()) {
 
  484                                        $hash = 
$_POST[
"ilfilehash"];
 
  485                                        foreach($_FILES as $field => 
$data)
 
  487                                                if(is_array(
$data[
"tmp_name"]))
 
  489                                                        foreach(
$data[
"tmp_name"] as $idx => $upload)
 
  491                                                                if(is_array($upload))
 
  493                                                                        foreach($upload as $idx2 => 
$file)
 
  497                                                                                        $file_name = 
$data[
"name"][$idx][$idx2];
 
  498                                                                                        $file_type = 
$data[
"type"][$idx][$idx2];
 
  499                                                                                        $this->form->keepTempFileUpload($hash, $field, 
$file, $file_name, $file_type, $idx, $idx2);
 
  503                                                                else if($upload && is_uploaded_file($upload))
 
  505                                                                        $file_name = 
$data[
"name"][$idx];
 
  506                                                                        $file_type = 
$data[
"type"][$idx];
 
  507                                                                        $this->form->keepTempFileUpload($hash, $field, $upload, $file_name, $file_type, $idx);
 
  513                                                        $this->form->keepTempFileUpload($hash, $field, 
$data[
"tmp_name"], 
$data[
"name"], 
$data[
"type"]);
 
  518                                        foreach ($all_fields as $field) {
 
  522                                        $this->saveConfirmation($record_obj, $hash);
 
  531                                $this->record_id = $record_obj->
getId();
 
  542                        foreach ($all_fields as $field) {
 
  550                                        $this->
sendFailure($this->lng->txt(
'user_not_known'));
 
  557                        $dispatchEvent = 
"update";
 
  559                        $dispatchEventData = array(
 
  560                                'dcl' => $this->parent_obj->getDataCollectionObject(),
 
  561                                'table_id' => $this->table_id,
 
  562                                'record_id' => $record_obj->
getId(),
 
  563                                'record' => $record_obj,
 
  567                                $dispatchEvent = 
"create";
 
  568                                ilObjDataCollection::sendNotification(
"new_record", $this->table_id, $record_obj->
getId());
 
  570                                $dispatchEventData[
'prev_record'] = $unchanged_obj;
 
  573                        $record_obj->
doUpdate($create_mode);
 
  575                        $ilAppEventHandler->raise(
'Modules/DataCollection',
 
  576                                $dispatchEvent.
'Record',
 
  580                        $this->ctrl->setParameter($this, 
"table_id", $this->table_id);
 
  581                        $this->ctrl->setParameter($this, 
"tableview_id", $this->tableview_id);
 
  582                        $this->ctrl->setParameter($this, 
"record_id", $this->record_id);
 
  584                        if (!$this->ctrl->isAsynch()) {
 
  589                        if ($this->ctrl->isAsynch()) {
 
  591                                $this->record_id = $record_obj->
getId();
 
  594                                echo $this->tpl->getMessageHTML($this->lng->txt(
'msg_obj_modified'), 
'success') . $this->form->getHTML();
 
  597                                $this->ctrl->redirectByClass(
"ildclrecordlistgui", 
"listRecords");
 
  602                        $this->form->setValuesByPost();
 
  603                        if ($this->ctrl->isAsynch()) {
 
  604                                echo $this->form->getHTML();
 
  618                if ($force_redirect || (isset(
$_GET[
'redirect']) && !$this->ctrl->isAsynch())) {
 
  619                        switch ((
int)
$_GET[
'redirect']) {
 
  621                                        $this->ctrl->setParameterByClass(
'ilDclDetailedViewGUI', 
'record_id', $this->record_id);
 
  622                                        $this->ctrl->setParameterByClass(
'ilDclDetailedViewGUI', 
'table_id', $this->table_id);
 
  623                                        $this->ctrl->setParameterByClass(
'ilDclDetailedViewGUI', 
'tableview_id', $this->tableview_id);
 
  624                                        $this->ctrl->redirectByClass(
"ilDclDetailedViewGUI", 
"renderRecord");
 
  627                                        $this->ctrl->redirectByClass(
"ildclrecordlistgui", 
"listRecords");
 
  630                                        $this->ctrl->redirectByClass(
"ildclrecordlistgui", 
"listRecords");
 
  637                if (!$this->ctrl->isAsynch()) {
 
  639                        $this->ctrl->redirectByClass(
'ildclrecordlistgui', 
'listRecords');
 
  641                        echo $this->lng->txt(
'dcl_msg_no_perm_edit');
 
  651                $keep = ($this->ctrl->isAsynch()) ? 
false : 
true;
 
  652                $this->form->setValuesByPost();
 
  653                if ($this->ctrl->isAsynch()) {
 
  654                        echo $this->tpl->getMessageHTML($message, 
'failure') . $this->form->getHTML();
 
  666                $search = 
$_POST[
'search_for'];
 
  669                include_once 
'./Services/Search/classes/class.ilQueryParser.php';
 
  671                $query_parser->setMinWordLength(1, 
true);
 
  673                $query_parser->parse();
 
  674                if (!$query_parser->validate()) {
 
  675                        $html .= $query_parser->getMessage() . 
"<br />";
 
  679                include_once 
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
 
  681                $res = $object_search->performSearch();
 
  683                $res->filter(ROOT_FOLDER_ID, 
true);
 
  686                        $html .= $this->lng->txt(
'dcl_no_search_results_found_for') . 
' ' . $search . 
"<br />";
 
  691                        $tpl = 
new ilTemplate(
"tpl.dcl_tree.html", 
true, 
true, 
"Modules/DataCollection");
 
  692                        foreach ((array)$entry[
'refs'] as $reference) {
 
  693                                include_once 
'./Services/Tree/classes/class.ilPathGUI.php';
 
  695                                $tpl->setCurrentBlock(
'result');
 
  696                                $tpl->setVariable(
'RESULT_PATH', 
$path->getPath(ROOT_FOLDER_ID, $reference) . 
" ยป " . $entry[
'title']);
 
  697                                $tpl->setVariable(
'RESULT_REF', $reference);
 
  698                                $tpl->setVariable(
'FIELD_ID', $dest);
 
  699                                $tpl->parseCurrentBlock();
 
  709                return "<script>ilDataCollection.strings.add_value='" . $this->lng->txt(
'add_value') . 
"';</script>";
 
  722                foreach ($a_res as $obj_id => $references) {
 
  726                        $r[
'obj_id'] = $obj_id;
 
  727                        $r[
'refs'] = $references;
 
  739                $ilfilehash = (isset(
$_POST[
'ilfilehash'])) ? 
$_POST[
'ilfilehash'] : 
null;
 
  740                if ($ilfilehash != 
null) {
 
  741                        $this->form->cleanupTempFiles($ilfilehash);
 
An exception for terminatinating execution or to throw for unit testing.
Confirmation screen class.
@classDescription Date and time handling
Class ilDclBaseRecordModel.
setLastEditBy($last_edit_by)
hasPermissionToEdit($ref_id)
setLastUpdate($a_datetime)
Set Last Update Date.
setRecordFieldValueFromForm($field_id, &$form)
Set a field value.
setOwner($a_id)
Set Owner.
setCreateDate($a_datetime)
Set Creation Date.
doUpdate($omit_notification=false)
doUpdate
getRecordField($field_id)
setTableId($a_id)
Set Table ID.
static getRecordFieldCache($record, $field)
static getTableCache($table_id=0)
static getRecordCache($record_id=0)
static getRecordRepresentation(ilDclBaseRecordFieldModel $record_field)
Returns a record representation.
static getFieldRepresentation(ilDclBaseFieldModel $field)
static getRecordRepresentationInstance(ilDclBaseRecordFieldModel $record_field)
Get RecordRepresentation from RecordFieldModel.
Class ilDclBaseFieldModel.
Class ilDclMobRecordFieldModel.
Class ilDclRecordEditGUI.
confirmDelete()
Delete confirmation.
parseSearchResults($a_res)
Parse search results.
__construct(ilObjDataCollectionGUI $parent_obj)
getRecordData($record_id=0)
Return All fields and values from a record ID.
searchObjects()
This function is only used by the ajax request if searching for ILIAS references.
cancelDelete()
Cancel deletion.
setFormValues()
Set values from object to form.
cleanupTempFiles()
Cleanup temp-files.
checkAndPerformRedirect($force_redirect=false)
Checkes to what view (table or detail) should be redirected and performs redirect.
cancelUpdate()
Cancel Update.
const REDIRECT_RECORD_LIST
Possible redirects after saving/updating a record - use GET['redirect'] to set constants.
create()
Create new record gui.
static hasAddRecordAccess($ref, $user_id=0)
static hasEditAccess($ref, $user_id=0)
Has permission to view and edit all entries event when he is not the owner.
static hasPermissionToAddRecord($ref_id, $table_id)
static hasWriteAccess($ref, $user_id=0)
Class ilObjDataCollectionGUI.
static _lookupId($a_user_str)
Lookup id by login.
static _lookupTitle($a_id)
lookup object title
static _lookupDescription($a_id)
lookup object description
Creates a path for a start and endnode.
special template class to simplify handling of ITX/PEAR
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file