ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilAdvancedMDRecord Class Reference
+ Collaboration diagram for ilAdvancedMDRecord:

Public Member Functions

 __construct (int $a_record_id=0)
 Singleton constructor To create an array of new records (without saving them) call the constructor directly. More...
 
 setDefaultLanguage (string $language_code)
 
 getDefaultLanguage ()
 
 delete ()
 
 enabledScope ()
 
 enableScope (bool $a_stat)
 
 setScopes (array $a_scopes)
 
 getScopes ()
 Get scopes. More...
 
 getScopeRefIds ()
 
 save ()
 
 update ()
 
 validate ()
 
 setGlobalPosition (int $position)
 
 getGlobalPosition ()
 
 getRecordId ()
 
 setActive (bool $a_active)
 
 isActive ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setDescription (string $a_description)
 
 getDescription ()
 
 setImportId (string $a_id_string)
 
 getImportId ()
 
 setAssignedObjectTypes (array $a_obj_types)
 
 appendAssignedObjectType (string $a_obj_type, string $a_sub_type, bool $a_optional=false)
 
 getAssignedObjectTypes ()
 
 isAssignedObjectType (string $a_obj_type, string $a_sub_type)
 
 setParentObject (int $a_obj_id)
 
 getParentObject ()
 
 toXML (ilXmlWriter $writer)
 To Xml. More...
 
 __destruct ()
 
 _clone (array &$a_fields_map, ?int $a_parent_obj_id=null)
 

Static Public Member Functions

static _getInstanceByRecordId (int $a_record_id)
 
static _getActiveSearchableRecords ()
 Get active searchable records. More...
 
static _lookupTitle (int $a_record_id)
 
static _lookupRecordIdByImportId (string $a_ilias_id)
 
static _getAssignableObjectTypes (bool $a_include_text=false)
 Get assignable object type public. More...
 
static _getActivatedObjTypes ()
 get activated obj types More...
 
static _getRecords ()
 Get records public. More...
 
static _getAllRecordsByObjectType ()
 Get records by obj_type Note: this returns only records with no sub types! More...
 
static _getActivatedRecordsByObjectType (string $a_obj_type, string $a_sub_type="", bool $a_only_optional=false)
 Get activated records by object type. More...
 
static _getSelectedRecordsByObject (string $a_obj_type, int $a_id, string $a_sub_type="", bool $is_ref_id=true)
 
static isFilteredByScope ($a_ref_id, array $scopes)
 Check if a given ref id is not filtered by scope restriction. More...
 
static _delete ($a_record_id)
 
static saveObjRecSelection (int $a_obj_id, string $a_sub_type="", ?array $a_records=null, bool $a_delete_before=true)
 Save repository object record selection. More...
 
static deleteObjRecSelection (int $a_obj_id)
 Delete repository object record selection. More...
 
static getObjRecSelection (int $a_obj_id, string $a_sub_type="")
 Get repository object record selection. More...
 
static getSharedRecords (int $a_obj1_id, int $a_obj2_id, string $a_sub_type="-")
 

Protected Member Functions

 setRecordId (int $record_id)
 
 generateImportId ()
 generate unique record id More...
 

Protected Attributes

int $record_id
 
int $global_position = 0
 
string $import_id = ''
 
bool $active = false
 
string $title = ''
 
string $description = ''
 
string $language_default = ''
 
array $obj_types = array()
 
int $parent_obj = 0
 
bool $scope_enabled = false
 
array $scopes = []
 
ilDBInterface $db
 

Private Member Functions

 read ()
 

Static Private Attributes

static $instances = []
 

Detailed Description

Definition at line 26 of file class.ilAdvancedMDRecord.php.

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDRecord::__construct ( int  $a_record_id = 0)

Singleton constructor To create an array of new records (without saving them) call the constructor directly.

Otherwise call getInstance... public

Parameters
intrecord id

Definition at line 59 of file class.ilAdvancedMDRecord.php.

References $DIC, getRecordId(), and read().

60  {
61  global $DIC;
62 
63  $this->db = $DIC->database();
64  $this->record_id = $a_record_id;
65 
66  if ($this->getRecordId()) {
67  $this->read();
68  }
69  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ __destruct()

ilAdvancedMDRecord::__destruct ( )

Definition at line 760 of file class.ilAdvancedMDRecord.php.

References getRecordId().

761  {
762  unset(self::$instances[$this->getRecordId()]);
763  }
+ Here is the call graph for this function:

Member Function Documentation

◆ _clone()

ilAdvancedMDRecord::_clone ( array &  $a_fields_map,
?int  $a_parent_obj_id = null 
)

Definition at line 848 of file class.ilAdvancedMDRecord.php.

References getAssignedObjectTypes(), getDefaultLanguage(), getDescription(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), ilAdvancedMDFieldDefinition\getInstancesByRecordId(), getParentObject(), getRecordId(), getTitle(), isActive(), and setActive().

849  {
850  $new_obj = new self();
851  $new_obj->setActive($this->isActive());
852  $new_obj->setTitle($this->getTitle());
853  $new_obj->setDescription($this->getDescription());
854  $new_obj->setParentObject($a_parent_obj_id
855  ?: $this->getParentObject());
856  $new_obj->setAssignedObjectTypes($this->getAssignedObjectTypes());
857  $new_obj->setDefaultLanguage($this->getDefaultLanguage());
858  $new_obj->save();
859 
860  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($this->getRecordId()) as $definition) {
861  $new_def = $definition->_clone($new_obj->getRecordId());
862  $a_fields_map[$definition->getFieldId()] = $new_def->getFieldId();
863  }
864 
866  $record_translation->cloneRecord($new_obj->getRecordId());
867 
868  return $new_obj;
869  }
static getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
+ Here is the call graph for this function:

◆ _delete()

static ilAdvancedMDRecord::_delete (   $a_record_id)
static

Definition at line 393 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $res, and ilAdvancedMDFieldDefinition\getInstancesByRecordId().

Referenced by delete().

