ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilObjGlossary Class Reference

Class ilObjGlossary. More...

+ Inheritance diagram for ilObjGlossary:
+ Collaboration diagram for ilObjGlossary:

Public Member Functions

 __construct ($a_id=0, $a_call_by_reference=true)
 Constructor public. More...
 
 create ($a_upload=false)
 create glossary object More...
 
 read ()
 read data of content object More...
 
 getDescription ()
 get description of glossary object More...
 
 setDescription ($a_description)
 set description of glossary object More...
 
 setVirtualMode ($a_mode)
 set glossary type (virtual: fixed/level/subtree, normal:none) More...
 
 getVirtualMode ()
 get glossary type (normal or virtual) More...
 
 isVirtual ()
 returns true if glossary type is virtual (any mode) More...
 
 getTitle ()
 get title of glossary object More...
 
 setTitle ($a_title)
 set title of glossary object More...
 
 setPresentationMode ($a_val)
 Set presentation mode. More...
 
 getPresentationMode ()
 Get presentation mode. More...
 
 setSnippetLength ($a_val)
 Set snippet length. More...
 
 getSnippetLength ()
 Get snippet length. More...
 
 setOnline ($a_online)
 
 getOnline ()
 
 setActiveGlossaryMenu ($a_act_glo_menu)
 
 isActiveGlossaryMenu ()
 
 setActiveDownloads ($a_down)
 
 isActiveDownloads ()
 
 getStyleSheetId ()
 Get ID of assigned style sheet object. More...
 
 setStyleSheetId ($a_style_id)
 Set ID of assigned style sheet object. More...
 
 setShowTaxonomy ($a_val)
 Set show taxonomy. More...
 
 getShowTaxonomy ()
 Get show taxonomy. More...
 
 setAutoGlossaries ($a_val)
 Set auto glossaries. More...
 
 addAutoGlossary ($glo_id)
 Add auto glossary. More...
 
 getAutoGlossaries ()
 Get auto glossaries. More...
 
 removeAutoGlossary ($a_glo_id)
 Remove auto glossary. More...
 
 update ()
 Update object. More...
 
 updateAutoGlossaries ()
 Update auto glossaries. More...
 
 getTermList ( $searchterm="", $a_letter="", $a_def="", $a_tax_node=0, $a_include_offline_childs=false, $a_add_amet_fields=false, array $a_amet_filter=null, $a_omit_virtual=false, $a_include_references=false)
 Get term list. More...
 
 getFirstLetters ($a_tax_node=0)
 Get term list. More...
 
 getAllGlossaryIds ($a_include_offline_childs=false, $ids_are_ref_ids=false)
 Get all glossary ids. More...
 
 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) More...
 
 getImportDirectory ()
 get import directory of glossary More...
 
 createExportDirectory ($a_type="xml")
 Creates export directory. More...
 
 getExportDirectory ($a_type="xml")
 Get export directory of glossary. More...
 
 getExportFiles ()
 Get export files. More...
 
 setPublicExportFile ($a_type, $a_file)
 specify public export file for type More...
 
 getPublicExportFile ($a_type)
 get public export file More...
 
 exportXML (&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
 export object to xml (see ilias_co.dtd) More...
 
 exportXMLGlossaryItems (&$a_xml_writer, $a_inst, &$expLog)
 export page objects to xml (see ilias_co.dtd) More...
 
 exportXMLMetaData (&$a_xml_writer)
 export content objects meta data to xml (see ilias_co.dtd) More...
 
 exportXMLMediaObjects (&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
 export media objects to xml (see ilias_co.dtd) More...
 
 exportFileItems ($a_target_dir, &$expLog)
 export files of file itmes More...
 
 modifyExportIdentifier ($a_tag, $a_param, $a_value)
 
 delete ()
 delete glossary and all related data More...
 
 getXMLZip ()
 Get zipped xml file for glossary. More...
 
 getTaxonomyId ()
 Get taxonomy. More...
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone glossary. More...
 
 removeOfflineGlossaries ($a_glo_ids, $ids_are_ref_ids=false)
 Remove offline glossaries from obj id array. More...
 
 autoLinkGlossaryTerms ($a_glo_ref_id)
 Auto link glossary terms. More...
 
 supportsLongTextQuery ()
 Is long text search supported. More...
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 setOfflineStatus ($a_status)
 Set offline status. More...
 
 getOfflineStatus ()
 Get offline status. More...
 
 supportsOfflineHandling ()
 Check whether object supports offline handling. More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _lookupOnline ($a_id)
 check wether content object is online More...
 
static lookupSnippetLength ($a_id)
 Lookup snippet length. More...
 
static lookupAutoGlossaries ($a_id)
 Lookup auto glossaries. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getAdvMDSubItemTitle ($a_obj_id, $a_sub_type, $a_sub_id)
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static lookupOfflineStatus ($a_obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id, $a_deleted_by)
 
static setDeletedDates ($a_ref_ids, $a_user_id)
 Set deleted date. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Data Fields

 $auto_glossaries = array()
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 

Static Protected Member Functions

static lookup ($a_id, $a_property)
 Lookup glossary property. More...
 

Protected Attributes

 $tpl
 
 $db
 
 $user
 
- Protected Attributes inherited from ilObject
 $objDefinition
 
 $db
 
 $log
 
 $error
 
 $tree
 
 $app_event_handler
 
 $rbacadmin
 
 $rbacreview
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjGlossary::__construct (   $a_id = 0,
  $a_call_by_reference = true 
)

Constructor public.

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and user().

38  {
39  global $DIC;
40  $this->error = $DIC["ilErr"];
41  $this->tpl = $DIC["tpl"];
42 
43  $this->db = $DIC->database();
44  $this->user = $DIC->user();
45  $this->type = "glo";
46  parent::__construct($a_id, $a_call_by_reference);
47  }
user()
Definition: user.php:4
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ _lookupOnline()

static ilObjGlossary::_lookupOnline (   $a_id)
static

check wether content object is online

Definition at line 247 of file class.ilObjGlossary.php.

References $db, $DIC, $lm_set, and ilUtil\yn2tf().

Referenced by ilRepositoryExplorer\isClickable(), and ilRepositoryExplorerGUI\isNodeClickable().

248  {
249  global $DIC;
250 
251  $db = $DIC->database();
252 
253  $q = "SELECT is_online FROM glossary WHERE id = " .
254  $db->quote($a_id, "integer");
255  $lm_set = $db->query($q);
256  $lm_rec = $db->fetchAssoc($lm_set);
257 
258  return ilUtil::yn2tf($lm_rec["is_online"]);
259  }
$lm_set
$DIC
Definition: xapitoken.php:46
static yn2tf($a_yn)
convert "y"/"n" to true/false
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addAutoGlossary()

ilObjGlossary::addAutoGlossary (   $glo_id)

Add auto glossary.

Parameters
int$glo_id

Definition at line 368 of file class.ilObjGlossary.php.

References ilObject\_lookupType().

Referenced by setAutoGlossaries().

369  {
370  $glo_id = (int) $glo_id;
371  if ($glo_id > 0 && ilObject::_lookupType($glo_id) == "glo" &&
372  !in_array($glo_id, $this->auto_glossaries)) {
373  $this->auto_glossaries[] = $glo_id;
374  }
375  }
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ autoLinkGlossaryTerms()

ilObjGlossary::autoLinkGlossaryTerms (   $a_glo_ref_id)

Auto link glossary terms.

Parameters

Definition at line 1054 of file class.ilObjGlossary.php.

References Vendor\Package\$c, ilObject\$id, ilPCParagraph\autoLinkGlossariesPage(), ilGlossaryDefinition\getDefinitionList(), ilObject\getRefId(), and ilGlossaryTerm\getTermList().

1055  {
1056  // get terms of target glossary
1057  $terms = ilGlossaryTerm::getTermList($a_glo_ref_id);
1058 
1059  // for each get page: get content
1060  $source_terms = ilGlossaryTerm::getTermList($this->getRefId());
1061  $found_pages = array();
1062  foreach ($source_terms as $source_term) {
1063  $source_defs = ilGlossaryDefinition::getDefinitionList($source_term["id"]);
1064 
1065  for ($j = 0; $j < count($source_defs); $j++) {
1066  $def = $source_defs[$j];
1067  $pg = new ilGlossaryDefPage($def["id"]);
1068 
1069  $c = $pg->getXMLContent();
1070  foreach ($terms as $t) {
1071  if (is_int(stripos($c, $t["term"]))) {
1072  $found_pages[$def["id"]]["terms"][] = $t;
1073  if (!is_object($found_pages[$def["id"]]["page"])) {
1074  $found_pages[$def["id"]]["page"] = $pg;
1075  }
1076  }
1077  }
1078  reset($terms);
1079  }
1080  }
1081 
1082  // ilPCParagraph autoLinkGlossariesPage with page and terms
1083  foreach ($found_pages as $id => $fp) {
1084  ilPCParagraph::autoLinkGlossariesPage($fp["page"], $fp["terms"]);
1085  }
1086  }
static getDefinitionList($a_term_id)
static
static autoLinkGlossariesPage($a_page, $a_terms)
Auto link glossary of whole page.
static getTermList( $a_glo_ref_id, $searchterm="", $a_first_letter="", $a_def="", $a_tax_node=0, $a_add_amet_fields=false, array $a_amet_filter=null, $a_include_references=false)
Get all terms for given set of glossary ids.
Glossary definition page object.
getRefId()
get reference id public
+ Here is the call graph for this function:

◆ cloneObject()

ilObjGlossary::cloneObject (   $a_target_id,
  $a_copy_id = 0,
  $a_omit_tree = false 
)

Clone glossary.

Parameters
inttarget ref_id
intcopy id

Definition at line 923 of file class.ilObjGlossary.php.

References Vendor\Package\$a, ilGlossaryTerm\_copyTerm(), ilCopyWizardOptions\_getInstance(), ilObjStyleSheet\_lookupStandard(), ilObject\cloneMetaData(), ilTaxNodeAssignment\getAssignmentsOfItem(), getAutoGlossaries(), getDescription(), ilObject\getId(), ilObjectFactory\getInstanceByObjId(), getOnline(), getPresentationMode(), ilObject\getRefId(), getSnippetLength(), getStyleSheetId(), getTaxonomyId(), ilGlossaryTerm\getTermList(), getVirtualMode(), and ilObjTaxonomy\saveUsage().

924  {
925  $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
926  $this->cloneMetaData($new_obj);
927 
928  //copy online status if object is not the root copy object
929  $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
930 
931  if (!$cp_options->isRootNode($this->getRefId())) {
932  $new_obj->setOnline($this->getOnline());
933  }
934 
935  // $new_obj->setTitle($this->getTitle());
936  $new_obj->setDescription($this->getDescription());
937  $new_obj->setVirtualMode($this->getVirtualMode());
938  $new_obj->setPresentationMode($this->getPresentationMode());
939  $new_obj->setSnippetLength($this->getSnippetLength());
940  $new_obj->setAutoGlossaries($this->getAutoGlossaries());
941  $new_obj->update();
942 
943  // set/copy stylesheet
944  $style_id = $this->getStyleSheetId();
945  if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id)) {
946  $style_obj = ilObjectFactory::getInstanceByObjId($style_id);
947  $new_id = $style_obj->ilClone();
948  $new_obj->setStyleSheetId($new_id);
949  $new_obj->update();
950  }
951 
952  // copy taxonomy
953  if (($tax_id = $this->getTaxonomyId()) > 0) {
954  // clone it
955  $tax = new ilObjTaxonomy($tax_id);
956  $new_tax = $tax->cloneObject(0, 0, true);
957  $map = $tax->getNodeMapping();
958 
959  // assign new taxonomy to new glossary
960  ilObjTaxonomy::saveUsage($new_tax->getId(), $new_obj->getId());
961  }
962 
963  // assign new tax/new glossary
964  // handle mapping
965 
966  // prepare tax node assignments objects
967  if ($tax_id > 0) {
968  $tax_ass = new ilTaxNodeAssignment("glo", $this->getId(), "term", $tax_id);
969  $new_tax_ass = new ilTaxNodeAssignment("glo", $new_obj->getId(), "term", $new_tax->getId());
970  }
971 
972  // copy terms
973  $term_mappings = array();
974  foreach (ilGlossaryTerm::getTermList($this->getRefId()) as $term) {
975  $new_term_id = ilGlossaryTerm::_copyTerm($term["id"], $new_obj->getId());
976  $term_mappings[$term["id"]] = $new_term_id;
977 
978  // copy tax node assignments
979  if ($tax_id > 0) {
980  $assignmts = $tax_ass->getAssignmentsOfItem($term["id"]);
981  foreach ($assignmts as $a) {
982  if ($map[$a["node_id"]] > 0) {
983  $new_tax_ass->addAssignment($map[$a["node_id"]], $new_term_id);
984  }
985  }
986  }
987  }
988 
989  // add mapping of term_ids to copy wizard options
990  if (!empty($term_mappings)) {
991  $cp_options->appendMapping($this->getRefId() . '_glo_terms', (array) $term_mappings);
992  }
993 
994 
995  return $new_obj;
996  }
getAssignmentsOfItem($a_item_id)
Get assignments for item.
Taxonomy node <-> item assignment.
getDescription()
get description of glossary object
static _lookupStandard($a_id)
Lookup standard flag.
getVirtualMode()
get glossary type (normal or virtual)
static _getInstance($a_copy_id)
Get instance of copy wizard options.
getId()
get object id public
getTaxonomyId()
Get taxonomy.
static getTermList( $a_glo_ref_id, $searchterm="", $a_first_letter="", $a_def="", $a_tax_node=0, $a_add_amet_fields=false, array $a_amet_filter=null, $a_include_references=false)
Get all terms for given set of glossary ids.
cloneMetaData($target_obj)
Copy meta data.
getPresentationMode()
Get presentation mode.
getSnippetLength()
Get snippet length.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
getAutoGlossaries()
Get auto glossaries.
static _copyTerm($a_term_id, $a_glossary_id)
Copy a term to a glossary.
getStyleSheetId()
Get ID of assigned style sheet object.
static saveUsage($a_tax_id, $a_obj_id)
Save Usage.
getRefId()
get reference id public
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
+ Here is the call graph for this function:

◆ create()

ilObjGlossary::create (   $a_upload = false)

create glossary object

Definition at line 52 of file class.ilObjGlossary.php.

References ilObject\createMetaData(), ilObject\getId(), getStyleSheetId(), getVirtualMode(), setPresentationMode(), setSnippetLength(), updateAutoGlossaries(), and ilObjStyleSheet\writeStyleUsage().

53  {
54  parent::create();
55 
56  // meta data will be created by
57  // import parser
58  if (!$a_upload) {
59  $this->createMetaData();
60  }
61  $this->db->insert(
62  'glossary',
63  array(
64  'id' => array('integer', $this->getId()),
65  'is_online' => array('text', 'n'),
66  'virtual' => array('text', $this->getVirtualMode()),
67  'pres_mode' => array('text', 'table'),
68  'snippet_length' => array('integer', 200)
69  )
70  );
71 
72  $this->setPresentationMode("table");
73  $this->setSnippetLength(200);
74 
75  $this->updateAutoGlossaries();
76 
77  if (((int) $this->getStyleSheetId()) > 0) {
79  }
80  }
setPresentationMode($a_val)
Set presentation mode.
createMetaData()
create meta data entry
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
getVirtualMode()
get glossary type (normal or virtual)
getId()
get object id public
updateAutoGlossaries()
Update auto glossaries.
getStyleSheetId()
Get ID of assigned style sheet object.
setSnippetLength($a_val)
Set snippet length.
+ Here is the call graph for this function:

