ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilAdvancedMDRecord Class Reference
+ Collaboration diagram for ilAdvancedMDRecord:

Public Member Functions

 __construct ($a_record_id=0)
 Singleton constructor To create an array of new records (without saving them) call the constructor directly. More...
 
 delete ()
 Delete. More...
 
 save ()
 save More...
 
 update ()
 update More...
 
 validate ()
 Validate settings Write error message to ilErr. More...
 
 getRecordId ()
 Get record id. More...
 
 setActive ($a_active)
 Set active. More...
 
 isActive ()
 Check if record is active. More...
 
 setTitle ($a_title)
 Set title. More...
 
 getTitle ()
 get title More...
 
 setDescription ($a_description)
 set description More...
 
 getDescription ()
 get description More...
 
 setImportId ($a_id_string)
 set import id More...
 
 getImportId ()
 get import id More...
 
 setAssignedObjectTypes ($a_obj_types)
 Set assigned object types. More...
 
 appendAssignedObjectType ($a_obj_type, $a_sub_type)
 append assigned object types More...
 
 getAssignedObjectTypes ()
 Get assigned object types. More...
 
 isAssignedObjectType ($a_obj_type, $a_sub_type)
 Is assigned object type? More...
 
 toXML (ilXmlWriter $writer)
 To Xml. More...
 
 __destruct ()
 Destructor. More...
 

Static Public Member Functions

static _getInstanceByRecordId ($a_record_id)
 Get instance by record id. More...
 
static _getActiveSearchableRecords ()
 Get active searchable records. More...
 
static _lookupTitle ($a_record_id)
 Lookup title. More...
 
static _lookupRecordIdByImportId ($a_ilias_id)
 Lookup record Id by import id. More...
 
static _getAssignableObjectTypes ($a_include_text=false)
 Get assignable object type. More...
 
static _getActivatedObjTypes ()
 get activated obj types More...
 
static _getRecords ()
 Get records. More...
 
static _getAllRecordsByObjectType ()
 Get records by obj_type Note: this returns only records with no sub types! @access public. More...
 
static _getActivatedRecordsByObjectType ($a_obj_type, $a_sub_type="")
 Get activated records by object type. More...
 
static _getSelectedRecordsByObject ($a_obj_type, $a_obj_id, $a_sub_type="")
 Get selected records by object. More...
 
static _delete ($a_record_id)
 Delete record and all related data. More...
 
static saveObjRecSelection ($a_obj_id, $a_sub_type="", array $a_records=null, $a_delete_before=true)
 Save repository object record selection. More...
 
static getObjRecSelection ($a_obj_id, $a_sub_type="")
 Get repository object record selection. More...
 

Protected Member Functions

 generateImportId ()
 generate unique record id More...
 

Protected Attributes

 $record_id
 
 $import_id
 
 $active
 
 $title
 
 $description
 
 $obj_types = array()
 
 $db = null
 

Private Member Functions

 read ()
 read record and assiged object types More...
 

Static Private Attributes

static $instances = array()
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDRecord::__construct (   $a_record_id = 0)

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

Otherwise call getInstance...

@access public

Parameters
intrecord id

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

37 {
38 global $ilDB;
39
40 $this->record_id = $a_record_id;
41 $this->db = $ilDB;
42
43 if($this->getRecordId())
44 {
45 $this->read();
46 }
47 }
read()
read record and assiged object types
global $ilDB

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

+ Here is the call graph for this function:

◆ __destruct()

ilAdvancedMDRecord::__destruct ( )

Destructor.

@access public

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

696 {
697 unset(self::$instances[$this->getRecordId()]);
698 }

References getRecordId().

+ Here is the call graph for this function:

Member Function Documentation

◆ _delete()

static ilAdvancedMDRecord::_delete (   $a_record_id)
static

Delete record and all related data.

@access public

Parameters
intrecord id

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

