/** * Create a new annotation for a site. * * @param string $idSite The site ID to add the annotation to. * @param string $date The date the annotation is attached to. * @param string $note The text of the annotation. * @param int $starred Either 0 or 1. Whether the annotation should be starred. * @return array Returns an array of two elements. The first element (indexed by * 'annotation') is the new annotation. The second element (indexed * by 'idNote' is the new note's ID). */ public function add($idSite, $date, $note, $starred = 0) { $this->checkSingleIdSite($idSite, $extraMessage = "Note: Cannot add one note to multiple sites."); $this->checkDateIsValid($date); $this->checkUserCanAddNotesFor($idSite); // add, save & return a new annotation $annotations = new AnnotationList($idSite); $newAnnotation = $annotations->add($idSite, $date, $note, $starred); $annotations->save($idSite); return $newAnnotation; }