[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
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 * Post-install script for the quiz statistics report. 19 * 20 * @package quiz_statistics 21 * @copyright 2008 Jamie Pratt 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 defined('MOODLE_INTERNAL') || die(); 26 27 /** 28 * Quiz statistics report upgrade code. 29 */ 30 function xmldb_quiz_statistics_upgrade($oldversion) { 31 global $DB; 32 33 $dbman = $DB->get_manager(); 34 35 // Moodle v2.2.0 release upgrade line. 36 // Put any upgrade step following this. 37 38 // Moodle v2.3.0 release upgrade line 39 // Put any upgrade step following this 40 41 // Moodle v2.4.0 release upgrade line 42 // Put any upgrade step following this 43 44 // Moodle v2.5.0 release upgrade line. 45 // Put any upgrade step following this. 46 47 if ($oldversion < 2013092000) { 48 49 // Define table question_statistics to be dropped. 50 $table = new xmldb_table('quiz_question_statistics'); 51 52 // Conditionally launch drop table for question_statistics. 53 if ($dbman->table_exists($table)) { 54 $dbman->drop_table($table); 55 } 56 57 // Define table question_response_analysis to be dropped. 58 $table = new xmldb_table('quiz_question_response_stats'); 59 60 // Conditionally launch drop table for question_response_analysis. 61 if ($dbman->table_exists($table)) { 62 $dbman->drop_table($table); 63 } 64 65 $table = new xmldb_table('quiz_statistics'); 66 $field = new xmldb_field('quizid'); 67 68 if ($dbman->field_exists($table, $field)) { 69 $dbman->drop_field($table, $field); 70 } 71 72 $field = new xmldb_field('groupid'); 73 74 if ($dbman->field_exists($table, $field)) { 75 $dbman->drop_field($table, $field); 76 } 77 78 $field = new xmldb_field('hashcode', XMLDB_TYPE_CHAR, '40', null, XMLDB_NOTNULL, null, null, 'id'); 79 80 if (!$dbman->field_exists($table, $field)) { 81 $dbman->add_field($table, $field); 82 } 83 84 // Main savepoint reached. 85 upgrade_plugin_savepoint(true, 2013092000, 'quiz', 'statistics'); 86 } 87 88 if ($oldversion < 2013093000) { 89 // Define table quiz_statistics to be dropped. 90 $table = new xmldb_table('quiz_statistics'); 91 92 // Conditionally launch drop table for quiz_statistics. 93 if ($dbman->table_exists($table)) { 94 $dbman->drop_table($table); 95 } 96 97 // Define table quiz_statistics to be created. 98 $table = new xmldb_table('quiz_statistics'); 99 100 // Adding fields to table quiz_statistics. 101 $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); 102 $table->add_field('hashcode', XMLDB_TYPE_CHAR, '40', null, XMLDB_NOTNULL, null, null); 103 $table->add_field('whichattempts', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, null); 104 $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); 105 $table->add_field('firstattemptscount', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); 106 $table->add_field('highestattemptscount', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); 107 $table->add_field('lastattemptscount', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); 108 $table->add_field('allattemptscount', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); 109 $table->add_field('firstattemptsavg', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null); 110 $table->add_field('highestattemptsavg', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null); 111 $table->add_field('lastattemptsavg', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null); 112 $table->add_field('allattemptsavg', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null); 113 $table->add_field('median', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null); 114 $table->add_field('standarddeviation', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null); 115 $table->add_field('skewness', XMLDB_TYPE_NUMBER, '15, 10', null, null, null, null); 116 $table->add_field('kurtosis', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null); 117 $table->add_field('cic', XMLDB_TYPE_NUMBER, '15, 10', null, null, null, null); 118 $table->add_field('errorratio', XMLDB_TYPE_NUMBER, '15, 10', null, null, null, null); 119 $table->add_field('standarderror', XMLDB_TYPE_NUMBER, '15, 10', null, null, null, null); 120 121 // Adding keys to table quiz_statistics. 122 $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); 123 124 // Conditionally launch create table for quiz_statistics. 125 if (!$dbman->table_exists($table)) { 126 $dbman->create_table($table); 127 } 128 129 // Statistics savepoint reached. 130 upgrade_plugin_savepoint(true, 2013093000, 'quiz', 'statistics'); 131 } 132 133 // Moodle v2.6.0 release upgrade line. 134 // Put any upgrade step following this. 135 136 // Moodle v2.7.0 release upgrade line. 137 // Put any upgrade step following this. 138 139 // Moodle v2.8.0 release upgrade line. 140 // Put any upgrade step following this. 141 142 return true; 143 } 144
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |