ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilGlossaryDefinition Class Reference

Class ilGlossaryDefinition. More...

+ Collaboration diagram for ilGlossaryDefinition:

Public Member Functions

 __construct ($a_id=0)
 Constructor @access public. More...
 
 read ()
 read data of content object More...
 
 setId ($a_id)
 
 getId ()
 
 getType ()
 
 setTermId ($a_term_id)
 
 getTermId ()
 
 setShortText ($a_text)
 
 getShortText ()
 
 setNr ($a_nr)
 
 getNr ()
 
 assignPageObject (&$a_page_object)
 
getPageObject ()
 
 getTitle ()
 get title of content object More...
 
 setTitle ($a_title)
 set title of content object More...
 
 getDescription ()
 Get description. More...
 
 setDescription ($a_description)
 Set description. More...
 
 setShortTextDirty ($a_val)
 Set short text dirty. More...
 
 getShortTextDirty ()
 Get short text dirty. More...
 
 create ($a_upload=false, $a_omit_page_creation=false)
 Create definition. More...
 
 delete ()
 
 moveUp ()
 
 moveDown ()
 
 update ()
 
 shortenShortText ($text)
 Shorten short text. More...
 
 updateShortText ()
 
 exportXML (&$a_xml_writer, $a_inst)
 export xml More...
 
 exportXMLMetaData (&$a_xml_writer)
 export content objects meta data to xml (see ilias_co.dtd) More...
 
 modifyExportIdentifier ($a_tag, $a_param, $a_value)
 
 exportXMLDefinition (&$a_xml_writer, $a_inst=0)
 export page objects meta data to xml (see ilias_co.dtd) More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 

Static Public Member Functions

static getDefinitionList ($a_term_id)
 static More...
 
static _lookupTermId ($a_def_id)
 Looks up term id for a definition id. More...
 
static setShortTextsDirty ($a_glo_id)
 Set short texts dirty. More...
 
static setShortTextsDirtyGlobally ()
 Set short texts dirty. More...
 

Data Fields

 $lng
 
 $tpl
 
 $id
 
 $term_id
 
 $glo_id
 
 $page_object
 
 $short_text
 
 $nr
 
 $short_text_dirty = false
 

Protected Attributes

 $db
 
 $user
 

Detailed Description

Class ilGlossaryDefinition.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilGlossaryDefinition::__construct (   $a_id = 0)

Constructor @access public.

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

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 }
user()
Definition: user.php:4
read()
read data of content object
global $DIC
Definition: saml.php:7

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

+ Here is the call graph for this function:

Member Function Documentation

◆ _lookupTermId()

static ilGlossaryDefinition::_lookupTermId (   $a_def_id)
static

Looks up term id for a definition id.

Parameters
int$a_def_iddefinition id

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

628 {
629 global $DIC;
630
631 $ilDB = $DIC->database();
632
633 $q = "SELECT * FROM glossary_definition WHERE id = " .
634 $ilDB->quote($a_def_id, "integer");
635 $def_set = $ilDB->query($q);
636 $def_rec = $ilDB->fetchAssoc($def_set);
637
638 return $def_rec["term_id"];
639 }
global $ilDB

References $DIC, and $ilDB.

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

+ Here is the caller graph for this function:

◆ assignPageObject()

ilGlossaryDefinition::assignPageObject ( $a_page_object)

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

125 {
126 $this->page_object = $a_page_object;
127 }

◆ create()

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

Create definition.

Parameters
booleanupload true/false

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

