ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilNote Class Reference

Note class. More...

+ Collaboration diagram for ilNote:

Public Member Functions

 ilNote ($a_id=0)
 constructor More...
 
 setId ($a_id)
 set id More...
 
 getId ()
 get id More...
 
 setObject ($a_obj_type, $a_rep_obj_id, $a_obj_id=0)
 set assigned object More...
 
 getObject ()
 
 setType ($a_type)
 set type More...
 
 getType ()
 get type More...
 
 setAuthor ($a_user_id)
 set author More...
 
 getAuthor ()
 get author More...
 
 setText ($a_text)
 set text More...
 
 getText ()
 get text More...
 
 setSubject ($a_subject)
 set subject More...
 
 getSubject ()
 get subject More...
 
 setCreationDate ($a_date)
 set creation date More...
 
 getCreationDate ()
 get creation date More...
 
 setUpdateDate ($a_date)
 set update date More...
 
 getUpdateDate ()
 get update date More...
 
 setLabel ($a_label)
 set label More...
 
 getLabel ()
 get label More...
 
 setInRepository ($a_value)
 set repository object status More...
 
 isInRepository ()
 belongs note to repository object? More...
 
 create ($a_use_provided_creation_date=false)
 
 update ()
 
 read ()
 
 delete ()
 delete note More...
 
 setAllData ($a_note_rec)
 set all note data by record array More...
 
 _lookupCreationDate ($a_id)
 lookup creation date of note More...
 
 _lookupUpdateDate ($a_id)
 lookup update date of note More...
 
 _getNotesOfObject ($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_type=IL_NOTE_PRIVATE, $a_incl_sub=false, $a_filter="", $a_all_public="y", $a_repository_mode=true, $a_sort_ascending=false)
 get all notes related to a specific object More...
 
 _getLastNotesOfUser ()
 get last notes of current user More...
 
 _getRelatedObjectsOfUser ($a_mode)
 get all related objects for user More...
 

Static Public Member Functions

static getUserCount ($a_rep_obj_id, $a_obj_id, $a_type)
 How many users have attached a note/comment to a given object? More...
 
static _countNotesAndCommentsMultiple ($a_rep_obj_ids, $a_no_sub_objs=false)
 Get all notes related to multiple objcts. More...
 
static _countNotesAndComments ($a_rep_obj_id, $a_sub_obj_id=null)
 Get all notes related to a specific object. More...
 
static activateComments ($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_activate=true)
 Activate notes feature. More...
 
static commentsActivated ($a_rep_obj_id, $a_obj_id, $a_obj_type)
 Are comments activated for object? More...
 
static getRepObjActivation ($a_rep_obj_ids)
 Get activation for repository objects. More...
 

Detailed Description

Note class.

Represents a single note.

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

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

Member Function Documentation

◆ _countNotesAndComments()

static ilNote::_countNotesAndComments (   $a_rep_obj_id,
  $a_sub_obj_id = null 
)
static

Get all notes related to a specific object.

Parameters
array$a_rep_obj_idsrepository object IDs array
int$a_sub_obj_idsub objects (if null, all comments are counted)

Definition at line 665 of file class.ilNote.php.

666 {
667 global $ilDB, $ilUser;
668
669 $q = "SELECT count(id) c, rep_obj_id, type FROM note WHERE ".
670 " ((type = ".$ilDB->quote(IL_NOTE_PRIVATE, "integer")." AND ".
671 "author = ".$ilDB->quote((int) $ilUser->getId(), "integer").") OR ".
672 " type = ".$ilDB->quote(IL_NOTE_PUBLIC, "integer").") AND ".
673 " rep_obj_id = ".$ilDB->quote($a_rep_obj_id, "integer");
674
675 if ($a_sub_obj_id !== null)
676 {
677 $q .= " AND obj_id = ".$ilDB->quote($a_sub_obj_id, "integer");
678 }
679
680 $q .= " GROUP BY rep_obj_id, type ";
681
682 $cnt = array();
683 $set = $ilDB->query($q);
684 while ($rec = $ilDB->fetchAssoc($set))
685 {
686 $cnt[$rec["rep_obj_id"]][$rec["type"]] = $rec["c"];
687 }
688
689 return $cnt;
690 }
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:4
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:5
global $ilDB
global $ilUser
Definition: imgupload.php:15

