ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilGlossaryDefinition Class Reference

Class ilGlossaryDefinition. More...

+ Collaboration diagram for ilGlossaryDefinition:

Public Member Functions

 __construct ($a_id=0)
 Constructor 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...
 

Data Fields

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

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

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

References $ilias, $lng, $tpl, and read().

33  {
34  global $lng, $ilias, $tpl;
35 
36  $this->lng = $lng;
37  $this->ilias = $ilias;
38  $this->tpl = $tpl;
39 
40  $this->id = $a_id;
41  if ($a_id != 0)
42  {
43  $this->read();
44  }
45  }
redirection script todo: (a better solution should control the processing via a xml file) ...
read()
read data of content object
+ 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 632 of file class.ilGlossaryDefinition.php.

References $ilDB.

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

633  {
634  global $ilDB;
635 
636  $q = "SELECT * FROM glossary_definition WHERE id = ".
637  $ilDB->quote($a_def_id, "integer");
638  $def_set = $ilDB->query($q);
639  $def_rec = $ilDB->fetchAssoc($def_set);
640 
641  return $def_rec["term_id"];
642  }
global $ilDB
+ Here is the caller graph for this function:

◆ assignPageObject()

ilGlossaryDefinition::assignPageObject ( $a_page_object)

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

113  {
114  $this->page_object = $a_page_object;
115  }

◆ create()

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

Create definition.

Parameters
booleanupload true/false

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

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

185  {
186  global $ilDB;
187 
188  $term = new ilGlossaryTerm($this->getTermId());
189 
190  $this->setId($ilDB->nextId("glossary_definition"));
191 
192  $ilAtomQuery = $ilDB->buildAtomQuery();
193  $ilAtomQuery->addTableLock('glossary_definition');
194 
195  $ilAtomQuery->addQueryCallable(function (ilDBInterface $ilDB) {
196 
197  // get maximum definition number
198  $q = "SELECT max(nr) AS max_nr FROM glossary_definition WHERE term_id = " .
199  $ilDB->quote($this->getTermId(), "integer");
200  $max_set = $ilDB->query($q);
201  $max_rec = $ilDB->fetchAssoc($max_set);
202  $max = (int)$max_rec["max_nr"];
203 
204  // insert new definition record
205  $ilDB->manipulate("INSERT INTO glossary_definition (id, term_id, short_text, nr, short_text_dirty)" .
206  " VALUES (" .
207  $ilDB->quote($this->getId(), "integer") . "," .
208  $ilDB->quote($this->getTermId(), "integer") . "," .
209  $ilDB->quote($this->getShortText(), "text") . ", " .
210  $ilDB->quote(($max + 1), "integer") . ", " .
211  $ilDB->quote($this->getShortTextDirty(), "integer") .
212  ")");
213 
214  });
215 
216  $ilAtomQuery->run();
217 
218  // get number
219  $q = "SELECT nr FROM glossary_definition WHERE id = ".
220  $ilDB->quote($this->id, "integer");
221  $def_set = $ilDB->query($q);
222  $def_rec = $ilDB->fetchAssoc($def_set);
223  $this->setNr($def_rec["nr"]);
224 
225  // meta data will be created by
226  // import parser
227  if (!$a_upload)
228  {
229  $this->createMetaData();
230  }
231 
232  if (!$a_omit_page_creation)
233  {
234  $this->page_object = new ilGlossaryDefPage();
235  $this->page_object->setId($this->getId());
236  $this->page_object->setParentId($term->getGlossaryId());
237  $this->page_object->create();
238  }
239  }
Class ilGlossaryTerm.
Interface ilDBInterface.
quote($value, $type)
Glossary definition page object.
createMetaData()
create meta data entry
global $ilDB
query($query)
fetchAssoc($query_result)
manipulate($query)
getShortTextDirty()
Get short text dirty.
+ Here is the call graph for this function:

◆ createMetaData()

ilGlossaryDefinition::createMetaData ( )

create meta data entry

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

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

Referenced by create().

525  {
526  include_once 'Services/MetaData/classes/class.ilMDCreator.php';
527 
528  global $ilUser;
529 
532  $md_creator = new ilMDCreator($glo_id,$this->getId(),$this->getType());
533  $md_creator->setTitle($this->getTitle());
534  $md_creator->setTitleLanguage($lang);
535  $md_creator->setDescription($this->getDescription());
536  $md_creator->setDescriptionLanguage($lang);
537  $md_creator->setKeywordLanguage($lang);
538  $md_creator->setLanguage($lang);
539 //echo "-".$this->getTitle()."-"; exit;
540  $md_creator->create();
541 
542  return true;
543  }
getTitle()
get title of content object
$ilUser
Definition: imgupload.php:18
static _lookLanguage($term_id)
lookup term language
static _lookGlossaryID($term_id)
get glossary id form term id
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilGlossaryDefinition::delete ( )

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

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