393  : void
394  {
395  global $DIC;
396 
397  $ilDB = $DIC['ilDB'];
398 
399  // Delete fields
400  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($a_record_id) as $field) {
401  $field->delete();
402  }
403 
404  $query = "DELETE FROM adv_md_record " .
405  "WHERE record_id = " . $ilDB->quote($a_record_id, 'integer') . " ";
406  $res = $ilDB->manipulate($query);
407 
408  $query = "DELETE FROM adv_md_record_objs " .
409  "WHERE record_id = " . $ilDB->quote($a_record_id, 'integer') . " ";
410  $res = $ilDB->manipulate($query);
411  }
$res
Definition: ltiservices.php:66
static getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getActivatedObjTypes()

static ilAdvancedMDRecord::_getActivatedObjTypes ( )
static

get activated obj types

Returns
string[]

Definition at line 184 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $obj_types, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilAdvancedSearchGUI\__setSearchOptions(), ilAdvancedSearchGUI\initAdvancedMetaDataForm(), and ilObjFileGUI\initSettingsTab().

184  : array
185  {
186  global $DIC;
187 
188  $ilDB = $DIC['ilDB'];
189 
190  $query = "SELECT DISTINCT(obj_type) FROM adv_md_record_objs amo " .
191  "JOIN adv_md_record amr ON amo.record_id = amr.record_id " .
192  "WHERE active = 1 ";
193  $res = $ilDB->query($query);
194  $obj_types = [];
195  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
196  $obj_types[] = (string) $row->obj_type;
197  }
198  return $obj_types;
199  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getActivatedRecordsByObjectType()

static ilAdvancedMDRecord::_getActivatedRecordsByObjectType ( string  $a_obj_type,
string  $a_sub_type = "",
bool  $a_only_optional = false 
)
static

Get activated records by object type.

Returns
ilAdvancedMDRecord[]

Definition at line 254 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilCourseExporter\getActiveAdvMDRecords(), ilSessionExporter\getActiveAdvMDRecords(), ilGroupExporter\getActiveAdvMDRecords(), ilWikiExporter\getActiveAdvMDRecords(), ilGlossaryExporter\getActiveAdvMDRecords(), ilExerciseExporter\getActiveAdvMDRecords(), ilStudyProgrammeTypeDBRepository\getAllAMDRecords(), ilOrgUnitType\getAvailableAdvancedMDRecords(), ilContainerFilterAdvMDAdapter\getAvailableRecordSets(), and ilAdvancedMDRecordGUI\parseRecordSelection().

258  : array {
259  global $DIC;
260 
261  $ilDB = $DIC['ilDB'];
262 
263  if ($a_sub_type == "") {
264  $a_sub_type = "-";
265  }
266 
267  $records = [];
268  $query = "SELECT amro.record_id record_id FROM adv_md_record_objs amro " .
269  "JOIN adv_md_record amr ON amr.record_id = amro.record_id " .
270  "WHERE active = 1 " .
271  "AND obj_type = " . $ilDB->quote($a_obj_type, 'text') . " " .
272  "AND sub_type = " . $ilDB->quote($a_sub_type, 'text');
273 
274  if ($a_only_optional) {
275  $query .= " AND optional =" . $ilDB->quote(1, 'integer');
276  }
277 
278  // #16428
279  $query .= "ORDER by parent_obj DESC, record_id";
280 
281  $res = $ilDB->query($query);
282  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
283  $records[] = self::_getInstanceByRecordId((int) $row->record_id);
284  }
285  return $records;
286  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getActiveSearchableRecords()

static ilAdvancedMDRecord::_getActiveSearchableRecords ( )
static

Get active searchable records.

Returns
ilAdvancedMDRecord[]

Definition at line 83 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

83  : array
84  {
85  global $DIC;
86 
87  $ilDB = $DIC['ilDB'];
88 
89  $query = "SELECT DISTINCT(amr.record_id) FROM adv_md_record amr " .
90  "JOIN adv_mdf_definition amfd ON amr.record_id = amfd.record_id " .
91  "WHERE searchable = 1 AND active = 1 ";
92 
93  $res = $ilDB->query($query);
94  $records = [];
95  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
96  $records[] = self::_getInstanceByRecordId((int) $row->record_id);
97  }
98  return $records;
99  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22

◆ _getAllRecordsByObjectType()

static ilAdvancedMDRecord::_getAllRecordsByObjectType ( )
static

Get records by obj_type Note: this returns only records with no sub types!

Returns
array<string, array<int, ilAdvancedMDRecord>

Definition at line 228 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $res, ilECSSetting\ecsConfigured(), ilDBConstants\FETCHMODE_OBJECT, and ilECSUtils\getPossibleRemoteTypes().

Referenced by ilAdvancedMDSettingsGUI\initFormSubstitutions(), ilAdvancedMDSettingsGUI\setSubTabs(), and ilAdvancedMDSettingsGUI\updateSubstitutions().

228  : array
229  {
230  global $DIC;
231 
232  $ilDB = $DIC['ilDB'];
233 
234  $records = [];
235  $query = "SELECT * FROM adv_md_record_objs WHERE sub_type=" . $ilDB->quote("-", "text");
236  $res = $ilDB->query($query);
237  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
238  $records[(string) $row->obj_type][] = self::_getInstanceByRecordId((int) $row->record_id);
239  }
240  // #13359 hide ecs if not configured
242  $filter = ilECSUtils::getPossibleRemoteTypes(false);
243  $filter[] = 'rtst';
244  $records = array_diff_key($records, array_flip($filter));
245  }
246 
247  return $records;
248  }
$res
Definition: ltiservices.php:66
static ecsConfigured()
Checks if an ecs server is configured.
static getPossibleRemoteTypes(bool $a_with_captions=false)
Get all possible remote object types.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getAssignableObjectTypes()

static ilAdvancedMDRecord::_getAssignableObjectTypes ( bool  $a_include_text = false)
static

Get assignable object type public.

Definition at line 141 of file class.ilAdvancedMDRecord.php.

References $DIC, $lng, ilECSSetting\ecsConfigured(), ilECSUtils\getPossibleRemoteTypes(), and ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

