Exemple #1
0
 /**
  * add note
  */
 function addNote()
 {
     global $ilUser, $lng, $ilCtrl;
     $this->initNoteForm("create", $_GET["note_type"]);
     //if ($this->form->checkInput())
     if ($_POST["note"] != "") {
         $note = new ilNote();
         $note->setObject($this->obj_type, $this->rep_obj_id, $this->obj_id);
         $note->setInRepository($this->repository_mode);
         $note->setType($_GET["note_type"]);
         $note->setAuthor($ilUser->getId());
         $note->setText(ilUtil::stripslashes($_POST["note"]));
         //			$note->setSubject($_POST["sub_note"]);
         //			$note->setLabel($_POST["note_label"]);
         $note->create();
         $this->notifyObserver("new", $note);
         $ilCtrl->setParameter($this, "note_mess", "mod");
         //			$ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
     }
     $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
     //		$this->note_mess = "frmfld";
     //		$this->form->setValuesByPost();
     //		return $this->addNoteForm(false);;
 }
 /**
  * Import record
  *
  * @param
  * @return
  */
 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 {
     switch ($a_entity) {
         case "user_notes":
             $usr_id = $a_mapping->getMapping("Services/User", "usr", $a_rec["Author"]);
             if ($usr_id > 0) {
                 include_once "./Services/Notes/classes/class.ilNote.php";
                 // only import real user (assigned to personal desktop) notes
                 // here.
                 if ((int) $a_rec["RepObjId"] == 0 && $a_rec["ObjId"] == $a_rec["Author"] && $a_rec["Type"] == IL_NOTE_PRIVATE && $a_rec["ObjType"] == "pd") {
                     $note = new ilNote();
                     $note->setObject("pd", 0, $usr_id);
                     $note->setType(IL_NOTE_PRIVATE);
                     $note->setAuthor($usr_id);
                     $note->setText($a_rec["NoteText"]);
                     $note->setSubject($a_rec["Subject"]);
                     $note->setCreationDate($a_rec["CreationDate"]);
                     $note->setLabel($a_rec["Label"]);
                     $note->create(true);
                 }
             }
             break;
     }
 }