Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
/**
18
 * This PHP script is designed to display a graphical indication of the
19
 * rating.  It will be called from HTML exactly as if it were an image, and will return
20
 * an image to the browser with the correct headers.  The image will contain between one
21
 * and five stars
22
 *
23
 * @package    block
24
 * @subpackage rate_course
25
 * @copyright  2009 Jenny Gray
26
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27
 *
28
 * Code was Rewritten for Moodle 2.X By Atar + Plus LTD for Comverse LTD.
29
 * @copyright &copy; 2011 Comverse LTD.
30
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
31
 */
32
 
33
require_once(dirname(__FILE__).'/../../../config.php');
34
 
35
$courseid = required_param('courseid', PARAM_INT); // Course.
36
 
37
@header('Content-Type: image/gif');
38
@header("Expires: ".gmdate("D, d M Y H:i:s") . " GMT" );
39
@header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
40
@header("Cache-Control: no-store, no-cache, must-revalidate");
41
@header("Cache-Control: post-check=0, pre-check=0", false);
42
@header("Pragma: no-cache");
43
 
44
// Get average of marks given by users.
45
$block = block_instance('rate_course');
46
$avg = $block->get_rating($courseid);
47
if ($avg >= 0) {
48
    echo file_get_contents( $CFG->dirroot.'/blocks/rate_course/pix/star'.$avg.'.png' );
49
}