本文整理汇总了PHP中tofriendlytime函数的典型用法代码示例。如果您正苦于以下问题:PHP tofriendlytime函数的具体用法?PHP tofriendlytime怎么用?PHP tofriendlytime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tofriendlytime函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: widget
/** @see WP_Widget::widget -- do not rename this */
function widget($args, $instance)
{
extract($args);
//Our variables from the widget settings.
$title = apply_filters('widget_title', $instance['title']);
$num = $instance['number'];
$activity = $instance['activity'];
$messages = $instance['messages'];
$friends = $instance['friends'];
if (!is_numeric($num)) {
$num = 5;
}
$user_id = bp_loggedin_user_id();
$width = $instance['width'];
echo '<div class="' . $width . '"><div class="dash-widget">' . $before_widget;
echo '<div id="vibe-tabs-student-activity" class="tabs tabbable">
<ul class="nav nav-tabs clearfix">';
if (isset($messages) && $messages && function_exists('messages_get_unread_count')) {
echo '<li><a href="#tab-messages" data-toggle="tab"><i class="icon-bubble-talk-1"></i>' . messages_get_unread_count($user_id) . '</a></li>';
}
if (isset($friends) && $friends) {
$searchArgs = array('type' => 'online', 'page' => 1, 'per_page' => $num, 'user_id' => $user_id);
if (bp_has_members($searchArgs)) {
while (bp_members()) {
bp_the_member();
$user_friends[] = array('avatar' => bp_get_member_avatar(), 'name' => bp_get_member_name(), 'last_active' => bp_get_member_last_active());
}
}
if (!is_array($user_friends)) {
$user_friends = array();
}
echo '<li><a href="#tab-friends" data-toggle="tab"><i class="icon-myspace-alt"></i>' . count($user_friends) . '</a></li>';
}
if (isset($activity) && $activity) {
echo '<li><a href="#tab-activity" data-toggle="tab"><i class="icon-atom"></i> </a></li>';
}
echo '</ul><div class="tab-content">';
// Display the widget title
global $wpdb, $bp;
if (isset($messages) && $messages) {
echo '<div id="tab-messages" class="tab-pane">
<h4>' . __('Unread Messages', 'wplms-dashboard') . '</h4>';
$message_args = array('user_id' => $user_id, 'box' => 'inbox', 'type' => 'unread', 'max' => $num);
if (bp_has_message_threads($message_args)) {
echo '<ul class="dash-unread-messages">';
while (bp_message_threads()) {
bp_message_thread();
echo '<li>' . bp_get_message_thread_avatar() . '<a href="' . bp_get_message_thread_view_link() . '">' . bp_get_message_thread_subject() . '<span>' . bp_get_message_thread_from() . '</span></a></li>';
}
echo '</ul>';
} else {
echo '<div class="message error">' . __('No messages found', 'wplms-dashboard') . '</div>';
}
echo '</div>';
}
if (isset($friends) && $friends) {
echo '<div id="tab-friends" class="tab-pane">
<h4>' . __('Friends Online', 'wplms-dashboard') . '</h4>';
if (count($user_friends)) {
echo '<ul class="dash-user-friends">';
foreach ($user_friends as $user_friend) {
echo '<li>' . $user_friend['avatar'] . ' ' . $user_friend['name'] . '<span>' . $user_friend['last_active'] . '</span></li>';
}
echo '</ul>';
} else {
echo '<div class="message error">' . __('No friends online', 'wplms-dashboard') . '</div>';
}
echo '</div>';
}
if (isset($activity) && $activity) {
$activities = apply_filters('wplms_dashboard_activity', $wpdb->get_results($wpdb->prepare("\n\t\t\tSELECT *\n\t\t FROM {$bp->activity->table_name} AS activity\n\t\t WHERE \tactivity.user_id IN (%d)\n\t\t AND (activity.action != '' OR activity.action IS NOT NULL)\n\t\t ORDER BY activity.date_recorded DESC\n\t\t LIMIT 0,{$num}\n\t\t", $user_id)));
echo '<div id="tab-activity" class="tab-pane student_activity">
<h4>' . __('Recent Activity', 'wplms-dashboard') . '</h4>';
if (isset($activities) && is_array($activities)) {
echo '<ul class="dash-activities">';
foreach ($activities as $activity) {
if (isset($activity->action) && $activity->action != '') {
$time = tofriendlytime(time() - strtotime($activity->date_recorded));
echo '<li class="' . $activity->component . ' ' . $activity->type . '">
<div class="dash-activity">
<span class="dash-activity-time">' . $time . ' ' . __('AGO', 'wplms-dashboard') . '</span>
<strong>' . $activity->action . '</strong>
</div>
</li>';
}
}
echo '</ul>';
} else {
echo '<div class="message error">' . __('No activity found', 'wplms-dashboard') . '</div>';
}
echo '</div>';
}
echo '</div></div>' . $after_widget . '</div></div>';
}
开发者ID:nikitansk,项目名称:devschool,代码行数:95,代码来源:activity_widget.php
示例2: bp_course_subscription_product
function bp_course_subscription_product()
{
global $product;
$check_susbscription = get_post_meta($product->id, 'vibe_subscription', true);
if (vibe_validate($check_susbscription)) {
$duration = intval(get_post_meta($product->id, 'vibe_duration', true));
$product_duration_parameter = apply_filters('vibe_product_duration_parameter', 86400);
$t = tofriendlytime($duration * $product_duration_parameter);
echo '<div id="duration"><strong>' . __('SUBSCRIPTION FOR', 'vibe') . ' ' . $t . '</strong></div>';
}
}
开发者ID:nikitansk,项目名称:devschool,代码行数:11,代码来源:bp-course-actions.php
示例3: widget
/** @see WP_Widget::widget -- do not rename this */
function widget($args, $instance)
{
extract($args);
//Our variables from the widget settings.
$title = apply_filters('widget_title', $instance['title']);
$num = $instance['number'];
$friends = $instance['friends'];
$width = $instance['width'];
echo '<div class="' . $width . '"><div class="dash-widget activity">' . $before_widget;
// Display the widget title
if ($title) {
echo $before_title . $title . $after_title;
}
if (isset($friends) && $friends) {
$friends = friends_get_friend_user_ids(bp_loggedin_user_id());
$friends[] = bp_loggedin_user_id();
$friends_and_me = implode(',', (array) $friends);
} else {
$friends_and_me = bp_loggedin_user_id();
}
global $wpdb, $bp;
$activities = apply_filters('wplms_dashboard_activity', $wpdb->get_results("\n\t\t\tSELECT *\n\t\t FROM {$bp->activity->table_name} AS activity\n\t\t WHERE \tactivity.user_id IN ({$friends_and_me})\n\t\t AND (activity.action != '' OR activity.action IS NOT NULL)\n\t\t ORDER BY activity.date_recorded DESC\n\t\t LIMIT 0,{$num}\n\t\t"));
if (isset($activities) && is_array($activities)) {
echo '<div class="student_activity"><a class="small button ' . ($title ? 'withtitle' : '') . '">' . __('VIEW ALL', 'wplms-dashboard') . '</a>
<ul class="dash-activities">';
foreach ($activities as $activity) {
if (isset($activity->action) && $activity->action != '') {
$time = tofriendlytime(time() - strtotime($activity->date_recorded));
echo '<li class="' . $activity->component . ' ' . $activity->type . '">
<div class="dash-activity">
<span class="dash-activity-time">' . $time . ' ' . __('AGO', 'wplms-dashboard') . '</span>
<strong>' . $activity->action . '</strong>
<p>' . $activity->content . '</p>
</div>
</li>';
}
}
echo '</ul>
</div></div>';
}
echo $after_widget . '</div>';
}
开发者ID:nikitansk,项目名称:devschool,代码行数:43,代码来源:calendar.php
示例4: get_the_course_time
function get_the_course_time($args)
{
$defaults = array('course_id' => get_the_ID(), 'user_id' => get_current_user_id());
$r = wp_parse_args($args, $defaults);
extract($r, EXTR_SKIP);
$course_duration_parameter = apply_filters('vibe_course_duration_parameter', 86400);
$seconds = get_user_meta($user_id, $course_id, true);
if (!isset($seconds) || !$seconds) {
$d = get_post_meta($course_id, 'vibe_duration', true);
$seconds = $d * $course_duration_parameter;
} else {
$seconds = $seconds - time();
}
$time = tofriendlytime($seconds);
return apply_filters('course_friendly_time', $time, $seconds, $course_id);
}
开发者ID:eddogan,项目名称:wplms-altered-functions,代码行数:16,代码来源:bp-course-functions.php
示例5: the_unit_tags
">
<?php
if (isset($unit_id)) {
the_unit_tags($unit_id);
if (is_numeric($unit_id)) {
the_unit_instructor($unit_id);
} else {
the_unit_instructor($course_id);
}
}
$minutes = 0;
$mins = get_post_meta($unit_id, 'vibe_duration', true);
$unit_duration_parameter = apply_filters('vibe_unit_duration_parameter', 60);
$unit_duration = $mins * $unit_duration_parameter;
do_action('wplms_course_unit_meta');
echo '<span><i class="icon-clock"></i> ' . tofriendlytime($unit_duration) . '</span>';
?>
<h1><?php
if (isset($course_id)) {
echo get_the_title($unit_id);
} else {
the_title();
}
?>
</h1>
<?php
if (isset($course_id)) {
the_sub_title($unit_id);
} else {
the_sub_title();
}
开发者ID:songlequang,项目名称:myclass,代码行数:31,代码来源:start.php
示例6: wplms_get_unit_section_comments
function wplms_get_unit_section_comments()
{
$unit_id = $_POST['unit_id'];
$section = $_POST['section'];
if (!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'security') || !is_numeric($unit_id)) {
_e('Security check Failed. Contact Administrator.', 'vibe');
die;
}
$num = $_POST['num'];
if (!$num || !is_numeric($num) || $num < 10) {
$num = 10;
} else {
$num = $num * 2;
}
$num = apply_filters('wplms_unit_comments_per_section', $num);
global $wpdb;
$user_id = get_current_user_id();
if (current_user_can('edit_posts')) {
$query = $wpdb->prepare("\n SELECT rel.meta_value,comments.comment_ID,comments.comment_date, comments.user_id,comments.comment_content,comments.comment_type\n FROM {$wpdb->comments} as comments\n LEFT JOIN {$wpdb->commentmeta} AS rel ON comments.comment_ID = rel.comment_id\n WHERE comments.comment_post_ID = %d\n AND comments.comment_ID IN (SELECT comment_id FROM {$wpdb->commentmeta} WHERE meta_key LIKE %s )\n ORDER BY comments.comment_date DESC\n LIMIT 0,%d\n ", $unit_id, 'unit' . $unit_id . '_%', $num);
} else {
$query = $wpdb->prepare("\n SELECT rel.meta_value,comments.comment_ID,comments.comment_date, comments.user_id,comments.comment_content,comments.comment_type\n FROM {$wpdb->comments} as comments\n LEFT JOIN {$wpdb->commentmeta} AS rel ON comments.comment_ID = rel.comment_id\n WHERE comments.comment_post_ID = %d\n AND comments.comment_ID IN (SELECT comment_id FROM {$wpdb->commentmeta} WHERE (meta_key = %s OR meta_key LIKE %s) )\n ORDER BY comments.comment_date DESC\n LIMIT 0,%d\n ", $unit_id, 'unit' . $unit_id . '_' . $user_id, 'unit' . $unit_id . '%public', $num);
}
$query = apply_filters('wplms_unit_comments_query', $query, $unit_id);
$results = $wpdb->get_results($query, ARRAY_A);
if (isset($results) && is_array($results)) {
$json_array = array();
$i = 0;
foreach ($results as $result) {
$avatar = get_avatar($result['user_id']);
preg_match('#src=["|\'](.+)["|\']#Uuis', $avatar, $matches);
$seconds_span = time() - strtotime($result['comment_date']);
$json_array[$i][$result['meta_value']] = array('ID' => $result['comment_ID'], 'content' => $result['comment_content'], 'time' => tofriendlytime($seconds_span), 'type' => $result['comment_type'], 'author' => array('user_id' => $result['user_id'], 'img' => $matches[1], 'name' => bp_core_get_user_displayname($result['user_id']), 'link' => bp_core_get_user_domain($result['user_id'])));
if ($result['user_id'] == $user_id || current_user_can('edit_posts')) {
$json_array[$i][$result['meta_value']]['controls'] = array('edit_unit_comment' => 1, 'instructor_reply_unit_comment' => 1);
if ($result['comment_type'] == 'public') {
$json_array[$i][$result['meta_value']]['controls']['private_unit_comment'] = 1;
} else {
$json_array[$i][$result['meta_value']]['controls']['public_unit_comment'] = 1;
}
$json_array[$i][$result['meta_value']]['controls']['reply_unit_comment'] = 1;
$json_array[$i][$result['meta_value']]['controls']['popup_unit_comment'] = 1;
$json_array[$i][$result['meta_value']]['controls']['remove_unit_comment'] = 1;
} else {
$json_array[$i][$result['meta_value']]['controls'] = array('reply_unit_comment' => 1, 'instructor_reply_unit_comment' => 1);
}
global $wpdb;
$replies = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM {$wpdb->commentmeta} WHERE meta_key = %s and meta_value = %d", 'reply_' . $unit_id . '_' . $_POST['section'], $result['comment_ID']), ARRAY_A);
if (isset($replies) && is_array($replies)) {
if (is_array($replies[0]) && is_numeric($replies[0]['comment_id']) && $replies[0]['comment_id']) {
$json_array[$i][$result['meta_value']]['controls']['reply_unit_comment'] = $replies[0]['comment_id'];
}
}
$i++;
}
$json_array = array_reverse($json_array);
echo json_encode($json_array);
}
die;
}
开发者ID:Nguyenkain,项目名称:Elearning,代码行数:59,代码来源:notes-discussions.php
示例7: foreach
<?php
}
?>
</ul>
<div class="clear"></div>
<?php
$items = $order->get_items();
foreach ($items as $item) {
$product_name = $item['name'];
$product_id = $item['product_id'];
$subs = '';
$subscribed = get_post_meta($product_id, 'vibe_subscription', true);
if (vibe_validate($subscribed)) {
$duration = get_post_meta($product_id, 'vibe_duration', true);
$product_duration_parameter = apply_filters('vibe_product_duration_parameter', 86400);
$date = tofriendlytime($duration * $product_duration_parameter);
$subs = '<strong>' . __('COURSE SUBSCRIBED FOR ', 'vibe') . ' : <span>' . $date . '</span></strong>';
} else {
$subs = '<strong>' . __('SUSBSCRIBED FOR FULL COURSE', 'vibe') . '</strong>';
}
$vcourses = vibe_sanitize(get_post_meta($product_id, 'vibe_courses', false));
if (count($vcourses)) {
echo '<h3 class="heading">' . __('Courses Subscribed', 'vibe') . '</h3>
<ul class="order_details">
<li><a>' . __('COURSE', 'vibe') . '</a>
<strong>' . __('SUBSCRIPTION', 'vibe') . '</strong></li>';
if ($order->status == 'completed' || $order->status == 'complete') {
$ostatus = __('START COURSE', 'vibe');
} else {
if ($order->status == 'pending') {
do_action('wplms_force_woocommerce_order_complete', $order);
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:31,代码来源:thankyou.php
示例8: wplms_unit_assignments
function wplms_unit_assignments($unit_id)
{
$assignment_ids = get_post_meta($unit_id, 'vibe_assignment', false);
if (is_Array($assignment_ids) && is_array($assignment_ids[0])) {
$assignment_ids = vibe_sanitize($assignment_ids);
}
$assignment_duration_parameter = apply_filters('vibe_assignment_duration_parameter', 86400);
if (isset($assignment_ids) && is_array($assignment_ids)) {
foreach ($assignment_ids as $assignment_id) {
if (is_numeric($assignment_id)) {
$marks = get_post_meta($assignment_id, 'vibe_assignment_marks', true);
$duration = get_post_meta($assignment_id, 'vibe_assignment_duration', true);
echo '<h3 class="assignment_heading heading">' . __('ASSIGNMENT : ', 'wplms-assignments') . '
<strong><a href="' . get_permalink($assignment_id) . '" target="_blank">' . get_the_title($assignment_id) . '<i class="icon-in-alt"></i></a></strong>
<span>' . __('MARKS : ', 'wplms-assignments') . $marks . '</span>
<span>' . __('DURATION : ', 'wplms-assignments') . (function_exists('tofriendlytime') ? tofriendlytime($duration * $assignment_duration_parameter) : $duration . __(' days', 'wplms-assignments')) . '</span>
</h3>';
}
}
}
}
开发者ID:Nguyenkain,项目名称:Elearning,代码行数:21,代码来源:assignments_functions.php
示例9: wplms_redirect_to_course
function wplms_redirect_to_course($order_id)
{
if (!class_exists('WC_Order')) {
return;
}
$order = new WC_Order($order_id);
$items = $order->get_items();
$order_courses = array();
foreach ($items as $item) {
$product_name = $item['name'];
$product_id = $item['product_id'];
$vcourses = vibe_sanitize(get_post_meta($product_id, 'vibe_courses', false));
if (isset($vcourses) && is_array($vcourses) && count($vcourses) && $vcourses != '') {
$order_courses[$product_id]['courses'] = $vcourses;
$subscribed = get_post_meta($product_id, 'vibe_subscription', true);
if (vibe_validate($subscribed)) {
$duration = get_post_meta($product_id, 'vibe_duration', true);
$product_duration_parameter = apply_filters('vibe_product_duration_parameter', 86400);
$date = tofriendlytime($duration * $product_duration_parameter);
$order_courses[$product_id]['subs'] = '<strong>' . __('COURSE SUBSCRIBED FOR ', 'vibe') . ' : <span>' . $date . '</span></strong>';
} else {
$order_courses[$product_id]['subs'] = '<strong>' . __('SUSBSCRIBED FOR FULL COURSE', 'vibe') . '</strong>';
}
}
}
if (isset($order_courses) && is_array($order_courses) && count($order_courses)) {
echo '<h3 class="heading">' . __('Courses Subscribed', 'vibe') . '</h3>
<ul class="order_details">
<li><a>' . __('COURSE', 'vibe') . '</a>
<strong>' . __('SUBSCRIPTION', 'vibe') . '</strong></li>';
if ($order->status == 'completed' || $order->status == 'complete') {
$ostatus = __('START COURSE', 'vibe');
} else {
if ($order->status == 'pending') {
do_action('wplms_force_woocommerce_order_complete', $order);
$ostatus = __('WAITING FOR ORDER CONFIRMATION TO START COURSE', 'vibe');
} else {
$ostatus = __('WAITING FOR ADMIN APPROVAL', 'vibe');
}
}
foreach ($order_courses as $order_course) {
foreach ($order_course['courses'] as $course) {
echo '<li>
<a class="course_name">' . get_the_title($course) . '</a>
<a href="' . get_permalink($course) . '" class="button">
' . $ostatus . '</a>' . $order_course['subs'] . '
</li>';
}
}
echo '</ul>';
if (count($order_courses) == 1 && count($order_courses[$product_id]['courses']) == 1 && ($order->status == 'completed' || $order->status == 'complete')) {
$thankyou_redirect = vibe_get_option('thankyou_redirect');
if (isset($thankyou_redirect) && $thankyou_redirect) {
echo '<script>
jQuery(location).attr("href","' . get_permalink($course) . '");
</script>';
}
}
}
}
开发者ID:Nguyenkain,项目名称:Elearning,代码行数:60,代码来源:func.php
示例10: unit_traverse1
function unit_traverse1()
{
$unit_id = $_POST['id'];
$course_id = $_POST['course_id'];
if (!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'security')) {
_e('Security check Failed. Contact Administrator.', 'vibe');
die;
}
// Check if user has taken the course
$user_id = get_current_user_id();
$coursetaken = get_user_meta($user_id, $course_id, true);
//if(!isset($_COOKIE['course'])) {
// code cũ if($coursetaken>time()){
if ($coursetaken) {
setcookie('course', $course_id, $expire, '/');
$_COOKIE['course'] = $course_id;
} else {
$pid = get_post_meta($course_id, 'vibe_product', true);
$pid = apply_filters('wplms_course_product_id', $pid, $course_id, -1);
// $id checks for Single Course page or Course page in the my courses section
if (is_numeric($pid)) {
$pid = get_permalink($pid);
}
echo '<div class="message"><p>' . __('Course Expired.', 'vibe') . '<a href="' . $pid . '" class="link alignright">' . __('Click to renew', 'vibe') . '</a></p></div>';
die;
}
//}
if (isset($coursetaken) && $coursetaken) {
$course_curriculum = vibe_sanitize(get_post_meta($course_id, 'vibe_course_curriculum', false));
$units = array();
foreach ($course_curriculum as $key => $curriculum) {
if (is_numeric($curriculum)) {
$units[] = $curriculum;
}
}
// Drip Feed Check
$drip_enable = get_post_meta($course_id, 'vibe_course_drip', true);
if (vibe_validate($drip_enable)) {
$drip_duration = get_post_meta($course_id, 'vibe_course_drip_duration', true);
$unitkey = array_search($unit_id, $units);
if ($unitkey == 0) {
$pre_unit_time = get_post_meta($units[$unitkey], $user_id, true);
if (!isset($pre_unit_time) || $pre_unit_time == '') {
add_post_meta($units[$unitkey], $user_id, time());
}
} else {
$pre_unit_time = get_post_meta($units[$unitkey - 1], $user_id, true);
if (isset($pre_unit_time) && $pre_unit_time) {
$drip_duration_parameter = apply_filters('vibe_drip_duration_parameter', 86400);
$value = $pre_unit_time + $drip_duration * $drip_duration_parameter;
$value = apply_filters('wplms_drip_value', $value, $units[$unitkey - 1], $course_id);
if ($value > time()) {
echo '<div class="message"><p>' . __('Unit will be available in ', 'vibe') . tofriendlytime($pre_unit_time + $drip_duration * $drip_duration_parameter - time()) . '</p></div>';
die;
} else {
$pre_unit_time = get_post_meta($units[$unitkey], $user_id, true);
if (!isset($pre_unit_time) || $pre_unit_time == '') {
add_post_meta($units[$unitkey], $user_id, time());
bp_course_record_activity(array('action' => __('Student started a unit', 'vibe'), 'content' => __('Student started the unit ', 'vibe') . get_the_title($unit_id) . __(' in course ', 'vibe') . get_the_title($course_id), 'type' => 'unit', 'primary_link' => get_permalink($unit_id), 'item_id' => $unit_id, 'secondary_item_id' => $user_id));
}
}
} else {
echo '<div class="message"><p>' . __('Unit can not be accessed.', 'vibe') . '</p></div>';
die;
}
}
}
// END Drip Feed Check
echo '<div class="tabheader" style="width:77.7%;">
<span class="title_unit" >' . get_the_title($unit_id) . '</span>
</div>';
$typequiz = get_post_type($unit_id);
if ($typequiz == "quiz") {
do_action('wplms_unit_header', $unit_id, $course_id);
}
echo '<div id="unit" class="quiz_title" data-unit="' . $unit_id . '">';
the_unit_tags($unit_id);
the_unit_instructor($unit_id);
$minutes = 0;
$mins = get_post_meta($unit_id, 'vibe_duration', true);
$unit_duration_parameter = apply_filters('vibe_unit_duration_parameter', 60);
if ($mins) {
if ($mins > $unit_duration_parameter) {
$hours = floor($mins / $unit_duration_parameter);
$minutes = $mins - $hours * $unit_duration_parameter;
} else {
$minutes = $mins;
}
do_action('wplms_course_unit_meta');
if ($mins < 9999) {
if ($unit_duration_parameter == 1) {
echo '<span><i class="icon-clock"></i> ' . (isset($hours) ? $hours . __(' Minutes', 'vibe') : '') . ' ' . $minutes . __(' seconds', 'vibe') . '</span>';
} else {
if ($unit_duration_parameter == 60) {
echo '<span><i class="icon-clock"></i> ' . (isset($hours) ? $hours . __(' Hours', 'vibe') : '') . ' ' . $minutes . __(' minutes', 'vibe') . '</span>';
} else {
if ($unit_duration_parameter == 3600) {
echo '<span><i class="icon-clock"></i> ' . (isset($hours) ? $hours . __(' Days', 'vibe') : '') . ' ' . $minutes . __(' hours', 'vibe') . '</span>';
}
}
//.........这里部分代码省略.........
开发者ID:songlequang,项目名称:myclass,代码行数:101,代码来源:functions.php
示例11: the_title
"><?php
the_title();
?>
</a>
<span><?php
if ($value > 0) {
echo '<i class="icon-check"></i> ' . __('Results Available', 'vibe');
} else {
echo '<i class="icon-alarm"></i> ' . __('Results Awaited', 'vibe');
}
?>
</span>
<span><?php
$newtime = get_user_meta($user_id, get_the_ID(), true);
$diff = time() - $newtime;
echo '<i class="icon-clock"></i> ' . __('Submitted ', 'vibe') . tofriendlytime($diff) . __(' ago', 'vibe');
?>
</span>
<?php
if ($value > 0) {
echo '<span><strong>' . $value . ' / ' . $max . '</strong></span>';
}
?>
</li>
<?php
}
?>
</ul>
<?php
if ($the_assignment->max_num_pages > 1) {
?>
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:31,代码来源:results.php
示例12: unit_traverse
function unit_traverse()
{
$unit_id = $_POST['id'];
$course_id = $_POST['course_id'];
if (!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'security')) {
_e('Security check Failed. Contact Administrator.', 'vibe');
die;
}
//verify unit in course
$units = bp_course_get_curriculum_units($course_id);
if (!in_array($unit_id, $units)) {
_e('Unit not in Course', 'vibe');
die;
}
// Check if user has taken the course
$user_id = get_current_user_id();
$coursetaken = get_user_meta($user_id, $course_id, true);
if (!isset($_COOKIE['course'])) {
if ($coursetaken > time()) {
setcookie('course', $course_id, $expire, '/');
$_COOKIE['course'] = $course_id;
} else {
$pid = get_post_meta($course_id, 'vibe_product', true);
$pid = apply_filters('wplms_course_product_id', $pid, $course_id, -1);
// $id checks for Single Course page or Course page in the my courses section
if (is_numeric($pid)) {
$pid = get_permalink($pid);
}
echo '<div class="message"><p>' . __('Course Expired.', 'vibe') . '<a href="' . $pid . '" class="link alignright">' . __('Click to renew', 'vibe') . '</a></p></div>';
die;
}
}
if (isset($coursetaken) && $coursetaken) {
if (!bp_course_check_unit_complete($unit_id, $user_id)) {
// IF unit not completed by user
// Drip Feed Check
$drip_enable = get_post_meta($course_id, 'vibe_course_drip', true);
if (vibe_validate($drip_enable)) {
$drip_duration = get_post_meta($course_id, 'vibe_course_drip_duration', true);
$drip_duration_parameter = apply_filters('vibe_drip_duration_parameter', 86400, $course_id);
$total_drip_turation = apply_filters('vibe_total_drip_duration', $drip_duration * $drip_duration_parameter, $course_id, $unit_id);
$unitkey = array_search($unit_id, $units);
for ($i = $unitkey - 1; $i >= 0; $i--) {
if (get_post_type($units[$i]) == 'unit') {
$pre_unit_key = $i;
break;
}
}
if ($unitkey == 0) {
// Start of Course
$pre_unit_time = bp_course_get_drip_access_time($units[$unitkey], $user_id);
if (!isset($pre_unit_time) || $pre_unit_time == '') {
bp_course_update_drip_access_time($units[$unitkey], $user_id, time());
if (is_numeric($units[1])) {
//Parmas : Next Unit, Next timestamp, course_id, userid
do_action('wplms_start_unit', $units[$unitkey], $course_id, $user_id, $units[1], time() + $drip_duration * $drip_duration_parameter);
}
}
} else {
//Continuation of Course
$pre_unit_time = get_post_meta($units[$pre_unit_key], $user_id, true);
if (isset($pre_unit_time) && $pre_unit_time) {
$value = $pre_unit_time + $drip_duration * $drip_duration_parameter;
$value = apply_filters('wplms_drip_value', $value, $units[$pre_unit_key], $course_id, $units[$unitkey]);
//print_r(date('l jS \of F Y h:i:s A',$value).' > '.date('l jS \of F Y h:i:s A',time()));
if ($value > time()) {
echo '<div class="message"><p>' . __('Unit will be available in ', 'vibe') . tofriendlytime($value - time()) . '</p></div>';
die;
} else {
$pre_unit_time = get_post_meta($units[$unitkey], $user_id, true);
if (!isset($pre_unit_time) || $pre_unit_time == '') {
update_post_meta($units[$unitkey], $user_id, time());
//Parmas : Next Unit, Next timestamp, course_id, userid
do_action('wplms_start_unit', $units[$unitkey], $course_id, $user_id, $units[$unitkey + 1], time() + $drip_duration * $drip_duration_parameter);
}
}
} else {
echo '<div class="message"><p>' . __('Unit can not be accessed.', 'vibe') . '</p></div>';
die;
}
}
}
// Drip enabled
}
// END Drip Feed Check
echo '<div id="unit" class="' . get_post_type($unit_id) . '_title" data-unit="' . $unit_id . '">';
do_action('wplms_unit_header', $unit_id, $course_id);
$duration = get_post_meta($unit_id, 'vibe_duration', true);
$unit_duration_parameter = apply_filters('vibe_unit_duration_parameter', 60, $unit_id);
if ($duration) {
do_action('wplms_course_unit_meta', $unit_id);
echo '<span><i class="icon-clock"></i> ' . tofriendlytime($unit_duration_parameter * $duration) . '</span>';
}
echo '<br /><h1>' . get_the_title($unit_id) . '</h1>';
the_sub_title($unit_id);
echo '<div class="clear"></div>';
echo '</div>';
the_unit($unit_id);
$unit_class = 'unit_button';
$hide_unit = 0;
//.........这里部分代码省略.........
开发者ID:nikitansk,项目名称:devschool,代码行数:101,代码来源:bp-course-ajax.php
示例13: wplms_course_credits_array
function wplms_course_credits_array($price_html, $course_id)
{
$points = get_post_meta($course_id, 'vibe_mycred_points', true);
if (isset($points) && is_numeric($points)) {
$mycred = mycred();
$points_html = '<strong>' . $mycred->format_creds($points);
$subscription = get_post_meta($course_id, 'vibe_mycred_subscription', true);
if (isset($subscription) && $subscription && $subscription != 'H') {
$duration = get_post_meta($course_id, 'vibe_mycred_duration', true);
$duration = $duration * $this->subscription_duration_parameter;
if (function_exists('tofriendlytime')) {
$points_html .= ' <span class="subs"> ' . __('per', 'vibe') . ' ' . tofriendlytime($duration) . '</span>';
}
}
$points_html .= '.000 VNĐ</strong>';
$price_html[] = $points_html;
}
return $price_html;
}
开发者ID:songlequang,项目名称:myclass,代码行数:19,代码来源:class.init.php
注:本文中的tofriendlytime函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论