Exemplo n.º 1
0
<?php

/*****  RECENTLY VIEWED COURSES *****/
$recents = Pageview::ListAllForUser(get_viewer_id());
Error::generate('debug', $recents);
if ($recents && count($recents) > 0) {
    ?>
                        <div id="recent_courses">
<?php 
} else {
    ?>
                        <div id="recent_courses" class="hidden">
<?php 
}
?>
                            <div id="sidebar_recent_courses">Recent courses:</div>
<?php 
$ctr = 0;
$unique_recents = array();
foreach ($recents as $r) {
    $found = false;
    foreach ($unique_recents as $u) {
        if ($u['comment_id'] == $r['comment_id']) {
            $found = true;
            break;
        }
    }
    if (!$found) {
        $unique_recents[] = $r;
        if (++$ctr == 5) {
            break;
Exemplo n.º 2
0
$unq_users = array();
foreach ($other_users as $ou) {
    $found = false;
    foreach ($unq_users as $u) {
        if ($ou['id'] == $u['id']) {
            $found = true;
            break;
        }
    }
    if (!$found) {
        $unq_users[] = $ou;
    }
}
$other_views = array();
foreach ($unq_users as $user) {
    $user_views = Pageview::ListAllForUser($user['id']);
    foreach ($user_views as $view) {
        if ($view['comment_id'] == $args['comment_id']) {
            continue;
        }
        if (isset($other_views[$view['comment_id']])) {
            $other_views[$view['comment_id']]++;
        } else {
            $other_views[$view['comment_id']] = 1;
        }
    }
}
arsort($other_views);
if ($other_views && count($other_views) > 0) {
    ?>
                        <div id="course_recommendations">