◆ createExportDirectory()

ilObjGlossary::createExportDirectory (   $a_type = "xml")

Creates export directory.

Definition at line 637 of file class.ilObjGlossary.php.

References $a_type, ilExport\_createExportDirectory(), ilObject\getId(), and ilObject\getType().

638  {
639  return ilExport::_createExportDirectory($this->getId(), $a_type, $this->getType());
640  }
static _createExportDirectory($a_obj_id, $a_export_type="xml", $a_obj_type="")
$a_type
Definition: workflow.php:92
getId()
get object id public
getType()
get object type public
+ Here is the call graph for this function:

◆ createImportDirectory()

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 599 of file class.ilObjGlossary.php.

References ilObject\$error, $ilErr, ilUtil\getDataDir(), ilObject\getId(), and ilUtil\makeDir().

600  {
602 
603  $glo_data_dir = ilUtil::getDataDir() . "/glo_data";
604  ilUtil::makeDir($glo_data_dir);
605  if (!is_writable($glo_data_dir)) {
606  $ilErr->raiseError("Glossary Data Directory (" . $glo_data_dir
607  . ") not writeable.", $ilErr->error_obj->FATAL);
608  }
609 
610  // create glossary directory (data_dir/glo_data/glo_<id>)
611  $glo_dir = $glo_data_dir . "/glo_" . $this->getId();
612  ilUtil::makeDir($glo_dir);
613  if (!@is_dir($glo_dir)) {
614  $ilErr->raiseError("Creation of Glossary Directory failed.", $ilErr->FATAL);
615  }
616  // create Import subdirectory (data_dir/glo_data/glo_<id>/import)
617  $import_dir = $glo_dir . "/import";
618  ilUtil::makeDir($import_dir);
619  if (!@is_dir($import_dir)) {
620  $ilErr->raiseError("Creation of Export Directory failed.", $ilErr->FATAL);
621  }
622  }
$ilErr
Definition: raiseError.php:18
getId()
get object id public
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:

◆ delete()

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

Returns
boolean true if all object data were removed; false if only a references were removed

Definition at line 841 of file class.ilObjGlossary.php.

References ilObject\deleteMetaData(), ilObject\getId(), getTermList(), and isVirtual().

842  {
843  // always call parent delete function first!!
844  if (!parent::delete()) {
845  return false;
846  }
847 
848  // delete terms
849  if (!$this->isVirtual()) {
850  $terms = $this->getTermList();
851  foreach ($terms as $term) {
852  $term_obj = new ilGlossaryTerm($term["id"]);
853  $term_obj->delete();
854  }
855  }
856 
857  // delete term references
858  $refs = new ilGlossaryTermReferences($this->getId());
859  $refs->delete();
860 
861  // delete glossary data entry
862  $q = "DELETE FROM glossary WHERE id = " . $this->db->quote($this->getId());
863  $this->db->query($q);
864 
865  // delete meta data
866  $this->deleteMetaData();
867 
868  return true;
869  }
getTermList( $searchterm="", $a_letter="", $a_def="", $a_tax_node=0, $a_include_offline_childs=false, $a_add_amet_fields=false, array $a_amet_filter=null, $a_omit_virtual=false, $a_include_references=false)
Get term list.
Glossary terms.
getId()
get object id public
deleteMetaData()
delete meta data entry
isVirtual()
returns true if glossary type is virtual (any mode)
+ Here is the call graph for this function:

◆ exportFileItems()

ilObjGlossary::exportFileItems (   $a_target_dir,
$expLog 
)

export files of file itmes

Definition at line 804 of file class.ilObjGlossary.php.

Referenced by exportXML().

805  {
806  foreach ($this->file_ids as $file_id) {
807  $expLog->write(date("[y-m-d H:i:s] ") . "File Item " . $file_id);
808  $file_obj = new ilObjFile($file_id, false);
809  $file_obj->export($a_target_dir);
810  unset($file_obj);
811  }
812  }
+ Here is the caller graph for this function:

◆ exportXML()