References $ilDB, $ilUser, IL_NOTE_PRIVATE, and IL_NOTE_PUBLIC.

Referenced by ilObjectListGUI\getHeaderAction(), and ilPollBlockGUI\getNumberOfComments().

+ Here is the caller graph for this function:

◆ _countNotesAndCommentsMultiple()

static ilNote::_countNotesAndCommentsMultiple (   $a_rep_obj_ids,
  $a_no_sub_objs = false 
)
static

Get all notes related to multiple objcts.

Parameters
array$a_rep_obj_idsrepository object IDs array
boolean$a_no_sub_objsinclude subobjects true/false

Definition at line 632 of file class.ilNote.php.

633 {
634 global $ilDB, $ilUser;
635
636 $q = "SELECT count(id) c, rep_obj_id, type FROM note WHERE ".
637 " ((type = ".$ilDB->quote(IL_NOTE_PRIVATE, "integer")." AND ".
638 "author = ".$ilDB->quote((int) $ilUser->getId(), "integer").") OR ".
639 " type = ".$ilDB->quote(IL_NOTE_PUBLIC, "integer").") AND ".
640 $ilDB->in("rep_obj_id", $a_rep_obj_ids, false, "integer");
641
642 if ($a_no_sub_objs)
643 {
644 $q .= " AND obj_id = ".$ilDB->quote(0, "integer");
645 }
646
647 $q .= " GROUP BY rep_obj_id, type ";
648
649 $cnt = array();
650 $set = $ilDB->query($q);
651 while ($rec = $ilDB->fetchAssoc($set))
652 {
653 $cnt[$rec["rep_obj_id"]][$rec["type"]] = $rec["c"];
654 }
655
656 return $cnt;
657 }

References $ilDB, $ilUser, IL_NOTE_PRIVATE, and IL_NOTE_PUBLIC.

Referenced by ilObjectListGUI\preloadCommonProperties().

+ Here is the caller graph for this function:

◆ _getLastNotesOfUser()

ilNote::_getLastNotesOfUser ( )

get last notes of current user

Definition at line 448 of file class.ilNote.php.

449 {
450 global $ilDB, $ilUser;
451
452 $q = "SELECT * FROM note WHERE ".
453 " type = ".$ilDB->quote((int) IL_NOTE_PRIVATE, "integer").
454 " AND author = ".$ilDB->quote((int) $ilUser->getId(), "integer").
455 " AND (no_repository IS NULL OR no_repository < ".$ilDB->quote(1, "integer").")".
456 " ORDER BY creation_date DESC";
457
458 $ilDB->quote($q);
459 $set = $ilDB->query($q);
460 $notes = array();
461 while($note_rec = $ilDB->fetchAssoc($set))
462 {
463 $cnt = count($notes);
464 $notes[$cnt] = new ilNote();
465 $notes[$cnt]->setAllData($note_rec);
466 }
467
468 return $notes;
469 }
ilNote($a_id=0)
constructor

References $ilDB, $ilUser, IL_NOTE_PRIVATE, and ilNote().

Referenced by ilPDNotesBlockGUI\fillDataSection().

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

◆ _getNotesOfObject()

ilNote::_getNotesOfObject (   $a_rep_obj_id,
  $a_obj_id,
  $a_obj_type,
  $a_type = IL_NOTE_PRIVATE,
  $a_incl_sub = false,
  $a_filter = "",
  $a_all_public = "y",
  $a_repository_mode = true,
  $a_sort_ascending = false 
)

get all notes related to a specific object

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

