ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 delete ()
 Delete.
 save ()
 save
 update ()
 update
 validate ()
 Validate settings Write error message to ilErr.
 getRecordId ()
 Get record id.
 setActive ($a_active)
 Set active.
 isActive ()
 Check if record is active.
 setTitle ($a_title)
 Set title.
 getTitle ()
 get title
 setDescription ($a_description)
 set description
 getDescription ()
 get description
 setImportId ($a_id_string)
 set import id
 getImportId ()
 get import id
 setAssignedObjectTypes ($a_obj_types)
 Set assigned object types.
 appendAssignedObjectType ($a_obj_type, $a_sub_type)
 append assigned object types
 getAssignedObjectTypes ()
 Get assigned object types.
 isAssignedObjectType ($a_obj_type, $a_sub_type)
 Is assigned object type?
 toXML (ilXmlWriter $writer)
 To Xml.
 __destruct ()
 Destructor.

Static Public Member Functions

static _getInstanceByRecordId ($a_record_id)
 Get instance by record id.
static _getActiveSearchableRecords ()
 Get active searchable records.
static _lookupTitle ($a_record_id)
 Lookup title.
static _lookupRecordIdByImportId ($a_ilias_id)
 Lookup record Id by import id.
static _getAssignableObjectTypes ($a_include_text=false)
 Get assignable object type.
static _getActivatedObjTypes ()
 get activated obj types
static _getRecords ()
 Get records.
static _getAllRecordsByObjectType ()
 Get records by obj_type Note: this returns only records with no sub types! public.
static _getActivatedRecordsByObjectType ($a_obj_type, $a_sub_type="")
 Get activated records by object type.
static _getSelectedRecordsByObject ($a_obj_type, $a_obj_id, $a_sub_type="")
 Get selected records by object.
static _delete ($a_record_id)
 Delete record and all related data.
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.

Protected Member Functions

 generateImportId ()
 generate unique record id

Protected Attributes

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

Private Member Functions

 read ()
 read record and assiged object types

Static Private Attributes

static $instances = array()

Detailed Description

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

Constructor & Destructor Documentation

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

public

Parameters
intrecord id

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

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

{
global $ilDB;
$this->record_id = $a_record_id;
$this->db = $ilDB;
if($this->getRecordId())
{
$this->read();
}
}

+ Here is the call graph for this function:

ilAdvancedMDRecord::__destruct ( )

Destructor.

public

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

References getRecordId().

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

+ Here is the call graph for this function:

Member Function Documentation

static ilAdvancedMDRecord::_delete (   $a_record_id)
static

Delete record and all related data.

public

Parameters
intrecord id

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

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

Referenced by delete().

{
global $ilDB;
// Delete fields
foreach(ilAdvancedMDFieldDefinition::getInstancesByRecordId($a_record_id) as $field)
{
$field->delete();
}
$query = "DELETE FROM adv_md_record ".
"WHERE record_id = ".$ilDB->quote($a_record_id ,'integer')." ";
$res = $ilDB->manipulate($query);
$query = "DELETE FROM adv_md_record_objs ".
"WHERE record_id = ".$ilDB->quote($a_record_id ,'integer')." ";
$res = $ilDB->manipulate($query);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilAdvancedMDRecord::_getActivatedObjTypes ( )
static

get activated obj types

public

Parameters
stringobj types

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

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

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

{
global $ilDB;
$query = "SELECT DISTINCT(obj_type) FROM adv_md_record_objs amo ".
"JOIN adv_md_record amr ON amo.record_id = amr.record_id ".
"WHERE active = 1 ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$obj_types[] = $row->obj_type;
}
return $obj_types ? $obj_types : array();
}

+ Here is the caller graph for this function:

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

Get activated records by object type.

public

Parameters
stringobj_type

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

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().

{
global $ilDB;
$records = array();
if ($a_sub_type == "")
{
$a_sub_type = "-";
}
$query = "SELECT amro.record_id record_id FROM adv_md_record_objs amro ".
"JOIN adv_md_record amr ON amr.record_id = amro.record_id ".
"WHERE active = 1 ".
"AND obj_type = ".$ilDB->quote($a_obj_type ,'text')." ".
"AND sub_type = ".$ilDB->quote($a_sub_type ,'text');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
}
return $records;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilAdvancedMDRecord::_getActiveSearchableRecords ( )
static