197 {
199
200 $term = new ilGlossaryTerm($this->getTermId());
201
202 $this->setId($ilDB->nextId("glossary_definition"));
203
204 $ilAtomQuery = $ilDB->buildAtomQuery();
205 $ilAtomQuery->addTableLock('glossary_definition');
206
207 $ilAtomQuery->addQueryCallable(function (ilDBInterface $ilDB) {
208
209 // get maximum definition number
210 $q = "SELECT max(nr) AS max_nr FROM glossary_definition WHERE term_id = " .
211 $ilDB->quote($this->getTermId(), "integer");
212 $max_set = $ilDB->query($q);
213 $max_rec = $ilDB->fetchAssoc($max_set);
214 $max = (int) $max_rec["max_nr"];
215
216 // insert new definition record
217 $ilDB->manipulate("INSERT INTO glossary_definition (id, term_id, short_text, nr, short_text_dirty)" .
218 " VALUES (" .
219 $ilDB->quote($this->getId(), "integer") . "," .
220 $ilDB->quote($this->getTermId(), "integer") . "," .
221 $ilDB->quote($this->getShortText(), "text") . ", " .
222 $ilDB->quote(($max + 1), "integer") . ", " .
223 $ilDB->quote($this->getShortTextDirty(), "integer") .
224 ")");
225 });
226
227 $ilAtomQuery->run();
228
229 // get number
230 $q = "SELECT nr FROM glossary_definition WHERE id = " .
231 $ilDB->quote($this->id, "integer");
232 $def_set = $ilDB->query($q);
233 $def_rec = $ilDB->fetchAssoc($def_set);
234 $this->setNr($def_rec["nr"]);
235
236 // meta data will be created by
237 // import parser
238 if (!$a_upload) {
239 $this->createMetaData();
240 }
241
242 if (!$a_omit_page_creation) {
243 $this->page_object = new ilGlossaryDefPage();
244 $this->page_object->setId($this->getId());
245 $this->page_object->setParentId($term->getGlossaryId());
246 $this->page_object->create();
247 }
248 }
Glossary definition page object.
createMetaData()
create meta data entry
Class ilGlossaryTerm.
Interface ilDBInterface.

References $db, $ilDB, createMetaData(), getId(), getTermId(), setId(), and setNr().

+ Here is the call graph for this function:

◆ createMetaData()

ilGlossaryDefinition::createMetaData ( )

create meta data entry

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

523 {
524 include_once 'Services/MetaData/classes/class.ilMDCreator.php';
525
527
530 $md_creator = new ilMDCreator($glo_id, $this->getId(), $this->getType());
531 $md_creator->setTitle($this->getTitle());
532 $md_creator->setTitleLanguage($lang);
533 $md_creator->setDescription($this->getDescription());
534 $md_creator->setDescriptionLanguage($lang);
535 $md_creator->setKeywordLanguage($lang);
536 $md_creator->setLanguage($lang);
537 //echo "-".$this->getTitle()."-"; exit;
538 $md_creator->create();
539
540 return true;
541 }
getTitle()
get title of content object
static _lookGlossaryID($term_id)
get glossary id form term id
static _lookLanguage($term_id)
lookup term language
$lang
Definition: consent.php:3
$ilUser
Definition: imgupload.php:18

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

Referenced by create().

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

◆ delete()

ilGlossaryDefinition::delete ( )

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

251 {
253
254 $ilAtomQuery = $ilDB->buildAtomQuery();
255 $ilAtomQuery->addTableLock("glossary_definition");
256
257 $ilAtomQuery->addQueryCallable(function (ilDBInterface $ilDB) {
258
259 // be sure to get the right number
260 $q = "SELECT * FROM glossary_definition WHERE id = " .
261 $ilDB->quote($this->id, "integer");
262 $def_set = $ilDB->query($q);
263 $def_rec = $ilDB->fetchAssoc($def_set);
264 $this->setNr($def_rec["nr"]);
265
266 // update numbers of other definitions
267 $ilDB->manipulate("UPDATE glossary_definition SET " .
268 " nr = nr - 1 " .
269 " WHERE term_id = " . $ilDB->quote($this->getTermId(), "integer") . " " .
270 " AND nr > " . $ilDB->quote($this->getNr(), "integer"));
271
272 // delete current definition
273 $ilDB->manipulate("DELETE FROM glossary_definition " .
274 " WHERE id = " . $ilDB->quote($this->getId(), "integer"));
275 });
276 $ilAtomQuery->run();
277
278 // delete page and meta data
279 $this->page_object->delete();
280
281 // delete meta data
282 $this->deleteMetaData();
283 }
deleteMetaData()
delete meta data entry

References $db, $ilDB, deleteMetaData(), and setNr().

+ Here is the call graph for this function:

◆ deleteMetaData()

ilGlossaryDefinition::deleteMetaData ( )

delete meta data entry

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

571 {
572 // Delete meta data
573 include_once('Services/MetaData/classes/class.ilMD.php');
575 $md = new ilMD($glo_id, $this->getId(), $this->getType());
576 $md->deleteAll();
577 }

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

Referenced by delete().

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

◆ exportXML()

ilGlossaryDefinition::exportXML ( $a_xml_writer,
  $a_inst 
)

export xml

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

459 {
460 $attrs = array();
461 $a_xml_writer->xmlStartTag("Definition", $attrs);
462
463 $this->exportXMLMetaData($a_xml_writer);
464 $this->exportXMLDefinition($a_xml_writer, $a_inst);
465
466 $a_xml_writer->xmlEndTag("Definition");
467 }
exportXMLDefinition(&$a_xml_writer, $a_inst=0)
export page objects meta data to xml (see ilias_co.dtd)
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)