Referenced by ilAdvancedMDRecordTableGUI\fillRow(), ilAdvancedMDSettingsGUI\initForm(), ilObjectMetaDataGUI\isAdvMDAvailable(), and ilAdvancedMDSettingsGUI\loadRecordFormData().

141  : array
142  {
143  global $DIC;
144 
145  $objDefinition = $DIC['objDefinition'];
146  $lng = $DIC['lng'];
147 
148  $types = array();
149  $filter = array();
150  $amet_types = $objDefinition->getAdvancedMetaDataTypes();
151 
153  $filter = array_merge($filter, ilECSUtils::getPossibleRemoteTypes(false));
154  $filter[] = 'rtst';
155  }
156 
157  foreach ($amet_types as $at) {
158  if (in_array($at["obj_type"], $filter)) {
159  continue;
160  }
161 
162  if ($a_include_text) {
163  $text = $lng->txt("obj_" . $at["obj_type"]);
164  if ($at["sub_type"] != "") {
165  $lng->loadLanguageModule($at["obj_type"]);
166  $text .= ": " . $lng->txt($at["obj_type"] . "_" . $at["sub_type"]);
167  } else {
168  $at["sub_type"] = "-";
169  }
170  $at["text"] = $text;
171  }
172 
173  $types[] = $at;
174  }
175 
176  sort($types);
177  return $types;
178  }
static ecsConfigured()
Checks if an ecs server is configured.
static getPossibleRemoteTypes(bool $a_with_captions=false)
Get all possible remote object types.
sort()
description: > Example for rendering a Sort Glyph.
Definition: sort.php:41
global $DIC
Definition: shib_login.php:22
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getInstanceByRecordId()

static ilAdvancedMDRecord::_getInstanceByRecordId ( int  $a_record_id)
static

◆ _getRecords()

static ilAdvancedMDRecord::_getRecords ( )
static

Get records public.

Parameters
arrayarray of record objects
Returns
ilAdvancedMDRecord[]

Definition at line 208 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $res, _getInstanceByRecordId(), and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilAdvancedMDValues\_cloneValues(), ilLuceneAdvancedSearchFields\getFields(), and ilAdvancedMDSettingsGUI\getParsedRecordObjects().

208  : array
209  {
210  global $DIC;
211 
212  $ilDB = $DIC['ilDB'];
213 
214  $query = "SELECT record_id FROM adv_md_record ORDER BY gpos ";
215  $res = $ilDB->query($query);
216  $records = [];
217  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
218  $records[] = ilAdvancedMDRecord::_getInstanceByRecordId((int) $row->record_id);
219  }
220  return $records;
221  }
$res
Definition: ltiservices.php:66
static _getInstanceByRecordId(int $a_record_id)
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getSelectedRecordsByObject()

static ilAdvancedMDRecord::_getSelectedRecordsByObject ( string  $a_obj_type,
int  $a_id,
string  $a_sub_type = "",
bool  $is_ref_id = true 
)
static
Parameters
string$a_obj_type
int$a_id
string$a_sub_type
bool$is_ref_id
Returns
array<int, ilAdvancedMDRecord>

Definition at line 295 of file class.ilAdvancedMDRecord.php.

References ilContainer\_lookupContainerSetting(), ilObject\_lookupObjId(), and ilObjectServiceSettingsGUI\CUSTOM_METADATA.

Referenced by ilGlossaryTerm\_copyTerm(), ilObjPortfolioBase\clonePagesAndSettings(), ILIAS\EmployeeTalk\Metadata\MetadataHandler\copyValues(), ilGlossaryAdvMetaDataAdapter\getActiveRecords(), ilAdvancedMDRecordGUI\getActiveRecords(), ilObjBookingPool\getAdvancedMDFields(), ilPCAMDFormGUI\getAdvRecords(), ilGlossaryAdvMetaDataAdapter\getAllFields(), ilObjectMetaDataGUI\getBlockHTML(), ilAdvancedMDValues\getInstancesForObjectId(), ilObjectMetaDataGUI\getKeyValueList(), ilWikiFunctionsBlockGUI\getLegacyContent(), ILIAS\Cache\Services\SubObjectModes\Filter\Supplier\getRecordIds(), ILIAS\Cache\Services\SubObjectModes\DataTable\Supplier\getRecordIds(), ilPCAMDPageList\handleCopiedContent(), ilObjectMetaDataGUI\hasActiveRecords(), ilAdvancedMDValues\preloadedRead(), and ilAdvancedMDValues\queryForRecords().

300  : array {
301  $records = array();
302 
303  if ($a_sub_type == "") {
304  $a_sub_type = "-";
305  }
306 
307  $a_obj_id = $is_ref_id
308  ? ilObject::_lookupObjId($a_id)
309  : $a_id;
310 
311  // object-wide metadata configuration setting
312  $config_setting = ilContainer::_lookupContainerSetting(
313  $a_obj_id,
315  ''
316  );
317 
318  $optional = array();
319  foreach (self::_getActivatedRecordsByObjectType($a_obj_type, $a_sub_type) as $record) {
320  // check scope
321  if ($is_ref_id && self::isFilteredByScope($a_id, $record->getScopes())) {
322  continue;
323  }
324  foreach ($record->getAssignedObjectTypes() as $item) {
325  if ($record->getParentObject()) {
326  // only matching local records
327  if ($record->getParentObject() != $a_obj_id) {
328  continue;
329  } // if object-wide setting is off, ignore local records
330  elseif (!$config_setting) {
331  continue;
332  }
333  }
334 
335  if ($item['obj_type'] == $a_obj_type &&
336  $item['sub_type'] == $a_sub_type) {
337  if ($item['optional']) {
338  $optional[] = $record->getRecordId();
339  }
340  $records[$record->getRecordId()] = $record;
341  }
342  }
343  }
344 
345  if ($optional) {
346  if (!$config_setting && !in_array($a_sub_type, array("orgu_type", "prg_type"))) { //#16925 + #17777
347  $selected = array();
348  } else {
349  $selected = self::getObjRecSelection($a_obj_id, $a_sub_type);
350  }
351  foreach ($optional as $record_id) {
352  if (!in_array($record_id, $selected)) {
353  unset($records[$record_id]);
354  }
355  }
356  }
357 
358  $orderings = new ilAdvancedMDRecordObjectOrderings();
359  $records = $orderings->sortRecords($records, $a_obj_id);
360 
361  return $records;
362  }
static _lookupObjId(int $ref_id)
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupRecordIdByImportId()