Get active searchable records.

public

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

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

{
global $ilDB;
$query = "SELECT DISTINCT(amr.record_id) FROM adv_md_record amr ".
"JOIN adv_mdf_definition amfd ON amr.record_id = amfd.record_id ".
"WHERE searchable = 1 AND active = 1 ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
}
return $records ? $records : array();
}

+ Here is the call graph for this function:

static ilAdvancedMDRecord::_getAllRecordsByObjectType ( )
static

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

Parameters

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

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

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

{
global $ilDB;
$records = array();
$query = "SELECT * FROM adv_md_record_objs WHERE sub_type=".$ilDB->quote("-", "text");
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$records[$row->obj_type][] = self::_getInstanceByRecordId($row->record_id);
}
return $records;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Get assignable object type.

public

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

References $lng.

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

{
global $objDefinition, $lng;
$types = array();
$amet_types = $objDefinition->getAdvancedMetaDataTypes();
foreach ($amet_types as $at)
{
if ($a_include_text)
{
$text = $lng->txt("obj_".$at["obj_type"]);
if ($at["sub_type"] != "")
{
$lng->loadLanguageModule($at["obj_type"]);
$text.= ": ".$lng->txt($at["obj_type"]."_".$at["sub_type"]);
}
else
{
$at["sub_type"] = "-";
}
$at["text"] = $text;
}
$types[] = $at;
}
return $types;
return array('cat','crs','rcrs');
}

+ Here is the caller graph for this function:

static ilAdvancedMDRecord::_getInstanceByRecordId (   $a_record_id)
static

Get instance by record id.

public

Parameters
intrecord id

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

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

{
if(isset(self::$instances[$a_record_id]))
{
return self::$instances[$a_record_id];
}
return self::$instances[$a_record_id] = new ilAdvancedMDRecord($a_record_id);
}

+ Here is the caller graph for this function:

static ilAdvancedMDRecord::_getRecords ( )
static

Get records.

public

Parameters
arrayarray of record objects

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

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

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

{
global $ilDB;
$query = "SELECT record_id FROM adv_md_record ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
}
return $records ? $records : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

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().

{
global $ilDB;
$records = array();
if ($a_sub_type == "")
{
$a_sub_type = "-";
}
$query = "SELECT amro.record_id record_id FROM adv_md_record_objs amro ".
"JOIN adv_md_record amr ON (amr.record_id = amro.record_id) ".
"JOIN adv_md_obj_rec_select os ON (amr.record_id = os.rec_id AND amro.sub_type = os.sub_type) ".
"WHERE active = 1 ".
"AND amro.obj_type = ".$ilDB->quote($a_obj_type ,'text')." ".
"AND amro.sub_type = ".$ilDB->quote($a_sub_type ,'text')." ".
"AND os.obj_id = ".$ilDB->quote($a_obj_id ,'integer')
;
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
}
return $records;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilAdvancedMDRecord::_lookupRecordIdByImportId (   $a_ilias_id)
static

Lookup record Id by import id.

public

Parameters
stringilias id

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

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

Referenced by ilAdvancedMDRecordParser\extractRecordId().

{
global $ilDB;
$query = "SELECT record_id FROM adv_md_record ".
"WHERE import_id = ".$ilDB->quote($a_ilias_id ,'text')." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
return $row->record_id;
}
return 0;
}

+ Here is the caller graph for this function:

static ilAdvancedMDRecord::_lookupTitle (   $a_record_id)
static

Lookup title.

public

Parameters
intrecord_id

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

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

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

{
static $title_cache = array();
if(isset($title_cache[$a_record_id]))
{
return $title_cache[$a_record_id];
}
global $ilDB;
$query = "SELECT title FROM adv_md_record ".
"WHERE record_id = ".$ilDB->quote($a_record_id ,'integer')." ";
$res = $ilDB->query($query);
return $title_cache[$a_record_id] = $row->title;
}

+ Here is the caller graph for this function:

ilAdvancedMDRecord::appendAssignedObjectType (   $a_obj_type,
  $a_sub_type 
)

append assigned object types

public

Parameters
stringilias object type

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

{
$this->obj_types[] = array("obj_type"=>$a_obj_type, "sub_type"=>$a_sub_type);
}
ilAdvancedMDRecord::delete ( )

Delete.

public

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

References _delete(), and getRecordId().

