Exemple #1
0
/**
 * @method  display_rating
 * @todo function calculates over all rating for course
 * @param int $courseid course id (used to indicates ,enable rating option for a specified course)
 * @param string $activity activity id
 * @param int $item activity node
 * @param string $ratearea activity name, string $heading (used to provide dynamic heading)
 * @returns rating image for course
 */
function display_rating($courseid, $activityid, $itemid, $ratearea, $heading) {
    global $CFG, $DB, $USER;
    $avgratings = get_rating($courseid, $activityid, $itemid, $ratearea);
    $res = '<div class="radiostars">';
    $res .= '<div class="overall_ratings_' . $itemid . '" style="float: left; cursor: pointer;">';
    $res .= "<img title='" . ($avgratings->avg / 2) . " out of 5' src='" . $CFG->wwwroot . "/local/ratings/pix/star" . ($avgratings->avg) . ".png'  onclick='fnViewAllRatings($courseid, $activityid, $itemid, \"$ratearea\", \"$CFG->wwwroot\", \"$heading\")'/>";
    $res .= '</div>'; //End of .overall_ratings
    $res .= '<div class="overall_users">';
    $res .= "(<font class='totalcount_$itemid'>$avgratings->count</font> users)";
    $res .= '</div>'; //End of .overall_users
    $res .= '</div>'; //End of .radiostars
    return $res;
}
function get_rating_select_options($default = "0")
{
    $str = "";
    $json = json_decode(get_rating());
    $str .= '<option value="">wie Album</option>';
    $str .= "\n";
    foreach ($json as $rating) {
        $str .= '<option value="' . $rating->id . '" ';
        if ((string) $rating->id == $default) {
            $str .= "selected";
        }
        $str .= ' >';
        $str .= $rating->rating . '</option>';
        $str .= "\n";
    }
    return $str;
}
?>
" class="profi">Купить <strong>PROFI</strong></a>
                    <a href="<?php 
echo base_url('/mailbox');
?>
"><i class="fa fa-send"></i> Отправить сообщение</a>
                </div>
            </div>
            <div class="panel_title"><strong>РЕЙТИНГ</strong></div>
            <div class="panel_content right_content_contacts">
                <div class="panel_content right_content_contacts text_align_center balance">
                    <span class="rating_value_main color_<?php 
echo get_rating_color($user_info->rating);
?>
"> <?php 
echo get_rating($user_info->rating);
?>
</span>
                 </div>
            </div>
            <div class="panel_title"><strong>Статистика</strong></div>
            <div class="panel_content right_content_contacts">
                <ul>
                    <li><i class="fa fa-comments"></i> Отзывы <span class="rating_value color_red"> - 23</span></li>
                    <li><i class="fa fa-star"></i> В избранном <span class="rating_value"> 121</span></li>
                    <li><i class="fa fa-eye"></i> Просмотры <span class="rating_value"> 3 805</span></li>
                </ul>
            </div>
            <div class="panel_title">Контакты<span class="edit"><i class="fa fa-pencil"></i> <a href="<?php 