242  {
243  global $ilDB;
244 
245  $ilAtomQuery = $ilDB->buildAtomQuery();
246  $ilAtomQuery->addTableLock("glossary_definition");
247 
248  $ilAtomQuery->addQueryCallable(function (ilDBInterface $ilDB){
249 
250  // be sure to get the right number
251  $q = "SELECT * FROM glossary_definition WHERE id = ".
252  $ilDB->quote($this->id, "integer");
253  $def_set = $ilDB->query($q);
254  $def_rec = $ilDB->fetchAssoc($def_set);
255  $this->setNr($def_rec["nr"]);
256 
257  // update numbers of other definitions
258  $ilDB->manipulate("UPDATE glossary_definition SET ".
259  " nr = nr - 1 ".
260  " WHERE term_id = ".$ilDB->quote($this->getTermId(), "integer")." ".
261  " AND nr > ".$ilDB->quote($this->getNr(), "integer"));
262 
263  // delete current definition
264  $ilDB->manipulate("DELETE FROM glossary_definition ".
265  " WHERE id = ".$ilDB->quote($this->getId(), "integer"));
266 
267  });
268  $ilAtomQuery->run();
269 
270  // delete page and meta data
271  $this->page_object->delete();
272 
273  // delete meta data
274  $this->deleteMetaData();
275  }
Interface ilDBInterface.
quote($value, $type)
deleteMetaData()
delete meta data entry
global $ilDB
query($query)
fetchAssoc($query_result)
manipulate($query)
+ Here is the call graph for this function:

◆ deleteMetaData()

ilGlossaryDefinition::deleteMetaData ( )

delete meta data entry

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

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

Referenced by delete().

574  {
575  // Delete meta data
576  include_once('Services/MetaData/classes/class.ilMD.php');
578  $md = new ilMD($glo_id, $this->getId(), $this->getType());
579  $md->deleteAll();
580  }
static _lookGlossaryID($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 ( $a_xml_writer,
  $a_inst 
)

export xml

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

References array, exportXMLDefinition(), and exportXMLMetaData().

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)
Create styles array
The data for the language used.
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
+ 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 506 of file class.ilGlossaryDefinition.php.

References ilPCFileList\collectFileItems().

Referenced by exportXML().

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

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

