Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00035 require_once "class.ilObject.php";
00036
00037
00038
00039 class ilObjNoteFolder extends ilObject
00040 {
00041 var $m_usr_id;
00042
00043 var $m_tree;
00044
00045 var $m_notefId ;
00046
00053 function ilObjNoteFolder($user_id = 0,$a_call_by_reference = true)
00054 {
00055 $this->type = "notf";
00056 $this->ilObject($user_id,$a_call_by_reference);
00057
00058 $this->m_usr_id = $user_id;
00059 }
00060
00066 function create()
00067 {
00068 parent::create();
00069
00070
00071
00072
00073
00074 }
00075
00083 function addNote($note_id, $group="")
00084 {
00085
00086 global $rbacreview;
00087
00088 $grp_members = $rbacreview->assignedUsers($group);
00089
00090 if(!empty($group))
00091 {
00092 foreach($grp_members as $member)
00093 {
00094 $myTree = new ilTree(0, 0, $member);
00095
00096
00097 $rootid = $myTree->getRootId();
00098
00099 $node_data = $myTree->getNodeDataByType("notf");
00100
00101 $myTree->insertNode($note_id, $node_data[0]["obj_id"], $rootid["child"]);
00102
00103 }
00104 }
00105
00106 $myTree = new ilTree(0, 0, $this->m_usr_id);
00107
00108
00109 $rootid = $myTree->getRootId();
00110
00111 $node_data = $myTree->getNodeDataByType("notf");
00112
00113 $myTree->insertNode($note_id, $node_data[0]["obj_id"], $rootid["child"]);
00114 }
00115
00122 function deleteNotes($notes)
00123 {
00124 global $rbacsystem;
00125 $myTree = new ilTree($this->m_notefId[0]["obj_id"], 0, 0, $this->m_usr_id);
00126
00127 foreach ($notes as $note)
00128 {
00129
00130
00131 $noteObj =& $this->ilias->obj_factory->getInstanceByObjId($note);
00132 if ($noteObj->getOwner() == $this->m_usr_id)
00133 {
00134 $query = "DELETE FROM note_data WHERE note_id ='".$note."'";
00135 $res = $this->ilias->db->query($query);
00136
00137
00138 }
00139
00140
00141 $node_data1 = $myTree->getNodeDataByType("notf");
00142 $note_data2 = $myTree->getNodeData($note);
00143 $myTree->deleteTree($note_data2);
00144 }
00145 }
00146
00155 function getNotes($note_id = "")
00156 {
00157 $notes = array();
00158 $myTree = new ilTree($this->m_notefId[0]["obj_id"], 0, 0, $this->m_usr_id);
00159
00160 $nodes = $myTree->getNodeDataByType("note");
00161
00162 if($note_id == "")
00163 {
00164 foreach($nodes as $node_data)
00165 {
00166
00167 $noteObj =& $this->ilias->obj_factory->getInstanceByObjId($node_data["child"]);
00168
00169 $note_data = array( "obj_id" => $noteObj->getId(),
00170 "type" => $noteObj->getType(),
00171 "description" => $noteObj->getDescription(),
00172 "owner" => $noteObj->getOwner(),
00173 "create_date" => $noteObj->getCreateDate(),
00174 "last_update" => $noteObj->getCreateDate());
00175 array_push($notes, $note_data);
00176 }
00177
00178 }
00179 else
00180 {
00181
00182
00183 $noteObj =& $this->ilias->obj_factory->getInstanceByObjId($note_id);
00184
00185 $notes = array( "obj_id" => $noteObj->getId(),
00186 "type" => $noteObj->getType(),
00187 "description" => $noteObj->getDescription(),
00188 "owner" => $noteObj->getOwner(),
00189 "create_date" => $noteObj->getCreateDate(),
00190 "last_update" => $noteObj->getCreateDate());
00191
00192 }
00193 return $notes;
00194 }
00195
00196 function viewNote($note_id)
00197 {
00198 $note = array();
00199 $myTree = new ilTree($this->m_notefId[0]["obj_id"], 0, $this->m_usr_id);
00200
00201 $nodes = $myTree->getNodeDataByType("note");
00202 $node_data["child"] = $note_id;
00203 $note = NoteObject::viewObject($node_data["child"]);
00204 return $note;
00205 }
00206
00207 }
00208
00209
00210 ?>