+ Here is the call graph for this function:

ilAdvancedMDRecord::generateImportId ( )
protected

generate unique record id

protected

Returns

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

References getRecordId().

Referenced by save(), and toXML().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDRecord::getAssignedObjectTypes ( )

Get assigned object types.

public

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

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

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

+ Here is the caller graph for this function:

ilAdvancedMDRecord::getDescription ( )

get description

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:

ilAdvancedMDRecord::getImportId ( )

get import id

public

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

References $import_id.

Referenced by save().

{
}

+ Here is the caller graph for this function:

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.

References $ilDB.

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

{
global $ilDB;
if ($a_sub_type == "")
{
$a_sub_type = "-";
}
$recs = array();
$set = $ilDB->query($r = "SELECT * FROM adv_md_obj_rec_select ".
" WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer").
" AND sub_type = ".$ilDB->quote($a_sub_type, "text")
);
while ($rec = $ilDB->fetchAssoc($set))
{
$recs[] = $rec["rec_id"];
}
return $recs;
}

+ Here is the caller graph for this function:

ilAdvancedMDRecord::getRecordId ( )

Get record id.

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:

ilAdvancedMDRecord::getTitle ( )

get title

public

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

References $title.

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

{
return $this->title;
}

+ Here is the caller graph for this function:

ilAdvancedMDRecord::isActive ( )

Check if record is active.

public

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

References $active.

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

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

+ Here is the caller graph for this function:

ilAdvancedMDRecord::isAssignedObjectType (   $a_obj_type,
  $a_sub_type 
)

Is assigned object type?

Parameters
@return

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

References $t, and getAssignedObjectTypes().

{
foreach ($this->getAssignedObjectTypes() as $t)
{
if ($t["obj_type"] == $a_obj_type &&
$t["sub_type"] == $a_sub_type)
{
return true;
}
}
return false;
}

+ Here is the call graph for this function:

ilAdvancedMDRecord::read ( )
private

read record and assiged object types

private

Parameters

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

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

Referenced by __construct().

{
global $ilDB;
$query = "SELECT * FROM adv_md_record ".
"WHERE record_id = ".$this->db->quote($this->getRecordId() ,'integer')." ";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->setImportId($row->import_id);
$this->setActive($row->active);
$this->setTitle($row->title);
$this->setDescription($row->description);
}
$query = "SELECT * FROM adv_md_record_objs ".
"WHERE record_id = ".$this->db->quote($this->getRecordId() ,'integer')." ";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->obj_types[] = array("obj_type" => $row->obj_type,
"sub_type" => $row->sub_type);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDRecord::save ( )

save

public

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

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

{
global $ilDB;
// Save import id if given
$next_id = $ilDB->nextId('adv_md_record');
$query = "INSERT INTO adv_md_record (record_id,import_id,active,title,description) ".
"VALUES(".
$ilDB->quote($next_id,'integer').", ".
$this->db->quote($this->getImportId(),'text').", ".
$this->db->quote($this->isActive() ,'integer').", ".
$this->db->quote($this->getTitle() ,'text').", ".
$this->db->quote($this->getDescription() ,'text')." ".
")";
$res = $ilDB->manipulate($query);
$this->record_id = $next_id;
if(!strlen($this->getImportId()))
{
// set import id to default value
$query = "UPDATE adv_md_record ".
"SET import_id = ".$this->db->quote($this->generateImportId() ,'text')." ".
"WHERE record_id = ".$this->db->quote($this->record_id ,'integer')." ";
$res = $ilDB->manipulate($query);
}
foreach($this->getAssignedObjectTypes() as $type)
{
global $ilDB;
$query = "INSERT INTO adv_md_record_objs (record_id,obj_type,sub_type) ".
"VALUES( ".
$this->db->quote($this->getRecordId() ,'integer').", ".
$this->db->quote($type["obj_type"] ,'text').", ".
$this->db->quote($type["sub_type"] ,'text')." ".
")";
$res = $ilDB->manipulate($query);
}
}

+ Here is the call graph for this function:

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.

References $ilDB.

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

