Note class. More...
Public Member Functions | |
| ilNote ($a_id=0) | |
| constructor | |
| setId ($a_id) | |
| set id | |
| getId () | |
| get id | |
| setObject ($a_obj_type, $a_rep_obj_id, $a_obj_id=0) | |
| set assigned object | |
| getObject () | |
| setType ($a_type) | |
| set type | |
| getType () | |
| get type | |
| setAuthor ($a_user_id) | |
| set author | |
| getAuthor () | |
| get author | |
| setText ($a_text) | |
| set text | |
| getText () | |
| get text | |
| setSubject ($a_subject) | |
| set subject | |
| getSubject () | |
| get subject | |
| setCreationDate ($a_date) | |
| set creation date | |
| getCreationDate () | |
| get creation date | |
| setUpdateDate ($a_date) | |
| set update date | |
| getUpdateDate () | |
| get update date | |
| setLabel ($a_label) | |
| set label | |
| getLabel () | |
| get label | |
| create () | |
| update () | |
| read () | |
| delete () | |
| delete note | |
| setAllData ($a_note_rec) | |
| set all note data by record array | |
| _lookupCreationDate ($a_id) | |
| lookup creation date of note | |
| _lookupUpdateDate ($a_id) | |
| lookup update date of note | |
| _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") | |
| get all notes related to a specific object | |
| _getLastNotesOfUser () | |
| get last notes of current user | |
| _getRelatedObjectsOfUser () | |
| get all related objects for user | |
Note class.
Represents a single note.
Definition at line 44 of file class.ilNote.php.
| ilNote::_getLastNotesOfUser | ( | ) |
get last notes of current user
Definition at line 408 of file class.ilNote.php.
References ilNote().
Referenced by ilPDNotesBlockGUI::fillDataSection().
{
global $ilDB, $ilUser;
$q = "SELECT * FROM note WHERE ".
" type = ".$ilDB->quote(IL_NOTE_PRIVATE).
" AND author = ".$ilDB->quote($ilUser->getId()).
" ORDER BY creation_date DESC";
$ilDB->quote($q);
$set = $ilDB->query($q);
$notes = array();
while($note_rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
{
$cnt = count($notes);
$notes[$cnt] = new ilNote();
$notes[$cnt]->setAllData($note_rec);
}
return $notes;
}
Here is the call graph for this function:
Here is the caller graph for this function:| 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" | |||
| ) |
get all notes related to a specific object
Definition at line 360 of file class.ilNote.php.
References ilNote().
Referenced by ilNoteGUI::getNoteListHTML().
{
global $ilDB, $ilUser;
$author_where = ($a_type == IL_NOTE_PRIVATE || $a_all_public == "n")
? " AND author = ".$ilDB->quote($ilUser->getId())
: "";
$sub_where = (!$a_incl_sub)
? " AND obj_id = ".$ilDB->quote($a_obj_id).
" AND obj_type = ".$ilDB->quote($a_obj_type)
: "";
$q = "SELECT * FROM note WHERE ".
" rep_obj_id = ".$ilDB->quote($a_rep_obj_id).
$sub_where.
" AND type = ".$ilDB->quote($a_type).
$author_where.
" ORDER BY creation_date DESC";
$set = $ilDB->query($q);
$notes = array();
while($note_rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
{
if ($a_filter != "")
{
if (!is_array($a_filter))
{
$a_filter = array($a_filter);
}
if (!in_array($note_rec["id"], $a_filter))
{
continue;
}
}
$cnt = count($notes);
$notes[$cnt] = new ilNote();
$notes[$cnt]->setAllData($note_rec);
}
return $notes;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilNote::_getRelatedObjectsOfUser | ( | ) |
get all related objects for user
Definition at line 433 of file class.ilNote.php.
Referenced by ilPDNotesGUI::view().
{
global $ilDB, $ilUser;
$q = "SELECT DISTINCT rep_obj_id FROM note WHERE ".
" type = ".$ilDB->quote(IL_NOTE_PRIVATE).
" AND author = ".$ilDB->quote($ilUser->getId()).
" ORDER BY rep_obj_id";
$ilDB->quote($q);
$set = $ilDB->query($q);
$reps = array();
while($rep_rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
{
$reps[] = array("rep_obj_id" => $rep_rec["rep_obj_id"]);
}
return $reps;
}
Here is the caller graph for this function:| ilNote::_lookupCreationDate | ( | $ | a_id | ) |
lookup creation date of note
Definition at line 330 of file class.ilNote.php.
References getId().
Referenced by create().
{
global $ilDB;
$q = "SELECT * FROM note WHERE id = ".
$ilDB->quote($this->getId());
$set = $ilDB->query($q);
$note_rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
return $note_rec["creation_date"];
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilNote::_lookupUpdateDate | ( | $ | a_id | ) |
lookup update date of note
Definition at line 345 of file class.ilNote.php.
References getId().
Referenced by update().
{
global $ilDB;
$q = "SELECT * FROM note WHERE id = ".
$ilDB->quote($this->getId());
$set = $ilDB->query($q);
$note_rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
return $note_rec["update_date"];
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilNote::create | ( | ) |
Definition at line 246 of file class.ilNote.php.
References _lookupCreationDate(), and getId().
{
global $ilDB;
$q = "INSERT INTO note (rep_obj_id, obj_id, obj_type, type,".
"author, text, subject, label, creation_date) VALUES (".
$ilDB->quote($this->rep_obj_id).",".
$ilDB->quote($this->obj_id).",".
$ilDB->quote($this->obj_type).",".
$ilDB->quote($this->type).",".
$ilDB->quote($this->author).",".
$ilDB->quote($this->text).",".
$ilDB->quote($this->subject).",".
$ilDB->quote($this->label).",".
"now())";
$ilDB->query($q);
$this->id = $ilDB->getLastInsertId();
$this->creation_date = ilNote::_lookupCreationDate($this->getId());
}
Here is the call graph for this function:| ilNote::delete | ( | ) |
delete note
Definition at line 302 of file class.ilNote.php.
References getId().
{
global $ilDB;
$q = "DELETE FROM note WHERE id = ".
$ilDB->quote($this->getId());
$ilDB->query($q);
}
Here is the call graph for this function:| ilNote::getAuthor | ( | ) |
get author
Definition at line 139 of file class.ilNote.php.
{
return $this->author;
}
| ilNote::getCreationDate | ( | ) |
get creation date
Definition at line 199 of file class.ilNote.php.
{
return $this->creation_date;
}
| ilNote::getId | ( | ) |
get id
Definition at line 74 of file class.ilNote.php.
Referenced by _lookupCreationDate(), _lookupUpdateDate(), create(), delete(), read(), and update().
{
return $this->id;
}
Here is the caller graph for this function:| ilNote::getLabel | ( | ) |
get label
Definition at line 241 of file class.ilNote.php.
{
return $this->label;
}
| ilNote::getObject | ( | ) |
Definition at line 96 of file class.ilNote.php.
{
return array("rep_obj_id" => $this->rep_obj_id,
"obj_id" => $this->obj_id,
"obj_type" => $this->obj_type);
}
| ilNote::getSubject | ( | ) |
get subject
Definition at line 179 of file class.ilNote.php.
{
return $this->subject;
}
| ilNote::getText | ( | ) |
get text
Definition at line 159 of file class.ilNote.php.
{
return $this->text;
}
| ilNote::getType | ( | ) |
get type
Definition at line 119 of file class.ilNote.php.
{
return $this->type;
}
| ilNote::getUpdateDate | ( | ) |
get update date
Definition at line 219 of file class.ilNote.php.
{
return $this->update_date;
}
| ilNote::ilNote | ( | $ | a_id = 0 |
) |
constructor
Definition at line 50 of file class.ilNote.php.
References read().
Referenced by _getLastNotesOfUser(), and _getNotesOfObject().
{
if ($a_id > 0)
{
$this->id = $a_id;
$this->read();
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilNote::read | ( | ) |
Definition at line 288 of file class.ilNote.php.
References getId(), and setAllData().
Referenced by ilNote().
{
global $ilDB;
$q = "SELECT * FROM note WHERE id = ".
$ilDB->quote($this->getId());
$set = $ilDB->query($q);
$note_rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
$this->setAllData($note_rec);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilNote::setAllData | ( | $ | a_note_rec | ) |
set all note data by record array
Definition at line 314 of file class.ilNote.php.
References setAuthor(), setCreationDate(), setId(), setLabel(), setObject(), setSubject(), setText(), setType(), and setUpdateDate().
Referenced by read().
{
$this->setId($a_note_rec["id"]);
$this->setObject($a_note_rec["obj_type"], $a_note_rec["rep_obj_id"], $a_note_rec["obj_id"]);
$this->setType($a_note_rec["type"]);
$this->setAuthor($a_note_rec["author"]);
$this->setText($a_note_rec["text"]);
$this->setSubject($a_note_rec["subject"]);
$this->setLabel($a_note_rec["label"]);
$this->setCreationDate($a_note_rec["creation_date"]);
$this->setUpdateDate($a_note_rec["update_date"]);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilNote::setAuthor | ( | $ | a_user_id | ) |
set author
| int | author user id |
Definition at line 129 of file class.ilNote.php.
Referenced by setAllData().
{
$this->author = $a_user_id;
}
Here is the caller graph for this function:| ilNote::setCreationDate | ( | $ | a_date | ) |
set creation date
| string | creation date |
Definition at line 189 of file class.ilNote.php.
Referenced by setAllData().
{
$this->creation_date = $a_date;
}
Here is the caller graph for this function:| ilNote::setId | ( | $ | a_id | ) |
set id
| int | note id |
Definition at line 64 of file class.ilNote.php.
Referenced by setAllData().
{
$this->id = $a_id;
}
Here is the caller graph for this function:| ilNote::setLabel | ( | $ | a_label | ) |
set label
| int | IL_NOTE_UNLABELED | IL_NOTE_IMPORTANT | IL_NOTE_QUESTION | IL_NOTE_PRO | IL_NOTE_CONTRA |
Definition at line 230 of file class.ilNote.php.
Referenced by setAllData().
{
return $this->label = $a_label;
}
Here is the caller graph for this function:| ilNote::setObject | ( | $ | a_obj_type, | |
| $ | a_rep_obj_id, | |||
| $ | a_obj_id = 0 | |||
| ) |
set assigned object
| $a_type | string type of the object (e.g st,pg,crs ...) | |
| $a_rep_obj_id | int 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_id | int 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 89 of file class.ilNote.php.
Referenced by setAllData().
{
$this->rep_obj_id = $a_rep_obj_id;
$this->obj_id = $a_obj_id;
$this->obj_type = $a_obj_type;
}
Here is the caller graph for this function:| ilNote::setSubject | ( | $ | a_subject | ) |
set subject
| string | text |
Definition at line 169 of file class.ilNote.php.
Referenced by setAllData().
{
$this->subject = $a_subject;
}
Here is the caller graph for this function:| ilNote::setText | ( | $ | a_text | ) |
set text
| string | text |
Definition at line 149 of file class.ilNote.php.
Referenced by setAllData().
{
$this->text = $a_text;
}
Here is the caller graph for this function:| ilNote::setType | ( | $ | a_type | ) |
set type
| int | IL_NOTE_PUBLIC | IL_NOTE_PRIVATE |
Definition at line 109 of file class.ilNote.php.
Referenced by setAllData().
{
$this->type = $a_type;
}
Here is the caller graph for this function:| ilNote::setUpdateDate | ( | $ | a_date | ) |
set update date
| string | update date |
Definition at line 209 of file class.ilNote.php.
Referenced by setAllData().
{
$this->update_date = $a_date;
}
Here is the caller graph for this function:| ilNote::update | ( | ) |
Definition at line 267 of file class.ilNote.php.
References _lookupUpdateDate(), and getId().
{
global $ilDB;
$q = "UPDATE note SET ".
"rep_obj_id = ".$ilDB->quote($this->rep_obj_id).",".
"obj_id = ".$ilDB->quote($this->obj_id).",".
"obj_type = ".$ilDB->quote($this->obj_type).",".
"type = ".$ilDB->quote($this->type).",".
"author = ".$ilDB->quote($this->author).",".
"text = ".$ilDB->quote($this->text).",".
"subject = ".$ilDB->quote($this->subject).",".
"update_date = now(),".
"label = ".$ilDB->quote($this->label).
"WHERE id =".$ilDB->quote($this->getId());
$ilDB->query($q);
$this->update_date = ilNote::_lookupUpdateDate($this->getId());
}
Here is the call graph for this function:
1.7.1