396 {
397 global $ilDB, $ilUser;
398
399 $author_where = ($a_type == IL_NOTE_PRIVATE || $a_all_public == "n")
400 ? " AND author = ".$ilDB->quote((int) $ilUser->getId(), "integer")
401 : "";
402
403 $sub_where = (!$a_incl_sub)
404 ? " AND obj_id = ".$ilDB->quote((int) $a_obj_id, "integer").
405 " AND obj_type = ".$ilDB->quote((string) $a_obj_type, "text")
406 : "";
407
408 if(!$a_repository_mode)
409 {
410 $sub_where .= " AND no_repository = ".$ilDB->quote(1, "integer");
411 }
412
413 $q = "SELECT * FROM note WHERE ".
414 " rep_obj_id = ".$ilDB->quote((int) $a_rep_obj_id, "integer").
415 $sub_where.
416 " AND type = ".$ilDB->quote((int) $a_type, "integer").
417 $author_where.
418 " ORDER BY creation_date ";
419
420 $q .= ((bool)$a_sort_ascending) ? "ASC" : "DESC";
421
422 $set = $ilDB->query($q);
423 $notes = array();
424 while($note_rec = $ilDB->fetchAssoc($set))
425 {
426 if ($a_filter != "")
427 {
428 if (!is_array($a_filter))
429 {
430 $a_filter = array($a_filter);
431 }
432 if (!in_array($note_rec["id"], $a_filter))
433 {
434 continue;
435 }
436 }
437 $cnt = count($notes);
438 $notes[$cnt] = new ilNote();
439 $notes[$cnt]->setAllData($note_rec);
440 }
441
442 return $notes;
443 }

References $ilDB, $ilUser, IL_NOTE_PRIVATE, and ilNote().

Referenced by ilDataCollectionRecord\getComments(), ilNoteGUI\getNoteListHTML(), and ilObjBlogGUI\renderList().

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

◆ _getRelatedObjectsOfUser()

ilNote::_getRelatedObjectsOfUser (   $a_mode)

get all related objects for user

Definition at line 474 of file class.ilNote.php.

475 {
476 global $ilDB, $ilUser, $tree;
477
478 if ($a_mode == ilPDNotesGUI::PRIVATE_NOTES)
479 {
480 $q = "SELECT DISTINCT rep_obj_id FROM note WHERE ".
481 " type = ".$ilDB->quote((int) IL_NOTE_PRIVATE, "integer").
482 " AND author = ".$ilDB->quote($ilUser->getId(), "integer").
483 " AND (no_repository IS NULL OR no_repository < ".$ilDB->quote(1, "integer").")".
484 " ORDER BY rep_obj_id";
485
486 $ilDB->quote($q);
487 $set = $ilDB->query($q);
488 $reps = array();
489 while($rep_rec = $ilDB->fetchAssoc($set))
490 {
491 // #9343: deleted objects
492 if(ilObject::_lookupType($rep_rec["rep_obj_id"]))
493 {
494 $reps[] = array("rep_obj_id" => $rep_rec["rep_obj_id"]);
495 }
496 }
497 }
498 else
499 {
500 // all objects where the user wrote at least one comment
501 $q = "SELECT DISTINCT rep_obj_id FROM note WHERE ".
502 " type = ".$ilDB->quote((int) IL_NOTE_PUBLIC, "integer").
503 " AND author = ".$ilDB->quote($ilUser->getId(), "integer").
504 " AND (no_repository IS NULL OR no_repository < ".$ilDB->quote(1, "integer").")".
505 " ORDER BY rep_obj_id";
506
507 $set = $ilDB->query($q);
508 $reps = array();
509 while($rep_rec = $ilDB->fetchAssoc($set))
510 {
511 // #9343: deleted objects
512 if ($type = ilObject::_lookupType($rep_rec["rep_obj_id"]))
513 {
514 if (ilNote::commentsActivated($rep_rec["rep_obj_id"], "", $type))
515 {
516 $reps[] = array("rep_obj_id" => $rep_rec["rep_obj_id"]);
517 }
518 }
519 }
520
521 // additionally all objects on the personal desktop of the user
522 // that have at least on comment
524 $obj_ids = array();
525 foreach($dis as $di)
526 {
527 $obj_ids[] = $di["obj_id"];
528 }
529 if (count($obj_ids) > 0)
530 {
531 $q = "SELECT DISTINCT rep_obj_id FROM note WHERE ".
532 $ilDB->in("rep_obj_id", $obj_ids, false, "integer").
533 " AND (no_repository IS NULL OR no_repository < ".$ilDB->quote(1, "integer").")";
534
535 $set = $ilDB->query($q);
536 while($rec = $ilDB->fetchAssoc($set))
537 {
538 $add = true;
539 reset($reps);
540 foreach ($reps as $r)
541 {
542 if ($r["rep_obj_id"] == $rec["rep_obj_id"])
543 {
544 $add = false;
545 }
546 }
547 if ($add)
548 {
549 $type = ilObject::_lookupType($rec["rep_obj_id"]);
550 if (ilNote::commentsActivated($rec["rep_obj_id"], "", $type))
551 {
552 $reps[] = array("rep_obj_id" => $rec["rep_obj_id"]);
553 }
554 }
555 }
556 }
557 }
558
559 if(sizeof($reps))
560 {
561 // check if notes/comments belong to objects in trash
562 // see ilNoteGUI::showTargets()
563 foreach($reps as $idx => $rep)
564 {
565 $has_active_ref = false;
566
567 // repository?
568 $ref_ids = ilObject::_getAllReferences($rep["rep_obj_id"]);
569 if($ref_ids)
570 {
571 $reps[$idx]["ref_ids"] = array_values($ref_ids);
572
573 foreach($ref_ids as $ref_id)
574 {
575 if(!$tree->isDeleted($ref_id))
576 {
577 $has_active_ref = true;
578 break;
579 }
580 }
581 }
582 else
583 {
584 // personal workspace?
585 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
586 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
587 $wsp_tree = new ilWorkspaceTree($ilUser->getId());
588 $node_id = $wsp_tree->lookupNodeId($rep["rep_obj_id"]);
589 if($node_id)
590 {
591 $reps[$idx]["wsp_id"] = $node_id;
592
593 $has_active_ref = true;
594 }
595 }
596
597 if(!$has_active_ref)
598 {
599 unset($reps[$idx]);
600 }
601 }
602 }
603
604 return $reps;
605 }
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type)
Are comments activated for object?
static _lookupDesktopItems($user_id, $a_types="")
get all desktop items of user and specified type
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
Tree handler for personal workspace.
$ref_id
Definition: sahs_server.php:39