ilObjGlossary::exportXML ( $a_xml_writer,
  $a_inst,
  $a_target_dir,
$expLog 
)

export object to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

Definition at line 688 of file class.ilObjGlossary.php.

References ilPCFileList\collectFileItems(), exportFileItems(), exportXMLGlossaryItems(), exportXMLMediaObjects(), exportXMLMetaData(), ilGlossaryDefinition\getDefinitionList(), and getTermList().

689  {
690  // export glossary
691  $attrs = array();
692  $attrs["Type"] = "Glossary";
693  $a_xml_writer->xmlStartTag("ContentObject", $attrs);
694 
695  // MetaData
696  $this->exportXMLMetaData($a_xml_writer);
697 
698  // collect media objects
699  $terms = $this->getTermList();
700  $this->mob_ids = array();
701  $this->file_ids = array();
702  foreach ($terms as $term) {
703  $defs = ilGlossaryDefinition::getDefinitionList($term[id]);
704 
705  foreach ($defs as $def) {
706  $this->page_object = new ilGlossaryDefPage($def["id"]);
707  $this->page_object->buildDom();
708  $this->page_object->insertInstIntoIDs(IL_INST_ID);
709  $mob_ids = $this->page_object->collectMediaObjects(false);
710  $file_ids = ilPCFileList::collectFileItems($this->page_object, $this->page_object->getDomDoc());
711  foreach ($mob_ids as $mob_id) {
712  $this->mob_ids[$mob_id] = $mob_id;
713  }
714  foreach ($file_ids as $file_id) {
715  $this->file_ids[$file_id] = $file_id;
716  }
717  }
718  }
719 
720  // export media objects
721  $expLog->write(date("[y-m-d H:i:s] ") . "Start Export Media Objects");
722  $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
723  $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export Media Objects");
724 
725  // FileItems
726  $expLog->write(date("[y-m-d H:i:s] ") . "Start Export File Items");
727  $this->exportFileItems($a_target_dir, $expLog);
728  $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export File Items");
729 
730  // Glossary
731  $expLog->write(date("[y-m-d H:i:s] ") . "Start Export Glossary Items");
732  $this->exportXMLGlossaryItems($a_xml_writer, $a_inst, $expLog);
733  $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export Glossary Items");
734 
735  $a_xml_writer->xmlEndTag("ContentObject");
736  }
static getDefinitionList($a_term_id)
static
exportXMLGlossaryItems(&$a_xml_writer, $a_inst, &$expLog)
export page objects to xml (see ilias_co.dtd)
getTermList( $searchterm="", $a_letter="", $a_def="", $a_tax_node=0, $a_include_offline_childs=false, $a_add_amet_fields=false, array $a_amet_filter=null, $a_omit_virtual=false, $a_include_references=false)
Get term list.
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)
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
Glossary definition page object.
exportFileItems($a_target_dir, &$expLog)
export files of file itmes
+ Here is the call graph for this function:

◆ exportXMLGlossaryItems()

ilObjGlossary::exportXMLGlossaryItems ( $a_xml_writer,
  $a_inst,
$expLog 
)

export page objects to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

Definition at line 744 of file class.ilObjGlossary.php.

References exportXMLMetaData(), and getTermList().

Referenced by exportXML().

745  {
746  $attrs = array();
747  $a_xml_writer->xmlStartTag("Glossary", $attrs);
748 
749  // MetaData
750  $this->exportXMLMetaData($a_xml_writer);
751 
752  $terms = $this->getTermList();
753 
754  // export glossary terms
755  reset($terms);
756  foreach ($terms as $term) {
757  $expLog->write(date("[y-m-d H:i:s] ") . "Page Object " . $page["obj_id"]);
758 
759  // export xml to writer object
760  $glo_term = new ilGlossaryTerm($term["id"]);
761  $glo_term->exportXML($a_xml_writer, $a_inst);
762 
763  unset($glo_term);
764  }
765 
766  $a_xml_writer->xmlEndTag("Glossary");
767  }
getTermList( $searchterm="", $a_letter="", $a_def="", $a_tax_node=0, $a_include_offline_childs=false, $a_add_amet_fields=false, array $a_amet_filter=null, $a_omit_virtual=false, $a_include_references=false)
Get term list.
Glossary terms.
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportXMLMediaObjects()

ilObjGlossary::exportXMLMediaObjects ( $a_xml_writer,
  $a_inst,
  $a_target_dir,
$expLog 
)

export media objects to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

Definition at line 789 of file class.ilObjGlossary.php.

Referenced by exportXML().

790  {
791  foreach ($this->mob_ids as $mob_id) {
792  $expLog->write(date("[y-m-d H:i:s] ") . "Media Object " . $mob_id);
793  $media_obj = new ilObjMediaObject($mob_id);
794  $media_obj->exportXML($a_xml_writer, $a_inst);
795  $media_obj->exportFiles($a_target_dir);
796  unset($media_obj);
797  }
798  }
Class ilObjMediaObject.
+ Here is the caller graph for this function:

◆ exportXMLMetaData()

ilObjGlossary::exportXMLMetaData ( $a_xml_writer)

export content objects meta data to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

Definition at line 775 of file class.ilObjGlossary.php.

References ilObject\getId(), and ilObject\getType().

Referenced by exportXML(), and exportXMLGlossaryItems().

776  {
777  $md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
778  $md2xml->setExportMode(true);
779  $md2xml->startExport();
780  $a_xml_writer->appendXML($md2xml->getXML());
781  }
getId()
get object id public
getType()
get object type public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdvMDSubItemTitle()

static ilObjGlossary::getAdvMDSubItemTitle (   $a_obj_id,
  $a_sub_type,
  $a_sub_id 
)
static

Implements ilAdvancedMetaDataSubItems.

Definition at line 1035 of file class.ilObjGlossary.php.

References $DIC, ilObject\$lng, and ilGlossaryTerm\_lookGlossaryTerm().

1036  {
1037  global $DIC;
1038 
1039  $lng = $DIC->language();
1040 
1041  if ($a_sub_type == "term") {
1042  $lng->loadLanguageModule("glo");
1043 
1044  return $lng->txt("glo_term") . ' "' . ilGlossaryTerm::_lookGlossaryTerm($a_sub_id) . '"';
1045  }
1046  }
$DIC
Definition: xapitoken.php:46
static _lookGlossaryTerm($term_id)
get glossary term
+ Here is the call graph for this function:

◆ getAllGlossaryIds()

ilObjGlossary::getAllGlossaryIds (   $a_include_offline_childs = false,
  $ids_are_ref_ids = false 
)

Get all glossary ids.

Parameters

Definition at line 531 of file class.ilObjGlossary.php.

