public function delete($id)
 {
     $id = (int) $id;
     $this->_access->query("START TRANSACTION");
     $manageRateDomain = new RateDomainManager();
     $manageRateQuality = new RateQualityManager();
     $manageRateDomain->deleteByActivityId($id);
     $manageRateQuality->deleteByActivityId($id);
     $manageSlide = new SlideManager();
     $slides = $manageSlide->getSlidesOfLesson($id);
     foreach ($slides as $slide) {
         $manageSlide->delete($slide->id());
     }
     $lesson = $this->getById($id);
     if ($lesson->getPostId() !== 0) {
         $this->unpost($lesson);
     }
     $this->_access->delete(StudyPressDB::getTableNameVisite(), array(StudyPressDB::COL_ID_ACTIVITY_VISITE => $id));
     $this->_access->delete(StudyPressDB::getTableNameActivity(), array(StudyPressDB::COL_ID_ACTIVITY => $id));
     if ($this->isError()) {
         $m = $this->getMessageError();
         $this->_access->query("ROLLBACK");
         $this->_access->setMsgError($m);
     } else {
         $this->_access->query("COMMIT");
     }
 }
if (isset($_POST['type']) && $_POST['type'] === "remove-slide") {
    if (isset($_POST['id_lesson']) && isset($_POST['id_slide'])) {
        $managerLesson = new LessonManager();
        $managerSlide = new SlideManager();
        $v = new validation();
        $v->addSource($_POST);
        $v->AddRules(array('id_lesson' => array('type' => 'numeric', 'required' => 'true', 'min' => '1', 'max' => '999999', 'trim' => 'true'), 'id_slide' => array('type' => 'numeric', 'required' => 'true', 'min' => '1', 'max' => '999999', 'trim' => 'true')));
        $v->run();
        if (sizeof($v->errors) > 0) {
            header("HTTP/1.0 400 Bad Request");
        } else {
            $lesson = $managerLesson->getById($v->sanitized['id_lesson']);
            if ($lesson) {
                foreach ($lesson->getSlides() as $l) {
                    if ($l->id() == $v->sanitized['id_slide']) {
                        $managerSlide->delete($v->sanitized['id_slide']);
                        echo "true";
                        break;
                    }
                }
            }
        }
    }
}
if (isset($_POST['type']) && $_POST['type'] === "get-slide") {
    if (isset($_POST['id_lesson']) && isset($_POST['id_slide'])) {
        $managerLesson = new LessonManager();
        $managerSlide = new SlideManager();
        $v = new validation();
        $v->addSource($_POST);
        $v->AddRules(array('id_lesson' => array('type' => 'numeric', 'required' => 'true', 'min' => '1', 'max' => '999999', 'trim' => 'true'), 'id_slide' => array('type' => 'numeric', 'required' => 'true', 'min' => '1', 'max' => '999999', 'trim' => 'true')));