ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilNotesDataSet.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/DataSet/classes/class.ilDataSet.php");
5
16{
23 public function getSupportedVersions()
24 {
25 return array("4.3.0");
26 }
27
34 public function getXmlNamespace($a_entity, $a_schema_version)
35 {
36 return "http://www.ilias.de/xml/Services/Notes/" . $a_entity;
37 }
38
45 protected function getTypes($a_entity, $a_version)
46 {
47 // user notes
48 if ($a_entity == "user_notes") {
49 switch ($a_version) {
50 case "4.3.0":
51 return array(
52 "Id" => "integer",
53 "RepObjId" => "integer",
54 "ObjId" => "integer",
55 "ObjType" => "text",
56 "ObjType" => "text",
57 "Type" => "integer",
58 "Author" => "integer",
59 "CreationDate" => "timestamp",
60 "NoteText" => "text",
61 "Label" => "integer",
62 "Subject" => "text",
63 "NoRepository" => "integer"
64 );
65 }
66 }
67 }
68
75 public function readData($a_entity, $a_version, $a_ids, $a_field = "")
76 {
78
79 if (!is_array($a_ids)) {
80 $a_ids = array($a_ids);
81 }
82
83 // user notes
84 if ($a_entity == "user_notes") {
85 switch ($a_version) {
86 case "4.3.0":
87 $this->getDirectDataFromQuery("SELECT id, rep_obj_id, obj_id, obj_type, type, " .
88 " author, note_text, creation_date, label, subject, no_repository " .
89 " FROM note " .
90 " WHERE " .
91 $ilDB->in("author", $a_ids, false, "integer") .
92 " AND obj_type = " . $ilDB->quote("pd", "text"));
93 break;
94 }
95 }
96 }
97
101 protected function getDependencies($a_entity, $a_version, $a_rec, $a_ids)
102 {
103 return false;
104 }
105
109
110
117 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
118 {
119 switch ($a_entity) {
120 case "user_notes":
121 $usr_id = $a_mapping->getMapping("Services/User", "usr", $a_rec["Author"]);
122 if ($usr_id > 0) {
123 include_once("./Services/Notes/classes/class.ilNote.php");
124
125 // only import real user (assigned to personal desktop) notes
126 // here.
127 if ((int) $a_rec["RepObjId"] == 0 &&
128 $a_rec["ObjId"] == $a_rec["Author"] &&
129 $a_rec["Type"] == IL_NOTE_PRIVATE &&
130 $a_rec["ObjType"] == "pd") {
131 $note = new ilNote();
132 $note->setObject("pd", 0, $usr_id);
133 $note->setType(IL_NOTE_PRIVATE);
134 $note->setAuthor($usr_id);
135 $note->setText($a_rec["NoteText"]);
136 $note->setSubject($a_rec["Subject"]);
137 $note->setCreationDate($a_rec["CreationDate"]);
138 $note->setLabel($a_rec["Label"]);
139 $note->create(true);
140 }
141 }
142 break;
143 }
144 }
145}
An exception for terminatinating execution or to throw for unit testing.
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:5
A dataset contains in data in a common structure that can be shared and transformed for different pur...
getDirectDataFromQuery($a_query, $a_convert_to_leading_upper=true, $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
Note class.
Notes Data set class.
getSupportedVersions()
Get supported versions.
getDependencies($a_entity, $a_version, $a_rec, $a_ids)
Determine the dependent sets of data.
getTypes($a_entity, $a_version)
Get field types for entity.
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
Import record.
readData($a_entity, $a_version, $a_ids, $a_field="")
Read data.
global $ilDB