4include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
5include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
6include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDPermissionHelper.php');
7include_once
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordScope.php';
39 public function __construct($a_ref_id =
null, $a_obj_type =
null, $a_sub_type =
null)
45 $this->lng->loadLanguageModule(
'meta');
47 $this->tabs_gui = $ilTabs;
49 $this->logger =
$GLOBALS[
'DIC']->logger()->amet();
51 $this->ref_id = $a_ref_id;
55 $this->obj_type = $a_obj_type;
56 $this->sub_type = $a_sub_type
83 $next_class = $this->ctrl->getNextClass($this);
84 $cmd = $this->ctrl->getCmd();
90 switch ($next_class) {
91 case "ilpropertyformgui":
94 $this->record->getRecordId() > 0 ?
'edit' :
'create'
96 $GLOBALS[
'DIC']->ctrl()->forwardCommand($this->form);
101 $cmd =
'showRecords';
116 global $ilToolbar, $ilAccess;
128 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
130 $button->setCaption(
"add");
131 $button->setUrl($this->ctrl->getLinkTarget($this,
"createRecord"));
132 $ilToolbar->addButtonInstance($button);
135 $ilToolbar->addSeparator();
140 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
142 $button->setCaption(
"import");
143 $button->setUrl($this->ctrl->getLinkTarget($this,
"importRecords"));
144 $ilToolbar->addButtonInstance($button);
147 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.show_records.html',
'Services/AdvancedMetaData');
149 include_once(
"./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordTableGUI.php");
151 $table_gui->setTitle($this->lng->txt(
"md_record_list_table"));
156 $table_gui->addMultiCommand(
"exportRecords", $this->lng->txt(
'export'));
157 $table_gui->setSelectAllCheckbox(
"record_id");
159 if ($ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
160 $table_gui->addMultiCommand(
"confirmDeleteRecords", $this->lng->txt(
"delete"));
161 $table_gui->addCommandButton(
"updateRecords", $this->lng->txt(
"save"));
165 $this->tpl->setVariable(
'RECORD_TABLE', $table_gui->getHTML());
173 if (is_object($this->form)) {
174 $this->tabs_gui->setSubTabActive(
'md_adv_presentation');
175 return $this->tpl->setContent($this->form->getHTML());
191 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
192 $this->ctrl->redirect($this,
"showPresentation");
198 if (in_array(
$obj_type, [
'cat',
'crs',
'sess'])) {
210 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
218 $sub->enableFieldNames((
int)
$_POST[
'enabled_field_names_' .
$obj_type]);
222 $definitions = $sub->sortDefinitions($definitions);
227 foreach ($definitions as
$def) {
228 $field_id =
$def->getFieldId();
229 $old_sub[$field_id] = array(
230 "active" => $sub->isSubstituted($field_id),
232 "bold" => $sub->isBold($field_id),
233 "newline" => $sub->hasNewline($field_id)
237 $sub->resetSubstitutions(array());
240 foreach ($definitions as
$def) {
241 $field_id =
$def->getFieldId();
242 $old = $old_sub[$field_id];
245 if ($perm_def[
"show"]) {
248 $active =
$old[
"active"];
252 $new_sub[$field_id] =
$old;
255 $new_sub[$field_id][
"pos"] = (int)
$_POST[
'position'][
$obj_type][$field_id];
257 if ($perm_def[
"bold"]) {
260 if ($perm_def[
"newline"]) {
266 if (
sizeof($new_sub)) {
268 foreach ($new_sub as $field_id => $field) {
269 $sub->appendSubstitution($field_id, $field[
"bold"], $field[
"newline"]);
278 $this->ctrl->redirect($this,
"showPresentation");
288 if (!isset(
$_POST[
'record_id'])) {
296 foreach (
$_POST[
'record_id'] as $record_id) {
303 $fail[] = $record->getTitle();
307 ilUtil::sendFailure($this->lng->txt(
'msg_no_perm_copy') .
" " . implode(
", ", $fail),
true);
308 $this->ctrl->redirect($this,
"showRecords");
311 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordXMLWriter.php');
313 $xml_writer->write();
315 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
317 $export_files->create($xml_writer->xmlDumpMem());
332 $this->tabs_gui->setSubTabActive(
'md_adv_file_list');
334 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
336 $file_data =
$files->readFilesInfo();
338 include_once(
"./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFilesTableGUI.php");
340 $table_gui->setTitle($this->lng->txt(
"md_record_export_table"));
341 $table_gui->parseFiles($file_data);
342 $table_gui->addMultiCommand(
"downloadFile", $this->lng->txt(
'download'));
344 if (
$GLOBALS[
'DIC']->access()->checkAccess(
'write',
'', $this->ref_id)) {
345 $table_gui->addMultiCommand(
"confirmDeleteFiles", $this->lng->txt(
"delete"));
347 $table_gui->addCommandButton(
'showFiles', $this->lng->txt(
'cancel'));
348 $table_gui->setSelectAllCheckbox(
"file_id");
350 $this->tpl->setContent($table_gui->getHTML());
362 if (!isset(
$_POST[
'file_id']) or count(
$_POST[
'file_id']) != 1) {
368 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
370 $abs_path =
$files->getAbsolutePathByFileId((
int)
$_POST[
'file_id'][0]);
383 if (!isset(
$_POST[
'file_id'])) {
389 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
393 $c_gui->setFormAction($this->ctrl->getFormAction($this,
"deleteFiles"));
394 $c_gui->setHeaderText($this->lng->txt(
"md_adv_delete_files_sure"));
395 $c_gui->setCancel($this->lng->txt(
"cancel"),
"showFiles");
396 $c_gui->setConfirm($this->lng->txt(
"confirm"),
"deleteFiles");
398 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
400 $file_data =
$files->readFilesInfo();
404 foreach (
$_POST[
"file_id"] as $file_id) {
405 $info = $file_data[$file_id];
406 $c_gui->addItem(
"file_id[]", $file_id, is_array(
$info[
'name']) ? implode(
',',
$info[
'name']) :
'No Records');
408 $this->tpl->setContent($c_gui->getHTML());
420 if (!isset(
$_POST[
'file_id'])) {
426 if (!
$GLOBALS[
'DIC']->access()->checkAccess(
'write',
'', $this->ref_id)) {
428 $GLOBALS[
'DIC']->ctrl()->redirect($this,
'showFiles');
431 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
434 foreach (
$_POST[
'file_id'] as $file_id) {
435 $files->deleteByFileId((
int) $file_id);
449 if (!isset(
$_POST[
'record_id'])) {
455 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
459 $c_gui->setFormAction($this->ctrl->getFormAction($this,
"deleteRecords"));
460 $c_gui->setHeaderText($this->lng->txt(
"md_adv_delete_record_sure"));
461 $c_gui->setCancel($this->lng->txt(
"cancel"),
"showRecords");
462 $c_gui->setConfirm($this->lng->txt(
"confirm"),
"deleteRecords");
465 foreach (
$_POST[
"record_id"] as $record_id) {
467 $c_gui->addItem(
"record_id[]", $record_id, $record->getTitle() ? $record->getTitle() :
'No Title');
469 $this->tpl->setContent($c_gui->getHTML());
480 if (!isset(
$_POST[
'record_id'])) {
488 foreach (
$_POST[
'record_id'] as $record_id) {
492 if (!$record->getParentObject()) {
493 $fail[] = $record->getTitle();
503 $fail[] = $record->getTitle();
507 ilUtil::sendFailure($this->lng->txt(
'msg_no_perm_delete') .
" " . implode(
", ", $fail),
true);
508 $this->ctrl->redirect($this,
"showRecords");
511 foreach (
$_POST[
'record_id'] as $record_id) {
516 $this->ctrl->redirect($this,
"showRecords");
528 $selected_global = array();
540 if (!$this->obj_type) {
544 $obj_types = array();
545 if (is_array(
$_POST[
'obj_types'][$record_obj->getRecordId()])) {
546 foreach (
$_POST[
'obj_types'][$record_obj->getRecordId()] as
$type => $status) {
549 $obj_types[] = array(
552 "optional" => ((
int) $status == 2)
557 $record_obj->setAssignedObjectTypes($obj_types);
561 $record_obj->setActive(isset(
$_POST[
'active'][$record_obj->getRecordId()]));
564 $record_obj->update();
567 if ($item[
'readonly'] &&
569 $_POST[
'active'][$item[
'id']]) {
570 $selected_global[] = $item[
'id'];
571 } elseif ($item[
'local']) {
573 $record_obj->setActive(isset(
$_POST[
'active'][$item[
'id']]));
574 $record_obj->update();
579 if ($this->obj_type) {
584 $this->ctrl->redirect($this,
"showRecords");
595 if (!isset(
$_POST[
'field_id'])) {
601 $this->ctrl->saveParameter($this,
'record_id');
603 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
607 $c_gui->setFormAction($this->ctrl->getFormAction($this,
"deleteFields"));
608 $c_gui->setHeaderText($this->lng->txt(
"md_adv_delete_fields_sure"));
609 $c_gui->setCancel($this->lng->txt(
"cancel"),
"editFields");
610 $c_gui->setConfirm($this->lng->txt(
"confirm"),
"deleteFields");
613 foreach (
$_POST[
"field_id"] as $field_id) {
615 $c_gui->addItem(
"field_id[]", $field_id, $field->getTitle() ? $field->getTitle() :
'No Title');
617 $this->tpl->setContent($c_gui->getHTML());
629 $this->ctrl->saveParameter($this,
'record_id');
631 if (!isset(
$_POST[
'field_id'])) {
639 foreach (
$_POST[
'field_id'] as $field_id) {
646 $fail[] = $field->getTitle();
650 ilUtil::sendFailure($this->lng->txt(
'msg_no_perm_delete') .
" " . implode(
", ", $fail),
true);
651 $this->ctrl->redirect($this,
"editFields");
654 foreach (
$_POST[
"field_id"] as $field_id) {
659 $this->ctrl->redirect($this,
"editFields");
671 $this->ctrl->saveParameter($this,
'record_id');
674 $this->tpl->setContent($this->form->getHTML());
681 $this->ctrl->saveParameter($this,
'record_id');
686 $this->record->getRecordId(),
693 $filter_warn = array();
696 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
703 if (!$field->isFilterSupported()) {
704 $filter_warn[] = $this->lng->txt($field->getTypeTitle());
708 $ilToolbar->addInputItem($types);
710 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,
"createField"));
712 include_once
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
714 $button->setCaption(
"add");
715 $button->setCommand(
"createField");
716 $ilToolbar->addButtonInstance($button);
720 if (
sizeof($filter_warn)) {
725 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
728 include_once(
"./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldTableGUI.php");
730 $table_gui->setTitle($this->lng->txt(
"md_adv_field_table"));
731 $table_gui->parseDefinitions($fields);
732 if (
sizeof($fields)) {
733 $table_gui->addCommandButton(
"updateFields", $this->lng->txt(
"save"));
735 $table_gui->addCommandButton(
"showRecords", $this->lng->txt(
'cancel'));
736 $table_gui->addMultiCommand(
"confirmDeleteFields", $this->lng->txt(
"delete"));
737 $table_gui->setSelectAllCheckbox(
"field_id");
739 $this->tpl->setContent($table_gui->getHTML());
750 $this->ctrl->saveParameter($this,
'record_id');
752 if (!isset(
$_GET[
'record_id']) or !
$_GET[
'record_id']) {
758 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
766 if (!isset(
$_POST[
'position']) or !is_array(
$_POST[
'position'])) {
771 asort(
$_POST[
'position'], SORT_NUMERIC);
772 $positions = array_flip(array_keys(
$_POST[
'position']));
773 foreach ($fields as $field) {
774 $field->setPosition($positions[$field->getFieldId()]);
779 foreach ($fields as $field) {
782 $field->getFieldId(),
786 $field->setSearchable(isset(
$_POST[
'searchable'][$field->getFieldId()]) ?
true :
false);
793 $this->ctrl->redirect($this,
"editFields");
805 if (!isset(
$_GET[
'record_id']) or !
$_GET[
'record_id']) {
813 $this->logger->dump(
$_POST);
815 if (!$this->record->validate()) {
820 $this->record->update();
838 $this->tpl->setContent($this->form->getHTML());
846 $this->tpl->setContent($this->import_form->getHTML());
856 if (is_object($this->import_form)) {
860 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
862 $this->import_form->setMultipart(
true);
863 $this->import_form->setFormAction($this->ctrl->getFormAction($this));
867 $file->setSuffixes(array(
'xml'));
868 $file->setRequired(
true);
869 $this->import_form->addItem(
$file);
871 $this->import_form->setTitle($this->lng->txt(
'md_adv_import_record'));
872 $this->import_form->addCommandButton(
'importRecord', $this->lng->txt(
'import'));
873 $this->import_form->addCommandButton(
'showRecords', $this->lng->txt(
'cancel'));
886 if (!$this->import_form->checkInput()) {
887 $this->import_form->setValuesByPost();
892 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordImportFiles.php');
894 if (!$create_time = $import_files->moveUploadedFile($_FILES[
'file'][
'tmp_name'])) {
900 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordParser.php');
905 $parser->setContext($this->obj_id, $this->obj_type, $this->sub_type);
916 $this->ctrl->redirect($this,
"showRecords");
917 }
catch (ilSAXParserException $exc) {
919 $this->ctrl->redirect($this,
"importRecords");
923 $import_files->deleteFileByCreationDate($create_time);
940 if ($this->obj_type) {
941 $this->record->setAssignedObjectTypes(array(
943 "obj_type"=>$this->obj_type,
944 "sub_type"=>$this->sub_type,
949 if (!$this->record->validate()) {
954 $this->record->save();
968 if (!$_REQUEST[
"record_id"] || !$_REQUEST[
"field_id"]) {
972 $this->ctrl->saveParameter($this,
'record_id');
973 $this->ctrl->saveParameter($this,
'field_id');
979 $this->tpl->setContent($a_form->getHTML());
990 if (!$_REQUEST[
"record_id"] || !$_REQUEST[
"field_id"]) {
994 $this->ctrl->saveParameter($this,
'record_id');
995 $this->ctrl->saveParameter($this,
'field_id');
1000 if (
$form->checkInput()) {
1002 if (!$field_definition->importDefinitionFormPostValuesNeedsConfirmation()) {
1003 $field_definition->update();
1006 $this->ctrl->redirect($this,
"editFields");
1012 $form->setValuesByPost();
1017 $field_definition->prepareDefinitionFormConfirmation(
$form);
1031 if (!$_REQUEST[
"record_id"] || !$_REQUEST[
"ftype"]) {
1035 $this->ctrl->saveParameter($this,
'record_id');
1036 $this->ctrl->saveParameter($this,
'ftype');
1039 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1041 $field_definition->setRecordId($_REQUEST[
"record_id"]);
1044 $this->tpl->setContent($a_form->getHTML());
1054 if (!$_REQUEST[
"record_id"] || !$_REQUEST[
"ftype"]) {
1058 $this->ctrl->saveParameter($this,
'record_id');
1059 $this->ctrl->saveParameter($this,
'ftype');
1061 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1063 $field_definition->setRecordId($_REQUEST[
"record_id"]);
1066 if (
$form->checkInput()) {
1068 $field_definition->save();
1071 $this->ctrl->redirect($this,
"editFields");
1074 $form->setValuesByPost();
1085 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1088 $form->setFormAction($this->ctrl->getFormAction($this));
1097 $form->setTitle($this->lng->txt(
'md_adv_create_field'));
1098 $form->addCommandButton(
'saveField', $this->lng->txt(
'create'));
1100 $form->setTitle($this->lng->txt(
'md_adv_edit_field'));
1101 $form->addCommandButton(
'updateField', $this->lng->txt(
'save'));
1104 $form->addCommandButton(
'editFields', $this->lng->txt(
'cancel'));
1116 if (is_object($this->form)) {
1122 $this->record->getRecordId(),
1134 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1137 $this->form->setFormAction($this->ctrl->getFormAction($this));
1142 $title->setValue($this->record->getTitle());
1144 $title->setMaxLength(70);
1145 $title->setRequired(
true);
1146 $this->form->addItem(
$title);
1149 $title->setDisabled(
true);
1154 $desc->setValue($this->record->getDescription());
1157 $this->form->addItem($desc);
1160 $desc->setDisabled(
true);
1165 $check->setChecked($this->record->isActive());
1166 $check->setValue(1);
1167 $this->form->addItem($check);
1170 $check->setDisabled(
true);
1173 if (!$this->obj_type) {
1176 $scope->setChecked($this->record->enabledScope());
1177 $scope->setValue(1);
1178 $this->form->addItem($scope);
1181 $subitems->setValue($this->record->getScopeRefIds());
1182 $exp = $subitems->getExplorerGUI();
1184 $definition =
$GLOBALS[
'objDefinition'];
1186 foreach ($definition->getAllRepositoryTypes() as
$type) {
1187 if ($definition->isContainer(
$type)) {
1188 $white_list[] =
$type;
1193 $exp->setTypeWhiteList($white_list);
1194 $exp->setSkipRootNode(
false);
1195 $exp->setRootId(ROOT_FOLDER_ID);
1196 $scope->addSubItem($subitems);
1199 if (!$this->obj_type) {
1201 $section->setTitle($this->lng->txt(
'md_obj_types'));
1206 0 => $this->lng->txt(
"meta_obj_type_inactive"),
1207 1 => $this->lng->txt(
"meta_obj_type_mandatory"),
1208 2 => $this->lng->txt(
"meta_obj_type_optional")
1214 $this->lng->loadLanguageModule(
$type[
"obj_type"]);
1217 switch (
$type[
"obj_type"]) {
1220 unset($type_options[1]);
1224 unset($type_options[1]);
1228 unset($type_options[2]);
1233 if ($a_mode ==
"edit") {
1234 foreach ($this->record->getAssignedObjectTypes() as $item) {
1235 if ($item[
"obj_type"] ==
$type[
"obj_type"] &&
1236 $item[
"sub_type"] ==
$type[
"sub_type"]) {
1237 $value = $item[
"optional"]
1245 $check->setOptions($type_options);
1246 $check->setValue($value);
1247 $this->form->addItem($check);
1250 $check->setDisabled(
true);
1257 $this->form->setTitle($this->lng->txt(
'md_adv_create_record'));
1258 $this->form->addCommandButton(
'saveRecord', $this->lng->txt(
'add'));
1259 $this->form->addCommandButton(
'showRecords', $this->lng->txt(
'cancel'));
1264 $this->form->setTitle($this->lng->txt(
'md_adv_edit_record'));
1265 $this->form->addCommandButton(
'updateRecord', $this->lng->txt(
'save'));
1266 $this->form->addCommandButton(
'showRecords', $this->lng->txt(
'cancel'));
1274 if ($a_obj_type ==
"crs") {
1291 } elseif ($a_obj_type ==
"cat") {
1308 } elseif ($a_obj_type ==
"sess") {
1337 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1344 $this->form->setFormAction($this->ctrl->getFormAction($this));
1345 #$this->form->setTableWidth('100%');
1351 if (in_array(
$obj_type, [
'crs',
'cat',
'sess'])) {
1363 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
1372 $check->setValue(1);
1373 $check->setOptionTitle($this->lng->txt(
'md_adv_desc_show'));
1374 $check->setChecked($sub->isDescriptionEnabled() ?
true :
false);
1375 $this->form->addItem($check);
1378 $check->setDisabled(
true);
1382 $check->setValue(1);
1383 $check->setOptionTitle($this->lng->txt(
'md_adv_fields_show'));
1384 $check->setChecked($sub->enabledFieldNames() ?
true :
false);
1385 $this->form->addItem($check);
1388 $check->setDisabled(
true);
1391 #$area = new ilTextAreaInputGUI($this->lng->txt('md_adv_substitution'),'substitution_'.$obj_type);
1392 #$area->setUseRte(true);
1393 #$area->setRteTagSet('standard');
1394 #$area->setValue(ilUtil::prepareFormOutput($sub->getSubstitutionString()));
1396 #$area->setCols(80);
1397 #$this->form->addItem($area);
1404 $definitions = $sub->sortDefinitions($definitions);
1407 foreach ($definitions as
$def) {
1408 $definition_id =
$def->getFieldId();
1416 $check->setValue(1);
1417 $check->setOptionTitle($this->lng->txt(
'md_adv_show'));
1418 $check->setChecked($sub->isSubstituted($definition_id));
1420 if ($perm && !$perm[
"show"]) {
1421 $check->setDisabled(
true);
1426 $pos->setMaxLength(4);
1427 $pos->allowDecimals(
true);
1429 $check->addSubItem($pos);
1431 if ($perm && !$perm_pos) {
1432 $pos->setDisabled(
true);
1437 $bold->setChecked($sub->isBold($definition_id));
1438 $check->addSubItem($bold);
1440 if ($perm && !$perm[
"bold"]) {
1441 $bold->setDisabled(
true);
1446 $bold->setChecked($sub->hasNewline($definition_id));
1447 $check->addSubItem($bold);
1449 if ($perm && !$perm[
"newline"]) {
1450 $bold->setDisabled(
true);
1454 $this->form->addItem($check);
1482 $this->form->setTitle($this->lng->txt(
'md_adv_substitution_table'));
1484 if ($ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
1485 $this->form->addCommandButton(
'updateSubstitutions', $this->lng->txt(
'save'));
1500 $this->record->getRecordId(),
1522 if (!$this->obj_type) {
1524 $obj_types = array();
1525 if (is_array(
$_POST[
'obj_types'])) {
1526 foreach (
$_POST[
'obj_types'] as
$t => $value) {
1528 $t = explode(
":",
$t);
1529 $obj_types[] = array(
1532 "optional" => ($value > 1)
1537 $this->record->setAssignedObjectTypes($obj_types);
1542 foreach ((array)
$_POST[
'scope_containers_sel'] as
$ref_id) {
1547 $this->record->setScopes(
$_POST[
'scope'] ? $scopes : []);
1548 $this->record->enableScope(
$_POST[
'scope'] ?
true :
false);
1558 if (!is_object($this->record)) {
1559 $record_id = isset(
$_GET[
'record_id'])
1560 ?
$_GET[
'record_id']
1567 $this->record->setParentObject($this->obj_id);
1571 return $this->record;
1581 $this->tabs_gui->clearSubTabs();
1583 $this->tabs_gui->addSubTabTarget(
1584 "md_adv_record_list",
1585 $this->ctrl->getLinkTarget($this,
"showRecords"),
1594 $this->tabs_gui->addSubTabTarget(
1595 "md_adv_presentation",
1596 $this->ctrl->getLinkTarget($this,
"showPresentation")
1600 $this->tabs_gui->addSubTabTarget(
1602 $this->ctrl->getLinkTarget($this,
"showFiles"),
1616 if ($this->obj_type) {
1621 $parent_id = $record->getParentObject();
1623 if (!$this->obj_type) {
1629 if ($parent_id && $parent_id != $this->obj_id) {
1634 if (!$parent_id && !$record->isActive()) {
1641 $record->getScopes()
1649 $tmp_arr[
'id'] = $record->getRecordId();
1650 $tmp_arr[
'active'] = $record->isActive();
1651 $tmp_arr[
'title'] = $record->getTitle();
1652 $tmp_arr[
'description'] = $record->getDescription();
1653 $tmp_arr[
'fields'] = array();
1654 $tmp_arr[
'obj_types'] = $record->getAssignedObjectTypes();
1656 $tmp_arr[
'perm'] = $this->permissions->hasPermissions(
1658 $record->getRecordId(),
1668 if ($this->obj_type) {
1669 $tmp_arr[
"readonly"] = !(bool) $parent_id;
1670 $tmp_arr[
"local"] = $parent_id;
1673 $assigned = $optional =
false;
1674 foreach ($tmp_arr[
'obj_types'] as $idx => $item) {
1675 if ($item[
"obj_type"] == $this->obj_type &&
1676 $item[
"sub_type"] == $this->sub_type) {
1678 $optional = $item[
"optional"];
1679 $tmp_arr[
'obj_types'][$idx][
'context'] =
true;
1686 $tmp_arr[
'optional'] = $optional;
1689 $tmp_arr[
'active'] = in_array($record->getRecordId(), $selected);
sprintf('%.4f', $callTime)
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
An exception for terminatinating execution or to throw for unit testing.
AMD field abstract base class.
static getInstance($a_field_id, $a_type=null)
Get definition instance by type.
static getInstancesByObjType($a_obj_type, $a_active_only=true)
getFieldId()
Get field_id.
static getValidTypes()
Get all valid types.
addToFieldDefinitionForm(ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions)
Add input elements to definition form.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
getTypeTitle()
Get type title (lang id)
const ACTION_SUBSTITUTION_COURSE_SHOW_FIELD
const SUBACTION_FIELD_SEARCHABLE
const CONTEXT_SUBSTITUTION_SESSION
const ACTION_RECORD_EXPORT
const ACTION_SUBSTITUTION_SHOW_FIELDNAMES
const SUBACTION_RECORD_DESCRIPTION
const ACTION_SUBSTITUTION_FIELD_POSITIONS
const ACTION_SUBSTITUTION_CATEGORY_EDIT_FIELD_PROPERTY
const ACTION_RECORD_CREATE_FIELD
const CONTEXT_SUBSTITUTION_COURSE
const CONTEXT_SUBSTITUTION_CATEGORY
const ACTION_RECORD_EDIT_FIELDS
const ACTION_RECORD_FIELD_POSITIONS
const SUBACTION_RECORD_TITLE
const ACTION_SUBSTITUTION_SHOW_DESCRIPTION
const SUBACTION_SUBSTITUTION_BOLD
const ACTION_FIELD_EDIT_PROPERTY
const ACTION_SUBSTITUTION_COURSE_EDIT_FIELD_PROPERTY
const ACTION_RECORD_TOGGLE_ACTIVATION
const SUBACTION_SUBSTITUTION_NEWLINE
const ACTION_SUBSTITUTION_CATEGORY_SHOW_FIELD
const ACTION_MD_CREATE_RECORD
const CONTEXT_SUBSTITUTION
const ACTION_RECORD_EDIT_PROPERTY
const ACTION_SUBSTITUTION_SESSION_SHOW_FIELD
const ACTION_MD_IMPORT_RECORDS
const SUBACTION_RECORD_OBJECT_TYPES
const ACTION_SUBSTITUTION_SESSION_EDIT_FIELD_PROPERTY
const ACTION_RECORD_DELETE
const ACTION_FIELD_DELETE
SAX based XML parser for record import files.
const MODE_INSERT_VALIDATION
Scope restrictions for advanced md records.
static _lookupTitle($a_record_id)
Lookup title.
static saveObjRecSelection($a_obj_id, $a_sub_type="", array $a_records=null, $a_delete_before=true)
Save repository object record selection.
static getObjRecSelection($a_obj_id, $a_sub_type="")
Get repository object record selection.
static _getAllRecordsByObjectType()
Get records by obj_type Note: this returns only records with no sub types! @access public.
static _getInstanceByRecordId($a_record_id)
Get instance by record id.
static _getActivatedObjTypes()
get activated obj types
static _getRecords()
Get records.
static _getAssignableObjectTypes($a_include_text=false)
Get assignable object type.
static isFilteredByScope($a_ref_id, array $scopes)
Check if a given ref id is not filtered by scope restriction.
updateSubstitutions()
Update substitution.
showFiles()
show export files
setSubTabs()
Set sub tabs.
updateRecord()
Update record.
showRecords()
show record list
updateRecords()
Save records (assigned object typed)
initForm($a_mode)
Init Form.
editField(ilPropertyFormGUI $a_form=null)
Edit field.
importRecord()
import xml file
executeCommand()
Execute command.
initRecordObject()
Init record object.
confirmDeleteFiles()
confirm delete files
initFieldForm(ilAdvancedMDFieldDefinition $a_definition)
init field form
initFormSubstitutions()
init form table 'substitutions'
initImportForm()
show import form
__construct($a_ref_id=null, $a_obj_type=null, $a_sub_type=null)
Constructor.
deleteRecords()
Permanently delete records.
loadRecordFormData()
load record form data
exportRecords()
Export records.
editRecord()
Edit one record.
updateFields()
Update fields.
deleteFields()
delete fields
confirmDeleteRecords()
Confirm delete.
downloadFile()
Download XML file.
getParsedRecordObjects()
Get and cache record objects.
getSubstitutionFieldPermissions($a_obj_type, $a_field_id)
updateField()
Update field.
createField(ilPropertyFormGUI $a_form=null)
Show field type selection.
confirmDeleteFields()
show delete fields confirmation screen
deleteFiles()
Delete files.
static _getInstanceByObjectType($a_type)
Singleton: use this method to get an instance.
static getInstance($a_user_id=null, $a_ref_id=null)
Factory.
Confirmation screen class.
This class represents a non editable value in a property form.
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(isset($_POST['submit'])) $form
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
foreach($_POST as $key=> $value) $res