Public Member Functions | Data Fields

ilObjNoteFolder Class Reference

Inheritance diagram for ilObjNoteFolder:
Collaboration diagram for ilObjNoteFolder:

Public Member Functions

 ilObjNoteFolder ($user_id=0, $a_call_by_reference=true)
 Constructor public.
 create ()
 create new note folder object
 addNote ($note_id, $group="")
 add note to notefolder
 deleteNotes ($notes)
 delete one specific note TODO:
 getNotes ($note_id="")
 returns all notes of a specific notefolder
 viewNote ($note_id)

Data Fields

 $m_usr_id
 $m_tree
 $m_notefId

Detailed Description

Definition at line 39 of file class.ilObjNoteFolder.php.


Member Function Documentation

ilObjNoteFolder::addNote ( note_id,
group = "" 
)

add note to notefolder

Parameters:
string note_id
string group_id = obj_id of group public

Definition at line 83 of file class.ilObjNoteFolder.php.

References $rbacreview.

        {

                global $rbacreview;
                //getgroupmembers
                $grp_members = $rbacreview->assignedUsers($group);
        
                if(!empty($group))
                {
                        foreach($grp_members as $member)
                        {       
                                $myTree = new ilTree(0, 0, $member); 

                                //get parent_id of usersettingfolder... 
                                $rootid =  $myTree->getRootId();
        
                                $node_data = $myTree->getNodeDataByType("notf");

                                $myTree->insertNode($note_id, $node_data[0]["obj_id"], $rootid["child"]);
                        
                        }
                }
                //insert the note in ones own notefolder
                $myTree = new ilTree(0, 0, $this->m_usr_id); 
        
                //get parent_id of usersettingfolder... 
                $rootid =  $myTree->getRootId();
        
                $node_data = $myTree->getNodeDataByType("notf");

                $myTree->insertNode($note_id, $node_data[0]["obj_id"], $rootid["child"]);
        } 

ilObjNoteFolder::create (  ) 

create new note folder object

note: title and description must be set

Reimplemented from ilObject.

Definition at line 66 of file class.ilObjNoteFolder.php.

        {
                parent::create();

                //$this->m_tree = new ilTree(0,0,$this->m_usr_id);
                
                // TODO: method needs revision
                //$this->m_notefId = $this->m_tree->getNodeDataByType("notf");
        }

ilObjNoteFolder::deleteNotes ( notes  ) 

delete one specific note TODO:

Parameters:
array note_ids !!! public

Definition at line 122 of file class.ilObjNoteFolder.php.

References $query, $rbacsystem, and $res.

        {
                global $rbacsystem;
                $myTree = new ilTree($this->m_notefId[0]["obj_id"], 0, 0, $this->m_usr_id);     

                foreach ($notes as $note)
                {
                        //delete note in note_data, only owner can delete notes 
                        //$note_obj = getObject($note);
                        $noteObj =& $this->ilias->obj_factory->getInstanceByObjId($note);
                        if ($noteObj->getOwner() == $this->m_usr_id)
                        {
                                $query = "DELETE FROM note_data WHERE note_id ='".$note."'";
                                $res = $this->ilias->db->query($query);
                                //TODO: delete entry in object_data and all dependencies, references 
                                //getgroupmembers and delete the note in members notefolder
                        }

                        //get note_data of note folder
                        $node_data1 = $myTree->getNodeDataByType("notf");               
                        $note_data2 = $myTree->getNodeData($note);      
                        $myTree->deleteTree($note_data2);                               
                }
        }

ilObjNoteFolder::getNotes ( note_id = ""  ) 

returns all notes of a specific notefolder

Parameters:
string title of learning object, i.e
string short description of note
Returns:
array data of notes [note_id|lo_id|text|create_date] public

Definition at line 155 of file class.ilObjNoteFolder.php.

        {
                $notes = array();
                $myTree = new ilTree($this->m_notefId[0]["obj_id"], 0, 0, $this->m_usr_id);

                $nodes = $myTree->getNodeDataByType("note");

                if($note_id == "")
                {
                        foreach($nodes as $node_data)
                        {
                                //$note_data = getObject($node_data["child"]);
                                $noteObj =& $this->ilias->obj_factory->getInstanceByObjId($node_data["child"]);
                                // todo: full object handling (getNodes should return real objects)
                                $note_data = array(     "obj_id" => $noteObj->getId(),
                                                                        "type" => $noteObj->getType(),
                                                                        "description" => $noteObj->getDescription(),
                                                                        "owner" => $noteObj->getOwner(),
                                                                        "create_date" => $noteObj->getCreateDate(),
                                                                        "last_update" => $noteObj->getCreateDate());
                                array_push($notes, $note_data);
                        }

                }
                else
                {
                        //$node_data["child"] = $note_id;
                        //$notes = getObject($node_data["child"]);
                        $noteObj =& $this->ilias->obj_factory->getInstanceByObjId($note_id);
                        // todo: full object handling (getNodes should return real objects)
                        $notes = array( "obj_id" => $noteObj->getId(),
                                                        "type" => $noteObj->getType(),
                                                        "description" => $noteObj->getDescription(),
                                                        "owner" => $noteObj->getOwner(),
                                                        "create_date" => $noteObj->getCreateDate(),
                                                        "last_update" => $noteObj->getCreateDate());

                }
                return $notes;
        }

ilObjNoteFolder::ilObjNoteFolder ( user_id = 0,
a_call_by_reference = true 
)

Constructor public.

Parameters:
integer reference_id or object_id of user
boolean treat the id as reference_id (true) or object_id (false)

Definition at line 53 of file class.ilObjNoteFolder.php.

References $user_id, and ilObject::ilObject().

        {
                $this->type = "notf";
                $this->ilObject($user_id,$a_call_by_reference);
                
                $this->m_usr_id = $user_id;
        }

Here is the call graph for this function:

ilObjNoteFolder::viewNote ( note_id  ) 

Definition at line 196 of file class.ilObjNoteFolder.php.

References viewObject().

        {
                $note = array();
                $myTree = new ilTree($this->m_notefId[0]["obj_id"], 0, $this->m_usr_id);

                $nodes = $myTree->getNodeDataByType("note");
                $node_data["child"] = $note_id;
                $note = NoteObject::viewObject($node_data["child"]);
                return $note;   
        }

Here is the call graph for this function:


Field Documentation

ilObjNoteFolder::$m_notefId

Definition at line 45 of file class.ilObjNoteFolder.php.

ilObjNoteFolder::$m_tree

Definition at line 43 of file class.ilObjNoteFolder.php.

ilObjNoteFolder::$m_usr_id

Definition at line 41 of file class.ilObjNoteFolder.php.


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