322 {
323 global $ilDB;
324
325 // Delete fields
326 foreach(ilAdvancedMDFieldDefinition::getInstancesByRecordId($a_record_id) as $field)
327 {
328 $field->delete();
329 }
330
331 $query = "DELETE FROM adv_md_record ".
332 "WHERE record_id = ".$ilDB->quote($a_record_id ,'integer')." ";
333 $res = $ilDB->manipulate($query);
334
335 $query = "DELETE FROM adv_md_record_objs ".
336 "WHERE record_id = ".$ilDB->quote($a_record_id ,'integer')." ";
337 $res = $ilDB->manipulate($query);
338 }
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.

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

Referenced by delete().

+ 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

@access public

Parameters
stringobj types

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

184 {
185 global $ilDB;
186
187 $query = "SELECT DISTINCT(obj_type) FROM adv_md_record_objs amo ".
188 "JOIN adv_md_record amr ON amo.record_id = amr.record_id ".
189 "WHERE active = 1 ";
190 $res = $ilDB->query($query);
191 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
192 {
193 $obj_types[] = $row->obj_type;
194 }
195 return $obj_types ? $obj_types : array();
196 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

References $ilDB, $obj_types, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilAdvancedSearchGUI\__setSearchOptions(), ilAdvancedSearchGUI\initAdvancedMetaDataForm(), ilObjCategoryGUI\setEditTabs(), and ilAdvancedMDSettingsGUI\updateSubstitutions().

+ Here is the caller graph for this function:

◆ _getActivatedRecordsByObjectType()

static ilAdvancedMDRecord::_getActivatedRecordsByObjectType (   $a_obj_type,
  $a_sub_type = "" 
)
static

Get activated records by object type.

@access public

Parameters
stringobj_type

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

251 {
252 global $ilDB;
253
254 $records = array();
255
256 if ($a_sub_type == "")
257 {
258 $a_sub_type = "-";
259 }
260
261 $query = "SELECT amro.record_id record_id FROM adv_md_record_objs amro ".
262 "JOIN adv_md_record amr ON amr.record_id = amro.record_id ".
263 "WHERE active = 1 ".
264 "AND obj_type = ".$ilDB->quote($a_obj_type ,'text')." ".
265 "AND sub_type = ".$ilDB->quote($a_sub_type ,'text');
266
267 $res = $ilDB->query($query);
268 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
269 {
271 }
272
273 return $records;
274 }
static _getInstanceByRecordId($a_record_id)
Get instance by record id.
$records
Definition: simple_test.php:17

References $ilDB, $query, $records, $res, $row, _getInstanceByRecordId(), and DB_FETCHMODE_OBJECT.

Referenced by ilSoapInstallationInfoXMLWriter\__buildClient(), ilGlossaryExporter\getActiveAdvMDRecords(), ilWikiExporter\getActiveAdvMDRecords(), ilOrgUnitType\getAvailableAdvancedMDRecords(), ilSoapAdministration\getNIC(), ilAdvancedMDRecordGUI\parseEditor(), ilAdvancedMDRecordGUI\parseFilter(), ilAdvancedMDRecordGUI\parseRecordSelection(), ilAdvancedMDRecordGUI\parseSearch(), ilAdvancedMDRecordGUI\parseTableCells(), and ilAdvancedMDRecordGUI\parseTableHead().

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

◆ _getActiveSearchableRecords()

static ilAdvancedMDRecord::_getActiveSearchableRecords ( )
static

Get active searchable records.

@access public

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

74 {
75 global $ilDB;
76
77 $query = "SELECT DISTINCT(amr.record_id) FROM adv_md_record amr ".
78 "JOIN adv_mdf_definition amfd ON amr.record_id = amfd.record_id ".
79 "WHERE searchable = 1 AND active = 1 ";
80
81 $res = $ilDB->query($query);
82 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
83 {
85 }
86 return $records ? $records : array();
87 }

References $ilDB, $query, $records, $res, $row, _getInstanceByRecordId(), and DB_FETCHMODE_OBJECT.

+ Here is the call graph for this function:

◆ _getAllRecordsByObjectType()

static ilAdvancedMDRecord::_getAllRecordsByObjectType ( )
static

Get records by obj_type Note: this returns only records with no sub types! @access public.

Parameters

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

228 {
229 global $ilDB;
230
231 $records = array();
232
233 $query = "SELECT * FROM adv_md_record_objs WHERE sub_type=".$ilDB->quote("-", "text");
234 $res = $ilDB->query($query);
235 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
236 {
237 $records[$row->obj_type][] = self::_getInstanceByRecordId($row->record_id);
238 }
239 return $records;
240 }

References $ilDB, $query, $records, $res, $row, _getInstanceByRecordId(), and DB_FETCHMODE_OBJECT.

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

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

◆ _getAssignableObjectTypes()

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

Get assignable object type.

@access public

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

145 {
146 global $objDefinition, $lng;
147
148 $types = array();
149 $amet_types = $objDefinition->getAdvancedMetaDataTypes();
150
151 foreach ($amet_types as $at)
152 {
153 if ($a_include_text)
154 {
155 $text = $lng->txt("obj_".$at["obj_type"]);
156 if ($at["sub_type"] != "")
157 {
158 $lng->loadLanguageModule($at["obj_type"]);
159 $text.= ": ".$lng->txt($at["obj_type"]."_".$at["sub_type"]);
160 }
161 else
162 {
163 $at["sub_type"] = "-";
164 }
165 $at["text"] = $text;
166 }
167
168 $types[] = $at;
169 }
170
171 return $types;
172 return array('cat','crs','rcrs');
173 }
global $lng
Definition: privfeed.php:40

References $lng.

Referenced by ilSoapInstallationInfoXMLWriter\__buildClient(), ilAdvancedMDRecordTableGUI\fillRow(), ilSoapAdministration\getNIC(), and ilAdvancedMDSettingsGUI\initForm().

+ Here is the caller graph for this function:

◆ _getInstanceByRecordId()

static ilAdvancedMDRecord::_getInstanceByRecordId (   $a_record_id)
static

Get instance by record id.

@access public

Parameters
intrecord id

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

58 {
59 if(isset(self::$instances[$a_record_id]))
60 {
61 return self::$instances[$a_record_id];
62 }
63 return self::$instances[$a_record_id] = new ilAdvancedMDRecord($a_record_id);
64 }

Referenced by _getActivatedRecordsByObjectType(), _getActiveSearchableRecords(), _getAllRecordsByObjectType(), _getRecords(), _getSelectedRecordsByObject(), ilAdvancedMDSettingsGUI\confirmDeleteRecords(), ilAdvancedMDSettingsGUI\deleteRecords(), ilAdvancedMDSettingsGUI\exportRecords(), ilAdvancedMDRecordParser\initRecordObject(), and ilAdvancedMDSettingsGUI\initRecordObject().

+ Here is the caller graph for this function:

◆ _getRecords()

static ilAdvancedMDRecord::_getRecords ( )
static

Get records.

@access public

Parameters
arrayarray of record objects

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

207 {
208 global $ilDB;
209
210 $query = "SELECT record_id FROM adv_md_record ";
211 $res = $ilDB->query($query);
212 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
213 {
215 }
216 return $records ? $records : array();
217 }

References $ilDB, $query, $records, $res, $row, _getInstanceByRecordId(), and DB_FETCHMODE_OBJECT.

Referenced by ilLuceneAdvancedSearchFields\getFields(), and ilAdvancedMDSettingsGUI\getRecordObjects().

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

◆ _getSelectedRecordsByObject()

static ilAdvancedMDRecord::_getSelectedRecordsByObject (   $a_obj_type,
  $a_obj_id,
  $a_sub_type = "" 
)
static

Get selected records by object.

Parameters
string$a_obj_typeobject type
string$a_obj_idobject id
string$a_sub_typesub type

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

284 {
285 global $ilDB;
286
287 $records = array();
288
289 if ($a_sub_type == "")
290 {
291 $a_sub_type = "-";
292 }
293
294 $query = "SELECT amro.record_id record_id FROM adv_md_record_objs amro ".
295 "JOIN adv_md_record amr ON (amr.record_id = amro.record_id) ".
296 "JOIN adv_md_obj_rec_select os ON (amr.record_id = os.rec_id AND amro.sub_type = os.sub_type) ".
297 "WHERE active = 1 ".
298 "AND amro.obj_type = ".$ilDB->quote($a_obj_type ,'text')." ".
299 "AND amro.sub_type = ".$ilDB->quote($a_sub_type ,'text')." ".
300 "AND os.obj_id = ".$ilDB->quote($a_obj_id ,'integer')
301 ;
302
303 $res = $ilDB->query($query);
304 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
305 {
307 }
308
309 return $records;
310 }

References $ilDB, $query, $records, $res, $row, _getInstanceByRecordId(), and DB_FETCHMODE_OBJECT.

Referenced by ilPCAMDPageList\findPages(), ilGlossaryAdvMetaDataAdapter\getAllFields(), ilWikiAdvMetaDataBlockGUI\getRecords(), ilAdvancedMDRecordGUI\parseEditor(), ilAdvancedMDRecordGUI\parseFilter(), ilAdvancedMDRecordGUI\parseSearch(), ilAdvancedMDRecordGUI\parseTableCells(), ilAdvancedMDRecordGUI\parseTableHead(), and ilAdvancedMDValues\queryForRecords().

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

◆ _lookupRecordIdByImportId()

static ilAdvancedMDRecord::_lookupRecordIdByImportId (   $a_ilias_id)
static

Lookup record Id by import id.

@access public

Parameters
stringilias id

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

125 {
126 global $ilDB;
127
128 $query = "SELECT record_id FROM adv_md_record ".
129 "WHERE import_id = ".$ilDB->quote($a_ilias_id ,'text')." ";
130 $res = $ilDB->query($query);
131 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
132 {
133 return $row->record_id;
134 }
135 return 0;
136 }

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilAdvancedMDRecordParser\extractRecordId().

+ Here is the caller graph for this function:

◆ _lookupTitle()

static ilAdvancedMDRecord::_lookupTitle (   $a_record_id)
static

Lookup title.

@access public

Parameters
intrecord_id

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

98 {
99 static $title_cache = array();
100
101 if(isset($title_cache[$a_record_id]))
102 {
103 return $title_cache[$a_record_id];
104 }
105
106 global $ilDB;
107
108 $query = "SELECT title FROM adv_md_record ".
109 "WHERE record_id = ".$ilDB->quote($a_record_id ,'integer')." ";
110 $res = $ilDB->query($query);
111 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
112
113 return $title_cache[$a_record_id] = $row->title;
114 }

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilAdvancedMDSettingsGUI\initFormSubstitutions(), ilAdvancedMDRecordGUI\parseInfoPage(), ilObjOrgUnitGUI\parseInfoScreen(), ilECSSettingsGUI\prepareFieldSelection(), and ilLuceneAdvancedSearchFields\readSections().

+ Here is the caller graph for this function:

◆ appendAssignedObjectType()

ilAdvancedMDRecord::appendAssignedObjectType (   $a_obj_type,
  $a_sub_type 
)

append assigned object types

@access public

Parameters
stringilias object type

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

576 {
577 $this->obj_types[] = array("obj_type"=>$a_obj_type, "sub_type"=>$a_sub_type);
578 }

◆ delete()

ilAdvancedMDRecord::delete ( )

Delete.

@access public

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

348 {
350 }
static _delete($a_record_id)
Delete record and all related data.

References _delete(), and getRecordId().

+ Here is the call graph for this function:

◆ generateImportId()

ilAdvancedMDRecord::generateImportId ( )
protected

generate unique record id

@access protected

Returns

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

685 {
686 return 'il_'.IL_INST_ID.'_adv_md_record_'.$this->getRecordId();
687 }

References getRecordId().

Referenced by save(), and toXML().

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

◆ getAssignedObjectTypes()

ilAdvancedMDRecord::getAssignedObjectTypes ( )

Get assigned object types.

@access public

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

587 {
588 return $this->obj_types ? $this->obj_types : array();
589 }

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

+ Here is the caller graph for this function:

◆ getDescription()

ilAdvancedMDRecord::getDescription ( )

get description

@access public

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

References $description.

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

+ Here is the caller graph for this function:

◆ getImportId()

ilAdvancedMDRecord::getImportId ( )

get import id

@access public

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

References $import_id.

Referenced by save().

+ Here is the caller graph for this function:

◆ getObjRecSelection()

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

Get repository object record selection.

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

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

746 {
747 global $ilDB;
748
749 if ($a_sub_type == "")
750 {
751 $a_sub_type = "-";
752 }
753
754 $recs = array();
755 $set = $ilDB->query($r = "SELECT * FROM adv_md_obj_rec_select ".
756 " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer").
757 " AND sub_type = ".$ilDB->quote($a_sub_type, "text")
758 );
759 while ($rec = $ilDB->fetchAssoc($set))
760 {
761 $recs[] = $rec["rec_id"];
762 }
763 return $recs;
764 }