static ilAdvancedMDRecord::_lookupRecordIdByImportId ( string  $a_ilias_id)
static

Definition at line 121 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilAdvancedMDRecordParser\extractRecordId().

121  : int
122  {
123  global $DIC;
124 
125  $ilDB = $DIC['ilDB'];
126 
127  $query = "SELECT record_id FROM adv_md_record " .
128  "WHERE import_id = " . $ilDB->quote($a_ilias_id, 'text') . " ";
129  $res = $ilDB->query($query);
130  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
131  return (int) $row->record_id;
132  }
133  return 0;
134  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _lookupTitle()

static ilAdvancedMDRecord::_lookupTitle ( int  $a_record_id)
static

Definition at line 101 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilAdvancedMDSettingsGUI\initFormSubstitutions(), and ilECSSettingsGUI\prepareFieldSelection().

101  : string
102  {
103  static $title_cache = array();
104 
105  if (isset($title_cache[$a_record_id])) {
106  return $title_cache[$a_record_id];
107  }
108 
109  global $DIC;
110 
111  $ilDB = $DIC['ilDB'];
112 
113  $query = "SELECT title FROM adv_md_record " .
114  "WHERE record_id = " . $ilDB->quote($a_record_id, 'integer') . " ";
115  $res = $ilDB->query($query);
116  $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
117 
118  return $title_cache[$a_record_id] = (string) $row->title;
119  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ appendAssignedObjectType()

ilAdvancedMDRecord::appendAssignedObjectType ( string  $a_obj_type,
string  $a_sub_type,
bool  $a_optional = false 
)

Definition at line 635 of file class.ilAdvancedMDRecord.php.

635  : void
636  {
637  $this->obj_types[] = array(
638  "obj_type" => $a_obj_type,
639  "sub_type" => $a_sub_type,
640  "optional" => $a_optional
641  );
642  }

◆ delete()

ilAdvancedMDRecord::delete ( )

Definition at line 431 of file class.ilAdvancedMDRecord.php.

References _delete(), ilAdvancedMDRecordScope\deleteByRecordId(), and getRecordId().

Referenced by ilAdvancedMDSettingsGUI\deleteRecords().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteObjRecSelection()

static ilAdvancedMDRecord::deleteObjRecSelection ( int  $a_obj_id)
static

Delete repository object record selection.

Definition at line 810 of file class.ilAdvancedMDRecord.php.

References $DIC, and $ilDB.

Referenced by ilAdvancedMDSettingsGUI\updateRecords().

810  : void
811  {
812  global $DIC;
813 
814  $ilDB = $DIC['ilDB'];
815 
816  $ilDB->manipulate("DELETE FROM adv_md_obj_rec_select WHERE " .
817  " obj_id = " . $ilDB->quote($a_obj_id, "integer"));
818  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ enabledScope()

ilAdvancedMDRecord::enabledScope ( )

Definition at line 437 of file class.ilAdvancedMDRecord.php.

References $scope_enabled.

437  : bool
438  {
439  return $this->scope_enabled;
440  }

◆ enableScope()

ilAdvancedMDRecord::enableScope ( bool  $a_stat)

Definition at line 442 of file class.ilAdvancedMDRecord.php.

442  : void
443  {
444  $this->scope_enabled = $a_stat;
445  }

◆ generateImportId()

ilAdvancedMDRecord::generateImportId ( )
protected

generate unique record id

Definition at line 755 of file class.ilAdvancedMDRecord.php.

References getRecordId(), and IL_INST_ID.

Referenced by save(), and toXML().

755  : string
756  {
757  return 'il_' . IL_INST_ID . '_adv_md_record_' . $this->getRecordId();
758  }
const IL_INST_ID
Definition: constants.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAssignedObjectTypes()

ilAdvancedMDRecord::getAssignedObjectTypes ( )
Returns
array<int, array{obj_type: string, sub_type: string, optional: bool}>

Definition at line 647 of file class.ilAdvancedMDRecord.php.

References $obj_types.

Referenced by _clone(), isAssignedObjectType(), save(), toXML(), and update().

647  : array
648  {
649  return $this->obj_types;
650  }
+ Here is the caller graph for this function:

◆ getDefaultLanguage()

ilAdvancedMDRecord::getDefaultLanguage ( )

Definition at line 426 of file class.ilAdvancedMDRecord.php.

References $language_default.

Referenced by _clone(), save(), ilAdvancedMDSettingsGUI\saveRecord(), and update().

426  : string
427  {
429  }
+ Here is the caller graph for this function:

◆ getDescription()

ilAdvancedMDRecord::getDescription ( )

Definition at line 611 of file class.ilAdvancedMDRecord.php.

References $description.

Referenced by _clone(), save(), toXML(), and update().

611  : string
612  {
613  return $this->description;
614  }
+ Here is the caller graph for this function:

◆ getGlobalPosition()

ilAdvancedMDRecord::getGlobalPosition ( )

Definition at line 576 of file class.ilAdvancedMDRecord.php.

References $global_position.

Referenced by ilAdvancedMDRecordObjectOrderings\compareLocalRecords(), ilAdvancedMDRecordObjectOrderings\compareRecords(), and update().

576  : int
577  {
578  return $this->global_position;
579  }
+ Here is the caller graph for this function:

◆ getImportId()

ilAdvancedMDRecord::getImportId ( )

Definition at line 621 of file class.ilAdvancedMDRecord.php.

References $import_id.

Referenced by save().

621  : string
622  {
623  return $this->import_id;
624  }
+ Here is the caller graph for this function:

◆ getObjRecSelection()

static ilAdvancedMDRecord::getObjRecSelection ( int  $a_obj_id,
string  $a_sub_type = "" 
)
static

Get repository object record selection.

Parameters
int$a_obj_idobject id if repository object
array$a_recordsarray of record ids that are selected (in use) by the object
Returns
int[]

Definition at line 826 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $r, and ILIAS\Repository\int().

Referenced by ilAdvancedMDValues\_cloneValues(), ilObjPortfolioBase\clonePagesAndSettings(), ILIAS\EmployeeTalk\Metadata\MetadataHandler\copyValues(), ilWikiExporter\getActiveAdvMDRecords(), ilGlossaryExporter\getActiveAdvMDRecords(), ilAdvancedMDSettingsGUI\getParsedRecordObjects(), getSharedRecords(), and ilAdvancedMDRecordGUI\parseRecordSelection().

826  : array
827  {
828  global $DIC;
829 
830  $ilDB = $DIC['ilDB'];
831 
832  if ($a_sub_type == "") {
833  $a_sub_type = "-";
834  }
835 
836  $recs = array();
837  $set = $ilDB->query(
838  $r = "SELECT * FROM adv_md_obj_rec_select " .
839  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") .
840  " AND sub_type = " . $ilDB->quote($a_sub_type, "text")
841  );
842  while ($rec = $ilDB->fetchAssoc($set)) {
843  $recs[] = (int) $rec["rec_id"];
844  }
845  return $recs;
846  }
global $DIC
Definition: shib_login.php:22
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParentObject()

ilAdvancedMDRecord::getParentObject ( )

Definition at line 668 of file class.ilAdvancedMDRecord.php.

References $parent_obj.

Referenced by _clone(), ilAdvancedMDSettingsGUI\deleteRecords(), and save().

668  : int
669  {
670  return $this->parent_obj;
671  }
+ Here is the caller graph for this function:

◆ getRecordId()

ilAdvancedMDRecord::getRecordId ( )

Definition at line 581 of file class.ilAdvancedMDRecord.php.

References $record_id.

Referenced by __construct(), __destruct(), _clone(), ilAdvancedMDRecordObjectOrderings\compareLocalRecords(), delete(), generateImportId(), read(), save(), ilAdvancedMDSettingsGUI\saveRecord(), toXML(), and update().

581  : int
582  {
583  return $this->record_id;
584  }
+ Here is the caller graph for this function:

◆ getScopeRefIds()

ilAdvancedMDRecord::getScopeRefIds ( )
Returns
int[]

Definition at line 467 of file class.ilAdvancedMDRecord.php.

References $scope.

Referenced by toXML().

467  : array
468  {
469  $ref_ids = [];
470  foreach ($this->scopes as $scope) {
471  $ref_ids[] = $scope->getRefId();
472  }
473  return $ref_ids;
474  }
$scope
Definition: ltiregstart.php:47
+ Here is the caller graph for this function:

◆ getScopes()

ilAdvancedMDRecord::getScopes ( )

Get scopes.

Returns
ilAdvancedMDRecordScope[]

Definition at line 459 of file class.ilAdvancedMDRecord.php.

References $scopes.

Referenced by save(), and update().

459  : array
460  {
461  return $this->scopes;
462  }
+ Here is the caller graph for this function:

◆ getSharedRecords()

static ilAdvancedMDRecord::getSharedRecords ( int  $a_obj1_id,
int  $a_obj2_id,
string  $a_sub_type = "-" 
)
static

Definition at line 871 of file class.ilAdvancedMDRecord.php.

References $res, ilObject\_lookupType(), and getObjRecSelection().

871  : array
872  {
873  $obj_type = ilObject::_lookupType($a_obj1_id);
874  $sel = array_intersect(
875  ilAdvancedMDRecord::getObjRecSelection($a_obj1_id, $a_sub_type),
876  ilAdvancedMDRecord::getObjRecSelection($a_obj2_id, $a_sub_type)
877  );
878 
879  $res = array();
880 
881  foreach (self::_getRecords() as $record) {
882  // local records cannot be shared
883  if ($record->getParentObject()) {
884  continue;
885  }
886 
887  // :TODO: inactive records can be ignored?
888  if (!$record->isActive()) {
889  continue;
890  }
891 
892  // parse assigned types
893  foreach ($record->getAssignedObjectTypes() as $item) {
894  if ($item["obj_type"] == $obj_type &&
895  $item["sub_type"] == $a_sub_type) {
896  // mandatory
897  if (!$item["optional"]) {
898  $res[] = $record->getRecordId();
899  } // optional
900  elseif (in_array($record->getRecordId(), $sel)) {
901  $res[] = $record->getRecordId();
902  }
903  }
904  }
905  }
906 
907  return $res;
908  }
$res
Definition: ltiservices.php:66
static getObjRecSelection(int $a_obj_id, string $a_sub_type="")
Get repository object record selection.
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ getTitle()

ilAdvancedMDRecord::getTitle ( )

Definition at line 601 of file class.ilAdvancedMDRecord.php.

References $title.

Referenced by _clone(), ilAdvancedMDSettingsGUI\confirmDeleteRecords(), ilAdvancedMDSettingsGUI\deleteRecords(), ilAdvancedMDSettingsGUI\exportRecords(), save(), toXML(), update(), and validate().

601  : string
602  {
603  return $this->title;
604  }
+ Here is the caller graph for this function:

◆ isActive()

ilAdvancedMDRecord::isActive ( )

Definition at line 591 of file class.ilAdvancedMDRecord.php.

References $active.

Referenced by _clone(), save(), toXML(), and update().

591  : bool
592  {
593  return $this->active;
594  }
+ Here is the caller graph for this function:

◆ isAssignedObjectType()

ilAdvancedMDRecord::isAssignedObjectType ( string  $a_obj_type,
string  $a_sub_type 
)

Definition at line 652 of file class.ilAdvancedMDRecord.php.

References getAssignedObjectTypes().

652  : bool
653  {
654  foreach ($this->getAssignedObjectTypes() as $t) {
655  if ($t["obj_type"] == $a_obj_type &&
656  $t["sub_type"] == $a_sub_type) {
657  return true;
658  }
659  }
660  return false;
661  }
+ Here is the call graph for this function:

◆ isFilteredByScope()

static ilAdvancedMDRecord::isFilteredByScope (   $a_ref_id,
array  $scopes 
)
static

Check if a given ref id is not filtered by scope restriction.

Parameters
int$a_ref_id
ilAdvancedMDRecordScope[]$scopes

Definition at line 369 of file class.ilAdvancedMDRecord.php.

References $GLOBALS, $scope, and ilTree\RELATION_PARENT.

Referenced by ilAdvancedMDSettingsGUI\getParsedRecordObjects().

369  : bool
370  {
371  $tree = $GLOBALS['DIC']->repositoryTree();
372  $logger = $GLOBALS['DIC']->logger()->amet();
373 
374  if (!count($scopes)) {
375  return false;
376  }
377  foreach ($scopes as $scope) {
378  $logger->debug('Comparing: ' . $a_ref_id . ' with: ' . $scope->getRefId());
379  if ($scope->getRefId() == $a_ref_id) {
380  $logger->debug('Elements are equal. No scope restrictions.');
381  return false;
382  }
383  if ($tree->getRelation($scope->getRefId(), $a_ref_id) == ilTree::RELATION_PARENT) {
384  $logger->debug('Node is child node. No scope restrictions.');
385  return false;
386  }
387  }
388  $logger->info('Scope filter matches.');
389 
390  return true;
391  }
$scope
Definition: ltiregstart.php:47
const RELATION_PARENT
$GLOBALS["DIC"]
Definition: wac.php:53
+ Here is the caller graph for this function:

◆ read()

ilAdvancedMDRecord::read ( )
private

Definition at line 716 of file class.ilAdvancedMDRecord.php.

References $res, ilDBConstants\FETCHMODE_OBJECT, getRecordId(), setActive(), setDefaultLanguage(), setDescription(), setGlobalPosition(), setImportId(), setParentObject(), setTitle(), and ilDBConstants\T_INTEGER.

Referenced by __construct().

716  : void
717  {
718  $query = "SELECT * FROM adv_md_record " .
719  "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
720  $res = $this->db->query($query);
721  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
722  $this->setImportId((string) $row->import_id);
723  $this->setActive((bool) $row->active);
724  $this->setTitle((string) $row->title);
725  $this->setDescription((string) $row->description);
726  $this->setParentObject((int) $row->parent_obj);
727  $this->setGlobalPosition((int) $row->gpos);
728  $this->setDefaultLanguage((string) $row->lang_default);
729  }
730  $query = "SELECT * FROM adv_md_record_objs " .
731  "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
732  $res = $this->db->query($query);
733  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
734  $this->obj_types[] = array(
735  "obj_type" => (string) $row->obj_type,
736  "sub_type" => (string) $row->sub_type,
737  "optional" => (bool) $row->optional
738  );
739  }
740 
741  $query = 'SELECT scope_id FROM adv_md_record_scope ' .
742  'WHERE record_id = ' . $this->db->quote($this->record_id, ilDBConstants::T_INTEGER);
743  $res = $this->db->query($query);
744  $this->scope_enabled = false;
745  $this->scopes = [];
746  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
747  $this->scope_enabled = true;
748  $this->scopes[] = new ilAdvancedMDRecordScope((int) $row->scope_id);
749  }
750  }
Scope restrictions for advanced md records.
$res
Definition: ltiservices.php:66
setDescription(string $a_description)
setDefaultLanguage(string $language_code)
setImportId(string $a_id_string)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilAdvancedMDRecord::save ( )

