ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 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 {
50 switch ($a_version)
51 {
52 case "4.3.0":
53 return array(
54 "Id" => "integer",
55 "RepObjId" => "integer",
56 "ObjId" => "integer",
57 "ObjType" => "text",
58 "ObjType" => "text",
59 "Type" => "integer",
60 "Author" => "integer",
61 "CreationDate" => "timestamp",
62 "NoteText" => "text",
63 "Label" => "integer",
64 "Subject" => "text",
65 "NoRepository" => "integer"
66 );
67 }
68 }
69 }
70
77 function readData($a_entity, $a_version, $a_ids, $a_field = "")
78 {
79 global $ilDB;
80
81 if (!is_array($a_ids))
82 {
83 $a_ids = array($a_ids);
84 }
85
86 // user notes
87 if ($a_entity == "user_notes")
88 {
89 switch ($a_version)
90 {
91 case "4.3.0":
92 $this->getDirectDataFromQuery("SELECT id, rep_obj_id, obj_id, obj_type, type, ".
93 " author, note_text, creation_date, label, subject, no_repository ".
94 " FROM note ".
95 " WHERE ".
96 $ilDB->in("author", $a_ids, false, "integer").
97 " AND obj_type = ".$ilDB->quote("pd" ,"text"));
98 break;
99 }
100 }
101 }
102
106 protected function getDependencies($a_entity, $a_version, $a_rec, $a_ids)
107 {
108 return false;
109 }
110
114
115
122 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
123 {
124 switch ($a_entity)
125 {
126 case "user_notes":
127 $usr_id = $a_mapping->getMapping("Services/User", "usr", $a_rec["Author"]);
128 if ($usr_id > 0)
129 {
130 include_once("./Services/Notes/classes/class.ilNote.php");
131
132 // only import real user (assigned to personal desktop) notes
133 // here.
134 if ((int) $a_rec["RepObjId"] == 0 &&
135 $a_rec["ObjId"] == $a_rec["Author"] &&
136 $a_rec["Type"] == IL_NOTE_PRIVATE &&
137 $a_rec["ObjType"] == "pd")
138 {
139 $note = new ilNote();
140 $note->setObject("pd", 0, $usr_id);
141 $note->setType(IL_NOTE_PRIVATE);
142 $note->setAuthor($usr_id);
143 $note->setText($a_rec["NoteText"]);
144 $note->setSubject($a_rec["Subject"]);
145 $note->setCreationDate($a_rec["CreationDate"]);
146 $note->setLabel($a_rec["Label"]);
147 $note->create(true);
148 }
149 }
150 break;
151 }
152 }
153}
154?>
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:4
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)
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