ActionBoxGenerator.php
1 year ago
AnnouncementsGenerator.php
1 year ago
CourseMetaGenerator.php
1 year ago
CourseThumbnailGenerator.php
1 year ago
ElementGenerator.php
1 year ago
GradebookGenerator.php
1 year ago
InstructorGenerator.php
1 year ago
LessonGenerator.php
1 year ago
Preview.php
1 year ago
QnAGenerator.php
1 year ago
RatingGenerator.php
1 year ago
ResourcesGenerator.php
1 year ago
ShareGenerator.php
1 year ago
TopicsGenerator.php
1 year ago
WishListGenerator.php
1 year ago
TopicsGenerator.php
44 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Preview script for html markup generator |
| 4 | * |
| 5 | * @package tutor-droip-elements |
| 6 | */ |
| 7 | |
| 8 | namespace TutorLMSDroip\ElementGenerator; |
| 9 | |
| 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | exit; // Exit if accessed directly. |
| 12 | } |
| 13 | |
| 14 | /** |
| 15 | * Class ActionboxGenerator |
| 16 | * This class is used to define all helper functions. |
| 17 | */ |
| 18 | trait TopicsGenerator { |
| 19 | |
| 20 | /** |
| 21 | * Generate topics markup |
| 22 | */ |
| 23 | private function generate_topics_markup() { |
| 24 | switch ( $this->element['name'] ) { |
| 25 | case TDE_APP_PREFIX . '-topics': |
| 26 | $course_id = isset( $this->options['post'] ) ? $this->options['post']->ID : get_the_ID(); |
| 27 | $topics = tutor_utils()->get_topics($course_id); |
| 28 | |
| 29 | $child = ! is_null( $topics ) && count( $topics->posts ) > 0 ? |
| 30 | call_user_func( $this->generate_child_element, $this->element['children'][1], $this->options ) : |
| 31 | call_user_func( $this->generate_child_element, $this->element['children'][0], $this->options ); |
| 32 | |
| 33 | return "<div $this->attributes>$child</div>"; |
| 34 | |
| 35 | case TDE_APP_PREFIX . '-has-topics': |
| 36 | return $this->generate_common_element(); |
| 37 | |
| 38 | case TDE_APP_PREFIX . '-no-topics': |
| 39 | return $this->generate_common_element(); |
| 40 | |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 |