References $DIC, ilObject\$tree, ilObject\getId(), ilObject\getRefId(), getVirtualMode(), isVirtual(), and removeOfflineGlossaries().

Referenced by getFirstLetters(), and getTermList().

532  {
533  global $DIC;
534 
535  $tree = $DIC->repositoryTree();
536 
537  if ($this->isVirtual()) {
538  $glo_ids = array();
539 
540  $virtual_mode = $this->getRefId() ? $this->getVirtualMode() : '';
541  switch ($virtual_mode) {
542  case "level":
543  $glo_arr = $tree->getChildsByType($tree->getParentId($this->getRefId()), "glo");
544  foreach ($glo_arr as $glo) {
545  {
546  if ($ids_are_ref_ids) {
547  $glo_ids[] = $glo['child'];
548  } else {
549  $glo_ids[] = $glo['obj_id'];
550  }
551  }
552  }
553  break;
554 
555  case "subtree":
556  $subtree_nodes = $tree->getSubTree($tree->getNodeData($tree->getParentId($this->getRefId())));
557 
558  foreach ($subtree_nodes as $node) {
559  if ($node['type'] == 'glo') {
560  if ($ids_are_ref_ids) {
561  $glo_ids[] = $node['child'];
562  } else {
563  $glo_ids[] = $node['obj_id'];
564  }
565  }
566  }
567  break;
568  }
569  if (!$a_include_offline_childs) {
570  $glo_ids = ilObjGlossary::removeOfflineGlossaries($glo_ids, $ids_are_ref_ids);
571  }
572  // always show entries of current glossary (if no permission is given, user will not come to the presentation screen)
573  // see bug #14477
574  if ($ids_are_ref_ids) {
575  if (!in_array($this->getRefId(), $glo_ids)) {
576  $glo_ids[] = $this->getRefId();
577  }
578  } else {
579  if (!in_array($this->getId(), $glo_ids)) {
580  $glo_ids[] = $this->getId();
581  }
582  }
583  } else {
584  if ($ids_are_ref_ids) {
585  $glo_ids = $this->getRefId();
586  } else {
587  $glo_ids = $this->getId();
588  }
589  }
590 
591  return $glo_ids;
592  }
getVirtualMode()
get glossary type (normal or virtual)
getId()
get object id public
removeOfflineGlossaries($a_glo_ids, $ids_are_ref_ids=false)
Remove offline glossaries from obj id array.
$DIC
Definition: xapitoken.php:46
getRefId()
get reference id public
isVirtual()
returns true if glossary type is virtual (any mode)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAutoGlossaries()

ilObjGlossary::getAutoGlossaries ( )

Get auto glossaries.

Returns
array int

Definition at line 382 of file class.ilObjGlossary.php.

References $auto_glossaries.

Referenced by ilGlossaryAutoLinkTableGUI\__construct(), cloneObject(), removeAutoGlossary(), and updateAutoGlossaries().

383  {
384  return $this->auto_glossaries;
385  }
+ Here is the caller graph for this function:

◆ getDeletionDependencies()

static ilObjGlossary::getDeletionDependencies (   $a_obj_id)
static

Get deletion dependencies.

Definition at line 884 of file class.ilObjGlossary.php.

References $DIC, ilObject\$lng, and ilObjSAHSLearningModule\getScormModulesForGlossary().

885  {
886  global $DIC;
887 
888  $lng = $DIC->language();
889 
890  $dep = array();
892  foreach ($sms as $sm) {
893  $lng->loadLanguageModule("content");
894  $dep[$sm] = $lng->txt("glo_used_in_scorm");
895  }
896  //echo "-".$a_obj_id."-";
897  //var_dump($dep);
898  return $dep;
899  }
static getScormModulesForGlossary($a_glo_id)
Get SCORM modules that assign a certain glossary.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ getDescription()

ilObjGlossary::getDescription ( )

get description of glossary object

Returns
string description

Definition at line 123 of file class.ilObjGlossary.php.

Referenced by cloneObject().

124  {
125  return parent::getDescription();
126  }
+ Here is the caller graph for this function:

◆ getExportDirectory()

ilObjGlossary::getExportDirectory (   $a_type = "xml")

Get export directory of glossary.

Definition at line 645 of file class.ilObjGlossary.php.

References $a_type, ilExport\_getExportDirectory(), ilObject\getId(), and ilObject\getType().

646  {
647  return ilExport::_getExportDirectory($this->getId(), $a_type, $this->getType());
648  }
$a_type
Definition: workflow.php:92
getId()
get object id public
getType()
get object type public
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
+ Here is the call graph for this function:

◆ getExportFiles()

ilObjGlossary::getExportFiles ( )

Get export files.

Definition at line 653 of file class.ilObjGlossary.php.

References ilExport\_getExportFiles(), ilObject\getId(), and ilObject\getType().

654  {
655  return ilExport::_getExportFiles($this->getId(), array("xml", "html"), $this->getType());
656  }
static _getExportFiles($a_obj_id, $a_export_types="", $a_obj_type="")
Get Export Files for a repository object.
getId()
get object id public
getType()
get object type public
+ Here is the call graph for this function:

◆ getFirstLetters()

ilObjGlossary::getFirstLetters (   $a_tax_node = 0)

Get term list.

Definition at line 518 of file class.ilObjGlossary.php.

References getAllGlossaryIds(), and ilGlossaryTerm\getFirstLetters().

519  {
520  $glo_ids = $this->getAllGlossaryIds();
521  $first_letters = ilGlossaryTerm::getFirstLetters($glo_ids, $a_tax_node);
522  return $first_letters;
523  }
getAllGlossaryIds($a_include_offline_childs=false, $ids_are_ref_ids=false)
Get all glossary ids.
static getFirstLetters($a_glo_id, $a_tax_node=0)
Get all terms for given set of glossary ids.
+ Here is the call graph for this function:

◆ getImportDirectory()

ilObjGlossary::getImportDirectory ( )

get import directory of glossary

Definition at line 627 of file class.ilObjGlossary.php.

References ilUtil\getDataDir(), and ilObject\getId().

628  {
629  $export_dir = ilUtil::getDataDir() . "/glo_data" . "/glo_" . $this->getId() . "/import";
630 
631  return $export_dir;
632  }
getId()
get object id public
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:

◆ getOnline()

ilObjGlossary::getOnline ( )

Definition at line 239 of file class.ilObjGlossary.php.

Referenced by cloneObject(), and update().

240  {
241  return $this->online;
242  }
+ Here is the caller graph for this function:

◆ getPresentationMode()

ilObjGlossary::getPresentationMode ( )

Get presentation mode.

Returns
string presentation mode

Definition at line 207 of file class.ilObjGlossary.php.