echo base_url('/profile/edit_contacts');
?>
Exemple #4
0
                 get_participantbox_minimal($participants[$i]);
                 ?>
                                                                     </div>						
                                                             <?php 
             }
             ?>
                                               </div>
                                             </div>					
                                     <?php 
         }
     }
     break;
 case "4":
     if (isset($_POST["se"])) {
         include_once "logic/service.php";
         get_rating($_POST["se"], is_login());
     }
     break;
 case "5":
     $answer = array("r" => "0", "d" => "Acceso no valido.");
     if (isset($_POST["user_"]) && isset($_POST["object_"]) && isset($_POST["paym"]) && isset($_POST["tc_"])) {
         $object_id = $_POST["object_"];
         $tc = $_POST["tc_"];
         $days = isset($_POST['day']) ? $_POST['day'] : null;
         //print_array($_POST);
         if ($_POST["user_"] == is_login()) {
             $cost = "";
             $status = false;
             $total = 0;
             switch ($_POST["paym"]) {
                 case "0":
Exemple #5
0
 function add_result($row)
 {
     global $db, $dl_prefix, $cpgtpl, $module_name;
     $this->result[$this->result_count++] = $row;
     $rating_info = get_rating($row['score'], $row['votes']);
     if ($row['date'] >= $row['updated']) {
         $row['date'] = _DLP_PUBLISHED . ': ' . generate_date($row['date']) . mark_date($row['date'], 3, 1, '', 2);
     } else {
         $row['date'] = _DLP_UPDATED . ': ' . generate_date($row['updated']) . mark_date($row['updated'], 3, 2, '', 2);
     }
     if (can_download($row['active'], $row['access'])) {
         $img = dl_image($row['access'] > 0 ? 'download_small_yes.png' : 'download_small.png');
         $img_title = _DLP_DLNOW;
     } else {
         $img = dl_image('download_small_no.png');
         $img_title = _DLP_DLFORBIDDEN;
     }
     if ($row['img_url']) {
         if (ereg('://', $row['img_url'])) {
             $row['img_url'] .= '" width="100';
         } else {
             $row['img_url'] = dl_thumbimage($row['img_url']) . '" width="100';
         }
     }
     $cpgtpl->assign_block_vars('dl_item', array('TITLE' => $row['title'], 'U_INFO' => URL::index('&amp;file=details&amp;id=' . $row['lid']), 'U_GET' => URL::index('&amp;get=' . $row['lid']), 'U_IMG' => $row['screen'] ? URL::index('&amp;screen=' . $row['screen']) : '', 'U_HOME' => $row['homepage'], 'U_WRITE' => URL::index('&amp;review=' . $row['lid']), 'U_REVIEWS' => URL::index('&amp;file=details&amp;id=' . $row['lid'] . '#reviews'), 'NO_REVIEWS' => $row['votes'] == 0 && is_user(), 'REVIEWS' => sprintf($row['votes'] == 1 ? '%s review' : '%s reviews', $row['votes']), 'VERSION' => !empty($row['version']) ? _VERSION . ' ' . $row['version'] : '', 'NOT_ACTIVE' => $row['active'] == 0 && can_admin($module_name) ? _DLP_INACTIVE : '', 'E_PICK' => $row['pick'] ? _DLP_EDPICK : '', 'SECURE' => isset($row['cpgcs']) && $row['cpgcs'] ? 'Certified Secure' : '', 'SUBMITTER' => is_numeric($row['submitter']) ? '<a href="' . URL::index('&amp;file=search&amp;sa=' . $row['submitter']) . '">' . $row['username'] . '</a>' : $row['submitter'], 'DL_IMG' => $img, 'DL_IMG_TITLE' => $img_title, 'RATING_IMG' => $rating_info['image'], 'POP_IMG' => popularity($row['lid']), 'DATE' => $row['date'], 'DESC' => nl2br($row['desc_short']), 'U_SCREEN' => URL::index('&amp;screen=' . $row['screen']), 'IMG_SCREEN' => $row['img_url'], 'IMG_MISSING' => dl_image('missing.png'), 'L_VIEWALLSCREENS' => _DLP_VIEWALLSCREENS, 'L_NOSCREENS' => _DLP_NOSCREENSHOTS, 'L_SUBMITTEDBY' => _DLP_SUBMITTEDBY));
 }
Exemple #6
0
        }
    } else {
        $cpgtpl->assign_var('DL_REVIEWS', false);
    }
    $db->sql_freeresult($result);
    if (can_admin($module_name) || $row['submitter'] == $userinfo['user_id']) {
        // pagination
        $cur_page2 = isset($_GET['p_page']) && $_GET['p_page'] > 0 ? intval($_GET['p_page']) : 1;
        $limit2 = ($cur_page2 - 1) * $perpage;
        $result = $db->sql_query("SELECT r.id, r.uid, r.ip, r.title, r.comment, r.score, r.timestamp, u.username, COUNT(r.score) AS votes FROM " . $dl_prefix . "_ratings r\n\tLEFT JOIN " . $user_prefix . "_users u ON (u.user_id = r.uid)\n\tWHERE r.lid='{$global_id}' AND r.comment!='' AND active=0 \n\tGROUP BY r.id DESC, r.uid, r.ip, r.title, r.comment, r.score, r.timestamp, u.username \n\tLIMIT {$perpage} OFFSET {$limit2}");
        list($pending) = $db->sql_ufetchrow("SELECT COUNT(*) FROM " . $dl_prefix . "_ratings \n\tWHERE lid='{$global_id}' AND active=0");
        if ($db->sql_numrows($result)) {
            $cpgtpl->assign_vars(array('DL_P_REVIEW_PAGES' => ceil($pending / $perpage) > 1 ? gen_pagination($pending, $perpage, $cur_page2, '&amp;file=details&amp;id=' . $global_id, 'p_reviews', 'p_page') : false, 'DL_P_REVIEWS' => $pending));
            $i = 0;
            while (list($review_id, $review_uid, $review_ip, $review_title, $review_comment, $review_score, $review_timestamp, $review_uname, $review_votes) = $db->sql_fetchrow($result)) {
                $rating_info = get_rating($review_score, $review_votes);
                $cpgtpl->assign_block_vars('dl_p_review', array('ID' => $review_id, 'U_ID' => htmlprepare(URL::uri()) . '#r' . $review_id, 'RATING' => _DLP_REVIEW . ' #' . $review_id . ': ' . $rating_info['desc'], 'U_MEMBER' => URL::index('Your_Account&amp;profile=' . $review_uid), 'MEMBERNAME' => $review_uname, 'DATE' => generate_date($review_timestamp), 'U_DEL' => can_admin($module_name) || $row['submitter'] == $userinfo['user_id'] ? '<a href="' . URL::index('&amp;del_review=' . $review_id) . '">[' . strtolower(_DELETE) . ']</a>' : false, 'U_APPR' => can_admin($module_name) || $row['submitter'] == $userinfo['user_id'] ? '<a href="' . URL::index('&amp;approve_review=' . $review_id) . '">[' . strtolower(_DLP_APPROVE) . ']</a>' : false, 'TITLE' => $review_title, 'COMMENT' => decode_bb_all($review_comment), 'IP' => decode_ip($review_ip), 'IMG_RATE' => dl_image('stars/' . $rating_info['rating'] . '.png'), 'SPACER' => $i > 0));
                $i++;
            }
        } else {
            $cpgtpl->assign_var('DL_P_REVIEWS', false);
        }
        $db->sql_freeresult($result);
    } else {
        $cpgtpl->assign_var('DL_P_REVIEWS', false);
    }
}
if ($row['pick']) {
    $cpgtpl->assign_block_vars('dl_image', array('SRC' => dl_image('pick.png'), 'TITLE' => _DLP_EDPICK));
}
// custom fields: images
    $path_params = spliti("/", $path);
}
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    // GET Request
    set_headers($type);
    if ($path_params[1] != null) {
        if ($path_params[1] == languages) {
            render_result(get_languages(), "meta", $type);
            /* render language table */
        }
        if ($path_params[1] == types) {
            render_result(get_types(), "meta", $type);
            /* render musictype table */
        }
        if ($path_params[1] == rating) {
            render_result(get_rating(), "meta", $type);
            /* render possible rating values */
        }
        if ($path_params[1] == quality) {
            render_result(get_quality(), "meta", $type);
            /* render possible quality values */
        }
        if ($path_params[1] == genres) {
            render_result(get_genres(), "meta", $type);
            /* render genre table */
        }
        if ($path_params[1] == source) {
            render_result(get_source(), "meta", $type);
            /* render source table */
        }
    }
Exemple #8
0
/**
 * This PHP script is designed to display a graphical indication of the
 * rating.  It will be called from HTML exactly as if it were an image, and will return
 * an image to the browser with the correct headers.  The image will contain between one
 * and five stars
 *
 * @package    block
 * @subpackage ratings
 * @copyright  2009 Jenny Gray
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 *
 * Code was Rewritten for Moodle 2.X By Atar + Plus LTD for Comverse LTD.
 * @copyright &copy; 2011 Comverse LTD.
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
 */

require_once(dirname(__FILE__).'/../../../config.php');
 $courseid = required_param('courseid', PARAM_INT); // Course.
@header('Content-Type: image/gif');
@header("Expires: ".gmdate("D, d M Y H:i:s") . " GMT" );
@header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
@header("Cache-Control: no-store, no-cache, must-revalidate");
@header("Cache-Control: post-check=0, pre-check=0", false);
@header("Pragma: no-cache");

// Get average of marks given by users.
$block = block_instance('ratings');
$avg = get_rating($courseid);
//if ($avg >= 0) {
    echo file_get_contents( $CFG->dirroot.'/local/ratings/pix/star'.$avg.'.png' );
//}
Exemple #9
0
                    $url = parse_url($row['mirror_url']);
                    $site = shrink_url($url['host']);
                } else {
                    $site = $MAIN_CFG['server']['domain'];
                }
                $cpgtpl->assign_block_vars('dl_item', array('BGCOLOR' => $bgcolor, 'DATE' => generate_date($row['date']), 'TITLE' => $row['title'], 'URL' => URL::index('&amp;file=details&amp;id=' . $row['id']), 'MIRROR' => $row['mirror_url'], 'MIRROR_SITE' => $site, 'REPORT' => $row['report'], 'U_USER' => URL::index('Your_Account&amp;profile=' . $row['uid']), 'USERNAME' => $row['username'], 'U_DISMISS' => URL::index('&amp;file=manage&amp;s=2&amp;dismiss=' . $row['id']), 'U_EDIT' => URL::index('&amp;file=manage&amp;edit=' . $row['lid'])));
            }
        }
        $db->sql_freeresult($result);
        $cpgtpl->set_filenames(array('body' => 'downloads/my_broken.html'));
    } else {
        $pagetitle .= ' ' . _BC_DELIM . ' Current';
        $total_author = $db->sql_count($dl_prefix . '_downloads', "submitter='{$userinfo['user_id']}' AND active!=2");
        $cpgtpl->assign_vars(array('L_CATEGORY' => _CATEGORY, 'L_EDIT' => _EDIT, 'DL_MENU' => '<span class="gen"><strong>My Downloads</strong></span><br /><a href="' . URL::index() . '">Main Page</a> | <strong>Current Downloads</strong> | <a href="' . URL::index('&amp;file=manage&amp;s=1') . '">Pending Downloads</a> | <a href="' . URL::index('&amp;file=manage&amp;s=2') . '">Broken D/L Reports</a>', 'DL_NO_ITEMS' => $total_author < 1 ? sprintf(_ERROR_NONE_TO_DISPLAY, strtolower(_DOWNLOADS)) : false, 'DL_PAGINATION' => ceil($total_author / $perpage) > 1 ? gen_pagination($total_author, $perpage, $cur_page, '&amp;file=manage') : false));
        if ($total_author) {
            $rating = $db->sql_query("SELECT lid, SUM(score)/COUNT(lid) AS score FROM " . $dl_prefix . "_ratings \n\t\t\tGROUP BY lid");
            while ($rows = $db->sql_fetchrow($rating)) {
                $ratings[$rows[0]]['score'] = $rows[1];
            }
            $result = $db->sql_query("SELECT d.lid, d.cid, d.title, d.active, d.desc_short, SUM(s.hits) as hits, SUM(s.views) as views FROM " . $dl_prefix . "_downloads d\n\t\t\t\tLEFT JOIN " . $dl_prefix . "_stats s ON (s.id = d.lid)\n\t\t\t\tWHERE d.submitter='{$userinfo['user_id']}' AND d.active!=2 \n\t\t\t\tGROUP BY d.lid, d.cid, d.title, d.active, d.desc_short \n\t\t\t\tLIMIT {$perpage} OFFSET {$limit}");
            while ($row = $db->sql_fetchrow($result)) {
                $rating_info = isset($ratings[$row['lid']]['score']) ? get_rating($ratings[$row['lid']]['score'], 1) : get_rating(0, 0);
                $cpgtpl->assign_block_vars('dl_item', array('TITLE' => $row['title'], 'U_DETAILS' => URL::index('&amp;file=details&amp;id=' . $row['lid']), 'U_EDIT' => URL::index('&amp;file=manage&amp;edit=' . $row['lid']), 'CATEGORY' => DL_Cat::breadcrumb($row['cid']), 'ACTIVE' => $row['active'] == 1 ? _ACTIVE : _INACTIVE, 'IMG_ACTIVE' => dl_image($row['active'] == 1 ? 'checked.png' : 'unchecked.png'), 'IMG_RATE' => $rating_info['image'], 'IMG_POP' => popularity($row['lid']), 'VIEWS' => $row['views'], 'HITS' => $row['hits']));
            }
            $db->sql_freeresult($result);
        }
        $cpgtpl->set_filenames(array('body' => 'downloads/my_downloads.html'));
    }
    require_once 'header.php';
    $cpgtpl->display('body');
}
function showratings($rtype, $id, $dummy1 = "3rd/4th/5th parameters are needed in oldstyle rating sys", $dummy2 = 0, $dummy3 = 0)
{
    global $show5, $showPerc, $showVotes, $static, $user, $userdata, $locale, $settings;
    if ($settings['ratings_enabled'] == "1" && $rtype != "F" || $settings['forum_ratings'] == "1" && $rtype == "F") {
        $show5 = false;
        $showPerc = false;
        $showVotes = false;
        $static = NULL;
        $boardrate = $rtype == "F" ? true : false;
        add_to_head("<link href='" . INCLUDES_RATING . "css/rating_style.css' rel='stylesheet' type='text/css' media='all' />");
        add_to_head("<script type='text/javascript' src='" . INCLUDES_RATING . "js/rating_update.js'></script>");
        if (!$boardrate) {
            opentable($locale['r100']);
        }
        // Check if they have already voted...
        $text = '';
        if (iMEMBER) {
            $user = $userdata['user_id'];
        } else {
            $user = "******";
        }
        $sel = dbquery("SELECT rating_item_id FROM " . DB_RATINGS . "\r\n\t\t\tWHERE rating_ip=" . _db(USER_IP) . " AND rating_item_id='" . (int) $id . "' AND rating_type=" . _db($rtype));
        $rating = get_rating($id, $rtype);
        $rating_perc = round($rating * 20, 2) . "%";
        $rating_average = round($rating, 2);
        if (dbrows($sel) != 0 || $static == 'novote' || !iMEMBER) {
            echo "<table class='tbl2' cellspacing='0' border='0' width='100%' style='margin: 0.7em 0em 0.7em 0em;'>\n";
            echo "<tr><td width='50%' align='right' valign='middle'>\n";
            echo '<div class="rated_text">';
            echo '<strong>' . $locale['r130'] . '</strong>';
            echo ' (' . $locale['r131'] . ' <span id="showvotes_' . $id . '" class="votesClass">' . get_votes($id, $rtype) . '</span>)';
            echo '<span>&nbsp;&nbsp;</span></div>';
            echo "</td><td width='50%' align='left'>\n";
            echo '<ul class="star-rating2" id="rater_' . $id . '">';
            echo '<li class="current-rating" style="width:' . $rating_perc . ';" id="ul_' . $id . '"></li>';
            echo "<li><a onclick='return true;' href='#' title='" . $locale['r136'] . "' class='one-star' >1</a></li>";
            echo "<li><a onclick='return true;' href='#' title='" . $locale['r137'] . "' class='two-stars'>2</a></li>";
            echo "<li><a onclick='return true;' href='#' title='" . $locale['r138'] . "' class='three-stars'>3</a></li>";
            echo "<li><a onclick='return true;' href='#' title='" . $locale['r139'] . "' class='four-stars'>4</a></li>";
            echo "<li><a onclick='return true;' href='#' title='" . $locale['r140'] . "' class='five-stars'>5</a></li>";
            echo "</ul>";
            echo "</td></tr>\n";
            echo "</table>\n";
            echo "<div align='center' id='loading_" . $id . "'></div>";
            if (!$boardrate) {
                echo "<table cellpadding='0' width='100%' cellspacing='1' class='tbl2 center'>\n";
                echo "\t<tr>\n";
                echo "\t\t<td class='tbl2'><center><strong>" . $locale['r150'] . "</strong>" . $rating_average . " " . $locale['r151'] . "</center></td>\n";
                echo "\t</tr>\n";
                echo "</table>\n";
            }
        } else {
            echo "<table class='tbl2' cellspacing='0' border='0' width='100%' style='margin: 0.7em 0em 0.7em 0em;'>\n";
            echo "<tr><td width='50%' align='right'>\n";
            echo '<div class="rated_text">';
            $show5bool = 'false';
            $showPercbool = 'false';
            $showVotesbool = 'false';
            echo '<strong>' . $locale['r130'] . '</strong><span>&nbsp;&nbsp;</span>';
            echo '</div>';
            echo "</td><td width='50%' align='left'>\n";
            echo '<ul class="star-rating" id="rater_' . $id . '">';
            echo '<li class="current-rating" style="width:' . $rating_perc . ';" id="ul_' . $id . '"></li>';
            $base = INCLUDES . 'ratings/';
            echo '<li><a onclick="rate(\'1\',\'' . $id . '\',' . $show5bool . ',' . $showPercbool . ',' . $showVotesbool . ',\'' . $rtype . '\', \'' . $base . '\'); return false;" href="' . INCLUDES . 'ratings/ratings_type_stars_process.php?id=' . $id . '&rating=1&rtype=' . $rtype . '" title="' . $locale['r136'] . '" class="one-star" >1</a></li>';
            echo '<li><a onclick="rate(\'2\',\'' . $id . '\',' . $show5bool . ',' . $showPercbool . ',' . $showVotesbool . ',\'' . $rtype . '\', \'' . $base . '\'); return false;" href="' . INCLUDES . 'ratings/ratings_type_stars_process.php?id=' . $id . '&rating=2&rtype=' . $rtype . '" title="' . $locale['r137'] . '" class="two-stars">2</a></li>';
            echo '<li><a onclick="rate(\'3\',\'' . $id . '\',' . $show5bool . ',' . $showPercbool . ',' . $showVotesbool . ',\'' . $rtype . '\', \'' . $base . '\'); return false;" href="' . INCLUDES . 'ratings/ratings_type_stars_process.php?id=' . $id . '&rating=3&rtype=' . $rtype . '" title="' . $locale['r138'] . '" class="three-stars">3</a></li>';
            echo '<li><a onclick="rate(\'4\',\'' . $id . '\',' . $show5bool . ',' . $showPercbool . ',' . $showVotesbool . ',\'' . $rtype . '\', \'' . $base . '\'); return false;" href="' . INCLUDES . 'ratings/ratings_type_stars_process.php?id=' . $id . '&rating=4&rtype=' . $rtype . '" title="' . $locale['r139'] . '" class="four-stars">4</a></li>';
            echo '<li><a onclick="rate(\'5\',\'' . $id . '\',' . $show5bool . ',' . $showPercbool . ',' . $showVotesbool . ',\'' . $rtype . '\', \'' . $base . '\'); return false;" href="' . INCLUDES . 'ratings/ratings_type_stars_process.php?id=' . $id . '&rating=5&rtype=' . $rtype . '" title="' . $locale['r140'] . '" class="five-stars">5</a></li>';
            echo '</ul>';
            echo "</td></tr>\n";
            echo "</table>\n";
            echo "<div align='center' id='loading_" . $id . "'></div>";
            if (!$boardrate) {
                echo "<table cellpadding='0' width='100%' cellspacing='1' class='tbl2 center'>\n";
                echo "\t<tr>\n";
                echo "\t\t<td class='tbl2'><center><strong>" . $locale['r150'] . "</strong>" . $rating_average . " " . $locale['r151'] . "</center></td>\n";
                echo "\t</tr>\n";
                echo "</table>\n";
            }
        }
        if (!$boardrate) {
            closetable();
        }
    }
}
Exemple #11
0
$activityid = $_REQUEST['activityid'];
$itemid = $_REQUEST['itemid'];
$ratearea = $_REQUEST['ratearea'];
$rating = $_REQUEST['rating'];
$heading = $_REQUEST['heading'];
if (!$course = $DB->get_record("course", array("id" => $courseid))) {
    print_error("Course ID not found");
}
$rate = new stdClass;
$rate->courseid = $courseid;
$rate->activityid = $activityid;
$rate->itemid = $itemid;
$rate->ratearea = $ratearea;
$rate->userid = $USER->id;
$rate->rating = $rating;
$rate->time = time();
if (!$DB->record_exists('local_rating', array('courseid' => $courseid, 'activityid' => $activityid, 'itemid' => $itemid, 'ratearea' => $ratearea, 'userid' => $USER->id)))
    $rate->id = $DB->insert_record('local_rating', $rate);