References $ilDB, $ilUser, $ref_id, ilObject\_getAllReferences(), ilObjUser\_lookupDesktopItems(), ilObject\_lookupType(), commentsActivated(), IL_NOTE_PRIVATE, IL_NOTE_PUBLIC, and ilPDNotesGUI\PRIVATE_NOTES.

Referenced by ilPDNotesGUI\view().

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

◆ _lookupCreationDate()

ilNote::_lookupCreationDate (   $a_id)

lookup creation date of note

Definition at line 363 of file class.ilNote.php.

364 {
365 global $ilDB;
366
367 $q = "SELECT * FROM note WHERE id = ".
368 $ilDB->quote((int) $this->getId(), "integer");
369 $set = $ilDB->query($q);
370 $note_rec = $ilDB->fetchAssoc($set);
371
372 return $note_rec["creation_date"];
373 }
getId()
get id

References $ilDB, and getId().

Referenced by create().

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

◆ _lookupUpdateDate()

ilNote::_lookupUpdateDate (   $a_id)

lookup update date of note

Definition at line 378 of file class.ilNote.php.

379 {
380 global $ilDB;
381
382 $q = "SELECT * FROM note WHERE id = ".
383 $ilDB->quote((int) $this->getId(), "integer");
384 $set = $ilDB->query($q);
385 $note_rec = $ilDB->fetchAssoc($set);
386
387 return $note_rec["update_date"];
388 }

References $ilDB, and getId().

Referenced by update().

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

◆ activateComments()

static ilNote::activateComments (   $a_rep_obj_id,
  $a_obj_id,
  $a_obj_type,
  $a_activate = true 
)
static

Activate notes feature.

Parameters

return

Definition at line 698 of file class.ilNote.php.