Referenced by cloneObject(), and update().

208  {
209  return $this->pres_mode;
210  }
+ Here is the caller graph for this function:

◆ getPublicExportFile()

ilObjGlossary::getPublicExportFile (   $a_type)

get public export file

Parameters
string$a_typetype ("xml" / "html")
Returns
string $a_file file name

Definition at line 676 of file class.ilObjGlossary.php.

References $a_type.

Referenced by update().

677  {
678  return $this->public_export_file[$a_type];
679  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ getShowTaxonomy()

ilObjGlossary::getShowTaxonomy ( )

Get show taxonomy.

Returns
bool show taxonomy

Definition at line 344 of file class.ilObjGlossary.php.

Referenced by update().

345  {
346  return $this->show_tax;
347  }
+ Here is the caller graph for this function:

◆ getSnippetLength()

ilObjGlossary::getSnippetLength ( )

Get snippet length.

Returns
int snippet length

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

Referenced by cloneObject(), and update().

228  {
229  return ($this->snippet_length > 0)
230  ? $this->snippet_length
231  : null;
232  }
+ Here is the caller graph for this function:

◆ getStyleSheetId()

ilObjGlossary::getStyleSheetId ( )

Get ID of assigned style sheet object.

Definition at line 315 of file class.ilObjGlossary.php.

Referenced by cloneObject(), create(), and update().

316  {
317  return $this->style_id;
318  }
+ Here is the caller graph for this function:

◆ getTaxonomyId()

ilObjGlossary::getTaxonomyId ( )

Get taxonomy.

Returns
int taxononmy ID

Definition at line 906 of file class.ilObjGlossary.php.

References ilObject\getId(), and ilObjTaxonomy\getUsageOfObject().

Referenced by cloneObject().

907  {
908  $tax_ids = ilObjTaxonomy::getUsageOfObject($this->getId());
909  if (count($tax_ids) > 0) {
910  // glossaries handle max. one taxonomy
911  return $tax_ids[0];
912  }
913  return 0;
914  }
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTermList()

ilObjGlossary::getTermList (   $searchterm = "",
  $a_letter = "",
  $a_def = "",
  $a_tax_node = 0,
  $a_include_offline_childs = false,
  $a_add_amet_fields = false,
array  $a_amet_filter = null,
  $a_omit_virtual = false,
  $a_include_references = false 
)

Get term list.

Definition at line 486 of file class.ilObjGlossary.php.

References getAllGlossaryIds(), ilObject\getRefId(), and ilGlossaryTerm\getTermList().

Referenced by delete(), exportXML(), and exportXMLGlossaryItems().

496  {
497  if ($a_omit_virtual) {
498  $glo_ref_ids[] = $this->getRefId();
499  } else {
500  $glo_ref_ids = $this->getAllGlossaryIds($a_include_offline_childs, true);
501  }
503  $glo_ref_ids,
504  $searchterm,
505  $a_letter,
506  $a_def,
507  $a_tax_node,
508  $a_add_amet_fields,
509  $a_amet_filter,
510  $a_include_references
511  );
512  return $list;
513  }
getAllGlossaryIds($a_include_offline_childs=false, $ids_are_ref_ids=false)
Get all glossary ids.
static getTermList( $a_glo_ref_id, $searchterm="", $a_first_letter="", $a_def="", $a_tax_node=0, $a_add_amet_fields=false, array $a_amet_filter=null, $a_include_references=false)
Get all terms for given set of glossary ids.
getRefId()
get reference id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ilObjGlossary::getTitle ( )

get title of glossary object

Returns
string title

Definition at line 178 of file class.ilObjGlossary.php.

179  {
180  return parent::getTitle();
181  }

◆ getVirtualMode()

ilObjGlossary::getVirtualMode ( )

get glossary type (normal or virtual)

Definition at line 160 of file class.ilObjGlossary.php.

Referenced by cloneObject(), create(), getAllGlossaryIds(), and update().

161  {
162  return $this->virtual_mode;
163  }
+ Here is the caller graph for this function:

◆ getXMLZip()

ilObjGlossary::getXMLZip ( )

Get zipped xml file for glossary.

Definition at line 874 of file class.ilObjGlossary.php.

875  {
876  $glo_exp = new ilGlossaryExport($this);
877  return $glo_exp->buildExportFile();
878  }
Export class for content objects.

◆ isActiveDownloads()

ilObjGlossary::isActiveDownloads ( )

Definition at line 307 of file class.ilObjGlossary.php.

Referenced by update().

308  {
309  return $this->downloads_active;
310  }
+ Here is the caller graph for this function:

◆ isActiveGlossaryMenu()

ilObjGlossary::isActiveGlossaryMenu ( )

Definition at line 297 of file class.ilObjGlossary.php.

Referenced by update().

298  {
299  return $this->glo_menu_active;
300  }
+ Here is the caller graph for this function:

◆ isVirtual()

ilObjGlossary::isVirtual ( )

returns true if glossary type is virtual (any mode)

Definition at line 168 of file class.ilObjGlossary.php.

Referenced by delete(), and getAllGlossaryIds().

169  {
170  return $this->virtual;
171  }
+ Here is the caller graph for this function:

◆ lookup()

static ilObjGlossary::lookup (   $a_id,
  $a_property 
)
staticprotected

Lookup glossary property.

Parameters
intglossary id
stringproperty

Definition at line 267 of file class.ilObjGlossary.php.

References $db, and $DIC.

Referenced by lookupSnippetLength().

268  {
269  global $DIC;
270 
271  $db = $DIC->database();
272 
273  $set = $db->query("SELECT $a_property FROM glossary WHERE id = " .
274  $db->quote($a_id, "integer"));
275  $rec = $db->fetchAssoc($set);
276 
277  return $rec[$a_property];
278  }
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ lookupAutoGlossaries()

static ilObjGlossary::lookupAutoGlossaries (   $a_id)
static

Lookup auto glossaries.

Parameters

Definition at line 465 of file class.ilObjGlossary.php.

References $db, and $DIC.

Referenced by ilGlossaryDefPage\beforePageContentUpdate().

466  {
467  global $DIC;
468 
469  $db = $DIC->database();
470 
471  // read auto glossaries
472  $set = $db->query(
473  "SELECT * FROM glo_glossaries " .
474  " WHERE id = " . $db->quote($a_id, "integer")
475  );
476  $glos = array();
477  while ($rec = $db->fetchAssoc($set)) {
478  $glos[] = $rec["glo_id"];
479  }
480  return $glos;
481  }
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ lookupSnippetLength()

static ilObjGlossary::lookupSnippetLength (   $a_id)
static

