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"); } }
public function delete($id) { $id = (int) $id; $this->_access->query("START TRANSACTION"); $manageRateDomain = new RateDomainManager(); $manageRateQuality = new RateQualityManager(); $manageRateDomain->deleteByActivityId($id); $manageRateQuality->deleteByActivityId($id); $manageQuestion = new QuestionManager(); $questions = $manageQuestion->getQuestionsOfQuiz($id); foreach ($questions as $q) { $manageQuestion->delete($q->getId()); } $this->deleteResultByQuiz($id); $quiz = $this->getById($id); if ($quiz->getPostId() !== 0) { $this->unpost($quiz); } $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"); } }
<?php global $tr; require_once '_AutoLoadClassAjax.php'; $aResponse['error'] = false; $aResponse['message'] = ''; if (StudyPressUserWP::isLoggedIn()) { if (isset($_POST['action'])) { if (htmlentities($_POST['action'], ENT_QUOTES, 'UTF-8') == 'rating') { $lessonId = (int) (isset($_POST['idBox']) ? $_POST['idBox'] : 0); $value = (int) (isset($_POST['rate']) ? $_POST['rate'] : 0); $userId = (int) (isset($_POST['user']) ? $_POST['user'] : 0); $managerRate = new RateQualityManager(); $currentUser = new StudyPressUserWP(); if ($value >= 1 && $value <= 5 && $currentUser->id() === $userId) { if ($rate = $managerRate->voteExist($lessonId, $userId)) { $rate->setValue($value); $rate->setDateRate(StudyPressDB::getCurrentDateTime()); $managerRate->update($rate->getId(), $rate); } else { $managerRate->add(new RateQuality(array('value' => $value, 'userId' => $userId, 'activityId' => $lessonId, 'dateRate' => StudyPressDB::getCurrentDateTime()))); } if ($managerRate->isError()) { $success = false; } else { $success = true; } } else { $success = false; } if ($success) {
<div class="progress"> <div class="progress-bar progress-bar-striped" role="progressbar" aria-valuemin="0" aria-valuemax="100" > <span class="sr-only"></span> </div> </div> </div> <?php //$get_children_array = PostWP::getChildrenPost($args); echo "<div class='sp-courses'><h2>" . $tr->__("Activities:") . "</h2><ul>"; $type = ""; foreach ($activities as $activity) { if ($activity->getPostId() !== 0) { $nbrActivities++; $managerLesson = new LessonManager(); $managerQuiz = new QuizManager(); $managerRate = new RateQualityManager(); $link = get_permalink($activity->getPostId()); if ($activity instanceof Lesson) { $icon = "glyphicon-book"; $type = $tr->__("Lesson"); $image = "lesson"; $manager = $managerLesson; } else { $icon = "glyphicon-check"; $image = "quiz"; $type = $tr->__("Quiz"); $manager = $managerQuiz; } $med_image_url = wp_get_attachment_image_src($activity->getPictureUrl(), $size = 'thumbnail'); if (!$med_image_url[0]) { $med_image_url[0] = __ROOT_PLUGIN__2 . "images/" . $image . ".png";
<?php /** * Created by PhpStorm. * User: Salim * Date: 18/03/2015 * Time: 17:04 */ // Interdire l'accée direct... if (!defined('ABSPATH')) { exit; } $managerRate = new RateQualityManager(); ?> <!-- Div rating--> <div class="sp-rater"> <div class="sp-btn-rater"></div> <div class="sp-content-rater hide"> <!-- Rate Quality --> <div class="sp-rater-quality"> <?php $managerDomain = new DomainManager(); $managerRateDomain = new RateDomainManager(); $domains = $managerDomain->getAll(); ?> <h2><?php if ($domains) {