699 {
700 global $ilDB;
701
702 if ($a_obj_type == "")
703 {
704 $a_obj_type = "-";
705 }
706 $set = $ilDB->query("SELECT * FROM note_settings ".
707 " WHERE rep_obj_id = ".$ilDB->quote((int) $a_rep_obj_id, "integer").
708 " AND obj_id = ".$ilDB->quote((int) $a_obj_id, "integer").
709 " AND obj_type = ".$ilDB->quote($a_obj_type, "text")
710 );
711 if ($rec = $ilDB->fetchAssoc($set))
712 {
713 if (($rec["activated"] == 0 && $a_activate) ||
714 ($rec["activated"] == 1 && !$a_activate))
715 {
716 $ilDB->manipulate("UPDATE note_settings SET ".
717 " activated = ".$ilDB->quote((int) $a_activate, "integer").
718 " WHERE rep_obj_id = ".$ilDB->quote((int) $a_rep_obj_id, "integer").
719 " AND obj_id = ".$ilDB->quote((int) $a_obj_id, "integer").
720 " AND obj_type = ".$ilDB->quote($a_obj_type, "text")
721 );
722 }
723 }
724 else
725 {
726 if ($a_activate)
727 {
728 $q = "INSERT INTO note_settings ".
729 "(rep_obj_id, obj_id, obj_type, activated) VALUES (".
730 $ilDB->quote((int) $a_rep_obj_id, "integer").",".
731 $ilDB->quote((int) $a_obj_id, "integer").",".
732 $ilDB->quote($a_obj_type, "text").",".
733 $ilDB->quote(1, "integer").
734 ")";
735 $ilDB->manipulate($q);
736 }
737 }
738 }

References $ilDB.

Referenced by ilNoteGUI\activateComments(), ilObjContentObject\createProperties(), ilNoteGUI\deactivateComments(), ilObjBlog\doCreate(), ilObjBlog\doUpdate(), ilObjPoll\doUpdate(), ilObjPortfolioBase\doUpdate(), and ilObjContentObject\updateProperties().

+ Here is the caller graph for this function:

◆ commentsActivated()

static ilNote::commentsActivated (   $a_rep_obj_id,
  $a_obj_id,
  $a_obj_type 
)
static

Are comments activated for object?

Parameters

return

Definition at line 746 of file class.ilNote.php.

747 {
748 global $ilDB;
749
750 if ($a_obj_type == "")
751 {
752 $a_obj_type = "-";
753 }
754 $set = $ilDB->query("SELECT * FROM note_settings ".
755 " WHERE rep_obj_id = ".$ilDB->quote((int) $a_rep_obj_id, "integer").
756 " AND obj_id = ".$ilDB->quote((int) $a_obj_id, "integer").
757 " AND obj_type = ".$ilDB->quote($a_obj_type, "text")
758 );
759 $rec = $ilDB->fetchAssoc($set);
760 return $rec["activated"];
761 }

References $ilDB.

Referenced by _getRelatedObjectsOfUser(), ilObjBlog\doRead(), ilObjPoll\doRead(), ilObjPortfolioBase\doRead(), ilNoteGUI\getNotesHTML(), ilBlogDataSet\getXmlRecord(), ilPollDataSet\getXmlRecord(), ilPortfolioDataSet\getXmlRecord(), ilNoteGUI\ilNoteGUI(), ilObjectGUI\initHeaderAction(), ilObjectListGUI\isCommentsActivated(), and ilObjContentObject\readProperties().

+ Here is the caller graph for this function:

◆ create()

ilNote::create (   $a_use_provided_creation_date = false)

Definition at line 246 of file class.ilNote.php.

247 {
248 global $ilDB;
249
250 $cd = ($a_use_provided_creation_date)
251 ? $this->getCreationDate()
252 : ilUtil::now();
253
254 $this->id = $ilDB->nextId("note");
255 /*$q = "INSERT INTO note (id, rep_obj_id, obj_id, obj_type, type,".
256 "author, note_text, subject, label, creation_date) VALUES (".
257 $ilDB->quote($this->id, "integer").",".
258 $ilDB->quote((int) $this->rep_obj_id, "integer").",".
259 $ilDB->quote((int) $this->obj_id, "integer").",".
260 $ilDB->quote((string) $this->obj_type, "text").",".
261 $ilDB->quote((int) $this->type, "integer").",".
262 $ilDB->quote((int) $this->author, "integer").",".
263 $ilDB->quote((string) $this->text, "clob").",".
264 $ilDB->quote((string) $this->subject, "text").",".
265 $ilDB->quote((int) $this->label, "integer").",".
266 $ilDB->now().")";
267 $ilDB->manipulate($q);*/
268
269 $ilDB->insert("note", array(
270 "id" => array("integer", $this->id),
271 "rep_obj_id" => array("integer", (int) $this->rep_obj_id),
272 "obj_id" => array("integer", (int) $this->obj_id),
273 "obj_type" => array("text", (string) $this->obj_type),
274 "type" => array("integer", (int) $this->type),
275 "author" => array("integer", (int) $this->author),
276 "note_text" => array("clob", (string) $this->text),
277 "subject" => array("text", (string) $this->subject),
278 "label" => array("integer", (int) $this->label),
279 "creation_date" => array("timestamp", $cd),
280 "no_repository" => array("integer", $this->no_repository)
281 ));
282
283 $this->creation_date = ilNote::_lookupCreationDate($this->getId());
284 }
_lookupCreationDate($a_id)
lookup creation date of note
getCreationDate()
get creation date
static now()
Return current timestamp in Y-m-d H:i:s format.

