Parent Directory
|
Revision Log
Revision 1.2 - (view) (download)
| 1 : | dservos | 1.1 | <?php |
| 2 : | dservos | 1.2 | /////////////////////////////////////////////////////////////////////////// |
| 3 : | // // | ||
| 4 : | // NOTICE OF COPYRIGHT // | ||
| 5 : | // // | ||
| 6 : | // Moodle - Modular Object-Oriented Dynamic Learning Environment // | ||
| 7 : | // http://moodle.org // | ||
| 8 : | // // | ||
| 9 : | // Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com // | ||
| 10 : | // // | ||
| 11 : | // This program is free software; you can redistribute it and/or modify // | ||
| 12 : | // it under the terms of the GNU General Public License as published by // | ||
| 13 : | // the Free Software Foundation; either version 2 of the License, or // | ||
| 14 : | // (at your option) any later version. // | ||
| 15 : | // // | ||
| 16 : | // This program is distributed in the hope that it will be useful, // | ||
| 17 : | // but WITHOUT ANY WARRANTY; without even the implied warranty of // | ||
| 18 : | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // | ||
| 19 : | // GNU General Public License for more details: // | ||
| 20 : | // // | ||
| 21 : | // http://www.gnu.org/copyleft/gpl.html // | ||
| 22 : | // // | ||
| 23 : | /////////////////////////////////////////////////////////////////////////// | ||
| 24 : | |||
| 25 : | dservos | 1.1 | require_once $CFG->dirroot . '/grade/report/visual/visualizations/visualization.php'; |
| 26 : | |||
| 27 : | class grades_vs_students extends visualization { | ||
| 28 : | |||
| 29 : | public $colorencoder; | ||
| 30 : | |||
| 31 : | public $shapeencoder; | ||
| 32 : | |||
| 33 : | public $grouplegend; | ||
| 34 : | |||
| 35 : | public $itemlegend; | ||
| 36 : | |||
| 37 : | |||
| 38 : | public function __construct() { | ||
| 39 : | parent::__construct(get_string('gradesvsstudents', 'gradereport_visual')); | ||
| 40 : | |||
| 41 : | $this->layout = visualization::LAYOUT_AXIS; | ||
| 42 : | $this->layoutsettings = null; | ||
| 43 : | |||
| 44 : | $this->xaxis = 'student'; | ||
| 45 : | $this->yaxis = 'grade'; | ||
| 46 : | |||
| 47 : | $this->xaxislabel = get_string('student', 'gradereport_visual'); | ||
| 48 : | $this->yaxislabel = get_string('grade', 'gradereport_visual'); | ||
| 49 : | $this->title = get_string('gradesvsstudents:title', 'gradereport_visual'); | ||
| 50 : | |||
| 51 : | dservos | 1.2 | $this->capability = 'gradereport/visual:vis:grades_vs_students'; |
| 52 : | dservos | 1.1 | |
| 53 : | $this->colorencoder = new encoder(encoder::ENCODER_COLOR, 'item'); | ||
| 54 : | $this->shapeencoder = new encoder(encoder::ENCODER_SHAPE, 'group'); | ||
| 55 : | $this->encoders = array($this->colorencoder, $this->shapeencoder); | ||
| 56 : | |||
| 57 : | $this->grouplegend = new legend($this->shapeencoder); | ||
| 58 : | $this->itemlegend = new legend($this->colorencoder); | ||
| 59 : | $this->legends = array($this->itemlegend, $this->grouplegend); | ||
| 60 : | } | ||
| 61 : | |||
| 62 : | |||
| 63 : | public function report_data($visualreport) { | ||
| 64 : | $data = array(); | ||
| 65 : | $data['header'] = array(); | ||
| 66 : | $data['header']['student'] = 'student'; | ||
| 67 : | $data['header']['grade'] = 'grade'; | ||
| 68 : | $data['header']['item'] = 'item'; | ||
| 69 : | $data['header']['group'] = 'group'; | ||
| 70 : | |||
| 71 : | foreach($visualreport->grades as $itemkey=>$itemgrades) { | ||
| 72 : | foreach($itemgrades as $studentkey=>$studentdata) { | ||
| 73 : | if($studentdata != null && $studentdata->finalgrade != null) { | ||
| 74 : | foreach(groups_get_user_groups($visualreport->courseid, $studentkey) as $grouping) { | ||
| 75 : | if(count($grouping) > 0) { | ||
| 76 : | foreach($grouping as $group) { | ||
| 77 : | $data[$studentkey . '-' . $itemkey . '-' . $group]['student'] = $visualreport->users[$studentkey]->firstname . ' ' . $visualreport->users[$studentkey]->lastname; | ||
| 78 : | $data[$studentkey . '-' . $itemkey . '-' . $group]['grade'] = $studentdata->standardise_score($studentdata->finalgrade, $visualreport->gtree->items[$itemkey]->grademin, $visualreport->gtree->items[$itemkey]->grademax, 0, 100); | ||
| 79 : | $data[$studentkey . '-' . $itemkey . '-' . $group]['item'] = $visualreport->gtree->items[$itemkey]->get_name(); | ||
| 80 : | $data[$studentkey . '-' . $itemkey . '-' . $group]['group'] = groups_get_group_name($group); | ||
| 81 : | } | ||
| 82 : | } else { | ||
| 83 : | $data[$studentkey . '-' . $itemkey . '-ng' ]['student'] = $visualreport->users[$studentkey]->firstname . ' ' . $visualreport->users[$studentkey]->lastname; | ||
| 84 : | $data[$studentkey . '-' . $itemkey . '-ng' ]['grade'] = $studentdata->standardise_score($studentdata->finalgrade, $visualreport->gtree->items[$itemkey]->grademin, $visualreport->gtree->items[$itemkey]->grademax, 0, 100); | ||
| 85 : | $data[$studentkey . '-' . $itemkey . '-ng' ]['item'] = $visualreport->gtree->items[$itemkey]->get_name(); | ||
| 86 : | $data[$studentkey . '-' . $itemkey . '-ng' ]['group'] = get_string('nogroup', 'gradereport_visual'); | ||
| 87 : | } | ||
| 88 : | } | ||
| 89 : | } | ||
| 90 : | } | ||
| 91 : | } | ||
| 92 : | |||
| 93 : | return $data; | ||
| 94 : | } | ||
| 95 : | } | ||
| 96 : | |||
| 97 : | ?> |
| Moodle CVS Admin | ViewVC Help |
| Powered by ViewVC 1.0.7 |