/**
* ============================================================
* LMX26 — TEMPLATE UNIVERSAL DE CURSO
* LearnPress
* ============================================================
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* ------------------------------------------------------------
* HELPERS
* ------------------------------------------------------------
*/
function lmx26_course_get_id( $atts = array() ) {
/**
* 1. ID enviado pelo shortcode:
*
* [lmx26_course_detail course_id="123"]
*/
if ( ! empty( $atts['course_id'] ) ) {
$course_id = absint(
$atts['course_id']
);
if ( $course_id ) {
return $course_id;
}
}
/**
* 2. Query string:
*
* ?course_id=123
*/
if ( isset( $_GET['course_id'] ) ) {
$course_id = absint(
wp_unslash(
$_GET['course_id']
)
);
if ( $course_id ) {
return $course_id;
}
}
/**
* 3. Página actual.
*/
$current_id =
get_queried_object_id();
if (
$current_id &&
get_post_type( $current_id ) === 'lp_course'
) {
return $current_id;
}
/**
* 4. Post global.
*/
if (
get_the_ID() &&
get_post_type( get_the_ID() ) === 'lp_course'
) {
return get_the_ID();
}
return 0;
}
/**
* ------------------------------------------------------------
* CATEGORIAS
* ------------------------------------------------------------
*/
function lmx26_course_categories(
$course_id
) {
$terms =
get_the_terms(
$course_id,
'course_category'
);
if (
empty( $terms ) ||
is_wp_error( $terms )
) {
return array();
}
return array_values(
array_map(
function ( $term ) {
return array(
'id' => $term->term_id,
'name' => $term->name,
'slug' => $term->slug,
'url' => get_term_link(
$term
),
);
},
$terms
)
);
}
/**
* ------------------------------------------------------------
* CURRÍCULO
* ------------------------------------------------------------
*/
function lmx26_course_curriculum(
$course_id
) {
$result = array();
if (
! function_exists(
'learn_press_get_course'
)
) {
return $result;
}
$course =
learn_press_get_course(
$course_id
);
if ( ! $course ) {
return $result;
}
/**
* LearnPress expõe os itens do currículo
* através do objecto do curso.
*/
try {
$items =
$course->get_curriculum_items();
} catch ( Throwable $e ) {
$items = array();
}
if ( empty( $items ) ) {
return $result;
}
foreach ( $items as $item ) {
$item_id =
absint(
$item->ID
);
if ( ! $item_id ) {
continue;
}
$type =
get_post_type(
$item_id
);
$is_quiz =
(
$type === 'lp_quiz'
);
$title =
get_the_title(
$item_id
);
$url =
get_permalink(
$item_id
);
$result[] = array(
'id' =>
$item_id,
'title' =>
$title
? $title
: 'Item sem título',
'type' =>
$is_quiz
? 'quiz'
: 'lesson',
'type_label' =>
$is_quiz
? 'Quiz'
: 'Aula',
'url' =>
$url
? $url
: '#',
'excerpt' =>
wp_trim_words(
wp_strip_all_tags(
get_post_field(
'post_content',
$item_id
)
),
20
),
);
}
return $result;
}
/**
* ------------------------------------------------------------
* UTILIZADOR / PROGRESSO
* ------------------------------------------------------------
*/
function lmx26_course_user_state(
$course_id
) {
$result = array(
'logged_in' =>
false,
'enrolled' =>
false,
'started' =>
false,
'completed' =>
false,
'passed' =>
false,
'status' =>
'not-enrolled',
'progress' =>
0,
);
if (
! is_user_logged_in()
) {
return $result;
}
$user_id =
get_current_user_id();
if (
! function_exists(
'learn_press_get_user'
)
) {
return $result;
}
$user =
learn_press_get_user(
$user_id
);
if ( ! $user ) {
return $result;
}
$result['logged_in'] =
true;
try {
$status =
$user->get_course_status(
$course_id
);
$result['status'] =
$status
? $status
: 'not-enrolled';
$result['enrolled'] =
in_array(
$status,
array(
'purchased',
'enrolled',
'started',
'finished',
'completed',
),
true
);
$result['started'] =
in_array(
$status,
array(
'started',
'finished',
'completed',
),
true
);
$result['completed'] =
in_array(
$status,
array(
'finished',
'completed',
),
true
);
$result['passed'] =
method_exists(
$user,
'has_passed_course'
)
? (
bool
$user->has_passed_course(
$course_id
)
)
: false;
/**
* LearnPress guarda o resultado
* do curso no objecto do utilizador.
*/
$course_data =
$user->get_course_data(
$course_id
);
if (
$course_data &&
method_exists(
$course_data,
'get_results'
)
) {
$results =
$course_data->get_results();
if (
is_array( $results )
) {
foreach (
array(
'progress',
'percent',
'percentage',
)
as $key
) {
if (
isset(
$results[ $key ]
) &&
is_numeric(
$results[ $key ]
)
) {
$result['progress'] =
max(
0,
min(
100,
(float)
$results[ $key ]
)
);
break;
}
}
}
}
if (
$result['completed']
) {
$result['progress'] =
100;
}
} catch ( Throwable $e ) {
if (
defined( 'WP_DEBUG' ) &&
WP_DEBUG
) {
error_log(
'LMX26 Course State: ' .
$e->getMessage()
);
}
}
return $result;
}
/**
* ------------------------------------------------------------
* SHORTCODE
* ------------------------------------------------------------
*/
add_shortcode(
'lmx26_course_detail',
function ( $atts ) {
$atts =
shortcode_atts(
array(
'course_id' => 0,
),
$atts,
'lmx26_course_detail'
);
$course_id =
lmx26_course_get_id(
$atts
);
if ( ! $course_id ) {
return '
Curso não encontrado.
';
}
if (
get_post_type(
$course_id
) !== 'lp_course'
) {
return '
O conteúdo indicado não é um curso LearnPress.
';
}
/**
* Dados base.
*/
$title =
get_the_title(
$course_id
);
$content =
get_post_field(
'post_content',
$course_id
);
$excerpt =
get_post_field(
'post_excerpt',
$course_id
);
if ( ! $excerpt ) {
$excerpt =
wp_trim_words(
wp_strip_all_tags(
$content
),
34
);
}
$categories =
lmx26_course_categories(
$course_id
);
$curriculum =
lmx26_course_curriculum(
$course_id
);
$user_state =
lmx26_course_user_state(
$course_id
);
$duration =
get_post_meta(
$course_id,
'_lp_duration',
true
);
$price =
get_post_meta(
$course_id,
'_lp_price',
true
);
$regular_price =
get_post_meta(
$course_id,
'_lp_regular_price',
true
);
$featured_image =
get_the_post_thumbnail_url(
$course_id,
'large'
);
$course_url =
get_permalink(
$course_id
);
ob_start();
?>
CONTEÚDO DO CURSO
O que vai aprender.
Explore o percurso e descubra como
o conteúdo está organizado.
O currículo deste curso ainda não está disponível.
1f2f2fa438","is_course_archive":"","courses_url":"https:\/\/e-learning.soniuve.com\/courses\/","urlParams":[],"lp_version":"4.2.9.4","lp_rest_load_ajax":"https:\/\/e-learning.soniuve.com\/wp-json\/lp\/v1\/load_content_via_ajax\/","ajaxUrl":"https:\/\/e-learning.soniuve.com\/wp-admin\/admin-ajax.php","lpAjaxUrl":"https:\/\/e-learning.soniuve.com\/lp-ajax-handle","coverImageRatio":"5.16","toast":{"gravity":"bottom","position":"center","duration":3000,"close":1,"stopOnFocus":1,"classPrefix":"lp-toast"},"i18n":[]};
Contactos – Dikanda
Contactos
Fantastic LMS and instructors, well laid out, good speed, and explains.
There are no products in the cart!
0
/**
* ============================================================
* LMX26 — TEMPLATE UNIVERSAL DE CURSO
* LearnPress
* ============================================================
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* ------------------------------------------------------------
* HELPERS
* ------------------------------------------------------------
*/
function lmx26_course_get_id( $atts = array() ) {
/**
* 1. ID enviado pelo shortcode:
*
* [lmx26_course_detail course_id="123"]
*/
if ( ! empty( $atts['course_id'] ) ) {
$course_id = absint(
$atts['course_id']
);
if ( $course_id ) {
return $course_id;
}
}
/**
* 2. Query string:
*
* ?course_id=123
*/
if ( isset( $_GET['course_id'] ) ) {
$course_id = absint(
wp_unslash(
$_GET['course_id']
)
);
if ( $course_id ) {
return $course_id;
}
}
/**
* 3. Página actual.
*/
$current_id =
get_queried_object_id();
if (
$current_id &&
get_post_type( $current_id ) === 'lp_course'
) {
return $current_id;
}
/**
* 4. Post global.
*/
if (
get_the_ID() &&
get_post_type( get_the_ID() ) === 'lp_course'
) {
return get_the_ID();
}
return 0;
}
/**
* ------------------------------------------------------------
* CATEGORIAS
* ------------------------------------------------------------
*/
function lmx26_course_categories(
$course_id
) {
$terms =
get_the_terms(
$course_id,
'course_category'
);
if (
empty( $terms ) ||
is_wp_error( $terms )
) {
return array();
}
return array_values(
array_map(
function ( $term ) {
return array(
'id' => $term->term_id,
'name' => $term->name,
'slug' => $term->slug,
'url' => get_term_link(
$term
),
);
},
$terms
)
);
}
/**
* ------------------------------------------------------------
* CURRÍCULO
* ------------------------------------------------------------
*/
function lmx26_course_curriculum(
$course_id
) {
$result = array();
if (
! function_exists(
'learn_press_get_course'
)
) {
return $result;
}
$course =
learn_press_get_course(
$course_id
);
if ( ! $course ) {
return $result;
}
/**
* LearnPress expõe os itens do currículo
* através do objecto do curso.
*/
try {
$items =
$course->get_curriculum_items();
} catch ( Throwable $e ) {
$items = array();
}
if ( empty( $items ) ) {
return $result;
}
foreach ( $items as $item ) {
$item_id =
absint(
$item->ID
);
if ( ! $item_id ) {
continue;
}
$type =
get_post_type(
$item_id
);
$is_quiz =
(
$type === 'lp_quiz'
);
$title =
get_the_title(
$item_id
);
$url =
get_permalink(
$item_id
);
$result[] = array(
'id' =>
$item_id,
'title' =>
$title
? $title
: 'Item sem título',
'type' =>
$is_quiz
? 'quiz'
: 'lesson',
'type_label' =>
$is_quiz
? 'Quiz'
: 'Aula',
'url' =>
$url
? $url
: '#',
'excerpt' =>
wp_trim_words(
wp_strip_all_tags(
get_post_field(
'post_content',
$item_id
)
),
20
),
);
}
return $result;
}
/**
* ------------------------------------------------------------
* UTILIZADOR / PROGRESSO
* ------------------------------------------------------------
*/
function lmx26_course_user_state(
$course_id
) {
$result = array(
'logged_in' =>
false,
'enrolled' =>
false,
'started' =>
false,
'completed' =>
false,
'passed' =>
false,
'status' =>
'not-enrolled',
'progress' =>
0,
);
if (
! is_user_logged_in()
) {
return $result;
}
$user_id =
get_current_user_id();
if (
! function_exists(
'learn_press_get_user'
)
) {
return $result;
}
$user =
learn_press_get_user(
$user_id
);
if ( ! $user ) {
return $result;
}
$result['logged_in'] =
true;
try {
$status =
$user->get_course_status(
$course_id
);
$result['status'] =
$status
? $status
: 'not-enrolled';
$result['enrolled'] =
in_array(
$status,
array(
'purchased',
'enrolled',
'started',
'finished',
'completed',
),
true
);
$result['started'] =
in_array(
$status,
array(
'started',
'finished',
'completed',
),
true
);
$result['completed'] =
in_array(
$status,
array(
'finished',
'completed',
),
true
);
$result['passed'] =
method_exists(
$user,
'has_passed_course'
)
? (
bool
$user->has_passed_course(
$course_id
)
)
: false;
/**
* LearnPress guarda o resultado
* do curso no objecto do utilizador.
*/
$course_data =
$user->get_course_data(
$course_id
);
if (
$course_data &&
method_exists(
$course_data,
'get_results'
)
) {
$results =
$course_data->get_results();
if (
is_array( $results )
) {
foreach (
array(
'progress',
'percent',
'percentage',
)
as $key
) {
if (
isset(
$results[ $key ]
) &&
is_numeric(
$results[ $key ]
)
) {
$result['progress'] =
max(
0,
min(
100,
(float)
$results[ $key ]
)
);
break;
}
}
}
}
if (
$result['completed']
) {
$result['progress'] =
100;
}
} catch ( Throwable $e ) {
if (
defined( 'WP_DEBUG' ) &&
WP_DEBUG
) {
error_log(
'LMX26 Course State: ' .
$e->getMessage()
);
}
}
return $result;
}
/**
* ------------------------------------------------------------
* SHORTCODE
* ------------------------------------------------------------
*/
add_shortcode(
'lmx26_course_detail',
function ( $atts ) {
$atts =
shortcode_atts(
array(
'course_id' => 0,
),
$atts,
'lmx26_course_detail'
);
$course_id =
lmx26_course_get_id(
$atts
);
if ( ! $course_id ) {
return '
Curso não encontrado.
';
}
if (
get_post_type(
$course_id
) !== 'lp_course'
) {
return '
O conteúdo indicado não é um curso LearnPress.
';
}
/**
* Dados base.
*/
$title =
get_the_title(
$course_id
);
$content =
get_post_field(
'post_content',
$course_id
);
$excerpt =
get_post_field(
'post_excerpt',
$course_id
);
if ( ! $excerpt ) {
$excerpt =
wp_trim_words(
wp_strip_all_tags(
$content
),
34
);
}
$categories =
lmx26_course_categories(
$course_id
);
$curriculum =
lmx26_course_curriculum(
$course_id
);
$user_state =
lmx26_course_user_state(
$course_id
);
$duration =
get_post_meta(
$course_id,
'_lp_duration',
true
);
$price =
get_post_meta(
$course_id,
'_lp_price',
true
);
$regular_price =
get_post_meta(
$course_id,
'_lp_regular_price',
true
);
$featured_image =
get_the_post_thumbnail_url(
$course_id,
'large'
);
$course_url =
get_permalink(
$course_id
);
ob_start();
?>
CONTEÚDO DO CURSO
O que vai aprender.
Explore o percurso e descubra como
o conteúdo está organizado.
O currículo deste curso ainda não está disponível.
58bf295768"},"swiperClass":"swiper","settings":{"page":[],"editorPreferences":[]},"kit":{"active_breakpoints":["viewport_mobile","viewport_tablet","viewport_tablet_extra","viewport_widescreen"],"viewport_widescreen":1440,"viewport_tablet":1023,"global_image_lightbox":"yes","lightbox_enable_counter":"yes","lightbox_enable_fullscreen":"yes","lightbox_enable_zoom":"yes","lightbox_enable_share":"yes","lightbox_title_src":"title","lightbox_description_src":"description","woocommerce_notices_elements":[]},"post":{"id":87,"title":"Contactos%20%E2%80%93%20Dikanda","excerpt":"","featuredImage":false}};
//# sourceURL=elementor-frontend-js-before
/**
* ============================================================
* LMX26 — TEMPLATE UNIVERSAL DE CURSO
* LearnPress
* ============================================================
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* ------------------------------------------------------------
* HELPERS
* ------------------------------------------------------------
*/
function lmx26_course_get_id( $atts = array() ) {
/**
* 1. ID enviado pelo shortcode:
*
* [lmx26_course_detail course_id="123"]
*/
if ( ! empty( $atts['course_id'] ) ) {
$course_id = absint(
$atts['course_id']
);
if ( $course_id ) {
return $course_id;
}
}
/**
* 2. Query string:
*
* ?course_id=123
*/
if ( isset( $_GET['course_id'] ) ) {
$course_id = absint(
wp_unslash(
$_GET['course_id']
)
);
if ( $course_id ) {
return $course_id;
}
}
/**
* 3. Página actual.
*/
$current_id =
get_queried_object_id();
if (
$current_id &&
get_post_type( $current_id ) === 'lp_course'
) {
return $current_id;
}
/**
* 4. Post global.
*/
if (
get_the_ID() &&
get_post_type( get_the_ID() ) === 'lp_course'
) {
return get_the_ID();
}
return 0;
}
/**
* ------------------------------------------------------------
* CATEGORIAS
* ------------------------------------------------------------
*/
function lmx26_course_categories(
$course_id
) {
$terms =
get_the_terms(
$course_id,
'course_category'
);
if (
empty( $terms ) ||
is_wp_error( $terms )
) {
return array();
}
return array_values(
array_map(
function ( $term ) {
return array(
'id' => $term->term_id,
'name' => $term->name,
'slug' => $term->slug,
'url' => get_term_link(
$term
),
);
},
$terms
)
);
}
/**
* ------------------------------------------------------------
* CURRÍCULO
* ------------------------------------------------------------
*/
function lmx26_course_curriculum(
$course_id
) {
$result = array();
if (
! function_exists(
'learn_press_get_course'
)
) {
return $result;
}
$course =
learn_press_get_course(
$course_id
);
if ( ! $course ) {
return $result;
}
/**
* LearnPress expõe os itens do currículo
* através do objecto do curso.
*/
try {
$items =
$course->get_curriculum_items();
} catch ( Throwable $e ) {
$items = array();
}
if ( empty( $items ) ) {
return $result;
}
foreach ( $items as $item ) {
$item_id =
absint(
$item->ID
);
if ( ! $item_id ) {
continue;
}
$type =
get_post_type(
$item_id
);
$is_quiz =
(
$type === 'lp_quiz'
);
$title =
get_the_title(
$item_id
);
$url =
get_permalink(
$item_id
);
$result[] = array(
'id' =>
$item_id,
'title' =>
$title
? $title
: 'Item sem título',
'type' =>
$is_quiz
? 'quiz'
: 'lesson',
'type_label' =>
$is_quiz
? 'Quiz'
: 'Aula',
'url' =>
$url
? $url
: '#',
'excerpt' =>
wp_trim_words(
wp_strip_all_tags(
get_post_field(
'post_content',
$item_id
)
),
20
),
);
}
return $result;
}
/**
* ------------------------------------------------------------
* UTILIZADOR / PROGRESSO
* ------------------------------------------------------------
*/
function lmx26_course_user_state(
$course_id
) {
$result = array(
'logged_in' =>
false,
'enrolled' =>
false,
'started' =>
false,
'completed' =>
false,
'passed' =>
false,
'status' =>
'not-enrolled',
'progress' =>
0,
);
if (
! is_user_logged_in()
) {
return $result;
}
$user_id =
get_current_user_id();
if (
! function_exists(
'learn_press_get_user'
)
) {
return $result;
}
$user =
learn_press_get_user(
$user_id
);
if ( ! $user ) {
return $result;
}
$result['logged_in'] =
true;
try {
$status =
$user->get_course_status(
$course_id
);
$result['status'] =
$status
? $status
: 'not-enrolled';
$result['enrolled'] =
in_array(
$status,
array(
'purchased',
'enrolled',
'started',
'finished',
'completed',
),
true
);
$result['started'] =
in_array(
$status,
array(
'started',
'finished',
'completed',
),
true
);
$result['completed'] =
in_array(
$status,
array(
'finished',
'completed',
),
true
);
$result['passed'] =
method_exists(
$user,
'has_passed_course'
)
? (
bool
$user->has_passed_course(
$course_id
)
)
: false;
/**
* LearnPress guarda o resultado
* do curso no objecto do utilizador.
*/
$course_data =
$user->get_course_data(
$course_id
);
if (
$course_data &&
method_exists(
$course_data,
'get_results'
)
) {
$results =
$course_data->get_results();
if (
is_array( $results )
) {
foreach (
array(
'progress',
'percent',
'percentage',
)
as $key
) {
if (
isset(
$results[ $key ]
) &&
is_numeric(
$results[ $key ]
)
) {
$result['progress'] =
max(
0,
min(
100,
(float)
$results[ $key ]
)
);
break;
}
}
}
}
if (
$result['completed']
) {
$result['progress'] =
100;
}
} catch ( Throwable $e ) {
if (
defined( 'WP_DEBUG' ) &&
WP_DEBUG
) {
error_log(
'LMX26 Course State: ' .
$e->getMessage()
);
}
}
return $result;
}
/**
* ------------------------------------------------------------
* SHORTCODE
* ------------------------------------------------------------
*/
add_shortcode(
'lmx26_course_detail',
function ( $atts ) {
$atts =
shortcode_atts(
array(
'course_id' => 0,
),
$atts,
'lmx26_course_detail'
);
$course_id =
lmx26_course_get_id(
$atts
);
if ( ! $course_id ) {
return '
Curso não encontrado.
';
}
if (
get_post_type(
$course_id
) !== 'lp_course'
) {
return '
O conteúdo indicado não é um curso LearnPress.
';
}
/**
* Dados base.
*/
$title =
get_the_title(
$course_id
);
$content =
get_post_field(
'post_content',
$course_id
);
$excerpt =
get_post_field(
'post_excerpt',
$course_id
);
if ( ! $excerpt ) {
$excerpt =
wp_trim_words(
wp_strip_all_tags(
$content
),
34
);
}
$categories =
lmx26_course_categories(
$course_id
);
$curriculum =
lmx26_course_curriculum(
$course_id
);
$user_state =
lmx26_course_user_state(
$course_id
);
$duration =
get_post_meta(
$course_id,
'_lp_duration',
true
);
$price =
get_post_meta(
$course_id,
'_lp_price',
true
);
$regular_price =
get_post_meta(
$course_id,
'_lp_regular_price',
true
);
$featured_image =
get_the_post_thumbnail_url(
$course_id,
'large'
);
$course_url =
get_permalink(
$course_id
);
ob_start();
?>
CONTEÚDO DO CURSO
O que vai aprender.
Explore o percurso e descubra como
o conteúdo está organizado.
O currículo deste curso ainda não está disponível.
312a1aac40","urls":{"assets":"https:\/\/e-learning.soniuve.com\/wp-content\/plugins\/elementor-pro\/assets\/","rest":"https:\/\/e-learning.soniuve.com\/wp-json\/"},"shareButtonsNetworks":{"facebook":{"title":"Facebook","has_counter":true},"twitter":{"title":"Twitter"},"linkedin":{"title":"LinkedIn","has_counter":true},"pinterest":{"title":"Pinterest","has_counter":true},"reddit":{"title":"Reddit","has_counter":true},"vk":{"title":"VK","has_counter":true},"odnoklassniki":{"title":"OK","has_counter":true},"tumblr":{"title":"Tumblr"},"digg":{"title":"Digg"},"skype":{"title":"Skype"},"stumbleupon":{"title":"StumbleUpon","has_counter":true},"mix":{"title":"Mix"},"telegram":{"title":"Telegram"},"pocket":{"title":"Pocket","has_counter":true},"xing":{"title":"XING","has_counter":true},"whatsapp":{"title":"WhatsApp"},"email":{"title":"Email"},"print":{"title":"Print"}},"woocommerce":{"menu_cart":{"cart_page_url":"https:\/\/e-learning.soniuve.com\/carrinho\/","checkout_page_url":"https:\/\/e-learning.soniuve.com\/finalizar-compra\/","fragments_nonce":"c23447b55b"}},"facebook_sdk":{"lang":"pt_PT","app_id":""},"lottie":{"defaultAnimationUrl":"https:\/\/e-learning.soniuve.com\/wp-content\/plugins\/elementor-pro\/modules\/lottie\/assets\/animations\/default.json"}};
//# sourceURL=elementor-pro-frontend-js-before