References $ilDB, _lookupCreationDate(), getCreationDate(), getId(), and ilUtil\now().

+ Here is the call graph for this function:

◆ delete()

ilNote::delete ( )

delete note

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

335 {
336 global $ilDB;
337
338 $q = "DELETE FROM note WHERE id = ".
339 $ilDB->quote((int) $this->getId(), "integer");
340 $ilDB->manipulate($q);
341 }

References $ilDB, and getId().

+ Here is the call graph for this function:

◆ getAuthor()

ilNote::getAuthor ( )

get author

Returns
int user id

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

120 {
121 return $this->author;
122 }

◆ getCreationDate()

ilNote::getCreationDate ( )

get creation date

Returns
string creation date

Definition at line 179 of file class.ilNote.php.

180 {
181 return $this->creation_date;
182 }

Referenced by create().

+ Here is the caller graph for this function:

◆ getId()

ilNote::getId ( )

get id

Returns
int note id

Definition at line 54 of file class.ilNote.php.

55 {
56 return $this->id;
57 }

Referenced by _lookupCreationDate(), _lookupUpdateDate(), create(), delete(), read(), and update().

+ Here is the caller graph for this function:

◆ getLabel()

ilNote::getLabel ( )

get label

Returns
int IL_NOTE_UNLABELED | IL_NOTE_IMPORTANT | IL_NOTE_QUESTION | IL_NOTE_PRO | IL_NOTE_CONTRA

Definition at line 221 of file class.ilNote.php.

222 {
223 return $this->label;
224 }

◆ getObject()

ilNote::getObject ( )

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

77 {
78 return array("rep_obj_id" => $this->rep_obj_id,
79 "obj_id" => $this->obj_id,
80 "obj_type" => $this->obj_type);
81 }

◆ getRepObjActivation()

static ilNote::getRepObjActivation (   $a_rep_obj_ids)
static

Get activation for repository objects.

Parameters

return

Definition at line 769 of file class.ilNote.php.

770 {
771 global $ilDB;
772
773 $set = $ilDB->query("SELECT * FROM note_settings ".
774 " WHERE ".$ilDB->in("rep_obj_id", $a_rep_obj_ids, false, "integer").
775 " AND obj_id = 0 ");
776 $activations = array();
777 while ($rec = $ilDB->fetchAssoc($set))
778 {
779 if ($rec["activated"])
780 {
781 $activations[$rec["rep_obj_id"]][$rec["obj_type"]] = true;
782 }
783 }
784
785 return $activations;
786 }

References $ilDB.

Referenced by ilObjectListGUI\preloadCommonProperties().

+ Here is the caller graph for this function:

◆ getSubject()

ilNote::getSubject ( )

get subject

Returns
string subject

Definition at line 159 of file class.ilNote.php.

160 {
161 return $this->subject;
162 }

◆ getText()

ilNote::getText ( )

get text

Returns
string text

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

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

◆ getType()

ilNote::getType ( )

get type

Returns
int IL_NOTE_PUBLIC | IL_NOTE_PRIVATE

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

100 {
101 return $this->type;
102 }

◆ getUpdateDate()

ilNote::getUpdateDate ( )

get update date

Returns
string update date

Definition at line 199 of file class.ilNote.php.

200 {
201 return $this->update_date;
202 }

◆ getUserCount()

static ilNote::getUserCount (   $a_rep_obj_id,
  $a_obj_id,
  $a_type 
)
static

How many users have attached a note/comment to a given object?

Parameters
int$a_rep_obj_idobject id (as in object data)
int$a_obj_id(sub) object id
string$a_type(sub) object type

