ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilGlossaryDefinition Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilGlossaryDefinition:

Public Member Functions

 __construct (int $a_id=0)
 
 read ()
 
 setId (int $a_id)
 
 getId ()
 
 getType ()
 
 setTermId (int $a_term_id)
 
 getTermId ()
 
 setShortText (string $a_text)
 
 getShortText ()
 
 setNr (int $a_nr)
 
 getNr ()
 
 assignPageObject (ilGlossaryDefPage $a_page_object)
 
 getPageObject ()
 
 getTitle ()
 
 setTitle (string $a_title)
 
 getDescription ()
 
 setDescription (string $a_description)
 
 setShortTextDirty (bool $a_val)
 
 getShortTextDirty ()
 
 create (bool $a_upload=false, bool $a_omit_page_creation=false)
 
 delete ()
 
 moveUp ()
 
 moveDown ()
 
 update ()
 
 shortenShortText (string $text)
 Shorten short text. More...
 
 updateShortText ()
 
 exportXML (ilXmlWriter $a_xml_writer, int $a_inst)
 
 exportXMLMetaData (ilXmlWriter $a_xml_writer)
 
 modifyExportIdentifier (string $a_tag, string $a_param, string $a_value)
 
 exportXMLDefinition (ilXmlWriter $a_xml_writer, int $a_inst=0)
 export page objects meta data to xml More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 MDUpdateListener (string $a_element)
 Meta data update listener. More...
 

Static Public Member Functions

static getDefinitionList (int $a_term_id)
 
static _lookupTermId (int $a_def_id)
 Looks up term id for a definition id. More...
 