References exportXMLDefinition(), and exportXMLMetaData().

+ Here is the call graph for this function:

◆ exportXMLDefinition()

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

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

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

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

506 {
507 $this->page_object->buildDom();
508 $this->page_object->insertInstIntoIDs($a_inst);
509 $this->mobs_contained = $this->page_object->collectMediaObjects(false);
510 include_once("./Services/COPage/classes/class.ilPCFileList.php");
511 $this->files_contained = ilPCFileList::collectFileItems($this->page_object, $this->page_object->getDomDoc());
512 $xml = $this->page_object->getXMLFromDom(false, false, false, "", true);
513 $xml = str_replace("&", "&", $xml);
514 $a_xml_writer->appendXML($xml);
515
516 $this->page_object->freeDom();
517 }
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
$xml
Definition: metadata.php:240

References $xml, and ilPCFileList\collectFileItems().

Referenced by exportXML().

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

◆ exportXMLMetaData()

ilGlossaryDefinition::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 476 of file class.ilGlossaryDefinition.php.

477 {
479 include_once("Services/MetaData/classes/class.ilMD2XML.php");
480 $md2xml = new ilMD2XML($glo_id, $this->getId(), $this->getType());
481 $md2xml->setExportMode(true);
482 $md2xml->startExport();
483 $a_xml_writer->appendXML($md2xml->getXML());
484 }

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

Referenced by exportXML().

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

◆ getDefinitionList()

static ilGlossaryDefinition::getDefinitionList (   $a_term_id)
static

static

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

435 {
436 global $DIC;
437
438 $ilDB = $DIC->database();
439
440 $defs = array();
441 $q = "SELECT * FROM glossary_definition WHERE term_id = " .
442 $ilDB->quote($a_term_id, "integer") .
443 " ORDER BY nr";
444 $def_set = $ilDB->query($q);
445 while ($def_rec = $ilDB->fetchAssoc($def_set)) {
446 $defs[] = array("term_id" => $def_rec["term_id"],
447 "page_id" => $def_rec["page_id"], "id" => $def_rec["id"],
448 "short_text" => strip_tags($def_rec["short_text"], "<br>"),
449 "nr" => $def_rec["nr"],
450 "short_text_dirty" => $def_rec["short_text_dirty"]);
451 }
452 return $defs;
453 }

References $DIC, and $ilDB.

Referenced by ilGlossaryTerm\_copyTerm(), ilSoapGLOStructureReader\_parseStructure(), ilObjGlossary\autoLinkGlossaryTerms(), ilGlossaryTerm\delete(), ilObjGlossary\exportHTMLGlossaryTerms(), ilObjContentObject\exportHTMLGlossaryTerms(), ilSCORM2004Asset\exportHTMLPageObjects(), ilGlossaryTerm\exportXML(), ilObjGlossary\exportXML(), ilPresentationListTableGUI\fillRow(), ilTermListTableGUI\fillRow(), ilTermQuickListTableGUI\fillRow(), ilGlossaryTermGUI\getInternalLinks(), ilGlossaryExporter\getXmlExportTailDependencies(), ilGlossaryPresentationGUI\listDefinitions(), ilGlossaryTermGUI\listDefinitions(), ilGlossaryTermGUI\output(), and ilLMPresentationGUI\showPrintView().

+ Here is the caller graph for this function:

◆ getDescription()

ilGlossaryDefinition::getDescription ( )

Get description.

Returns
string description

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

158 {
159 return $this->description;
160 }

References $description.

Referenced by createMetaData(), and updateMetaData().

+ Here is the caller graph for this function:

◆ getId()

ilGlossaryDefinition::getId ( )

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

References $id.

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

+ Here is the caller graph for this function:

◆ getNr()

ilGlossaryDefinition::getNr ( )

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

References $nr.

Referenced by moveDown(), and moveUp().

+ Here is the caller graph for this function:

◆ getPageObject()

& ilGlossaryDefinition::getPageObject ( )

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

References $page_object.

◆ getShortText()

ilGlossaryDefinition::getShortText ( )

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

References $short_text.

◆ getShortTextDirty()

ilGlossaryDefinition::getShortTextDirty ( )

Get short text dirty.

Returns
boolean short text dirty

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

References $short_text_dirty.

◆ getTermId()