Definition at line 476 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $res, $scope, generateImportId(), getAssignedObjectTypes(), getDefaultLanguage(), getDescription(), getImportId(), getParentObject(), getRecordId(), getScopes(), getTitle(), isActive(), and ilDBConstants\T_TEXT.

Referenced by ilAdvancedMDSettingsGUI\saveRecord().

476  : void
477  {
478  global $DIC;
479 
480  $ilDB = $DIC['ilDB'];
481 
482  // Save import id if given
483  $next_id = $ilDB->nextId('adv_md_record');
484 
485  $query = "INSERT INTO adv_md_record (record_id,import_id,active,title,description,parent_obj,lang_default) " .
486  "VALUES(" .
487  $ilDB->quote($next_id, 'integer') . ", " .
488  $this->db->quote($this->getImportId(), 'text') . ", " .
489  $this->db->quote($this->isActive(), 'integer') . ", " .
490  $this->db->quote($this->getTitle(), 'text') . ", " .
491  $this->db->quote($this->getDescription(), 'text') . ", " .
492  $this->db->quote($this->getParentObject(), 'integer') . ", " .
493  $this->db->quote($this->getDefaultLanguage(), ilDBConstants::T_TEXT) .
494  ")";
495  $res = $ilDB->manipulate($query);
496  $this->record_id = $next_id;
497 
498  if (!strlen($this->getImportId())) {
499  // set import id to default value
500  $query = "UPDATE adv_md_record " .
501  "SET import_id = " . $this->db->quote($this->generateImportId(), 'text') . " " .
502  "WHERE record_id = " . $this->db->quote($this->record_id, 'integer') . " ";
503  $res = $ilDB->manipulate($query);
504  }
505 
506  foreach ($this->getAssignedObjectTypes() as $type) {
507  global $DIC;
508  $ilDB = $DIC['ilDB'];
509  $query = "INSERT INTO adv_md_record_objs (record_id,obj_type,sub_type,optional) " .
510  "VALUES( " .
511  $this->db->quote($this->getRecordId(), 'integer') . ", " .
512  $this->db->quote($type["obj_type"], 'text') . ", " .
513  $this->db->quote($type["sub_type"], 'text') . ", " .
514  $this->db->quote($type["optional"], 'integer') . " " .
515  ")";
516  $res = $ilDB->manipulate($query);
517  }
518 
519  foreach ($this->getScopes() as $scope) {
520  $scope->setRecordId($this->getRecordId());
521  $scope->save();
522  }
523  }
$res
Definition: ltiservices.php:66
$scope
Definition: ltiregstart.php:47
global $DIC
Definition: shib_login.php:22
generateImportId()
generate unique record id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveObjRecSelection()

static ilAdvancedMDRecord::saveObjRecSelection ( int  $a_obj_id,
string  $a_sub_type = "",
?array  $a_records = null,
bool  $a_delete_before = true 
)
static

Save repository object record selection.

Parameters
int$a_obj_idobject id if repository object
string$a_sub_typesubtype
int[]$a_records array of record ids that are selected (in use) by the object
bool$a_delete_beforedelete before update
Returns
void

Definition at line 773 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, and $r.

Referenced by ilAdvancedMDValues\_cloneValues(), ilObjPortfolioBase\clonePagesAndSettings(), ILIAS\EmployeeTalk\Metadata\MetadataHandler\copyValues(), ilOrgUnitType\getAvailableAdvancedMDRecords(), ilAdvancedMetaDataImporter\importXmlRepresentation(), ilAdvancedMDRecordGUI\saveSelection(), ilObjOrgUnit\update(), ilObjStudyProgramme\update(), ilStudyProgrammeType\updateAssignedStudyProgrammesIcons(), and ilAdvancedMDSettingsGUI\updateRecords().

778  : void {
779  global $DIC;
780 
781  $ilDB = $DIC['ilDB'];
782 
783  if ($a_sub_type == "") {
784  $a_sub_type = "-";
785  }
786 
787  if ($a_delete_before) {
788  $ilDB->manipulate("DELETE FROM adv_md_obj_rec_select WHERE " .
789  " obj_id = " . $ilDB->quote($a_obj_id, "integer") .
790  " AND sub_type = " . $ilDB->quote($a_sub_type, "text"));
791  }
792 
793  if (is_array($a_records)) {
794  foreach ($a_records as $r) {
795  if ($r > 0) {
796  $ilDB->manipulate("INSERT INTO adv_md_obj_rec_select " .
797  "(obj_id, rec_id, sub_type) VALUES (" .
798  $ilDB->quote($a_obj_id, "integer") . "," .
799  $ilDB->quote($r, "integer") . "," .
800  $ilDB->quote($a_sub_type, "text") .
801  ")");
802  }
803  }
804  }
805  }
global $DIC
Definition: shib_login.php:22
$r
+ Here is the caller graph for this function:

