Esempio n. 1
0
 /**
  * Removes all annotations for a single site. Only super users can use this method.
  *
  * @param string $idSite The ID of the site to remove annotations for.
  */
 public function deleteAll($idSite)
 {
     $this->checkSingleIdSite($idSite, $extraMessage = "Note: Cannot delete annotations from multiple sites.");
     Piwik::checkUserHasSuperUserAccess();
     $annotations = new AnnotationList($idSite);
     // remove the notes & save the list
     $annotations->removeAll($idSite);
     $annotations->save($idSite);
 }
Esempio n. 2
0
 /**
  * Removes an annotation from a site's list of annotations.
  *
  * If the current user is not allowed to delete the annotation, an exception
  * will be thrown. A user can delete a note if:
  *  - the user has admin access for the site, OR
  *  - the user has view access, is not the anonymous user and is the user that
  *    created the note
  *
  * @param string $idSite The site ID to add the annotation to.
  * @param string $idNote The ID of the note to delete.
  */
 public function delete($idSite, $idNote)
 {
     $this->checkSingleIdSite($idSite, $extraMessage = "Note: Cannot delete multiple notes.");
     $annotations = new AnnotationList($idSite);
     // check permissions
     $this->checkUserCanModifyOrDelete($idSite, $annotations->get($idSite, $idNote));
     // remove the note & save the list
     $annotations->remove($idSite, $idNote);
     $annotations->save($idSite);
 }