ilGlossaryDefinition::getTermId ( )

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

References $term_id.

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

+ Here is the caller graph for this function:

◆ getTitle()

ilGlossaryDefinition::getTitle ( )

get title of content object

Returns
string title

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

140 {
141 return $this->title;
142 }

References $title.

Referenced by createMetaData(), and updateMetaData().

+ Here is the caller graph for this function:

◆ getType()

ilGlossaryDefinition::getType ( )

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

90 {
91 return "gdf";
92 }

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

+ Here is the caller graph for this function:

◆ MDUpdateListener()

ilGlossaryDefinition::MDUpdateListener (   $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

Parameters
string$a_element

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

594 {
595 include_once 'Services/MetaData/classes/class.ilMD.php';
596
597 switch ($a_element) {
598 case 'General':
599
600 // Update Title and description
602 $md = new ilMD($glo_id, $this->getId(), $this->getType());
603 $md_gen = $md->getGeneral();
604
605 //ilObject::_writeTitle($this->getId(),$md_gen->getTitle());
606 $this->setTitle($md_gen->getTitle());
607
608 foreach ($md_gen->getDescriptionIds() as $id) {
609 $md_des = $md_gen->getDescription($id);
610 //ilObject::_writeDescription($this->getId(),$md_des->getDescription());
611 $this->setDescription($md_des->getDescription());
612 break;
613 }
614
615 break;
616
617 default:
618 }
619 return true;
620 }
setDescription($a_description)
Set description.
setTitle($a_title)
set title of content object

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

+ Here is the call graph for this function:

◆ modifyExportIdentifier()

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

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

490 {
491 if ($a_tag == "Identifier" && $a_param == "Entry") {
492 $a_value = "il_" . IL_INST_ID . "_gdf_" . $this->getId();
493 }
494
495 return $a_value;
496 }

References getId().

+ Here is the call graph for this function:

◆ moveDown()

ilGlossaryDefinition::moveDown ( )

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

322 {
324
325 $ilAtomQuery = $ilDB->buildAtomQuery();
326 $ilAtomQuery->addTableLock('glossary_definition');
327
328 $ilAtomQuery->addQueryCallable(function (ilDBInterface $ilDB) {
329
330 // be sure to get the right number
331 $q = "SELECT * FROM glossary_definition WHERE id = " .
332 $ilDB->quote($this->id, "integer");
333 $def_set = $ilDB->query($q);
334 $def_rec = $ilDB->fetchAssoc($def_set);
335 $this->setNr($def_rec["nr"]);
336
337 // get max number
338 $q = "SELECT max(nr) as max_nr FROM glossary_definition WHERE term_id = " .
339 $ilDB->quote($this->getTermId(), "integer");
340 $max_set = $ilDB->query($q);
341 $max_rec = $ilDB->fetchAssoc($max_set);
342
343 if ($this->getNr() >= $max_rec["max_nr"]) {
344 return;
345 }
346
347 // update numbers of other definitions
348 $ilDB->manipulate("UPDATE glossary_definition SET " .
349 " nr = nr - 1 " .
350 " WHERE term_id = " . $ilDB->quote($this->getTermId(), "integer") . " " .
351 " AND nr = " . $ilDB->quote(($this->getNr() + 1), "integer"));
352
353 // delete current definition
354 $ilDB->manipulate("UPDATE glossary_definition SET " .
355 " nr = nr + 1 " .
356 " WHERE term_id = " . $ilDB->quote($this->getTermId(), "integer") . " " .
357 " AND id = " . $ilDB->quote($this->getId(), "integer"));
358 });
359
360 $ilAtomQuery->run();
361 }

References $db, $ilDB, getNr(), getTermId(), and setNr().

+ Here is the call graph for this function:

◆ moveUp()

ilGlossaryDefinition::moveUp ( )

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

287 {
289
290 $ilAtomQuery = $ilDB->buildAtomQuery();
291 $ilAtomQuery->addTableLock('glossary_definition');
292
293 $ilAtomQuery->addQueryCallable(function (ilDBInterface $ilDB) {
294
295 // be sure to get the right number
296 $q = "SELECT * FROM glossary_definition WHERE id = " .
297 $ilDB->quote($this->id, "integer");
298 $def_set = $ilDB->query($q);
299 $def_rec = $ilDB->fetchAssoc($def_set);
300 $this->setNr($def_rec["nr"]);
301
302 if ($this->getNr() < 2) {
303 return;
304 }
305
306 // update numbers of other definitions
307 $ilDB->manipulate("UPDATE glossary_definition SET " .
308 " nr = nr + 1 " .
309 " WHERE term_id = " . $ilDB->quote($this->getTermId(), "integer") . " " .
310 " AND nr = " . $ilDB->quote(($this->getNr() - 1), "integer"));
311
312 // delete current definition
313 $ilDB->manipulate("UPDATE glossary_definition SET " .
314 " nr = nr - 1 " .
315 " WHERE term_id = " . $ilDB->quote($this->getTermId(), "integer") . " " .
316 " AND id = " . $ilDB->quote($this->getId(), "integer"));
317 });
318 $ilAtomQuery->run();
319 }
manipulate($query)
Run a (write) Query on the database.

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

+ Here is the call graph for this function:

◆ read()

ilGlossaryDefinition::read ( )

read data of content object

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

63 {
65
66 $q = "SELECT * FROM glossary_definition WHERE id = " .
67 $ilDB->quote($this->id, "integer");
68 $def_set = $ilDB->query($q);
69 $def_rec = $ilDB->fetchAssoc($def_set);
70
71 $this->setTermId($def_rec["term_id"]);
72 $this->setShortText($def_rec["short_text"]);
73 $this->setNr($def_rec["nr"]);
74 $this->setShortTextDirty($def_rec["short_text_dirty"]);
75
76 $this->page_object = new ilGlossaryDefPage($this->id);
77 }
setShortTextDirty($a_val)
Set short text dirty.

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

Referenced by __construct().

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

◆ setDescription()

ilGlossaryDefinition::setDescription (   $a_description)

Set description.

Parameters
stringdescription

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

168 {
169 $this->description = $a_description;
170 }

Referenced by MDUpdateListener().

+ Here is the caller graph for this function:

◆ setId()

ilGlossaryDefinition::setId (   $a_id)

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

80 {
81 $this->id = $a_id;
82 }

Referenced by create().

+ Here is the caller graph for this function:

◆ setNr()

ilGlossaryDefinition::setNr (   $a_nr)

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

115 {
116 $this->nr = $a_nr;
117 }

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

+ Here is the caller graph for this function:

◆ setShortText()

ilGlossaryDefinition::setShortText (   $a_text)

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

105 {
106 $this->short_text = $this->shortenShortText($a_text);
107 }
shortenShortText($text)
Shorten short text.

References shortenShortText().

Referenced by read(), and updateShortText().

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

◆ setShortTextDirty()

ilGlossaryDefinition::setShortTextDirty (   $a_val)

Set short text dirty.

Parameters
booleanshort text dirty

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

178 {
179 $this->short_text_dirty = $a_val;
180 }

Referenced by read(), and updateShortText().

+ Here is the caller graph for this function:

◆ setShortTextsDirty()

static ilGlossaryDefinition::setShortTextsDirty (   $a_glo_id)
static

Set short texts dirty.

Parameters

return

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

648 {
649 global $DIC;
650
651 $ilDB = $DIC->database();
652
653 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
654 $term_ids = ilGlossaryTerm::getTermsOfGlossary($a_glo_id);
655
656 foreach ($term_ids as $term_id) {
657 $ilDB->manipulate(
658 "UPDATE glossary_definition SET " .
659 " short_text_dirty = " . $ilDB->quote(1, "integer") .
660 " WHERE term_id = " . $ilDB->quote($term_id, "integer")
661 );
662 }
663 }
static getTermsOfGlossary($a_glo_id)
Get terms of glossary.

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

Referenced by ilObjGlossaryGUI\saveProperties().

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

Parameters

return

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

672 {
673 global $DIC;
674
675 $ilDB = $DIC->database();
676
677 $ilDB->manipulate("UPDATE glossary_definition SET " .
678 " short_text_dirty = " . $ilDB->quote(1, "integer")
679 );
680 }

References $DIC, and $ilDB.

Referenced by ilObjAdvancedEditingGUI\initGeneralPageSettingsForm().

+ Here is the caller graph for this function:

◆ setTermId()

ilGlossaryDefinition::setTermId (   $a_term_id)

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

95 {
96 $this->term_id = $a_term_id;
97 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTitle()

ilGlossaryDefinition::setTitle (   $a_title)

set title of content object

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

148 {
149 $this->title = $a_title;
150 }

Referenced by MDUpdateListener().

+ Here is the caller graph for this function:

◆ shortenShortText()

ilGlossaryDefinition::shortenShortText (   $text)

Shorten short text.

Parameters

return

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

385 {
386 $a_length = 196;
387
388 if ($this->getTermId() > 0) {
389 include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
390 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
391 $glo_id = ilGlossaryTerm::_lookGlossaryId($this->getTermId());
393 if ($snippet_length > 0) {
394 $a_length = $snippet_length;
395 }
396 }
397
398 $text = str_replace("<br/>", "<br>", $text);
399 $text = strip_tags($text, "<br>");
400 if (is_int(strpos(substr($text, $a_length - 16 - 5, 10), "[tex]"))) {
401 $offset = 5;
402 }
403 $short = ilUtil::shortenText($text, $a_length - 16 + $offset, true);
404
405 // make short text longer, if tex end tag is missing
406 $ltexs = strrpos($short, "[tex]");
407 $ltexe = strrpos($short, "[/tex]");
408 if ($ltexs > $ltexe) {
409 $ltexe = strpos($text, "[/tex]", $ltexs);
410 if ($ltexe > 0) {
411 $text = ilUtil::shortenText($text, $ltexe + 6, true);
412 }
413 }
414
415 $short = ilUtil::shortenText($text, $a_length, true);
416
417 return $short;
418 }
static lookupSnippetLength($a_id)
Lookup snippet length.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
$text
Definition: errorreport.php:18

References $glo_id, $text, getTermId(), ilObjGlossary\lookupSnippetLength(), and ilUtil\shortenText().

Referenced by setShortText(), and updateShortText().

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

◆ update()

ilGlossaryDefinition::update ( )

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

365 {
367
368 $this->updateMetaData();
369
370 $ilDB->manipulate("UPDATE glossary_definition SET " .
371 " term_id = " . $ilDB->quote($this->getTermId(), "integer") . ", " .
372 " nr = " . $ilDB->quote($this->getNr(), "integer") . ", " .
373 " short_text = " . $ilDB->quote($this->getShortText(), "text") . ", " .
374 " short_text_dirty = " . $ilDB->quote($this->getShortTextDirty(), "integer") . " " .
375 " WHERE id = " . $ilDB->quote($this->getId(), "integer"));
376 }
updateMetaData()
update meta data entry

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

Referenced by updateShortText().

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

◆ updateMetaData()

ilGlossaryDefinition::updateMetaData ( )

update meta data entry

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

547 {
548 include_once("Services/MetaData/classes/class.ilMD.php");
549 include_once("Services/MetaData/classes/class.ilMDGeneral.php");
550 include_once("Services/MetaData/classes/class.ilMDDescription.php");
551
553 $md = new ilMD($glo_id, $this->getId(), $this->getType());
554 $md_gen = $md->getGeneral();
555 $md_gen->setTitle($this->getTitle());
556
557 // sets first description (maybe not appropriate)
558 $md_des_ids = $md_gen->getDescriptionIds();
559 if (count($md_des_ids) > 0) {
560 $md_des = $md_gen->getDescription($md_des_ids[0]);
561 $md_des->setDescription($this->getDescription());
562 $md_des->update();
563 }
564 $md_gen->update();
565 }

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

Referenced by update().

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

◆ updateShortText()

ilGlossaryDefinition::updateShortText ( )

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

421 {
422 $this->page_object->buildDom();
423 $text = $this->page_object->getFirstParagraphText();
424 $short = $this->shortenShortText($text);
425
426 $this->setShortText($short);
427 $this->setShortTextDirty(false);
428 $this->update();
429 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $db

ilGlossaryDefinition::$db
protected

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

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

◆ $glo_id

ilGlossaryDefinition::$glo_id

◆ $id

ilGlossaryDefinition::$id

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

Referenced by getId(), and MDUpdateListener().

◆ $lng

ilGlossaryDefinition::$lng

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

Referenced by __construct().

◆ $nr

ilGlossaryDefinition::$nr

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

Referenced by getNr().

◆ $page_object

ilGlossaryDefinition::$page_object

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

Referenced by getPageObject().

◆ $short_text

ilGlossaryDefinition::$short_text

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

Referenced by getShortText().

◆ $short_text_dirty

ilGlossaryDefinition::$short_text_dirty = false

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

Referenced by getShortTextDirty().

◆ $term_id

ilGlossaryDefinition::$term_id

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

Referenced by getTermId(), and setShortTextsDirty().

◆ $tpl

ilGlossaryDefinition::$tpl

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

Referenced by __construct().

◆ $user

ilGlossaryDefinition::$user
protected

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

Referenced by createMetaData().


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