References $ilDB.

Referenced by ilGlossaryExporter\getActiveAdvMDRecords(), ilWikiExporter\getActiveAdvMDRecords(), and ilAdvancedMDRecordGUI\parseRecordSelection().

+ Here is the caller graph for this function:

◆ getRecordId()

ilAdvancedMDRecord::getRecordId ( )

Get record id.

@access public

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

References $record_id.

Referenced by __construct(), __destruct(), delete(), generateImportId(), read(), save(), toXML(), and update().

+ Here is the caller graph for this function:

◆ getTitle()

ilAdvancedMDRecord::getTitle ( )

get title

@access public

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

References $title.

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

+ Here is the caller graph for this function:

◆ isActive()

ilAdvancedMDRecord::isActive ( )

Check if record is active.

@access public

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

483 {
484 return (bool) $this->active;
485 }

References $active.

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

+ Here is the caller graph for this function:

◆ isAssignedObjectType()

ilAdvancedMDRecord::isAssignedObjectType (   $a_obj_type,
  $a_sub_type 
)

Is assigned object type?

Parameters

return

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

598 {
599 foreach ($this->getAssignedObjectTypes() as $t)
600 {
601 if ($t["obj_type"] == $a_obj_type &&
602 $t["sub_type"] == $a_sub_type)
603 {
604 return true;
605 }
606 }
607 return false;
608 }
getAssignedObjectTypes()
Get assigned object types.

