Skip to content

Commit

Permalink
adding turnitintool 2012092401
Browse files Browse the repository at this point in the history
  • Loading branch information
thepurpleblob committed Oct 22, 2012
1 parent 91914dc commit 1abf777
Show file tree
Hide file tree
Showing 433 changed files with 10,910 additions and 4,249 deletions.
674 changes: 674 additions & 0 deletions mod/turnitintool/COPYING.txt

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions mod/turnitintool/ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2012-09-24 : Update icons with current Turnitin icons, update icons to allow multi version support
2012-09-24 : Fixed bug where Erater settings would reset when editing an assignment part
2012-09-24 : Added support for Translated Matching
2012-09-24 : Fixed numerous PHP strict standards warnings
2012-09-24 : Re-factored Unlink / Relink users page to paginate user data and reduce memory usage
2012-09-24 : Added a config level mod_turnitintool component file browser when using Moodle 2.0+ for mod_turnitintool
2012-09-24 : Fixed issue when defaults are used in a course reset
2012-09-24 : Fixed Tutor management screen HTML bug
2012-04-27 : Fixed assignment start, due and post dates to correctly use server default timezone rather than user default timezone
2012-04-27 : Fixed issue where invalid HTML was generated after an inbox refresh
2012-04-27 : Added feature to allow anonymized student name data during API calls
Expand Down
9 changes: 9 additions & 0 deletions mod/turnitintool/README.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
Moodle Direct Release Notes
------------------------------------------------------------------------------------
####################################################################################
Date: 2012-Sept-24
Release: v2012092401

- Added support for Translated Matching
- Update icons with current Turnitin icons, update icons to allow multi version support
- Added a config level mod_turnitintool component file browser when using Moodle 2.0+ for mod_turnitintool
- Re-factored Unlink / Relink users page to paginate user data and reduce memory usage

####################################################################################
Date: 2011-Aug-18
Release: v2011081801
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected function define_structure() {
'gradedisplay', 'autoupdates', 'commentedittime', 'commentmaxsize',
'autosubmission', 'shownonsubmission', 'excludebiblio', 'excludequoted',
'excludevalue', 'excludetype', 'erater', 'erater_handbook', 'erater_dictionary',
'erater_spelling', 'erater_grammar', 'erater_usage', 'erater_mechanics', 'erater_style'
'erater_spelling', 'erater_grammar', 'erater_usage', 'erater_mechanics', 'erater_style', 'transmatch'
));

$parts = new backup_nested_element('parts');
Expand All @@ -74,7 +74,7 @@ protected function define_structure() {
'submission_status', 'submission_queued', 'submission_attempts',
'submission_modified', 'submission_parent', 'submission_nmuserid',
'submission_nmfirstname', 'submission_nmlastname', 'submission_unanon',
'submission_anonreason', 'tiiuserid'));
'submission_anonreason', 'submission_transmatch', 'tiiuserid'));

$comments = new backup_nested_element('comments');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ protected function process_turnitintool($data) {
}

