function slide_presentation_quiz(Quiz $quiz, $name)
{
    global $tr;
    $manageCourse = new CourseManager();
    $c = $manageCourse->getById($quiz->getCourseId());
    return "<div class='sp-presentation-content'>\r\n            <div>\r\n                <h4><strong>" . $tr->__("Author") . "</strong>: " . $name . "</h4>\r\n                <h4><strong>" . $tr->__("Course") . "</strong>: " . $c->getName() . "</h4>\r\n                <h4><strong>" . $tr->__("Duration") . "</strong>: " . $quiz->getDuration() . " min</h4>\r\n            </div>\r\n            <h2>" . $quiz->getName() . "</h2>\r\n\r\n        </div>";
}
     exit;
 }
 wp_enqueue_media();
 global $tr;
 $user = new StudyPressUserWP();
 $managerCourse = new CourseManager();
 $course = null;
 $error_course_update = "";
 $error_course_add = "";
 if (isset($_GET['id']) && !empty($_GET['id'])) {
     $v = new validation();
     $v->addSource($_GET);
     $v->addRule('id', 'numeric', true, 1, 9999999, true);
     $v->run();
     if (!sizeof($v->errors) > 0) {
         $course = $managerCourse->getById($v->sanitized['id']);
         if ($course) {
             if (isset($_POST['update'])) {
                 if ($user->isAdministrator()) {
                     if (isset($_POST['course']) && isset($_POST['course']['categories']) && isset($_POST['course']['users'])) {
                         $v1 = new validation();
                         $v2 = new validation();
                         $v3 = new validation();
                         $v1->addSource($_POST['course']);
                         $v2->addSource($_POST['course']['categories']);
                         $v3->addSource($_POST['course']['users']);
                         //rule Image
                         if (isset($_POST['course']['pictureId']) && !empty($_POST['course']['pictureId'])) {
                             $v1->addRule('pictureId', 'numeric', true, 1, 999999, true);
                         }
                         $v1->AddRules(array('id' => array('type' => 'numeric', "required" => true, 'min' => '1', 'max' => '999999', 'trim' => true), 'name' => array('type' => 'string', "required" => true, 'min' => '1', 'max' => '200', 'trim' => true), 'description' => array('type' => 'string', "required" => true, 'min' => '0', 'max' => '999999', 'trim' => true)));
                if (sizeof($v->errors) > 0) {
                    $error_quiz_update = $v->getMessageErrors();
                } else {
                    $currentUser = new StudyPressUserWP();
                    if ($managerCourse->getCoursesByAuthor($currentUser->id())) {
                        $quiz = $managerQuiz->getById($v->sanitized['id']);
                        $quiz->setName($v->sanitized['name']);
                        $quiz->setCourseId($v->sanitized['courseId']);
                        $quiz->setDescription($v->sanitized['description']);
                        $quiz->setDuration($v->sanitized['duree']);
                        $quiz->setPictureUrl($v->sanitized['pictureurl']);
                        $quiz->setTags($notes);
                        $quiz->setGlossary($glossaires);
                        $managerQuiz->update($v->sanitized['id'], $quiz);
                        $quiz = $managerQuiz->getById($v->sanitized['id']);
                    }
                }
            }
        } else {
            wp_die("Access denied !");
        }
        $course = $managerCourse->getById($quiz->getCourseId());
        if ($user->isAdministrator() || in_array($user->id(), $course->getAuthors())) {
            require_once __ROOT_PLUGIN__ . "Views/admin/modQuiz.view.php";
        } else {
            wp_die("Access denied !");
        }
    } else {
        echo "<h3>" . $tr->__("Page not found") . " !!</h3>";
    }
}
Example #4
0
wp_register_style("display_css_rating", plugins_url("../css/player/rating.css", __FILE__));
wp_enqueue_style('display_css_rating');
?>

<style>
    #sp-rate-id
    {
        margin: 0;
        padding: 0;

    }
</style>

<?php 
$managerCourse = new CourseManager();
$course = $managerCourse->getById($id);
if ($course) {
    if ($course->getPictureId()) {
        $courseImageUrl = wp_get_attachment_image_src($course->getPictureId(), $size = 'thumbnail');
    } else {
        $courseImageUrl[0] = __ROOT_PLUGIN__2 . "images/course.png";
    }
    ?>


    <div class='course-description'>
        <p>

            <img src="<?php 
    echo $courseImageUrl[0];
    ?>
                if (sizeof($v->errors) > 0) {
                    $error_lesson_update = $v->getMessageErrors();
                } else {
                    $currentUser = new StudyPressUserWP();
                    if ($managerCourse->getCoursesByAuthor($currentUser->id())) {
                        $lesson = $managerLesson->getById($v->sanitized['id']);
                        $lesson->setName($v->sanitized['name']);
                        $lesson->setCourseId($v->sanitized['courseId']);
                        $lesson->setDescription($v->sanitized['description']);
                        $lesson->setDuration($v->sanitized['duree']);
                        $lesson->setPictureUrl($v->sanitized['pictureurl']);
                        $lesson->setTags($notes);
                        $lesson->setGlossary($glossaires);
                        $managerLesson->update($v->sanitized['id'], $lesson);
                        $lesson = $managerLesson->getById($v->sanitized['id']);
                    }
                }
            }
        } else {
            wp_die("Access denied !");
        }
        $course = $managerCourse->getById($lesson->getCourseId());
        if ($user->isAdministrator() || in_array($user->id(), $course->getAuthors())) {
            require_once __ROOT_PLUGIN__ . "Views/admin/modLesson.view.php";
        } else {
            wp_die("Access denied !");
        }
    } else {
        echo "<h3>" . $tr->__("Page not found") . " !!</h3>";
    }
}
 public function shareOnGroupsBP(AbstractActivity $activity, $action, $content)
 {
     if (self::isBuddyPressActive()) {
         $configuration = new Configuration();
         $configuration = $configuration->getConfig();
         if ($configuration['bp_shareActivity'] === 'true') {
             $managerCourse = new CourseManager();
             $course = $managerCourse->getById($activity->getCourseId());
             foreach ($course->getGroupsBP() as $groupId) {
                 $activity_id = bp_activity_add(array('user_id' => $activity->getAuthorId(), 'component' => 'groups', 'type' => 'activity_update', 'action' => $action, 'content' => $content, 'item_id' => $groupId));
             }
         }
     }
 }