Referenced by exportXML().

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  }
static _lookGlossaryID($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 (   $a_term_id)
static

static

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

References $ilDB, and array.

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

436  {
437  global $ilDB;
438 
439  $defs = array();
440  $q = "SELECT * FROM glossary_definition WHERE term_id = ".
441  $ilDB->quote($a_term_id, "integer").
442  " ORDER BY nr";
443  $def_set = $ilDB->query($q);
444  while ($def_rec = $ilDB->fetchAssoc($def_set))
445  {
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  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getDescription()

ilGlossaryDefinition::getDescription ( )

Get description.

Returns
string description

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

Referenced by createMetaData(), and updateMetaData().

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

◆ getId()

ilGlossaryDefinition::getId ( )

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

References $id.

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

73  {
74  return $this->id;
75  }
+ Here is the caller graph for this function:

◆ getNr()

ilGlossaryDefinition::getNr ( )

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

References $nr.

Referenced by moveDown(), and moveUp().

108  {
109  return $this->nr;
110  }
+ Here is the caller graph for this function:

◆ getPageObject()

& ilGlossaryDefinition::getPageObject ( )

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

References $page_object.

118  {
119  return $this->page_object;
120  }

◆ getShortText()

ilGlossaryDefinition::getShortText ( )

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

References $short_text.

◆ getShortTextDirty()

ilGlossaryDefinition::getShortTextDirty ( )

Get short text dirty.

Returns
boolean short text dirty

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

References $short_text_dirty.

Referenced by create().

+ Here is the caller graph for this function:

◆ getTermId()

ilGlossaryDefinition::getTermId ( )

Definition at line 87 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 127 of file class.ilGlossaryDefinition.php.

References $title.

Referenced by createMetaData(), and updateMetaData().

128  {
129  return $this->title;
130  }
+ Here is the caller graph for this function:

◆ getType()

ilGlossaryDefinition::getType ( )

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

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

78  {
79  return "gdf";
80  }
+ 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 596 of file class.ilGlossaryDefinition.php.

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

597  {
598  include_once 'Services/MetaData/classes/class.ilMD.php';
599 
600  switch($a_element)
601  {
602  case 'General':
603 
604  // Update Title and description
606  $md = new ilMD($glo_id, $this->getId(), $this->getType());
607  $md_gen = $md->getGeneral();
608 
609  //ilObject::_writeTitle($this->getId(),$md_gen->getTitle());
610  $this->setTitle($md_gen->getTitle());
611 
612  foreach($md_gen->getDescriptionIds() as $id)
613  {
614  $md_des = $md_gen->getDescription($id);
615  //ilObject::_writeDescription($this->getId(),$md_des->getDescription());
616  $this->setDescription($md_des->getDescription());
617  break;
618  }
619 
620  break;
621 
622  default:
623  }
624  return true;
625  }
setDescription($a_description)
Set description.
setTitle($a_title)
set title of content object
static _lookGlossaryID($term_id)
get glossary id form term id
+ 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.

References getId().

490  {
491  if ($a_tag == "Identifier" && $a_param == "Entry")
492  {
493  $a_value = "il_".IL_INST_ID."_gdf_".$this->getId();
494  }
495 
496  return $a_value;
497  }
+ Here is the call graph for this function:

◆ moveDown()

ilGlossaryDefinition::moveDown ( )

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

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

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

◆ moveUp()

ilGlossaryDefinition::moveUp ( )

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

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

279  {
280  global $ilDB;
281 
282  $ilAtomQuery = $ilDB->buildAtomQuery();
283  $ilAtomQuery->addTableLock('glossary_definition');
284 
285  $ilAtomQuery->addQueryCallable(function (ilDBInterface $ilDB) {
286 
287  // be sure to get the right number
288  $q = "SELECT * FROM glossary_definition WHERE id = " .
289  $ilDB->quote($this->id, "integer");
290  $def_set = $ilDB->query($q);
291  $def_rec = $ilDB->fetchAssoc($def_set);
292  $this->setNr($def_rec["nr"]);
293 
294  if ($this->getNr() < 2) {
295  return;
296  }
297 
298  // update numbers of other definitions
299  $ilDB->manipulate("UPDATE glossary_definition SET " .
300  " nr = nr + 1 " .
301  " WHERE term_id = " . $ilDB->quote($this->getTermId(), "integer") . " " .
302  " AND nr = " . $ilDB->quote(($this->getNr() - 1), "integer"));
303 
304  // delete current definition
305  $ilDB->manipulate("UPDATE glossary_definition SET " .
306  " nr = nr - 1 " .
307  " WHERE term_id = " . $ilDB->quote($this->getTermId(), "integer") . " " .
308  " AND id = " . $ilDB->quote($this->getId(), "integer"));
309 
310  });
311  $ilAtomQuery->run();
312  }
Interface ilDBInterface.
quote($value, $type)
global $ilDB
query($query)
fetchAssoc($query_result)
manipulate($query)
+ Here is the call graph for this function:

◆ read()

ilGlossaryDefinition::read ( )

read data of content object

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

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

Referenced by __construct().

51  {
52  global $ilDB;
53 
54  $q = "SELECT * FROM glossary_definition WHERE id = ".
55  $ilDB->quote($this->id, "integer");
56  $def_set = $ilDB->query($q);
57  $def_rec = $ilDB->fetchAssoc($def_set);
58 
59  $this->setTermId($def_rec["term_id"]);
60  $this->setShortText($def_rec["short_text"]);
61  $this->setNr($def_rec["nr"]);
62  $this->setShortTextDirty($def_rec["short_text_dirty"]);
63 
64  $this->page_object = new ilGlossaryDefPage($this->id);
65  }
setShortTextDirty($a_val)
Set short text dirty.
Glossary definition page object.
global $ilDB
+ 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 155 of file class.ilGlossaryDefinition.php.

Referenced by MDUpdateListener().

156  {
157  $this->description = $a_description;
158  }
+ Here is the caller graph for this function:

◆ setId()

ilGlossaryDefinition::setId (   $a_id)

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

Referenced by create().

68  {
69  $this->id = $a_id;
70  }
+ Here is the caller graph for this function:

◆ setNr()

ilGlossaryDefinition::setNr (   $a_nr)

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

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

103  {
104  $this->nr = $a_nr;
105  }
+ Here is the caller graph for this function:

◆ setShortText()

ilGlossaryDefinition::setShortText (   $a_text)

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

References shortenShortText().

Referenced by read(), and updateShortText().

93  {
94  $this->short_text = $this->shortenShortText($a_text);
95  }
shortenShortText($text)
Shorten short text.
+ 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 165 of file class.ilGlossaryDefinition.php.

Referenced by read(), and updateShortText().

166  {
167  $this->short_text_dirty = $a_val;
168  }
+ Here is the caller graph for this function:

◆ setShortTextsDirty()

static ilGlossaryDefinition::setShortTextsDirty (   $a_glo_id)
static

Set short texts dirty.

Parameters

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

References $ilDB, and ilGlossaryTerm\getTermsOfGlossary().

Referenced by ilObjGlossaryGUI\saveProperties().

651  {
652  global $ilDB;
653 
654  include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
655  $term_ids = ilGlossaryTerm::getTermsOfGlossary($a_glo_id);
656 
657  foreach ($term_ids as $term_id)
658  {
659  $ilDB->manipulate("UPDATE glossary_definition SET ".
660  " short_text_dirty = ".$ilDB->quote(1, "integer").
661  " WHERE term_id = ".$ilDB->quote($term_id, "integer")
662  );
663  }
664  }
global $ilDB
static getTermsOfGlossary($a_glo_id)
Get terms of glossary.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTermId()

ilGlossaryDefinition::setTermId (   $a_term_id)

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

Referenced by read().

83  {
84  $this->term_id = $a_term_id;
85  }
+ Here is the caller graph for this function:

◆ setTitle()

ilGlossaryDefinition::setTitle (   $a_title)

set title of content object

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

Referenced by MDUpdateListener().

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

◆ shortenShortText()

ilGlossaryDefinition::shortenShortText (   $text)

Shorten short text.

Parameters

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

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

Referenced by setShortText(), and updateShortText().

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

◆ update()

ilGlossaryDefinition::update ( )

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

References $ilDB, and updateMetaData().

Referenced by updateShortText().

360  {
361  global $ilDB;
362 
363  $this->updateMetaData();
364 
365  $ilDB->manipulate("UPDATE glossary_definition SET ".
366  " term_id = ".$ilDB->quote($this->getTermId(), "integer").", ".
367  " nr = ".$ilDB->quote($this->getNr(), "integer").", ".
368  " short_text = ".$ilDB->quote($this->getShortText(), "text").", ".
369  " short_text_dirty = ".$ilDB->quote($this->getShortTextDirty(), "integer")." ".
370  " WHERE id = ".$ilDB->quote($this->getId(), "integer"));
371  }
updateMetaData()
update meta data entry
global $ilDB
+ 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 548 of file class.ilGlossaryDefinition.php.

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

Referenced by update().

549  {
550  include_once("Services/MetaData/classes/class.ilMD.php");
551  include_once("Services/MetaData/classes/class.ilMDGeneral.php");
552  include_once("Services/MetaData/classes/class.ilMDDescription.php");
553 
555  $md = new ilMD($glo_id, $this->getId(), $this->getType());
556  $md_gen = $md->getGeneral();
557  $md_gen->setTitle($this->getTitle());
558 
559  // sets first description (maybe not appropriate)
560  $md_des_ids = $md_gen->getDescriptionIds();
561  if (count($md_des_ids) > 0)
562  {
563  $md_des = $md_gen->getDescription($md_des_ids[0]);
564  $md_des->setDescription($this->getDescription());
565  $md_des->update();
566  }
567  $md_gen->update();
568  }
getTitle()
get title of content object
static _lookGlossaryID($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 420 of file class.ilGlossaryDefinition.php.

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

421  {
422  $this->page_object->buildDom();
423  $text = $this->page_object->getFirstParagraphText();
424 
425  $short = $this->shortenShortText($text);
426 
427  $this->setShortText($short);
428  $this->setShortTextDirty(false);
429  $this->update();
430  }
setShortTextDirty($a_val)
Set short text dirty.
$text
shortenShortText($text)
Shorten short text.
+ Here is the call graph for this function:

Field Documentation

◆ $glo_id

ilGlossaryDefinition::$glo_id

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

◆ $id

ilGlossaryDefinition::$id

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

Referenced by getId(), and MDUpdateListener().

◆ $ilias

ilGlossaryDefinition::$ilias

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

Referenced by __construct().

◆ $lng

ilGlossaryDefinition::$lng

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

Referenced by __construct().

◆ $nr

ilGlossaryDefinition::$nr

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

Referenced by getNr().

◆ $page_object

ilGlossaryDefinition::$page_object

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

Referenced by getPageObject().

◆ $short_text

ilGlossaryDefinition::$short_text

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

Referenced by getShortText().

◆ $short_text_dirty

ilGlossaryDefinition::$short_text_dirty = false

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

Referenced by getShortTextDirty().

◆ $term_id

ilGlossaryDefinition::$term_id

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

Referenced by getTermId().

◆ $tpl

ilGlossaryDefinition::$tpl

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

Referenced by __construct().


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