if ($CFG->turnitin_account_id!=$data->tiiaccount) {
$a = new stdClass();
$a->backupid=$data->tiiaccount;
$a->current=$CFG->turnitin_account_id;
turnitintool_print_error('wrongaccountid','turnitintool',NULL,$a);
Expand Down
2 changes: 2 additions & 0 deletions mod/turnitintool/backuplib.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ function turnitintool_backup_one_mod($bf,$preferences,$turnitintool) {
fwrite ($bf,full_tag("ERATERUSAGE",4,false,$turnitintool->erater_usage));
fwrite ($bf,full_tag("ERATERMECHANICS",4,false,$turnitintool->erater_mechanics));
fwrite ($bf,full_tag("ERATERSTYLE",4,false,$turnitintool->erater_style));
fwrite ($bf,full_tag("TRANSMATCH",4,false,$turnitintool->transmatch));

// Get the parts for this assignment, add check to determine the database call to enable backward compatibility
if (is_callable(array($DB,'get_records'))) {
Expand Down Expand Up @@ -176,6 +177,7 @@ function backup_turnitintool_submissions($bf,$preferences,$turnitintool) {
fwrite ($bf,full_tag("SUBMISSION_NMLASTNAME",6,false,$tii_sub->submission_nmlastname));
fwrite ($bf,full_tag("SUBMISSION_UNANON",6,false,$tii_sub->submission_unanon));
fwrite ($bf,full_tag("SUBMISSION_UNANONREASON",6,false,$tii_sub->submission_unanonreason));
fwrite ($bf,full_tag("SUBMISSION_TRANSMATCH",6,false,$tii_sub->submission_transmatch));

// Get the turnitin user data for this submission, add check to determine the database call to enable backward compatibility
if (is_callable(array($DB,'get_record'))) {
Expand Down
27 changes: 22 additions & 5 deletions mod/turnitintool/comms.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,13 @@ class turnitintool_commclass {
var $curlerror;
/**
* A backward compatible constructor / destructor method that works in PHP4 to emulate the PHP5 magic method __construct
* Disabled to remove strict warnings, only useful for PHP 4 and there shouldn't be too many PHP 4 installs around by now
*/
function turnitintool_commclass($iUid,$iUfn,$iUln,$iUem,$iUtp,&$iLoaderBar) {
/*function turnitintool_commclass($iUid,$iUfn,$iUln,$iUem,$iUtp,&$iLoaderBar) {
if (version_compare(PHP_VERSION,"5.0.0","<")) {
$this->__construct($iUid,$iUfn,$iUln,$iUem,$iUtp,$iLoaderBar);
}
}
}*/
/**
* The constructor for the class, Calls the startsession() method if we are using sessions
*
Expand Down Expand Up @@ -263,10 +264,20 @@ function getSubmissionArray() {
$output[$objectid]["lastname"]=(isset($values['LASTNAME']['value'])) ? $values['LASTNAME']['value'] : '';
$output[$objectid]["title"] = html_entity_decode($values['TITLE']['value'],ENT_QUOTES,"UTF-8");
$output[$objectid]["similarityscore"]=(isset($values['SIMILARITYSCORE']['value']) AND $values['SIMILARITYSCORE']['value']!="-1") ? $values['SIMILARITYSCORE']['value'] : NULL;


$overlap = $values['OVERLAP']['value'];
$transmatch_overlap = ( isset( $values['TRANSLATED_MATCHING'][0] ) ) ? $values['TRANSLATED_MATCHING'][0]['OVERLAP']['value'] : 0;
if ( $transmatch_overlap > $overlap ) {
$high_overlap = $transmatch_overlap;
$output[$objectid]["transmatch"] = 1;
} else {
$high_overlap = $overlap;
$output[$objectid]["transmatch"] = 0;
}

$output[$objectid]["overlap"]=(isset($values['OVERLAP']['value']) // this is the Originality Percentage Score
AND $values['OVERLAP']['value']!="-1"
AND !is_null($output[$objectid]["similarityscore"])) ? $values['OVERLAP']['value'] : NULL;
AND !is_null($output[$objectid]["similarityscore"])) ? $high_overlap : NULL;

$output[$objectid]["grademark"]=(isset($values['SCORE']['value'])
AND $values['SCORE']['value']!="-1"
Expand Down Expand Up @@ -659,6 +670,9 @@ function createAssignment($post,$do='INSERT',$status) {
$assigndata["ets_mechanics"]=$post->erater_mechanics;
$assigndata["ets_style"]=$post->erater_style;
}
if (isset($post->transmatch)) {
$assigndata["translated_matching"]=$post->transmatch;
}
if (isset($post->idsync)) {
$assigndata['idsync']=$post->idsync;
}
Expand Down Expand Up @@ -794,6 +808,7 @@ function getAssignmentObject() {
$pos13 = $this->_xmlkeys['ANON'][$i];
$pos14 = $this->_xmlkeys['MAXPOINTS'][$i];

$output = new stdClass();
$output->assign = $this->_xmlvalues[$pos1]['value'];
$output->dtstart = strtotime($this->_xmlvalues[$pos2]['value']);
$output->dtdue = strtotime($this->_xmlvalues[$pos3]['value']);
Expand Down Expand Up @@ -1533,7 +1548,9 @@ function getLang() {
'tr'=>'tr',
'ca'=>'es',
'sv'=>'sv',
'nl'=>'nl'
'nl'=>'nl',
'fi'=>'fi',
'ar'=>'ar'
);
$langcode = (isset($langarray[$langcode])) ? $langarray[$langcode] : 'en_us';
return $langcode;
Expand Down
12 changes: 12 additions & 0 deletions mod/turnitintool/db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW
)
),

'mod/turnitintool:addinstance' => array(
'riskbitmask' => RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,

'legacy' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/course:manageactivities'
)
);

Expand Down
6 changes: 4 additions & 2 deletions mod/turnitintool/db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
<FIELD NAME="erater_grammar" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="erater_spelling" NEXT="erater_usage"/>
<FIELD NAME="erater_usage" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="erater_grammar" NEXT="erater_mechanics"/>
<FIELD NAME="erater_mechanics" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="erater_usage" NEXT="erater_style"/>
<FIELD NAME="erater_style" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="erater_mechanics"/>
<FIELD NAME="erater_style" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="erater_mechanics" NEXT="transmatch"/>
<FIELD NAME="transmatch" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="erater_style"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
Expand Down Expand Up @@ -122,7 +123,8 @@
<FIELD NAME="submission_nmfirstname" TYPE="text" LENGTH="medium" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="submission_nmuserid" NEXT="submission_nmlastname"/>
<FIELD NAME="submission_nmlastname" TYPE="text" LENGTH="medium" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="submission_nmfirstname" NEXT="submission_unanon"/>
<FIELD NAME="submission_unanon" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="submission_nmlastname" NEXT="submission_unanonreason"/>
<FIELD NAME="submission_unanonreason" TYPE="text" LENGTH="medium" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="submission_unanon"/>
<FIELD NAME="submission_unanonreason" TYPE="text" LENGTH="medium" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="submission_unanon" NEXT="submission_transmatch"/>
<FIELD NAME="submission_transmatch" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="submission_unanonreason"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
Expand Down
25 changes: 25 additions & 0 deletions mod/turnitintool/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,31 @@ function xmldb_turnitintool_upgrade($oldversion) {
}
}

if ($result && $oldversion < 2012081301) {
if (is_callable(array($DB,'get_manager'))) {
$dbman=$DB->get_manager();
$table = new xmldb_table('turnitintool_submissions');
$field = new xmldb_field('submission_transmatch', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, 0, 'submission_unanonreason');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
$table = new xmldb_table('turnitintool');
$field = new xmldb_field('transmatch', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, 0, 'erater_style');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
} else {
$table = new XMLDBTable('turnitintool_submissions');
$field = new XMLDBField('submission_transmatch');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', null, null, null, null, null, 0, 'submission_unanonreason');
$result = $result && add_field($table, $field);
$table = new XMLDBTable('turnitintool');
$field = new XMLDBField('transmatch');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', null, null, null, null, null, 0, 'erater_style');
$result = $result && add_field($table, $field);
}
}

return $result;
}

Expand Down
Loading

0 comments on commit 1abf777

Please sign in to comment.