◆ setActive()

ilAdvancedMDRecord::setActive ( bool  $a_active)

Definition at line 586 of file class.ilAdvancedMDRecord.php.

Referenced by _clone(), and read().

586  : void
587  {
588  $this->active = $a_active;
589  }
+ Here is the caller graph for this function:

◆ setAssignedObjectTypes()

ilAdvancedMDRecord::setAssignedObjectTypes ( array  $a_obj_types)
Parameters
string[]
Todo:
is this format of $a_obj_types correct?

Definition at line 630 of file class.ilAdvancedMDRecord.php.

630  : void
631  {
632  $this->obj_types = $a_obj_types;
633  }

◆ setDefaultLanguage()

ilAdvancedMDRecord::setDefaultLanguage ( string  $language_code)
Parameters
string$language_code

Definition at line 421 of file class.ilAdvancedMDRecord.php.

Referenced by read(), and ilAdvancedMDSettingsGUI\saveRecord().

421  : void
422  {
423  $this->language_default = $language_code;
424  }
+ Here is the caller graph for this function:

◆ setDescription()

ilAdvancedMDRecord::setDescription ( string  $a_description)

Definition at line 606 of file class.ilAdvancedMDRecord.php.

Referenced by read().

606  : void
607  {
608  $this->description = $a_description;
609  }
+ Here is the caller graph for this function:

◆ setGlobalPosition()

ilAdvancedMDRecord::setGlobalPosition ( int  $position)

Definition at line 571 of file class.ilAdvancedMDRecord.php.

Referenced by ilAdvancedMDRecordObjectOrderings\compareRecords(), and read().

571  : void
572  {
573  $this->global_position = $position;
574  }
+ Here is the caller graph for this function:

◆ setImportId()

ilAdvancedMDRecord::setImportId ( string  $a_id_string)

Definition at line 616 of file class.ilAdvancedMDRecord.php.

Referenced by read().

616  : void
617  {
618  $this->import_id = $a_id_string;
619  }
+ Here is the caller graph for this function:

◆ setParentObject()

ilAdvancedMDRecord::setParentObject ( int  $a_obj_id)

Definition at line 663 of file class.ilAdvancedMDRecord.php.

Referenced by read().

663  : void
664  {
665  $this->parent_obj = $a_obj_id;
666  }
+ Here is the caller graph for this function:

◆ setRecordId()

ilAdvancedMDRecord::setRecordId ( int  $record_id)
protected

Definition at line 413 of file class.ilAdvancedMDRecord.php.

References $record_id.

413  : void
414  {
415  $this->record_id = $record_id;
416  }

◆ setScopes()

ilAdvancedMDRecord::setScopes ( array  $a_scopes)
Parameters
ilAdvancedMDRecordScope[]

Definition at line 450 of file class.ilAdvancedMDRecord.php.

450  : void
451  {
452  $this->scopes = $a_scopes;
453  }

◆ setTitle()

ilAdvancedMDRecord::setTitle ( string  $a_title)

Definition at line 596 of file class.ilAdvancedMDRecord.php.

Referenced by read().

596  : void
597  {
598  $this->title = $a_title;
599  }
+ Here is the caller graph for this function:

◆ toXML()

ilAdvancedMDRecord::toXML ( ilXmlWriter  $writer)

To Xml.

This method writes only the subset Record (including all fields) Use class.ilAdvancedMDRecordXMLWriter to generate a complete xml presentation.

Definition at line 678 of file class.ilAdvancedMDRecord.php.

References $ref_id, ilObject\_lookupObjId(), ilObject\_lookupType(), generateImportId(), getAssignedObjectTypes(), getDescription(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), ilAdvancedMDFieldDefinition\getInstancesByRecordId(), getRecordId(), getScopeRefIds(), getTitle(), IL_INST_ID, isActive(), null, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