static setShortTextsDirty (int $a_glo_id)
 Set all short texts of glossary dirty (e.g. More...
 
static setShortTextsDirtyGlobally ()
 Set short texts dirty (for all glossaries) More...
 

Data Fields

ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
int $id = 0
 
int $term_id = 0
 
int $glo_id = 0
 
ilGlossaryDefPage $page_object
 
string $short_text = ""
 
int $nr = 0
 
bool $short_text_dirty = false
 

Protected Attributes

array $files_contained = []
 
array $mobs_contained = []
 
string $description = ""
 
string $title = ""
 
ilDBInterface $db
 
ilObjUser $user
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilGlossaryDefinition::__construct ( int  $a_id = 0)

Definition at line 40 of file class.ilGlossaryDefinition.php.

References $DIC, $lng, $tpl, ILIAS\Repository\lng(), read(), and ILIAS\Repository\user().

42  {
43  global $DIC;
44 
45  $this->db = $DIC->database();
46  $this->user = $DIC->user();
47  $lng = $DIC->language();
48  $tpl = $DIC["tpl"];
49 
50  $this->lng = $lng;
51  $this->tpl = $tpl;
52 
53  $this->id = $a_id;
54  if ($a_id != 0) {
55  $this->read();
56  }
57  }
global $DIC
Definition: feed.php:28
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:

Member Function Documentation

◆ _lookupTermId()

static ilGlossaryDefinition::_lookupTermId ( int  $a_def_id)
static

Looks up term id for a definition id.

Parameters
int$a_def_iddefinition id

Definition at line 549 of file class.ilGlossaryDefinition.php.

References $DIC, and $ilDB.

Referenced by ilObjMediaObjectAccess\checkAccessGlossaryTerm(), ilTermUsagesTableGUI\fillRow(), ilMediaPoolPageUsagesTableGUI\fillRow(), ilMediaObjectUsagesTableGUI\fillRow(), ilObjMediaObject\getParentObjectIdForUsage(), ilLMContentSearch\performSearch(), and ilGlossaryDefPageGUI\postOutputProcessing().

549  : int
550  {
551  global $DIC;
552 
553  $ilDB = $DIC->database();
554 
555  $q = "SELECT * FROM glossary_definition WHERE id = " .
556  $ilDB->quote($a_def_id, "integer");
557  $def_set = $ilDB->query($q);
558  $def_rec = $ilDB->fetchAssoc($def_set);
559 
560  return $def_rec["term_id"];
561  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ assignPageObject()

ilGlossaryDefinition::assignPageObject ( ilGlossaryDefPage  $a_page_object)

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

121  : void
122  {
123  $this->page_object = $a_page_object;
124  }

◆ create()

ilGlossaryDefinition::create ( bool  $a_upload = false,
bool  $a_omit_page_creation = false 
)

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

References $db, $ilDB, createMetaData(), ilDBInterface\fetchAssoc(), getId(), getShortTextDirty(), getTermId(), ILIAS\Repository\int(), ilDBInterface\manipulate(), ilDBInterface\query(), ilDBInterface\quote(), setId(), and setNr().

Referenced by ilQuestionPageParser\buildTag().

163  : void {
164  $ilDB = $this->db;
165 
166  $term = new ilGlossaryTerm($this->getTermId());
167 
168  $this->setId($ilDB->nextId("glossary_definition"));
169 
170  $ilAtomQuery = $ilDB->buildAtomQuery();
171  $ilAtomQuery->addTableLock('glossary_definition');
172 
173  $ilAtomQuery->addQueryCallable(function (ilDBInterface $ilDB) {
174 
175  // get maximum definition number
176  $q = "SELECT max(nr) AS max_nr FROM glossary_definition WHERE term_id = " .
177  $ilDB->quote($this->getTermId(), "integer");
178  $max_set = $ilDB->query($q);
179  $max_rec = $ilDB->fetchAssoc($max_set);
180  $max = (int) $max_rec["max_nr"];
181 
182  // insert new definition record
183  $ilDB->manipulate("INSERT INTO glossary_definition (id, term_id, short_text, nr, short_text_dirty)" .
184  " VALUES (" .
185  $ilDB->quote($this->getId(), "integer") . "," .
186  $ilDB->quote($this->getTermId(), "integer") . "," .
187  $ilDB->quote($this->getShortText(), "text") . ", " .
188  $ilDB->quote(($max + 1), "integer") . ", " .
189  $ilDB->quote($this->getShortTextDirty(), "integer") .
190  ")");
191  });
192 
193  $ilAtomQuery->run();
194 
195  // get number
196  $q = "SELECT nr FROM glossary_definition WHERE id = " .
197  $ilDB->quote($this->id, "integer");
198  $def_set = $ilDB->query($q);
199  $def_rec = $ilDB->fetchAssoc($def_set);
200  $this->setNr($def_rec["nr"]);
201 
202  // meta data will be created by
203  // import parser
204  if (!$a_upload) {
205  $this->createMetaData();
206  }
207 
208  if (!$a_omit_page_creation) {
209  $this->page_object = new ilGlossaryDefPage();
210  $this->page_object->setId($this->getId());
211  $this->page_object->setParentId($term->getGlossaryId());
212  $this->page_object->create(false);
213  }
214  }
fetchAssoc(ilDBStatement $statement)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
manipulate(string $query)
Run a (write) Query on the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createMetaData()

ilGlossaryDefinition::createMetaData ( )

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

References $lang, ilGlossaryTerm\_lookGlossaryID(), ilGlossaryTerm\_lookLanguage(), getDescription(), getId(), getTermId(), getTitle(), and getType().

Referenced by create().

467  : void
468  {
471  $md_creator = new ilMDCreator($glo_id, $this->getId(), $this->getType());
472  $md_creator->setTitle($this->getTitle());
473  $md_creator->setTitleLanguage($lang);
474  $md_creator->setDescription($this->getDescription());
475  $md_creator->setDescriptionLanguage($lang);
476  $md_creator->setKeywordLanguage($lang);
477  $md_creator->setLanguage($lang);
478  $md_creator->create();
479  }
static _lookLanguage(int $term_id)
lookup term language
$lang
Definition: xapiexit.php:26
static _lookGlossaryID(int $term_id)
get glossary id form term id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilGlossaryDefinition::delete ( )

Definition at line 216 of file class.ilGlossaryDefinition.php.

References $db, $ilDB, deleteMetaData(), ilDBInterface\fetchAssoc(), ilDBInterface\manipulate(), ilDBInterface\query(), ilDBInterface\quote(), and setNr().

Referenced by ilGlossaryTermGUI\deleteDefinition(), and ilObjGlossaryGUI\deleteDefinition().

216  : void
217  {
218  $ilDB = $this->db;
219 
220  $ilAtomQuery = $ilDB->buildAtomQuery();
221  $ilAtomQuery->addTableLock("glossary_definition");
222 
223  $ilAtomQuery->addQueryCallable(function (ilDBInterface $ilDB) {
224 
225  // be sure to get the right number
226  $q = "SELECT * FROM glossary_definition WHERE id = " .
227  $ilDB->quote($this->id, "integer");
228  $def_set = $ilDB->query($q);
229  $def_rec = $ilDB->fetchAssoc($def_set);
230  $this->setNr($def_rec["nr"]);
231 
232  // update numbers of other definitions
233  $ilDB->manipulate("UPDATE glossary_definition SET " .
234  " nr = nr - 1 " .
235  " WHERE term_id = " . $ilDB->quote($this->getTermId(), "integer") . " " .
236  " AND nr > " . $ilDB->quote($this->getNr(), "integer"));
237 
238  // delete current definition
239  $ilDB->manipulate("DELETE FROM glossary_definition " .
240  " WHERE id = " . $ilDB->quote($this->getId(), "integer"));
241  });
242  $ilAtomQuery->run();
243 
244  // delete page and meta data
245  $this->page_object->delete();
246 
247  // delete meta data
248  $this->deleteMetaData();
249  }
fetchAssoc(ilDBStatement $statement)
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
manipulate(string $query)
Run a (write) Query on the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteMetaData()

ilGlossaryDefinition::deleteMetaData ( )

Definition at line 498 of file class.ilGlossaryDefinition.php.

References ilGlossaryTerm\_lookGlossaryID(), getId(), getTermId(), and getType().

Referenced by delete().

498  : void
499  {
500  // Delete meta data
502  $md = new ilMD($glo_id, $this->getId(), $this->getType());
503  $md->deleteAll();
504  }
static _lookGlossaryID(int $term_id)
get glossary id form term id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportXML()

ilGlossaryDefinition::exportXML ( ilXmlWriter  $a_xml_writer,
int  $a_inst 
)

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

References exportXMLDefinition(), exportXMLMetaData(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

416  : void {
417  $attrs = array();
418  $a_xml_writer->xmlStartTag("Definition", $attrs);
419 
420  $this->exportXMLMetaData($a_xml_writer);
421  $this->exportXMLDefinition($a_xml_writer, $a_inst);
422 
423  $a_xml_writer->xmlEndTag("Definition");
424  }
exportXMLMetaData(ilXmlWriter $a_xml_writer)
exportXMLDefinition(ilXmlWriter $a_xml_writer, int $a_inst=0)
export page objects meta data to xml
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
+ Here is the call graph for this function:

◆ exportXMLDefinition()

ilGlossaryDefinition::exportXMLDefinition ( ilXmlWriter  $a_xml_writer,
int  $a_inst = 0 
)

export page objects meta data to xml

Definition at line 452 of file class.ilGlossaryDefinition.php.

References $xml, ilXmlWriter\appendXML(), and ilPCFileList\collectFileItems().

Referenced by exportXML().

455  : void {
456  $this->page_object->buildDom();
457  $this->page_object->insertInstIntoIDs($a_inst);
458  $this->mobs_contained = $this->page_object->collectMediaObjects(false);
459  $this->files_contained = ilPCFileList::collectFileItems($this->page_object, $this->page_object->getDomDoc());
460  $xml = $this->page_object->getXMLFromDom(false, false, false, "", true);
461  $xml = str_replace("&", "&", $xml);
462  $a_xml_writer->appendXML($xml);
463 
464  $this->page_object->freeDom();
465  }
appendXML(string $a_str)
append xml string to document
static collectFileItems(ilPageObject $a_page, DOMDocument $a_domdoc)
Get all file items that are used within the page.
$xml
Definition: metadata.php:351
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportXMLMetaData()

ilGlossaryDefinition::exportXMLMetaData ( ilXmlWriter  $a_xml_writer)

Definition at line 427 of file class.ilGlossaryDefinition.php.

References ilGlossaryTerm\_lookGlossaryID(), ilXmlWriter\appendXML(), getId(), getTermId(), and getType().

Referenced by exportXML().

429  : void {
431  $md2xml = new ilMD2XML($glo_id, $this->getId(), $this->getType());
432  $md2xml->setExportMode(true);
433  $md2xml->startExport();
434  $a_xml_writer->appendXML($md2xml->getXML());
435  }
appendXML(string $a_str)
append xml string to document
static _lookGlossaryID(int $term_id)
get glossary id form term id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefinitionList()

static ilGlossaryDefinition::getDefinitionList ( int  $a_term_id)
static

Definition at line 392 of file class.ilGlossaryDefinition.php.

References $DIC, and $ilDB.

Referenced by ilGlossaryTerm\_copyTerm(), ilSoapGLOStructureReader\_parseStructure(), ilObjGlossary\autoLinkGlossaryTerms(), ilCOPageHTMLExport\collectPageElements(), ilGlossaryTerm\delete(), ILIAS\Glossary\Export\GlossaryHtmlExport\exportHTMLGlossaryTerms(), ilGlossaryTerm\exportXML(), ilObjGlossary\exportXML(), ilTermQuickListTableGUI\fillRow(), ilPresentationListTableGUI\fillRow(), ilTermListTableGUI\fillRow(), ilGlossaryTermGUI\getInternalLinks(), ilGlossaryExporter\getXmlExportTailDependencies(), ilGlossaryTermGUI\listDefinitions(), ilGlossaryPresentationGUI\listDefinitions(), ilGlossaryTermGUI\output(), and ilLMPresentationGUI\showPrintView().

392  : array
393  {
394  global $DIC;
395 
396  $ilDB = $DIC->database();
397 
398  $defs = array();
399  $q = "SELECT * FROM glossary_definition WHERE term_id = " .
400  $ilDB->quote($a_term_id, "integer") .
401  " ORDER BY nr";
402  $def_set = $ilDB->query($q);
403  while ($def_rec = $ilDB->fetchAssoc($def_set)) {
404  $defs[] = array("term_id" => $def_rec["term_id"],
405  "page_id" => (int) ($def_rec["page_id"] ?? 0), "id" => $def_rec["id"],
406  "short_text" => strip_tags($def_rec["short_text"], "<br>"),
407  "nr" => $def_rec["nr"],
408  "short_text_dirty" => $def_rec["short_text_dirty"]);
409  }
410  return $defs;
411  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ getDescription()

ilGlossaryDefinition::getDescription ( )

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

References $description.

Referenced by createMetaData(), and updateMetaData().

141  : string
142  {
143  return $this->description;
144  }
+ Here is the caller graph for this function:

◆ getId()

ilGlossaryDefinition::getId ( )

Definition at line 81 of file class.ilGlossaryDefinition.php.

References $id.

Referenced by create(), createMetaData(), deleteMetaData(), exportXMLMetaData(), MDUpdateListener(), modifyExportIdentifier(), and updateMetaData().

81  : int
82  {
83  return $this->id;
84  }
+ Here is the caller graph for this function:

◆ getNr()

ilGlossaryDefinition::getNr ( )

Definition at line 116 of file class.ilGlossaryDefinition.php.

References $nr.

Referenced by moveDown(), and moveUp().

116  : int
117  {
118  return $this->nr;
119  }
+ Here is the caller graph for this function:

◆ getPageObject()

ilGlossaryDefinition::getPageObject ( )

Definition at line 126 of file class.ilGlossaryDefinition.php.

References $page_object.

127  {
128  return $this->page_object;
129  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getShortText()

ilGlossaryDefinition::getShortText ( )

Definition at line 106 of file class.ilGlossaryDefinition.php.

References $short_text.

106  : string
107  {
108  return $this->short_text;
109  }

◆ getShortTextDirty()

ilGlossaryDefinition::getShortTextDirty ( )

Definition at line 156 of file class.ilGlossaryDefinition.php.

References $short_text_dirty.

Referenced by create().

156  : bool
157  {
159  }
+ Here is the caller graph for this function:

◆ getTermId()

ilGlossaryDefinition::getTermId ( )

Definition at line 96 of file class.ilGlossaryDefinition.php.

References $term_id.

Referenced by create(), createMetaData(), deleteMetaData(), exportXMLMetaData(), MDUpdateListener(), moveDown(), shortenShortText(), and updateMetaData().

96  : int
97  {
98  return $this->term_id;
99  }
+ Here is the caller graph for this function:

◆ getTitle()

ilGlossaryDefinition::getTitle ( )

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

References $title.

Referenced by createMetaData(), and updateMetaData().

131  : string
132  {
133  return $this->title;
134  }
+ Here is the caller graph for this function:

◆ getType()

ilGlossaryDefinition::getType ( )

Definition at line 86 of file class.ilGlossaryDefinition.php.

Referenced by createMetaData(), deleteMetaData(), exportXMLMetaData(), MDUpdateListener(), and updateMetaData().

86  : string
87  {
88  return "gdf";
89  }
+ Here is the caller graph for this function:

◆ MDUpdateListener()

ilGlossaryDefinition::MDUpdateListener ( string  $a_element)

Meta data update listener.

Important note: Do never call create() or update() method of ilObject here. It would result in an endless loop: update object -> update meta -> update object -> ... Use static _writeTitle() ... methods instead.

Even if this is not stored to db, it should be stored to the object e.g. for during import parsing

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

References $id, ilGlossaryTerm\_lookGlossaryID(), getId(), getTermId(), getType(), setDescription(), and setTitle().

518  : bool
519  {
520  switch ($a_element) {
521  case 'General':
522 
523  // Update Title and description
525  $md = new ilMD($glo_id, $this->getId(), $this->getType());
526  $md_gen = $md->getGeneral();
527 
528  //ilObject::_writeTitle($this->getId(),$md_gen->getTitle());
529  $this->setTitle($md_gen->getTitle());
530 
531  foreach ($md_gen->getDescriptionIds() as $id) {
532  $md_des = $md_gen->getDescription($id);
533  //ilObject::_writeDescription($this->getId(),$md_des->getDescription());
534  $this->setDescription($md_des->getDescription());
535  break;
536  }
537 
538  break;
539 
540  default:
541  }
542  return true;
543  }
setDescription(string $a_description)
static _lookGlossaryID(int $term_id)
get glossary id form term id
+ Here is the call graph for this function:

◆ modifyExportIdentifier()

ilGlossaryDefinition::modifyExportIdentifier ( string  $a_tag,
string  $a_param,
string  $a_value 
)

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

References getId(), and IL_INST_ID.

441  : string {
442  if ($a_tag == "Identifier" && $a_param == "Entry") {
443  $a_value = "il_" . IL_INST_ID . "_gdf_" . $this->getId();
444  }
445 
446  return $a_value;
447  }
const IL_INST_ID
Definition: constants.php:40
+ Here is the call graph for this function:

◆ moveDown()

ilGlossaryDefinition::moveDown ( )

Definition at line 287 of file class.ilGlossaryDefinition.php.

References $db, $ilDB, ilDBInterface\fetchAssoc(), getNr(), getTermId(), ilDBInterface\manipulate(), ilDBInterface\query(), ilDBInterface\quote(), and setNr().

Referenced by ilObjGlossaryGUI\moveDefinitionDown(), and ilGlossaryTermGUI\moveDown().

287  : void
288  {
289  $ilDB = $this->db;
290 
291  $ilAtomQuery = $ilDB->buildAtomQuery();
292  $ilAtomQuery->addTableLock('glossary_definition');
293 
294  $ilAtomQuery->addQueryCallable(function (ilDBInterface $ilDB) {
295 
296  // be sure to get the right number
297  $q = "SELECT * FROM glossary_definition WHERE id = " .
298  $ilDB->quote($this->id, "integer");
299  $def_set = $ilDB->query($q);
300  $def_rec = $ilDB->fetchAssoc($def_set);
301  $this->setNr($def_rec["nr"]);
302 
303  // get max number
304  $q = "SELECT max(nr) as max_nr FROM glossary_definition WHERE term_id = " .
305  $ilDB->quote($this->getTermId(), "integer");
306  $max_set = $ilDB->query($q);
307  $max_rec = $ilDB->fetchAssoc($max_set);
308 
309  if ($this->getNr() >= $max_rec["max_nr"]) {
310  return;
311  }
312 
313  // update numbers of other definitions
314  $ilDB->manipulate("UPDATE glossary_definition SET " .
315  " nr = nr - 1 " .
316  " WHERE term_id = " . $ilDB->quote($this->getTermId(), "integer") . " " .
317  " AND nr = " . $ilDB->quote(($this->getNr() + 1), "integer"));
318 
319  // delete current definition
320  $ilDB->manipulate("UPDATE glossary_definition SET " .
321  " nr = nr + 1 " .
322  " WHERE term_id = " . $ilDB->quote($this->getTermId(), "integer") . " " .
323  " AND id = " . $ilDB->quote($this->getId(), "integer"));
324  });
325 
326  $ilAtomQuery->run();
327  }
fetchAssoc(ilDBStatement $statement)
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
manipulate(string $query)
Run a (write) Query on the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveUp()

ilGlossaryDefinition::moveUp ( )

Definition at line 252 of file class.ilGlossaryDefinition.php.

References $db, $ilDB, ilDBInterface\fetchAssoc(), getNr(), ilDBInterface\manipulate(), ilDBInterface\query(), ilDBInterface\quote(), and setNr().

Referenced by ilObjGlossaryGUI\moveDefinitionUp(), and ilGlossaryTermGUI\moveUp().

252  : void
253  {
254  $ilDB = $this->db;
255 
256  $ilAtomQuery = $ilDB->buildAtomQuery();
257  $ilAtomQuery->addTableLock('glossary_definition');
258 
259  $ilAtomQuery->addQueryCallable(function (ilDBInterface $ilDB) {
260 
261  // be sure to get the right number
262  $q = "SELECT * FROM glossary_definition WHERE id = " .
263  $ilDB->quote($this->id, "integer");
264  $def_set = $ilDB->query($q);
265  $def_rec = $ilDB->fetchAssoc($def_set);
266  $this->setNr($def_rec["nr"]);
267 
268  if ($this->getNr() < 2) {
269  return;
270  }
271 
272  // update numbers of other definitions
273  $ilDB->manipulate("UPDATE glossary_definition SET " .
274  " nr = nr + 1 " .
275  " WHERE term_id = " . $ilDB->quote($this->getTermId(), "integer") . " " .
276  " AND nr = " . $ilDB->quote(($this->getNr() - 1), "integer"));
277 
278  // delete current definition
279  $ilDB->manipulate("UPDATE glossary_definition SET " .
280  " nr = nr - 1 " .
281  " WHERE term_id = " . $ilDB->quote($this->getTermId(), "integer") . " " .
282  " AND id = " . $ilDB->quote($this->getId(), "integer"));
283  });
284  $ilAtomQuery->run();
285  }
fetchAssoc(ilDBStatement $statement)
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
manipulate(string $query)
Run a (write) Query on the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilGlossaryDefinition::read ( )

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

References $db, $ilDB, setNr(), setShortText(), setShortTextDirty(), and setTermId().

Referenced by __construct().

59  : void
60  {
61  $ilDB = $this->db;
62 
63  $q = "SELECT * FROM glossary_definition WHERE id = " .
64  $ilDB->quote($this->id, "integer");
65  $def_set = $ilDB->query($q);
66  $def_rec = $ilDB->fetchAssoc($def_set);
67 
68  $this->setTermId((int) $def_rec["term_id"]);
69  $this->setShortText((string) $def_rec["short_text"]);
70  $this->setNr((int) $def_rec["nr"]);
71  $this->setShortTextDirty((bool) $def_rec["short_text_dirty"]);
72 
73  $this->page_object = new ilGlossaryDefPage($this->id);
74  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDescription()

ilGlossaryDefinition::setDescription ( string  $a_description)

Definition at line 146 of file class.ilGlossaryDefinition.php.

Referenced by MDUpdateListener().

146  : void
147  {
148  $this->description = $a_description;
149  }
+ Here is the caller graph for this function:

◆ setId()

ilGlossaryDefinition::setId ( int  $a_id)

Definition at line 76 of file class.ilGlossaryDefinition.php.

Referenced by create().

76  : void
77  {
78  $this->id = $a_id;
79  }
+ Here is the caller graph for this function:

◆ setNr()

ilGlossaryDefinition::setNr ( int  $a_nr)

Definition at line 111 of file class.ilGlossaryDefinition.php.

Referenced by create(), delete(), moveDown(), moveUp(), and read().

111  : void
112  {
113  $this->nr = $a_nr;
114  }
+ Here is the caller graph for this function:

◆ setShortText()

ilGlossaryDefinition::setShortText ( string  $a_text)

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

References shortenShortText().

Referenced by read(), and updateShortText().

101  : void
102  {
103  $this->short_text = $this->shortenShortText($a_text);
104  }
shortenShortText(string $text)
Shorten short text.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setShortTextDirty()

ilGlossaryDefinition::setShortTextDirty ( bool  $a_val)

Definition at line 151 of file class.ilGlossaryDefinition.php.

Referenced by read(), and updateShortText().

151  : void
152  {
153  $this->short_text_dirty = $a_val;
154  }
+ Here is the caller graph for this function:

◆ setShortTextsDirty()

static ilGlossaryDefinition::setShortTextsDirty ( int  $a_glo_id)
static

Set all short texts of glossary dirty (e.g.

if length is changed in settings)

Definition at line 567 of file class.ilGlossaryDefinition.php.

References $DIC, $ilDB, and ilGlossaryTerm\getTermsOfGlossary().

Referenced by ilObjGlossaryGUI\saveProperties().

567  : void
568  {
569  global $DIC;
570 
571  $ilDB = $DIC->database();
572 
573  $term_ids = ilGlossaryTerm::getTermsOfGlossary($a_glo_id);
574 
575  foreach ($term_ids as $term_id) {
576  $ilDB->manipulate(
577  "UPDATE glossary_definition SET " .
578  " short_text_dirty = " . $ilDB->quote(1, "integer") .
579  " WHERE term_id = " . $ilDB->quote($term_id, "integer")
580  );
581  }
582  }
global $DIC
Definition: feed.php:28
static getTermsOfGlossary(int $a_glo_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setShortTextsDirtyGlobally()

static ilGlossaryDefinition::setShortTextsDirtyGlobally ( )
static

Set short texts dirty (for all glossaries)

Definition at line 587 of file class.ilGlossaryDefinition.php.

References $DIC, and $ilDB.

Referenced by ilObjAdvancedEditingGUI\initGeneralPageSettingsForm().

587  : void
588  {
589  global $DIC;
590 
591  $ilDB = $DIC->database();
592 
593  $ilDB->manipulate(
594  "UPDATE glossary_definition SET " .
595  " short_text_dirty = " . $ilDB->quote(1, "integer")
596  );
597  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ setTermId()

ilGlossaryDefinition::setTermId ( int  $a_term_id)

Definition at line 91 of file class.ilGlossaryDefinition.php.

Referenced by read().

91  : void
92  {
93  $this->term_id = $a_term_id;
94  }
+ Here is the caller graph for this function:

◆ setTitle()

ilGlossaryDefinition::setTitle ( string  $a_title)

Definition at line 136 of file class.ilGlossaryDefinition.php.

Referenced by MDUpdateListener().

136  : void
137  {
138  $this->title = $a_title;
139  }
+ Here is the caller graph for this function:

◆ shortenShortText()

ilGlossaryDefinition::shortenShortText ( string  $text)

Shorten short text.

Definition at line 346 of file class.ilGlossaryDefinition.php.

References ilGlossaryTerm\_lookGlossaryID(), getTermId(), ilObjGlossary\lookupSnippetLength(), and ilStr\shortenTextExtended().

Referenced by setShortText(), and updateShortText().

346  : string
347  {
348  $a_length = 196;
349 
350  if ($this->getTermId() > 0) {
352  $snippet_length = ilObjGlossary::lookupSnippetLength($glo_id);
353  if ($snippet_length > 0) {
354  $a_length = $snippet_length;
355  }
356  }
357 
358  $text = str_replace("<br/>", "<br>", $text);
359  $text = strip_tags($text, "<br>");
360  $offset = 0;
361  if (is_int(strpos(substr($text, $a_length - 16 - 5, 10), "[tex]"))) {
362  $offset = 5;
363  }
364  $short = ilStr::shortenTextExtended($text, $a_length - 16 + $offset, true);
365 
366  // make short text longer, if tex end tag is missing
367  $ltexs = strrpos($short, "[tex]");
368  $ltexe = strrpos($short, "[/tex]");
369  if ($ltexs > $ltexe) {
370  $ltexe = strpos($text, "[/tex]", $ltexs);
371  if ($ltexe > 0) {
372  $text = ilStr::shortenTextExtended($text, $ltexe + 6, true);
373  }
374  }
375 
376  $short = ilStr::shortenTextExtended($text, $a_length, true);
377 
378  return $short;
379  }
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
static lookupSnippetLength(int $a_id)
static _lookGlossaryID(int $term_id)
get glossary id form term id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilGlossaryDefinition::update ( )

Definition at line 329 of file class.ilGlossaryDefinition.php.

References $db, $ilDB, and updateMetaData().

Referenced by updateShortText().

329  : void
330  {
331  $ilDB = $this->db;
332 
333  $this->updateMetaData();
334 
335  $ilDB->manipulate("UPDATE glossary_definition SET " .
336  " term_id = " . $ilDB->quote($this->getTermId(), "integer") . ", " .
337  " nr = " . $ilDB->quote($this->getNr(), "integer") . ", " .
338  " short_text = " . $ilDB->quote($this->getShortText(), "text") . ", " .
339  " short_text_dirty = " . $ilDB->quote($this->getShortTextDirty(), "integer") . " " .
340  " WHERE id = " . $ilDB->quote($this->getId(), "integer"));
341  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateMetaData()

ilGlossaryDefinition::updateMetaData ( )

Definition at line 481 of file class.ilGlossaryDefinition.php.

References ilGlossaryTerm\_lookGlossaryID(), getDescription(), getId(), getTermId(), getTitle(), and getType().

Referenced by update().

481  : void
482  {
484  $md = new ilMD($glo_id, $this->getId(), $this->getType());
485  $md_gen = $md->getGeneral();
486  $md_gen->setTitle($this->getTitle());
487 
488  // sets first description (maybe not appropriate)
489  $md_des_ids = $md_gen->getDescriptionIds();
490  if (count($md_des_ids) > 0) {
491  $md_des = $md_gen->getDescription($md_des_ids[0]);
492  $md_des->setDescription($this->getDescription());
493  $md_des->update();
494  }
495  $md_gen->update();
496  }
static _lookGlossaryID(int $term_id)
get glossary id form term id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateShortText()

ilGlossaryDefinition::updateShortText ( )

Definition at line 381 of file class.ilGlossaryDefinition.php.

References setShortText(), setShortTextDirty(), shortenShortText(), and update().

381  : void
382  {
383  $this->page_object->buildDom();
384  $text = $this->page_object->getFirstParagraphText();
385  $short = $this->shortenShortText($text);
386 
387  $this->setShortText($short);
388  $this->setShortTextDirty(false);
389  $this->update();
390  }
shortenShortText(string $text)
Shorten short text.
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ilGlossaryDefinition::$db
protected

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

Referenced by create(), delete(), moveDown(), moveUp(), read(), and update().

◆ $description

string ilGlossaryDefinition::$description = ""
protected

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

Referenced by getDescription().

◆ $files_contained

array ilGlossaryDefinition::$files_contained = []
protected

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

◆ $glo_id

int ilGlossaryDefinition::$glo_id = 0

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

◆ $id

int ilGlossaryDefinition::$id = 0

Definition at line 32 of file class.ilGlossaryDefinition.php.

Referenced by getId(), and MDUpdateListener().

◆ $lng

ilLanguage ilGlossaryDefinition::$lng

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

Referenced by __construct().

◆ $mobs_contained

array ilGlossaryDefinition::$mobs_contained = []
protected

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

◆ $nr

int ilGlossaryDefinition::$nr = 0

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

Referenced by getNr().

◆ $page_object

ilGlossaryDefPage ilGlossaryDefinition::$page_object

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

Referenced by getPageObject().

◆ $short_text

string ilGlossaryDefinition::$short_text = ""

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

Referenced by getShortText().

◆ $short_text_dirty

bool ilGlossaryDefinition::$short_text_dirty = false

Definition at line 38 of file class.ilGlossaryDefinition.php.

Referenced by getShortTextDirty().

◆ $term_id

int ilGlossaryDefinition::$term_id = 0

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

Referenced by getTermId().

◆ $title

string ilGlossaryDefinition::$title = ""
protected

Definition at line 27 of file class.ilGlossaryDefinition.php.

Referenced by getTitle().

◆ $tpl

ilGlobalTemplateInterface ilGlossaryDefinition::$tpl

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

Referenced by __construct().

◆ $user

ilObjUser ilGlossaryDefinition::$user
protected

Definition at line 29 of file class.ilGlossaryDefinition.php.


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