Lookup snippet length.

Parameters
intglossary id
Returns
int snippet length

Definition at line 286 of file class.ilObjGlossary.php.

References lookup().

Referenced by ilGlossaryDefinition\shortenShortText().

287  {
288  return ilObjGlossary::lookup($a_id, "snippet_length");
289  }
static lookup($a_id, $a_property)
Lookup glossary property.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modifyExportIdentifier()

ilObjGlossary::modifyExportIdentifier (   $a_tag,
  $a_param,
  $a_value 
)

Definition at line 819 of file class.ilObjGlossary.php.

References ilObject\getId().

820  {
821  if ($a_tag == "Identifier" && $a_param == "Entry") {
822  $a_value = "il_" . IL_INST_ID . "_glo_" . $this->getId();
823  }
824 
825  return $a_value;
826  }
getId()
get object id public
+ Here is the call graph for this function:

◆ read()

ilObjGlossary::read ( )

read data of content object

Definition at line 85 of file class.ilObjGlossary.php.

References ilObject\getId(), ilObjStyleSheet\lookupObjectStyle(), setActiveDownloads(), setActiveGlossaryMenu(), setAutoGlossaries(), setOnline(), setPresentationMode(), setPublicExportFile(), setShowTaxonomy(), setSnippetLength(), setStyleSheetId(), setVirtualMode(), and ilUtil\yn2tf().

86  {
87  parent::read();
88  # echo "Glossary<br>\n";
89 
90  $q = "SELECT * FROM glossary WHERE id = " .
91  $this->db->quote($this->getId(), "integer");
92  $gl_set = $this->db->query($q);
93  $gl_rec = $this->db->fetchAssoc($gl_set);
94  $this->setOnline(ilUtil::yn2tf($gl_rec["is_online"]));
95  $this->setVirtualMode($gl_rec["virtual"]);
96  $this->setPublicExportFile("xml", $gl_rec["public_xml_file"]);
97  $this->setPublicExportFile("html", $gl_rec["public_html_file"]);
98  $this->setActiveGlossaryMenu(ilUtil::yn2tf($gl_rec["glo_menu_active"]));
99  $this->setActiveDownloads(ilUtil::yn2tf($gl_rec["downloads_active"]));
100  $this->setPresentationMode($gl_rec["pres_mode"]);
101  $this->setSnippetLength($gl_rec["snippet_length"]);
102  $this->setShowTaxonomy($gl_rec["show_tax"]);
103 
105 
106  // read auto glossaries
107  $set = $this->db->query(
108  "SELECT * FROM glo_glossaries " .
109  " WHERE id = " . $this->db->quote($this->getId(), "integer")
110  );
111  $glos = array();
112  while ($rec = $this->db->fetchAssoc($set)) {
113  $glos[] = $rec["glo_id"];
114  }
115  $this->setAutoGlossaries($glos);
116  }
setStyleSheetId($a_style_id)
Set ID of assigned style sheet object.
setAutoGlossaries($a_val)
Set auto glossaries.
setShowTaxonomy($a_val)
Set show taxonomy.
setPresentationMode($a_val)
Set presentation mode.
setPublicExportFile($a_type, $a_file)
specify public export file for type
static lookupObjectStyle($a_obj_id)
Lookup object style.
setActiveGlossaryMenu($a_act_glo_menu)
setVirtualMode($a_mode)
set glossary type (virtual: fixed/level/subtree, normal:none)
getId()
get object id public
static yn2tf($a_yn)
convert "y"/"n" to true/false
setSnippetLength($a_val)
Set snippet length.
+ Here is the call graph for this function:

◆ removeAutoGlossary()

ilObjGlossary::removeAutoGlossary (   $a_glo_id)

Remove auto glossary.

Parameters

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

References getAutoGlossaries(), and setAutoGlossaries().

394  {
395  $glo_ids = array();
396  foreach ($this->getAutoGlossaries() as $g) {
397  if ($g != $a_glo_id) {
398  $glo_ids[] = $g;
399  }
400  }
401  $this->setAutoGlossaries($glo_ids);
402  }
setAutoGlossaries($a_val)
Set auto glossaries.
getAutoGlossaries()
Get auto glossaries.
+ Here is the call graph for this function:

◆ removeOfflineGlossaries()

ilObjGlossary::removeOfflineGlossaries (   $a_glo_ids,
  $ids_are_ref_ids = false 
)

Remove offline glossaries from obj id array.

Parameters

Definition at line 1004 of file class.ilObjGlossary.php.

References ilObject\$id, ilObject\$ref_id, and ilObject\_lookupObjectId().

Referenced by getAllGlossaryIds().

1005  {
1006  $glo_ids = $a_glo_ids;
1007  if ($ids_are_ref_ids) {
1008  $glo_ids = array_map(function ($id) {
1010  }, $a_glo_ids);
1011  }
1012 
1013  $set = $this->db->query(
1014  "SELECT id FROM glossary " .
1015  " WHERE " . $this->db->in("id", $glo_ids, false, "integer") .
1016  " AND is_online = " . $this->db->quote("y", "text")
1017  );
1018  $online_glo_ids = array();
1019  while ($rec = $this->db->fetchAssoc($set)) {
1020  $online_glo_ids[] = $rec["id"];
1021  }
1022 
1023  if (!$ids_are_ref_ids) {
1024  return $online_glo_ids;
1025  }
1026 
1027  $online_ref_ids = array_filter($a_glo_ids, function ($ref_id) use ($online_glo_ids) {
1028  return in_array(ilObject::_lookupObjectId($ref_id), $online_glo_ids);
1029  });
1030 
1031 
1032  return $online_ref_ids;
1033  }
static _lookupObjectId($a_ref_id)
lookup object id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setActiveDownloads()

ilObjGlossary::setActiveDownloads (   $a_down)

Definition at line 302 of file class.ilObjGlossary.php.

Referenced by read().

303  {
304  $this->downloads_active = $a_down;
305  }
+ Here is the caller graph for this function:

◆ setActiveGlossaryMenu()

ilObjGlossary::setActiveGlossaryMenu (   $a_act_glo_menu)

Definition at line 292 of file class.ilObjGlossary.php.

Referenced by read().

293  {
294  $this->glo_menu_active = $a_act_glo_menu;
295  }
+ Here is the caller graph for this function:

◆ setAutoGlossaries()

ilObjGlossary::setAutoGlossaries (   $a_val)

Set auto glossaries.

Parameters
array$a_valint

Definition at line 354 of file class.ilObjGlossary.php.

References addAutoGlossary().

Referenced by read(), and removeAutoGlossary().