References $t, and getAssignedObjectTypes().

+ Here is the call graph for this function:

◆ read()

ilAdvancedMDRecord::read ( )
private

read record and assiged object types

@access private

Parameters

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

655 {
656 global $ilDB;
657
658 $query = "SELECT * FROM adv_md_record ".
659 "WHERE record_id = ".$this->db->quote($this->getRecordId() ,'integer')." ";
660 $res = $this->db->query($query);
661 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
662 {
663 $this->setImportId($row->import_id);
664 $this->setActive($row->active);
665 $this->setTitle($row->title);
666 $this->setDescription($row->description);
667 }
668 $query = "SELECT * FROM adv_md_record_objs ".
669 "WHERE record_id = ".$this->db->quote($this->getRecordId() ,'integer')." ";
670 $res = $this->db->query($query);
671 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
672 {
673 $this->obj_types[] = array("obj_type" => $row->obj_type,
674 "sub_type" => $row->sub_type);
675 }
676 }
setTitle($a_title)
Set title.
setDescription($a_description)
set description
setActive($a_active)
Set active.
setImportId($a_id_string)
set import id

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, getRecordId(), setActive(), setDescription(), setImportId(), and setTitle().

Referenced by __construct().

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

◆ save()

ilAdvancedMDRecord::save ( )