{
global $ilDB;
if ($a_sub_type == "")
{
$a_sub_type = "-";
}
if((bool)$a_delete_before)
{
$ilDB->manipulate("DELETE FROM adv_md_obj_rec_select WHERE ".
" obj_id = ".$ilDB->quote($a_obj_id, "integer").
" AND sub_type = ".$ilDB->quote($a_sub_type, "text"));
}
if (is_array($a_records))
{
foreach ($a_records as $r)
{
if ($r > 0)
{
$ilDB->manipulate("INSERT INTO adv_md_obj_rec_select ".
"(obj_id, rec_id, sub_type) VALUES (".
$ilDB->quote($a_obj_id, "integer").",".
$ilDB->quote($r, "integer").",".
$ilDB->quote($a_sub_type, "text").
")");
}
}
}
}

+ Here is the caller graph for this function:

ilAdvancedMDRecord::setActive (   $a_active)

Set active.

public

Parameters

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

Referenced by read().

{
$this->active = $a_active;
}

+ Here is the caller graph for this function:

ilAdvancedMDRecord::setAssignedObjectTypes (   $a_obj_types)

Set assigned object types.

public

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

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

{
$this->obj_types = $a_obj_types;
}
ilAdvancedMDRecord::setDescription (   $a_description)

set description

public

Parameters
stringdescription

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

Referenced by read().

{
$this->description = $a_description;
}

+ Here is the caller graph for this function:

ilAdvancedMDRecord::setImportId (   $a_id_string)

set import id

public

Parameters
stringimport id

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

Referenced by read().

{
$this->import_id = $a_id_string;
}

+ Here is the caller graph for this function:

ilAdvancedMDRecord::setTitle (   $a_title)

Set title.

public

Parameters
stringtitle

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

Referenced by read().

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

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.

public

Parameters
objectilXmlWriter

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

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

{
$writer->xmlStartTag('Record',array('active' => $this->isActive() ? 1 : 0,
'id' => $this->generateImportId()));
$writer->xmlElement('Title',null,$this->getTitle());
$writer->xmlElement('Description',null,$this->getDescription());
foreach($this->getAssignedObjectTypes() as $obj_type)
{
if ($obj_type["sub_type"] == "")
{
$writer->xmlElement('ObjectType',null,$obj_type["obj_type"]);
}
else
{
$writer->xmlElement('ObjectType',null,$obj_type["obj_type"].":".$obj_type["sub_type"]);
}
}
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
{
$definition->toXML($writer);
}
$writer->xmlEndTag('Record');
}

+ Here is the call graph for this function:

ilAdvancedMDRecord::update ( )

update

public

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

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

{
global $ilDB;
$query = "UPDATE adv_md_record ".
"SET active = ".$this->db->quote($this->isActive() ,'integer').", ".
"title = ".$this->db->quote($this->getTitle() ,'text').", ".
"description = ".$this->db->quote($this->getDescription() ,'text')." ".
"WHERE record_id = ".$this->db->quote($this->getRecordId() ,'integer')." ";
$res = $ilDB->manipulate($query);
// Delete assignments
$query = "DELETE FROM adv_md_record_objs ".
"WHERE record_id = ".$this->db->quote($this->getRecordId() ,'integer')." ";
$res = $ilDB->manipulate($query);
// Insert assignments
foreach($this->getAssignedObjectTypes() as $type)
{
$query = "INSERT INTO adv_md_record_objs (record_id,obj_type, sub_type) ".
"VALUES ( ".
$this->db->quote($this->getRecordId() ,'integer').", ".
$this->db->quote($type["obj_type"] ,'text').", ".
$this->db->quote($type["sub_type"] ,'text')." ".
")";
$res = $ilDB->manipulate($query);
}
}

+ Here is the call graph for this function:

ilAdvancedMDRecord::validate ( )

Validate settings Write error message to ilErr.

public

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

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

{
global $ilErr,$lng;
if(!strlen($this->getTitle()))
{
$ilErr->setMessage('fill_out_all_required_fields');
return false;
}
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilAdvancedMDRecord::$active
protected

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

Referenced by isActive().

ilAdvancedMDRecord::$db = null
protected

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

ilAdvancedMDRecord::$description
protected

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

Referenced by getDescription().

ilAdvancedMDRecord::$import_id
protected

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

Referenced by getImportId().

ilAdvancedMDRecord::$instances = array()
staticprivate

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

ilAdvancedMDRecord::$obj_types = array()
protected

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

Referenced by _getActivatedObjTypes().

ilAdvancedMDRecord::$record_id
protected

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

Referenced by getRecordId().

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: