Ejemplo n.º 1
0
            $context =context_user::instance($file->usermodified);
            $systemcontext =context_system::instance($file->usermodified);

            echo '<table class="maintable">';
            if (has_capability('local/collegestructure:manage', $systemcontext, $file->usermodified) && is_siteadmin($file->usermodified))
                echo '<tr><td class="rowtitle" colspan="3">Admin Generated Content</td></tr>';
            else if (has_capability('local/collegestructure:manage', $systemcontext, $file->usermodified) && !is_siteadmin($file->usermodified))
                echo '<tr><td class="rowtitle" colspan="3">Registrar Generated Content</td></tr>';
            else if (has_capability('local/clclasses:enrollclass', $context, $file->usermodified) && !is_siteadmin($file->usermodified))
                echo '<tr><td class="rowtitle" colspan="3">Student Generated Content</td></tr>';
            else {
                if (has_capability('local/clclasses:submitgrades', $systemcontext, $file->usermodified) && !is_siteadmin($file->usermodified))
                    echo'<tr><td class="rowtitle" colspan="3">Faculty Uploaded Content</td></tr>';
            }
            echo '<tr><td class="rowname" colspan="3"><a href="download.php?id=' . $file->id . '&course=' . $id . '">' . $file->title . '</a></td></td></tr>';
            echo '<tr><td class="rowusername" colspan="3">by ' . $DB->get_field('user', 'firstname', array('id' => $file->usermodified)) . '
    ' . $DB->get_field('user', 'lastname', array('id' => $file->usermodified)) . '
    ' . date('l, d F Y, g:i A', $file->timecreated) . '</td></td></tr>';
            echo '<tr><td class="rowintro" colspan="3">' . $file->description . '</td></tr>';
            echo '<tr><td class="rowrating" id="rate' . $file->id . '". colspan="3">' . get_like_comment_rating($id, $file->id, $file->id) . '</td></tr>';
            $a = display_like_unlike($id, $file->id, $file->id, 'Resource Central');
            $b = display_rating($id, $file->id, $file->id, 'Resource Central', 'Rating');
            $c = display_comment_area($id, $file->id, $file->id, 'Resource Central');
            echo '<tr><td>' . $a . '</td><td>' . $b . '</td><td>' . $c . '</td></tr>';
            echo '</table>';
        }
    }
}
echo '<div id="myratings"></div>';
echo $OUTPUT->footer();
Ejemplo n.º 2
0
$topics = $DB->get_records_sql("select  * from {local_townhall_topic} where courseid=$id and publish=1 limit $start2, $per_page2");
$course_name = $DB->get_field('course', 'fullname', array(id => $id));
echo '<h3>' . get_string('topics', 'local_townhall') . '</h3><hr>';
if (empty($topics)) {
    echo get_string('notopics', 'local_townhall');
}
foreach ($topics as $topic) {
    $content = preg_replace("/<img[^>]+\>/i", "", $topic->description);
    preg_match('/(<img[^>]+>)/i', $topic->description, $matches);
    echo '<div class="town_list_bar">';
    if ((count($matches)) == 0) {
        echo '<div class="town_topic_task_list1"><span>' . addslashes($topic->topic) . '</span><span>' . $content . '<span></div>';
    } else {
        echo ' <div class="town_topic_task_list2"><span><font>' . addslashes($topic->topic) . '</font>' . $content . '</span><span>' . $matches[0] . '</span> </div>';
    }
    echo '<div class="town_topic_ratings">
    <div class="town_likes">' . display_like_unlike($id, 0, $topic->id, townhall) . '</div>
    <div  class="town_rates">' . display_rating($id, 0, $topic->id, townhall, $course_name) . '</div>
    <div  class="town_commnets">' . display_comment_area($id, 0, $topic->id, townhall) . '</div>
    </div>
    </div>';
}
echo '<div id="myratings"></div>';
//$baseurl2 = new moodle_url('/local/townhall/view.php?id='.$id.'');
$pagevar2 = 'mypage2';
echo '<div class="paging_bar">';
echo $OUTPUT->paging_bar($count2, $page2, $per_page2, $baseurl, $pagevar2);
echo '</div>';
echo $OUTPUT->footer();
?>