save

@access public

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

359 {
360 global $ilDB;
361
362 // Save import id if given
363 $next_id = $ilDB->nextId('adv_md_record');
364
365 $query = "INSERT INTO adv_md_record (record_id,import_id,active,title,description) ".
366 "VALUES(".
367 $ilDB->quote($next_id,'integer').", ".
368 $this->db->quote($this->getImportId(),'text').", ".
369 $this->db->quote($this->isActive() ,'integer').", ".
370 $this->db->quote($this->getTitle() ,'text').", ".
371 $this->db->quote($this->getDescription() ,'text')." ".
372 ")";
373 $res = $ilDB->manipulate($query);
374 $this->record_id = $next_id;
375
376 if(!strlen($this->getImportId()))
377 {
378 // set import id to default value
379 $query = "UPDATE adv_md_record ".
380 "SET import_id = ".$this->db->quote($this->generateImportId() ,'text')." ".
381 "WHERE record_id = ".$this->db->quote($this->record_id ,'integer')." ";
382 $res = $ilDB->manipulate($query);
383 }
384
385 foreach($this->getAssignedObjectTypes() as $type)
386 {
387 global $ilDB;
388
389 $query = "INSERT INTO adv_md_record_objs (record_id,obj_type,sub_type) ".
390 "VALUES( ".
391 $this->db->quote($this->getRecordId() ,'integer').", ".
392 $this->db->quote($type["obj_type"] ,'text').", ".
393 $this->db->quote($type["sub_type"] ,'text')." ".
394 ")";
395 $res = $ilDB->manipulate($query);
396 }
397 }
isActive()
Check if record is active.
generateImportId()
generate unique record id

References $ilDB, $query, $res, generateImportId(), getAssignedObjectTypes(), getDescription(), getImportId(), getRecordId(), getTitle(), and isActive().

+ Here is the call graph for this function:

◆ saveObjRecSelection()

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

Save repository object record selection.

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

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

707 {
708 global $ilDB;
709
710 if ($a_sub_type == "")
711 {
712 $a_sub_type = "-";
713 }
714
715 if((bool)$a_delete_before)
716 {
717 $ilDB->manipulate("DELETE FROM adv_md_obj_rec_select WHERE ".
718 " obj_id = ".$ilDB->quote($a_obj_id, "integer").
719 " AND sub_type = ".$ilDB->quote($a_sub_type, "text"));
720 }
721
722 if (is_array($a_records))
723 {
724 foreach ($a_records as $r)
725 {
726 if ($r > 0)
727 {
728 $ilDB->manipulate("INSERT INTO adv_md_obj_rec_select ".
729 "(obj_id, rec_id, sub_type) VALUES (".
730 $ilDB->quote($a_obj_id, "integer").",".
731 $ilDB->quote($r, "integer").",".
732 $ilDB->quote($a_sub_type, "text").
733 ")");
734 }
735 }
736 }
737 }

References $ilDB.

Referenced by ilAdvancedMetaDataImporter\importXmlRepresentation(), ilAdvancedMDRecordGUI\saveSelection(), and ilObjOrgUnit\update().

+ Here is the caller graph for this function:

◆ setActive()

ilAdvancedMDRecord::setActive (   $a_active)

Set active.

@access public

Parameters

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