678  : void
679  {
680  $writer->xmlStartTag('Record', array('active' => $this->isActive() ? 1 : 0,
681  'id' => $this->generateImportId()
682  ));
683  $writer->xmlElement('Title', null, $this->getTitle());
684  $writer->xmlElement('Description', null, $this->getDescription());
685 
687  $translations->toXML($writer);
688 
689  foreach ($this->getAssignedObjectTypes() as $obj_type) {
690  $optional = array("optional" => $obj_type["optional"]);
691  if ($obj_type["sub_type"] == "") {
692  $writer->xmlElement('ObjectType', $optional, $obj_type["obj_type"]);
693  } else {
694  $writer->xmlElement('ObjectType', $optional, $obj_type["obj_type"] . ":" . $obj_type["sub_type"]);
695  }
696  }
697 
698  // scopes
699  if (count($this->getScopeRefIds())) {
700  $writer->xmlStartTag('Scope');
701  }
702  foreach ($this->getScopeRefIds() as $ref_id) {
704  $writer->xmlElement('ScopeEntry', ['id' => 'il_' . IL_INST_ID . '_' . $type . '_' . $ref_id]);
705  }
706  if (count($this->getScopeRefIds())) {
707  $writer->xmlEndTag('Scope');
708  }
709 
710  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($this->getRecordId()) as $definition) {
711  $definition->toXML($writer);
712  }
713  $writer->xmlEndTag('Record');
714  }
const IL_INST_ID
Definition: constants.php:40
static getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
static _lookupObjId(int $ref_id)
xmlEndTag(string $tag)
Writes an endtag.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
static _lookupType(int $id, bool $reference=false)
generateImportId()
generate unique record id
+ Here is the call graph for this function:

◆ update()

ilAdvancedMDRecord::update ( )

Definition at line 525 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $res, $scope, ilAdvancedMDRecordScope\deleteByRecordId(), getAssignedObjectTypes(), getDefaultLanguage(), getDescription(), getGlobalPosition(), getRecordId(), getScopes(), getTitle(), isActive(), and ilDBConstants\T_TEXT.

525  : void
526  {
527  global $DIC;
528 
529  $ilDB = $DIC['ilDB'];
530 
531  $query = "UPDATE adv_md_record " .
532  "SET active = " . $this->db->quote($this->isActive(), 'integer') . ", " .
533  "title = " . $this->db->quote($this->getTitle(), 'text') . ", " .
534  "description = " . $this->db->quote($this->getDescription(), 'text') . ", " .
535  'gpos = ' . $this->db->quote($this->getGlobalPosition(), 'integer') . ', ' .
536  'lang_default = ' . $this->db->quote($this->getDefaultLanguage(), ilDBConstants::T_TEXT) . ' ' .
537  "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
538  $res = $ilDB->manipulate($query);
539 
540  // Delete assignments
541  $query = "DELETE FROM adv_md_record_objs " .
542  "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
543  $res = $ilDB->manipulate($query);
544 
545  // Insert assignments
546  foreach ($this->getAssignedObjectTypes() as $type) {
547  $query = "INSERT INTO adv_md_record_objs (record_id,obj_type,sub_type,optional) " .
548  "VALUES ( " .
549  $this->db->quote($this->getRecordId(), 'integer') . ", " .
550  $this->db->quote($type["obj_type"], 'text') . ", " .
551  $this->db->quote($type["sub_type"], 'text') . ", " .
552  $this->db->quote($type["optional"], 'integer') . " " .
553  ")";
554  $res = $ilDB->manipulate($query);
555  }
557  foreach ($this->getScopes() as $scope) {
558  $scope->setRecordId($this->getRecordId());
559  $scope->save();
560  }
561  }
$res
Definition: ltiservices.php:66
$scope
Definition: ltiregstart.php:47
global $DIC
Definition: shib_login.php:22
static deleteByRecordId(int $a_record_id)
+ Here is the call graph for this function:

◆ validate()

ilAdvancedMDRecord::validate ( )

Definition at line 563 of file class.ilAdvancedMDRecord.php.

References getTitle().

563  : bool
564  {
565  if (!strlen($this->getTitle())) {
566  return false;
567  }
568  return true;
569  }
+ Here is the call graph for this function:

Field Documentation

◆ $active

bool ilAdvancedMDRecord::$active = false
protected

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

Referenced by isActive().

◆ $db

ilDBInterface ilAdvancedMDRecord::$db
protected

Definition at line 50 of file class.ilAdvancedMDRecord.php.

◆ $description

string ilAdvancedMDRecord::$description = ''
protected

Definition at line 36 of file class.ilAdvancedMDRecord.php.

Referenced by getDescription().

◆ $global_position

int ilAdvancedMDRecord::$global_position = 0
protected

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

Referenced by getGlobalPosition().

◆ $import_id

string ilAdvancedMDRecord::$import_id = ''
protected

Definition at line 33 of file class.ilAdvancedMDRecord.php.

Referenced by getImportId().

◆ $instances

ilAdvancedMDRecord::$instances = []
staticprivate

Definition at line 28 of file class.ilAdvancedMDRecord.php.

◆ $language_default

string ilAdvancedMDRecord::$language_default = ''
protected

Definition at line 37 of file class.ilAdvancedMDRecord.php.

Referenced by getDefaultLanguage().

◆ $obj_types

array ilAdvancedMDRecord::$obj_types = array()
protected

Definition at line 42 of file class.ilAdvancedMDRecord.php.

Referenced by _getActivatedObjTypes(), and getAssignedObjectTypes().

◆ $parent_obj

int ilAdvancedMDRecord::$parent_obj = 0
protected

Definition at line 43 of file class.ilAdvancedMDRecord.php.

Referenced by getParentObject().

◆ $record_id

int ilAdvancedMDRecord::$record_id
protected

Definition at line 30 of file class.ilAdvancedMDRecord.php.

Referenced by getRecordId(), and setRecordId().

◆ $scope_enabled

bool ilAdvancedMDRecord::$scope_enabled = false
protected

Definition at line 44 of file class.ilAdvancedMDRecord.php.

Referenced by enabledScope().

◆ $scopes

array ilAdvancedMDRecord::$scopes = []
protected

Definition at line 48 of file class.ilAdvancedMDRecord.php.

Referenced by getScopes().

◆ $title

string ilAdvancedMDRecord::$title = ''
protected

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

Referenced by getTitle().


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