Definition at line 614 of file class.ilNote.php.

615 {
616 global $ilDB;
617
618 $set = $ilDB->queryF("SELECT count(DISTINCT author) cnt FROM note WHERE ".
619 "rep_obj_id = %s AND obj_id = %s AND obj_type = %s",
620 array("integer", "integer", "text"),
621 array((int) $a_rep_obj_id, (int) $a_obj_id, (string)$a_type));
622 $rec = $ilDB->fetchAssoc($set);
623 return (int) $rec["cnt"];
624 }

References $ilDB.

Referenced by ilBlogPostingGUI\deleteBlogPostingConfirmationScreen(), and ilWikiPageGUI\deleteWikiPageConfirmationScreen().

+ Here is the caller graph for this function:

◆ ilNote()

ilNote::ilNote (   $a_id = 0)

constructor

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

31 {
32 if ($a_id > 0)
33 {
34 $this->id = $a_id;
35 $this->read();
36 }
37 }

References read().

Referenced by _getLastNotesOfUser(), and _getNotesOfObject().

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

◆ isInRepository()

ilNote::isInRepository ( )

belongs note to repository object?

Returns
bool

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

242 {
243 return !$this->no_repository;
244 }

◆ read()

ilNote::read ( )

Definition at line 320 of file class.ilNote.php.

321 {
322 global $ilDB;
323
324 $q = "SELECT * FROM note WHERE id = ".
325 $ilDB->quote((int) $this->getId(), "integer");
326 $set = $ilDB->query($q);
327 $note_rec = $ilDB->fetchAssoc($set);
328 $this->setAllData($note_rec);
329 }
setAllData($a_note_rec)
set all note data by record array

References $ilDB, getId(), and setAllData().

Referenced by ilNote().

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

◆ setAllData()

ilNote::setAllData (   $a_note_rec)

set all note data by record array

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

347 {
348 $this->setId($a_note_rec["id"]);
349 $this->setObject($a_note_rec["obj_type"], $a_note_rec["rep_obj_id"], $a_note_rec["obj_id"]);
350 $this->setType($a_note_rec["type"]);
351 $this->setAuthor($a_note_rec["author"]);
352 $this->setText($a_note_rec["note_text"]);
353 $this->setSubject($a_note_rec["subject"]);
354 $this->setLabel($a_note_rec["label"]);
355 $this->setCreationDate($a_note_rec["creation_date"]);
356 $this->setUpdateDate($a_note_rec["update_date"]);
357 $this->setInRepository(!(bool)$a_note_rec["no_repository"]);
358 }
setObject($a_obj_type, $a_rep_obj_id, $a_obj_id=0)
set assigned object
setType($a_type)
set type
setLabel($a_label)
set label
setUpdateDate($a_date)
set update date
setId($a_id)
set id
setAuthor($a_user_id)
set author
setText($a_text)
set text
setInRepository($a_value)
set repository object status
setCreationDate($a_date)
set creation date
setSubject($a_subject)
set subject

References setAuthor(), setCreationDate(), setId(), setInRepository(), setLabel(), setObject(), setSubject(), setText(), setType(), and setUpdateDate().

Referenced by read().

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

◆ setAuthor()

ilNote::setAuthor (   $a_user_id)

set author

Parameters
intauthor user id

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

110 {
111 $this->author = $a_user_id;
112 }

Referenced by setAllData().

+ Here is the caller graph for this function:

◆ setCreationDate()

ilNote::setCreationDate (   $a_date)

set creation date

Parameters
stringcreation date

Definition at line 169 of file class.ilNote.php.

170 {
171 $this->creation_date = $a_date;
172 }

Referenced by setAllData().

+ Here is the caller graph for this function:

◆ setId()

ilNote::setId (   $a_id)

set id

Parameters
intnote id

Definition at line 44 of file class.ilNote.php.

45 {
46 $this->id = $a_id;
47 }

Referenced by setAllData().

+ Here is the caller graph for this function:

◆ setInRepository()

ilNote::setInRepository (   $a_value)

set repository object status

Parameters
bool

Definition at line 231 of file class.ilNote.php.

232 {
233 return $this->no_repository = !(bool)$a_value;
234 }

Referenced by setAllData().

+ Here is the caller graph for this function:

