Public Member Functions | |
ilObjGlossary ($a_id=0, $a_call_by_reference=true) | |
Constructor public. | |
initMeta () | |
init meta data object if needed | |
create ($a_upload=false) | |
create glossary object | |
read () | |
read data of content object | |
getDescription () | |
get description of glossary object | |
setDescription ($a_description) | |
set description of glossary object | |
getTitle () | |
get title of glossary object | |
setTitle ($a_title) | |
set title of glossary object | |
setOnline ($a_online) | |
getOnline () | |
_lookupOnline ($a_id) | |
check wether content object is online | |
assignMetaData (&$a_meta_data) | |
assign a meta data object to glossary object | |
& | getMetaData () |
get meta data object of glossary object | |
updateMetaData () | |
update meta data only | |
update () | |
update complete object | |
getImportId () | |
get import id | |
setImportId ($a_id) | |
set import id | |
getTermList ($searchterm="") | |
get term list | |
createImportDirectory () | |
creates data directory for import files (data_dir/glo_data/glo_<id>/import, depending on data directory that is set in ILIAS setup/ini) | |
getImportDirectory () | |
get import directory of glossary | |
createExportDirectory () | |
creates data directory for export files (data_dir/glo_data/glo_<id>/export, depending on data directory that is set in ILIAS setup/ini) | |
getExportDirectory () | |
get export directory of glossary | |
getExportFiles ($dir) | |
get export files | |
exportXML (&$a_xml_writer, $a_inst, $a_target_dir, &$expLog) | |
export object to xml (see ilias_co.dtd) | |
exportXMLGlossaryItems (&$a_xml_writer, $a_inst, &$expLog) | |
export page objects to xml (see ilias_co.dtd) | |
exportXMLMetaData (&$a_xml_writer) | |
export content objects meta data to xml (see ilias_co.dtd) | |
exportXMLMediaObjects (&$a_xml_writer, $a_inst, $a_target_dir, &$expLog) | |
export media objects to xml (see ilias_co.dtd) | |
exportFileItems ($a_target_dir, &$expLog) | |
export files of file itmes | |
modifyExportIdentifier ($a_tag, $a_param, $a_value) | |
ilClone ($a_parent_ref) | |
copy all properties and subobjects of a glossary | |
delete () | |
delete glossary and all related data | |
notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0) | |
notifys an object about an event occured Based on the event happend, each object may decide how it reacts. | |
getXMLZip () |
Definition at line 36 of file class.ilObjGlossary.php.
ilObjGlossary::_lookupOnline | ( | $ | a_id | ) |
check wether content object is online
Definition at line 164 of file class.ilObjGlossary.php.
References $q, and ilUtil::yn2tf().
Referenced by ilObjUser::getDesktopItems(), ilRepositoryGUI::getFlatListData(), and ilRepositoryExplorer::isClickable().
{ global $ilDB; $q = "SELECT * FROM glossary WHERE id = '".$a_id."'"; $lm_set = $ilDB->query($q); $lm_rec = $lm_set->fetchRow(DB_FETCHMODE_ASSOC); return ilUtil::yn2tf($lm_rec["online"]); }
ilObjGlossary::assignMetaData | ( | &$ | a_meta_data | ) |
assign a meta data object to glossary object
object | $a_meta_data meta data object |
Definition at line 180 of file class.ilObjGlossary.php.
Referenced by initMeta().
{ $this->meta_data =& $a_meta_data; }
ilObjGlossary::create | ( | $ | a_upload = false |
) |
create glossary object
Definition at line 76 of file class.ilObjGlossary.php.
References $q, ilObject::create(), getDescription(), ilObject::getId(), getTitle(), ilObject::getType(), and initMeta().
{ global $ilDB; parent::create(); if (!$a_upload) { $this->initMeta(); $this->meta_data->setId($this->getId()); $this->meta_data->setType($this->getType()); $this->meta_data->setTitle($this->getTitle()); $this->meta_data->setDescription($this->getDescription()); $this->meta_data->setObject($this); $this->meta_data->create(); } $q = "INSERT INTO glossary (id, online) VALUES ". " (".$ilDB->quote($this->getId()).",".$ilDB->quote("n").")"; $ilDB->query($q); }
ilObjGlossary::createExportDirectory | ( | ) |
creates data directory for export files (data_dir/glo_data/glo_<id>/export, depending on data directory that is set in ILIAS setup/ini)
Definition at line 300 of file class.ilObjGlossary.php.
References ilUtil::getDataDir(), ilObject::getId(), and ilUtil::makeDir().
{ $glo_data_dir = ilUtil::getDataDir()."/glo_data"; ilUtil::makeDir($glo_data_dir); if(!is_writable($glo_data_dir)) { $this->ilias->raiseError("Glossary Data Directory (".$glo_data_dir .") not writeable.",$this->ilias->error_obj->FATAL); } // create glossary directory (data_dir/glo_data/glo_<id>) $glo_dir = $glo_data_dir."/glo_".$this->getId(); ilUtil::makeDir($glo_dir); if(!@is_dir($glo_dir)) { $this->ilias->raiseError("Creation of Glossary Directory failed.",$this->ilias->error_obj->FATAL); } // create Export subdirectory (data_dir/glo_data/glo_<id>/export) $export_dir = $glo_dir."/export"; ilUtil::makeDir($export_dir); if(!@is_dir($export_dir)) { $this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL); } }
ilObjGlossary::createImportDirectory | ( | ) |
creates data directory for import files (data_dir/glo_data/glo_<id>/import, depending on data directory that is set in ILIAS setup/ini)
Definition at line 259 of file class.ilObjGlossary.php.
References ilUtil::getDataDir(), ilObject::getId(), and ilUtil::makeDir().
{ $glo_data_dir = ilUtil::getDataDir()."/glo_data"; ilUtil::makeDir($glo_data_dir); if(!is_writable($glo_data_dir)) { $this->ilias->raiseError("Glossary Data Directory (".$glo_data_dir .") not writeable.",$this->ilias->error_obj->FATAL); } // create glossary directory (data_dir/glo_data/glo_<id>) $glo_dir = $glo_data_dir."/glo_".$this->getId(); ilUtil::makeDir($glo_dir); if(!@is_dir($glo_dir)) { $this->ilias->raiseError("Creation of Glossary Directory failed.",$this->ilias->error_obj->FATAL); } // create Import subdirectory (data_dir/glo_data/glo_<id>/import) $import_dir = $glo_dir."/import"; ilUtil::makeDir($import_dir); if(!@is_dir($import_dir)) { $this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL); } }
ilObjGlossary::delete | ( | ) |
delete glossary and all related data
this method has been tested on may 9th 2004 meta data, terms, definitions, definition meta data and definition pages have been deleted correctly as desired
public
Reimplemented from ilObject.
Definition at line 596 of file class.ilObjGlossary.php.
References $q, ilObject::getId(), getTermList(), and ilObject::getType().
{ // always call parent delete function first!! if (!parent::delete()) { return false; } // delete terms $terms = $this->getTermList(); foreach ($terms as $term) { $term_obj =& new ilGlossaryTerm($term["id"]); $term_obj->delete(); } // delete glossary data entry $q = "DELETE FROM glossary WHERE id = ".$this->getId(); $this->ilias->db->query($q); // delete meta data $nested = new ilNestedSetXML(); $nested->init($this->getId(), $this->getType()); $nested->deleteAllDBData(); return true; }
ilObjGlossary::exportFileItems | ( | $ | a_target_dir, | |
&$ | expLog | |||
) |
export files of file itmes
Definition at line 536 of file class.ilObjGlossary.php.
References $file_obj.
Referenced by exportXML().
{ include_once("classes/class.ilObjFile.php"); foreach ($this->file_ids as $file_id) { $expLog->write(date("[y-m-d H:i:s] ")."File Item ".$file_id); $file_obj = new ilObjFile($file_id, false); $file_obj->export($a_target_dir); unset($file_obj); } }
ilObjGlossary::exportXML | ( | &$ | a_xml_writer, | |
$ | a_inst, | |||
$ | a_target_dir, | |||
&$ | expLog | |||
) |
export object to xml (see ilias_co.dtd)
object | $a_xml_writer ilXmlWriter object that receives the xml data |
Definition at line 381 of file class.ilObjGlossary.php.
References $ilBench, exportFileItems(), exportXMLGlossaryItems(), exportXMLMediaObjects(), exportXMLMetaData(), ilGlossaryDefinition::getDefinitionList(), and getTermList().
{ global $ilBench; // export glossary $attrs = array(); $attrs["Type"] = "Glossary"; $a_xml_writer->xmlStartTag("ContentObject", $attrs); // MetaData $this->exportXMLMetaData($a_xml_writer); // collect media objects $terms = $this->getTermList(); $this->mob_ids = array(); $this->file_ids = array(); foreach ($terms as $term) { include_once "./content/classes/class.ilGlossaryDefinition.php"; $defs = ilGlossaryDefinition::getDefinitionList($term[id]); foreach($defs as $def) { $this->page_object =& new ilPageObject("gdf", $def["id"], $this->halt_on_error); $this->page_object->buildDom(); $this->page_object->insertInstIntoIDs(IL_INST_ID); $mob_ids = $this->page_object->collectMediaObjects(false); $file_ids = $this->page_object->collectFileItems(); foreach($mob_ids as $mob_id) { $this->mob_ids[$mob_id] = $mob_id; } foreach($file_ids as $file_id) { $this->file_ids[$file_id] = $file_id; } } } // export media objects $expLog->write(date("[y-m-d H:i:s] ")."Start Export Media Objects"); $ilBench->start("GlossaryExport", "exportMediaObjects"); $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog); $ilBench->stop("GlossaryExport", "exportMediaObjects"); $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Media Objects"); // FileItems $expLog->write(date("[y-m-d H:i:s] ")."Start Export File Items"); $ilBench->start("ContentObjectExport", "exportFileItems"); $this->exportFileItems($a_target_dir, $expLog); $ilBench->stop("ContentObjectExport", "exportFileItems"); $expLog->write(date("[y-m-d H:i:s] ")."Finished Export File Items"); // Glossary $expLog->write(date("[y-m-d H:i:s] ")."Start Export Glossary Items"); $ilBench->start("GlossaryExport", "exportGlossaryItems"); $this->exportXMLGlossaryItems($a_xml_writer, $a_inst, $expLog); $ilBench->stop("GlossaryExport", "exportGlossaryItems"); $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Glossary Items"); $a_xml_writer->xmlEndTag("ContentObject"); }
ilObjGlossary::exportXMLGlossaryItems | ( | &$ | a_xml_writer, | |
$ | a_inst, | |||
&$ | expLog | |||
) |
export page objects to xml (see ilias_co.dtd)
object | $a_xml_writer ilXmlWriter object that receives the xml data |
Definition at line 452 of file class.ilObjGlossary.php.
References $ilBench, exportXMLMetaData(), and getTermList().
Referenced by exportXML().
{ global $ilBench; $attrs = array(); $a_xml_writer->xmlStartTag("Glossary", $attrs); // MetaData $this->exportXMLMetaData($a_xml_writer); $terms = $this->getTermList(); // export glossary terms reset($terms); foreach ($terms as $term) { $ilBench->start("GlossaryExport", "exportGlossaryItem"); $expLog->write(date("[y-m-d H:i:s] ")."Page Object ".$page["obj_id"]); // export xml to writer object $ilBench->start("GlossaryExport", "exportGlossaryItem_getGlossaryTerm"); $glo_term = new ilGlossaryTerm($term["id"]); $ilBench->stop("GlossaryExport", "exportGlossaryItem_getGlossaryTerm"); $ilBench->start("GlossaryExport", "exportGlossaryItem_XML"); $glo_term->exportXML($a_xml_writer, $a_inst); $ilBench->stop("GlossaryExport", "exportGlossaryItem_XML"); // collect all file items /* $ilBench->start("GlossaryExport", "exportGlossaryItem_CollectFileItems"); $file_ids = $page_obj->getFileItemIds(); foreach($file_ids as $file_id) { $this->file_ids[$file_id] = $file_id; } $ilBench->stop("GlossaryExport", "exportGlossaryItem_CollectFileItems"); */ unset($glo_term); $ilBench->stop("GlossaryExport", "exportGlossaryItem"); } $a_xml_writer->xmlEndTag("Glossary"); }
ilObjGlossary::exportXMLMediaObjects | ( | &$ | a_xml_writer, | |
$ | a_inst, | |||
$ | a_target_dir, | |||
&$ | expLog | |||
) |
export media objects to xml (see ilias_co.dtd)
object | $a_xml_writer ilXmlWriter object that receives the xml data |
Definition at line 518 of file class.ilObjGlossary.php.
Referenced by exportXML().
{ include_once("content/classes/Media/class.ilObjMediaObject.php"); foreach ($this->mob_ids as $mob_id) { $expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id); $media_obj = new ilObjMediaObject($mob_id); $media_obj->exportXML($a_xml_writer, $a_inst); $media_obj->exportFiles($a_target_dir); unset($media_obj); } }
ilObjGlossary::exportXMLMetaData | ( | &$ | a_xml_writer | ) |
export content objects meta data to xml (see ilias_co.dtd)
object | $a_xml_writer ilXmlWriter object that receives the xml data |
Definition at line 504 of file class.ilObjGlossary.php.
References ilObject::getType().
Referenced by exportXML(), and exportXMLGlossaryItems().
{ $nested = new ilNestedSetXML(); $nested->setParameterModifier($this, "modifyExportIdentifier"); $a_xml_writer->appendXML($nested->export($this->getId(), $this->getType())); }
ilObjGlossary::getDescription | ( | ) |
get description of glossary object
Reimplemented from ilObject.
Definition at line 118 of file class.ilObjGlossary.php.
Referenced by create().
{ return parent::getDescription(); }
ilObjGlossary::getExportDirectory | ( | ) |
get export directory of glossary
Definition at line 328 of file class.ilObjGlossary.php.
References ilUtil::getDataDir().
{ $export_dir = ilUtil::getDataDir()."/glo_data"."/glo_".$this->getId()."/export"; return $export_dir; }
ilObjGlossary::getExportFiles | ( | $ | dir | ) |
get export files
Definition at line 338 of file class.ilObjGlossary.php.
References $file.
{ // quit if import dir not available if (!@is_dir($dir) or !is_writeable($dir)) { return array(); } // open directory $dir = dir($dir); // initialize array $file = array(); // get files and save the in the array while ($entry = $dir->read()) { if ($entry != "." and $entry != ".." and substr($entry, -4) == ".zip" and ereg("^[0-9]{10}_{2}[0-9]+_{2}(glo_)*[0-9]+\.zip\$", $entry)) { $file[] = $entry; } } // close import directory $dir->close(); // sort files sort ($file); reset ($file); return $file; }
ilObjGlossary::getImportDirectory | ( | ) |
get import directory of glossary
Definition at line 288 of file class.ilObjGlossary.php.
References ilUtil::getDataDir().
{ $export_dir = ilUtil::getDataDir()."/glo_data"."/glo_".$this->getId()."/import"; return $export_dir; }
ilObjGlossary::getImportId | ( | ) |
get import id
public
Reimplemented from ilObject.
Definition at line 232 of file class.ilObjGlossary.php.
References initMeta().
{ $this->initMeta(); return $this->meta_data->getImportIdentifierEntryID(); }
& ilObjGlossary::getMetaData | ( | ) |
get meta data object of glossary object
Definition at line 190 of file class.ilObjGlossary.php.
References initMeta().
{ $this->initMeta(); return $this->meta_data; }
ilObjGlossary::getOnline | ( | ) |
Definition at line 156 of file class.ilObjGlossary.php.
Referenced by update().
{
return $this->online;
}
ilObjGlossary::getTermList | ( | $ | searchterm = "" |
) |
get term list
Definition at line 248 of file class.ilObjGlossary.php.
References $list, and ilObject::getId().
Referenced by delete(), exportXML(), and exportXMLGlossaryItems().
{ $list = ilGlossaryTerm::getTermList($this->getId(),$searchterm); return $list; }
ilObjGlossary::getTitle | ( | ) |
get title of glossary object
Reimplemented from ilObject.
Definition at line 137 of file class.ilObjGlossary.php.
Referenced by create().
{ return parent::getTitle(); }
ilObjGlossary::getXMLZip | ( | ) |
Reimplemented from ilObject.
Definition at line 688 of file class.ilObjGlossary.php.
{ include_once("content/classes/class.ilGlossaryExport.php"); $glo_exp = new ilGlossaryExport($this); return $glo_exp->buildExportFile(); }
ilObjGlossary::ilClone | ( | $ | a_parent_ref | ) |
copy all properties and subobjects of a glossary
public
Reimplemented from ilObject.
Definition at line 573 of file class.ilObjGlossary.php.
References $rbacadmin.
{ global $rbacadmin; // always call parent ilClone function first!! $new_ref_id = parent::ilClone($a_parent_ref); // todo: put here glossary specific stuff // ... and finally always return new reference ID!! return $new_ref_id; }
ilObjGlossary::ilObjGlossary | ( | $ | a_id = 0 , |
|
$ | a_call_by_reference = true | |||
) |
Constructor public.
Definition at line 43 of file class.ilObjGlossary.php.
References ilObject::ilObject(), and initMeta().
{ $this->type = "glo"; $this->ilObject($a_id,$a_call_by_reference); if ($a_id == 0) { $this->initMeta(); } }
ilObjGlossary::initMeta | ( | ) |
init meta data object if needed
Definition at line 57 of file class.ilObjGlossary.php.
References assignMetaData(), ilObject::getId(), and ilObject::getType().
Referenced by create(), getImportId(), getMetaData(), ilObjGlossary(), setImportId(), and updateMetaData().
{ if (!is_object($this->meta_data)) { if ($this->getId()) { $new_meta =& new ilMetaData($this->getType(), $this->getId()); } else { $new_meta =& new ilMetaData(); } $this->assignMetaData($new_meta); } }
ilObjGlossary::modifyExportIdentifier | ( | $ | a_tag, | |
$ | a_param, | |||
$ | a_value | |||
) |
Definition at line 554 of file class.ilObjGlossary.php.
References ilObject::getId().
{ if ($a_tag == "Identifier" && $a_param == "Entry") { $a_value = "il_".IL_INST_ID."_glo_".$this->getId(); } return $a_value; }
ilObjGlossary::notify | ( | $ | a_event, | |
$ | a_ref_id, | |||
$ | a_parent_non_rbac_id, | |||
$ | a_node_id, | |||
$ | a_params = 0 | |||
) |
notifys an object about an event occured Based on the event happend, each object may decide how it reacts.
public
string | event | |
integer | reference id of object where the event occured | |
array | passes optional paramters if required |
Reimplemented from ilObject.
Definition at line 634 of file class.ilObjGlossary.php.
References $_GET, $tree, and ilObject::getType().
{ global $tree; switch ($a_event) { case "link": //var_dump("<pre>",$a_params,"</pre>"); //echo "Glossary ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id; //exit; break; case "cut": //echo "Glossary ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id; //exit; break; case "copy": //var_dump("<pre>",$a_params,"</pre>"); //echo "Glossary ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id; //exit; break; case "paste": //echo "Glossary ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id; //exit; break; case "new": //echo "Glossary ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id; //exit; break; } // At the beginning of the recursive process it avoids second call of the notify function with the same parameter if ($a_node_id==$_GET["ref_id"]) { $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id); $parent_type = $parent_obj->getType(); if($parent_type == $this->getType()) { $a_node_id = (int) $tree->getParentId($a_node_id); } } parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params); }
ilObjGlossary::read | ( | ) |
read data of content object
Definition at line 101 of file class.ilObjGlossary.php.
References $gl_set, $q, setOnline(), and ilUtil::yn2tf().
{ parent::read(); # echo "Glossary<br>\n"; $q = "SELECT * FROM glossary WHERE id = '".$this->getId()."'"; $gl_set = $this->ilias->db->query($q); $gl_rec = $gl_set->fetchRow(DB_FETCHMODE_ASSOC); $this->setOnline(ilUtil::yn2tf($gl_rec["online"])); }
ilObjGlossary::setDescription | ( | $ | a_description | ) |
set description of glossary object
Reimplemented from ilObject.
Definition at line 126 of file class.ilObjGlossary.php.
Referenced by updateMetaData().
{ parent::setDescription($a_description); $this->meta_data->setDescription($a_description); }
ilObjGlossary::setImportId | ( | $ | a_import_id | ) |
set import id
public
string | $a_import_id import id |
Reimplemented from ilObject.
Definition at line 238 of file class.ilObjGlossary.php.
References initMeta().
{ $this->initMeta(); $this->meta_data->setImportIdentifierEntryID($a_id); }
ilObjGlossary::setOnline | ( | $ | a_online | ) |
Definition at line 151 of file class.ilObjGlossary.php.
Referenced by read().
{ $this->online = $a_online; }
ilObjGlossary::setTitle | ( | $ | a_title | ) |
set title of glossary object
Reimplemented from ilObject.
Definition at line 145 of file class.ilObjGlossary.php.
Referenced by updateMetaData().
{ parent::setTitle($a_title); $this->meta_data->setTitle($a_title); }
ilObjGlossary::update | ( | ) |
update complete object
Reimplemented from ilObject.
Definition at line 221 of file class.ilObjGlossary.php.
References $q, getOnline(), and updateMetaData().
Referenced by updateMetaData().
{ $this->updateMetaData(); $q = "UPDATE glossary SET ". " online = '".ilUtil::tf2yn($this->getOnline())."'". " WHERE id = '".$this->getId()."'"; $this->ilias->db->query($q); }
ilObjGlossary::updateMetaData | ( | ) |
update meta data only
Definition at line 199 of file class.ilObjGlossary.php.
References initMeta(), setDescription(), setTitle(), and update().
Referenced by update().
{ $this->initMeta(); $this->meta_data->update(); if ($this->meta_data->section != "General") { $meta = $this->meta_data->getElement("Title", "General"); $this->meta_data->setTitle($meta[0]["value"]); $meta = $this->meta_data->getElement("Description", "General"); $this->meta_data->setDescription($meta[0]["value"]); } else { $this->setTitle($this->meta_data->getTitle()); $this->setDescription($this->meta_data->getDescription()); } parent::update(); }