Plagiarism API MDL-13680 add plagiarism support for user submitted files - currently only added to single and advanced Assignment types - other modules to come in future.

This commit is contained in:
Dan Marsden
2010-09-20 07:32:31 +00:00
parent e71e340d8e
commit bce59524ce
15 changed files with 377 additions and 2 deletions
+86
View File
@@ -6552,6 +6552,92 @@ class admin_setting_manageexternalservices extends admin_setting {
return highlight($query, $return);
}
}
/**
* Special class for plagiarism administration.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_setting_manageplagiarism extends admin_setting {
/**
* Calls parent::__construct with specific arguments
*/
public function __construct() {
$this->nosave = true;
parent::__construct('plagiarismui', get_string('plagiarismsettings', 'plagiarism'), '', '');
}
/**
* Always returns true
*
* @return true
*/
public function get_setting() {
return true;
}
/**
* Always returns true
*
* @return true
*/
public function get_defaultsetting() {
return true;
}
/**
* Always returns '' and doesn't write anything
*
* @return string Always returns ''
*/
public function write_setting($data) {
// do not write any setting
return '';
}
/**
* Return XHTML to display control
*
* @param mixed $data Unused
* @param string $query
* @return string highlight
*/
public function output_html($data, $query='') {
global $CFG, $OUTPUT;
// display strings
$txt = get_strings(array('settings', 'name'));
$plagiarismplugins = get_plugin_list('plagiarism');
if (empty($plagiarismplugins)) {
return get_string('nopluginsinstalled', 'plagiarism');
}
$return = $OUTPUT->heading(get_string('availableplugins', 'plagiarism'), 3, 'main');
$return .= $OUTPUT->box_start('generalbox authsui');
$table = new html_table();
$table->head = array($txt->name, $txt->settings);
$table->align = array('left', 'center');
$table->data = array();
$table->attributes['class'] = 'manageplagiarismtable generaltable';
// iterate through auth plugins and add to the display table
$authcount = count($plagiarismplugins);
foreach ($plagiarismplugins as $plugin => $dir) {
if (file_exists($dir.'/settings.php')) {
$displayname = "<span>".get_string($plugin, 'plagiarism_'.$plugin)."</span>";
// settings link
$settings = "<a href=\"$CFG->wwwroot/plagiarism/$plugin/settings.php\">{$txt->settings}</a>";
// add a row to the table
$table->data[] =array($displayname, $settings);
}
}
$return .= html_writer::table($table);
$return .= get_string('configplagiarismplugins', 'plagiarism');
$return .= $OUTPUT->box_end();
return highlight($query, $return);
}
}
/**
* Special class for overview of external services