◆ setLabel()

ilNote::setLabel (   $a_label)

set label

Parameters
intIL_NOTE_UNLABELED | IL_NOTE_IMPORTANT | IL_NOTE_QUESTION | IL_NOTE_PRO | IL_NOTE_CONTRA

Definition at line 210 of file class.ilNote.php.

211 {
212 return $this->label = $a_label;
213 }

Referenced by setAllData().

+ Here is the caller graph for this function:

◆ setObject()

ilNote::setObject (   $a_obj_type,
  $a_rep_obj_id,
  $a_obj_id = 0 
)

set assigned object

Parameters
$a_typestring type of the object (e.g st,pg,crs ...)
$a_rep_obj_idint object id (NOT ref_id!) of repository object (e.g for page objects the obj_id of the learning module; for personal desktop this is set to 0)
$a_obj_idint object id (e.g for page objects the obj_id of the page object) for, this is set to 0 for normal repository objects like forums ...

Definition at line 69 of file class.ilNote.php.

70 {
71 $this->rep_obj_id = $a_rep_obj_id;
72 $this->obj_id = $a_obj_id;
73 $this->obj_type = $a_obj_type;
74 }

Referenced by setAllData().

+ Here is the caller graph for this function:

◆ setSubject()

ilNote::setSubject (   $a_subject)

set subject

Parameters
stringtext

Definition at line 149 of file class.ilNote.php.

150 {
151 $this->subject = $a_subject;
152 }

Referenced by setAllData().

+ Here is the caller graph for this function:

◆ setText()

ilNote::setText (   $a_text)

set text

Parameters
stringtext

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

130 {
131 $this->text = $a_text;
132 }

Referenced by setAllData().

+ Here is the caller graph for this function:

◆ setType()

ilNote::setType (   $a_type)

set type

Parameters
intIL_NOTE_PUBLIC | IL_NOTE_PRIVATE

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

90 {
91 $this->type = $a_type;
92 }

Referenced by setAllData().

+ Here is the caller graph for this function:

◆ setUpdateDate()

ilNote::setUpdateDate (   $a_date)

set update date

Parameters
stringupdate date

Definition at line 189 of file class.ilNote.php.

190 {
191 $this->update_date = $a_date;
192 }

Referenced by setAllData().

+ Here is the caller graph for this function:

◆ update()

ilNote::update ( )

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

287 {
288 global $ilDB;
289
290 /*$q = "UPDATE note SET ".
291 "rep_obj_id = ".$ilDB->quote((int) $this->rep_obj_id, "integer").",".
292 "obj_id = ".$ilDB->quote((int) $this->obj_id, "integer").",".
293 "obj_type = ".$ilDB->quote((string) $this->obj_type, "text").",".
294 "type = ".$ilDB->quote((int) $this->type, "integer").",".
295 "author = ".$ilDB->quote((int) $this->author,"integer").",".
296 "note_text = ".$ilDB->quote((string) $this->text, "clob").",".
297 "subject = ".$ilDB->quote((string) $this->subject, "text").",".
298 "update_date = ".$ilDB->now().",".
299 "label = ".$ilDB->quote((int) $this->label, "integer").
300 "WHERE id =".$ilDB->quote((int) $this->getId(), "integer");
301 $ilDB->manipulate($q);*/
302 $ilDB->update("note", array(
303 "rep_obj_id" => array("integer", (int) $this->rep_obj_id),
304 "obj_id" => array("integer", (int) $this->obj_id),
305 "obj_type" => array("text", (string) $this->obj_type),
306 "type" => array("integer", (int) $this->type),
307 "author" => array("integer", (int) $this->author),
308 "note_text" => array("clob", (string) $this->text),
309 "subject" => array("text", (string) $this->subject),
310 "label" => array("integer", (int) $this->label),
311 "update_date" => array("timestamp", ilUtil::now()),
312 "no_repository" => array("integer", $this->no_repository)
313 ), array(
314 "id" => array("integer", $this->getId())
315 ));
316
317 $this->update_date = ilNote::_lookupUpdateDate($this->getId());
318 }
_lookupUpdateDate($a_id)
lookup update date of note

References $ilDB, _lookupUpdateDate(), getId(), and ilUtil\now().

+ Here is the call graph for this function:

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