$numstars = $rating * 2;
$return_values = array();

$avgratings = get_rating($courseid, $activityid, $itemid, $ratearea);
$res = "<img title='" . ($avgratings->avg / 2) . " out of 5' src='" . $CFG->wwwroot . "/local/ratings/pix/star" . ($avgratings->avg) . ".png'  onclick='fnViewAllRatings($courseid, $activityid, $itemid, \"$ratearea\", \"$CFG->wwwroot\", \"$heading\")'/>";
$return_values[] = $res;
$return_values[] = $avgratings->count;
//$return_values[] = '(you) - '.userdate($rate->time);
echo implode('!@', $return_values);
?>


Exemple #12
0
require_once($CFG->dirroot . '/local/rate_course/lib.php');
$PAGE->requires->css('/local/rate_course/css/style.css');
$id = optional_param('id', 0, PARAM_INT);
$systemcontext = context_system::instance();
$PAGE->set_url('/local/rate_course/review.php');
$PAGE->set_pagelayout('admin');
$PAGE->set_context($systemcontext);
$PAGE->set_heading(get_string('pluginname', 'local_rate_course'));
$PAGE->navbar->add(get_string('pluginname', 'local_rate_course'), new moodle_url('/local/rate_course/review.php?id=' . $id . ''));
$PAGE->navbar->add(get_string('review', 'local_rate_course'));
echo $OUTPUT->header();

echo $OUTPUT->heading(get_string('review', 'local_rate_course'));
$conf = new object();
$conf->fullname = $DB->get_field('course', 'fullname', array('id' => $id));
$numstars = get_rating($id);
$conf->rating = '<img src="' . $CFG->wwwroot . '/local/rate_course/pix/star' . $numstars . '.png">';
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
    echo $OUTPUT->box(get_string('reviewdescription', 'local_rate_course', $conf));
}
$reviews = get_listof_reviews($id);
if (empty($reviews)) {
    echo get_string('noreview', 'local_rate_course');
} else {
    $data = array();
    foreach ($reviews as $review) {
        echo '<hr class="line">';
        $user = $DB->get_record('user', array('id' => $review->userid));
        echo html_writer::start_tag('div', array('class' => 'reviewimage'));
        echo html_writer::tag('p', $OUTPUT->user_picture($user, array('courseid' => SITEID, 'size' => 50)));
        echo html_writer::tag('p', $user->firstname . ' ' . $user->lastname);
Exemple #13
0
 function tot_ratings($module_type, $module_id, $database)
 {
     return count(get_rating($module_type, $module_id, $database));
 }