355  {
356  $this->auto_glossaries = array();
357  if (is_array($a_val)) {
358  foreach ($a_val as $v) {
359  $this->addAutoGlossary($v);
360  }
361  }
362  }
addAutoGlossary($glo_id)
Add auto glossary.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDescription()

ilObjGlossary::setDescription (   $a_description)

set description of glossary object

Definition at line 131 of file class.ilObjGlossary.php.

132  {
133  parent::setDescription($a_description);
134  }

◆ setOnline()

ilObjGlossary::setOnline (   $a_online)

Definition at line 234 of file class.ilObjGlossary.php.

Referenced by read().

235  {
236  $this->online = $a_online;
237  }
+ Here is the caller graph for this function:

◆ setPresentationMode()

ilObjGlossary::setPresentationMode (   $a_val)

Set presentation mode.

Parameters
stringpresentation mode

Definition at line 197 of file class.ilObjGlossary.php.

Referenced by create(), and read().

198  {
199  $this->pres_mode = $a_val;
200  }
+ Here is the caller graph for this function:

◆ setPublicExportFile()

ilObjGlossary::setPublicExportFile (   $a_type,
  $a_file 
)

specify public export file for type

Parameters
string$a_typetype ("xml" / "html")
string$a_filefile name

Definition at line 664 of file class.ilObjGlossary.php.

References $a_type.

Referenced by read().

665  {
666  $this->public_export_file[$a_type] = $a_file;
667  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ setShowTaxonomy()

ilObjGlossary::setShowTaxonomy (   $a_val)

Set show taxonomy.

Parameters
bool$a_valshow taxonomy

Definition at line 334 of file class.ilObjGlossary.php.

Referenced by read().

335  {
336  $this->show_tax = $a_val;
337  }
+ Here is the caller graph for this function:

◆ setSnippetLength()

ilObjGlossary::setSnippetLength (   $a_val)

Set snippet length.

Parameters
intsnippet length

Definition at line 217 of file class.ilObjGlossary.php.

Referenced by create(), and read().

218  {
219  $this->snippet_length = $a_val;
220  }
+ Here is the caller graph for this function:

◆ setStyleSheetId()

ilObjGlossary::setStyleSheetId (   $a_style_id)

Set ID of assigned style sheet object.

Definition at line 323 of file class.ilObjGlossary.php.

Referenced by read().

324  {
325  $this->style_id = $a_style_id;
326  }
+ Here is the caller graph for this function:

◆ setTitle()

ilObjGlossary::setTitle (   $a_title)

set title of glossary object

Definition at line 186 of file class.ilObjGlossary.php.

187  {
188  parent::setTitle($a_title);
189  // $this->meta_data->setTitle($a_title);
190  }

◆ setVirtualMode()

ilObjGlossary::setVirtualMode (   $a_mode)

set glossary type (virtual: fixed/level/subtree, normal:none)

Definition at line 140 of file class.ilObjGlossary.php.

Referenced by read().

141  {
142  switch ($a_mode) {
143  case "level":
144  case "subtree":
145  // case "fixed":
146  $this->virtual_mode = $a_mode;
147  $this->virtual = true;
148  break;
149 
150  default:
151  $this->virtual_mode = "none";
152  $this->virtual = false;
153  break;
154  }
155  }
+ Here is the caller graph for this function:

◆ supportsLongTextQuery()

ilObjGlossary::supportsLongTextQuery ( )

Is long text search supported.

Returns
bool

Definition at line 1093 of file class.ilObjGlossary.php.

1094  {
1095  return true;
1096  }

◆ update()

ilObjGlossary::update ( )

Update object.

Definition at line 407 of file class.ilObjGlossary.php.

References ilObject\getId(), getOnline(), getPresentationMode(), getPublicExportFile(), getShowTaxonomy(), getSnippetLength(), getStyleSheetId(), getVirtualMode(), isActiveDownloads(), isActiveGlossaryMenu(), ilUtil\tf2yn(), updateAutoGlossaries(), ilObject\updateMetaData(), and ilObjStyleSheet\writeStyleUsage().

408  {
409  $this->updateMetaData();
410 
411  $this->db->update(
412  'glossary',
413  array(
414  'is_online' => array('text', ilUtil::tf2yn($this->getOnline())),
415  'virtual' => array('text', $this->getVirtualMode()),
416  'public_xml_file' => array('text', $this->getPublicExportFile("xml")),
417  'public_html_file' => array('text', $this->getPublicExportFile("html")),
418  'glo_menu_active' => array('text', ilUtil::tf2yn($this->isActiveGlossaryMenu())),
419  'downloads_active' => array('text', ilUtil::tf2yn($this->isActiveDownloads())),
420  'pres_mode' => array('text', $this->getPresentationMode()),
421  'show_tax' => array('integer', $this->getShowTaxonomy()),
422  'snippet_length' => array('integer', $this->getSnippetLength())
423  ),
424  array(
425  'id' => array('integer', $this->getId())
426  )
427  );
429 
430  $this->updateAutoGlossaries();
431  parent::update();
432  }
static tf2yn($a_tf)
convert true/false to "y"/"n"
updateMetaData()
update meta data entry
getPublicExportFile($a_type)
get public export file
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
getVirtualMode()
get glossary type (normal or virtual)
getId()
get object id public
updateAutoGlossaries()
Update auto glossaries.
getPresentationMode()
Get presentation mode.
getSnippetLength()
Get snippet length.
getShowTaxonomy()
Get show taxonomy.
getStyleSheetId()
Get ID of assigned style sheet object.
+ Here is the call graph for this function:

◆ updateAutoGlossaries()

ilObjGlossary::updateAutoGlossaries ( )

Update auto glossaries.

Parameters

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

References getAutoGlossaries(), and ilObject\getId().

Referenced by create(), and update().

442  {
443  // update auto glossaries
444  $this->db->manipulate(
445  "DELETE FROM glo_glossaries WHERE " .
446  " id = " . $this->db->quote($this->getId(), "integer")
447  );
448  foreach ($this->getAutoGlossaries() as $glo_id) {
449  $this->db->insert(
450  'glo_glossaries',
451  array(
452  'id' => array('integer', $this->getId()),
453  'glo_id' => array('integer', $glo_id)
454  )
455  );
456  }
457  }
getId()
get object id public
getAutoGlossaries()
Get auto glossaries.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $auto_glossaries

ilObjGlossary::$auto_glossaries = array()

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

Referenced by getAutoGlossaries().

◆ $db

ilObjGlossary::$db
protected

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

Referenced by _lookupOnline(), lookup(), and lookupAutoGlossaries().

◆ $tpl

ilObjGlossary::$tpl
protected

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

◆ $user

ilObjGlossary::$user
protected

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


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