<?php if (!ThemexCore::checkOption('course_retake')) { ?> <a href="#" class="element-button secondary medium submit-button left"><?php _e('Unsubscribe Now', 'academy'); ?> </a> <input type="hidden" name="course_action" value="remove_user" /> <?php } ?> <?php if (ThemexCourse::hasCertificate()) { ?> <a href="<?php echo ThemexCore::getURL('certificate', themex_encode(ThemexCourse::$data['ID'], ThemexUser::$data['user']['ID'])); ?> " target="_blank" class="element-button medium certificate-button"><?php _e('View Certificate', 'academy'); ?> </a> <?php } ?> <?php } } ?> <input type="hidden" name="course_id" value="<?php echo ThemexCourse::$data['ID']; ?>
/** * Gets course certificate * * @access public * @param int $ID * @param int $user * @return array */ public static function getCertificate($ID, $user) { $certificate['content'] = ThemexCore::getPostMeta($ID, 'course_certificate_content'); $certificate['progress'] = self::getProgress($ID, $user); if (!empty($certificate['content']) && $certificate['progress'] == 100) { $username = trim(get_user_meta($user, 'first_name', true) . ' ' . get_user_meta($user, 'last_name', true)); $title = get_the_title($ID); $grade = self::getGrade($ID, $user) . '%'; $number = themex_encode($ID, $user); $time = ThemexCore::getUserRelations($user, $ID, 'certificate', true); $date = date_i18n(get_option('date_format'), $time); if ($time == 0) { $date = date_i18n(get_option('date_format')); } $keywords = array('username' => $username, 'title' => $title, 'grade' => $grade, 'number' => $number, 'date' => $date); $certificate['user'] = $user; $certificate['background'] = ThemexCore::getPostMeta($ID, 'course_certificate_background'); $certificate['content'] = wpautop(themex_keywords($certificate['content'], $keywords)); } return $certificate; }
/** * Gets lesson attachments * * @access public * @param int $ID * @return array */ public static function getAttachments($ID) { $attachments = array_values(themex_filter(ThemexCore::getPostMeta($ID, 'lesson_attachments'))); foreach ($attachments as $index => &$attachment) { $attachment['redirect'] = ThemexCore::getURL('file', themex_encode($index, $ID)); } return $attachments; }