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