472 {
473 $this->active = $a_active;
474 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setAssignedObjectTypes()

ilAdvancedMDRecord::setAssignedObjectTypes (   $a_obj_types)

Set assigned object types.

@access public

Parameters
arrayarray(string) array of object types. E.g array('crs','crsl')

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

564 {
565 $this->obj_types = $a_obj_types;
566 }

◆ setDescription()

ilAdvancedMDRecord::setDescription (   $a_description)

set description

@access public

Parameters
stringdescription

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

518 {
519 $this->description = $a_description;
520 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setImportId()

ilAdvancedMDRecord::setImportId (   $a_id_string)

set import id

@access public

Parameters
stringimport id

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

541 {
542 $this->import_id = $a_id_string;
543 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTitle()

ilAdvancedMDRecord::setTitle (   $a_title)

Set title.

@access public

Parameters
stringtitle

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

495 {
496 $this->title = $a_title;
497 }

Referenced by read().

+ 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.

@access public

Parameters
objectilXmlWriter

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

621 {
622 $writer->xmlStartTag('Record',array('active' => $this->isActive() ? 1 : 0,
623 'id' => $this->generateImportId()));
624 $writer->xmlElement('Title',null,$this->getTitle());
625 $writer->xmlElement('Description',null,$this->getDescription());
626
627 foreach($this->getAssignedObjectTypes() as $obj_type)
628 {
629 if ($obj_type["sub_type"] == "")
630 {
631 $writer->xmlElement('ObjectType',null,$obj_type["obj_type"]);
632 }
633 else
634 {
635 $writer->xmlElement('ObjectType',null,$obj_type["obj_type"].":".$obj_type["sub_type"]);
636 }
637 }
638
639 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
641 {
642 $definition->toXML($writer);
643 }
644 $writer->xmlEndTag('Record');
645 }
xmlEndTag($tag)
Writes an endtag.
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)

References generateImportId(), getAssignedObjectTypes(), getDescription(), ilAdvancedMDFieldDefinition\getInstancesByRecordId(), getRecordId(), getTitle(), isActive(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

+ Here is the call graph for this function:

◆ update()

ilAdvancedMDRecord::update ( )

update

@access public

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

406 {
407 global $ilDB;
408
409 $query = "UPDATE adv_md_record ".
410 "SET active = ".$this->db->quote($this->isActive() ,'integer').", ".
411 "title = ".$this->db->quote($this->getTitle() ,'text').", ".
412 "description = ".$this->db->quote($this->getDescription() ,'text')." ".
413 "WHERE record_id = ".$this->db->quote($this->getRecordId() ,'integer')." ";
414 $res = $ilDB->manipulate($query);
415
416 // Delete assignments
417 $query = "DELETE FROM adv_md_record_objs ".
418 "WHERE record_id = ".$this->db->quote($this->getRecordId() ,'integer')." ";
419 $res = $ilDB->manipulate($query);
420
421 // Insert assignments
422 foreach($this->getAssignedObjectTypes() as $type)
423 {
424 $query = "INSERT INTO adv_md_record_objs (record_id,obj_type, sub_type) ".
425 "VALUES ( ".
426 $this->db->quote($this->getRecordId() ,'integer').", ".
427 $this->db->quote($type["obj_type"] ,'text').", ".
428 $this->db->quote($type["sub_type"] ,'text')." ".
429 ")";
430 $res = $ilDB->manipulate($query);
431 }
432 }

References $ilDB, $query, $res, getAssignedObjectTypes(), getDescription(), getRecordId(), getTitle(), and isActive().

+ Here is the call graph for this function:

◆ validate()

ilAdvancedMDRecord::validate ( )

Validate settings Write error message to ilErr.

@access public

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

442 {
443 global $ilErr,$lng;
444
445 if(!strlen($this->getTitle()))
446 {
447 $ilErr->setMessage('fill_out_all_required_fields');
448 return false;
449 }
450 return true;
451 }

References $ilErr, $lng, and getTitle().

+ Here is the call graph for this function:

Field Documentation

◆ $active

ilAdvancedMDRecord::$active
protected

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

Referenced by isActive().

◆ $db

ilAdvancedMDRecord::$db = null
protected

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

◆ $description

ilAdvancedMDRecord::$description
protected

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

Referenced by getDescription().

◆ $import_id

ilAdvancedMDRecord::$import_id
protected

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

Referenced by getImportId().

◆ $instances

ilAdvancedMDRecord::$instances = array()
staticprivate

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

◆ $obj_types

ilAdvancedMDRecord::$obj_types = array()
protected

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

Referenced by _getActivatedObjTypes().

◆ $record_id

ilAdvancedMDRecord::$record_id
protected

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

Referenced by getRecordId().

◆ $title

ilAdvancedMDRecord::$title
protected

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

Referenced by getTitle().


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