Commit 5e06efcb authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Gerrit Code Review
Browse files

Merge changes from topic 'lti-assignments'

* changes:
  Bug 1789297: module/lti: LTI assignment submission fix
  Bug 1789297: module/lti: Hide LTI groups
  Bug 1789297: module/lti: LTI assignment submission
  Bug 1789297: module/lti: Allow mahara to load in an iframe
  Bug 1789297: module/lti: Capture LTI outcome data to session
parents 14bf1063 b078b3a8
......@@ -1279,7 +1279,7 @@ class ArtefactTypeAnnotationfeedback extends ArtefactType {
// we are dealing with an annotation added since smartevidence was added
$defaultval = $evidence->state;
if ($options = Framework::get_my_assessment_options_for_user($view->get('owner'), $evidence->framework)) {
if ($options = Framework::get_my_assessment_options_for_user($view, $evidence->framework)) {
if (!array_key_exists($defaultval, $options)) {
$defaultval = null;
}
......
......@@ -363,7 +363,7 @@ if (!defined('CLI')) {
header('Pragma: no-cache');
// Security headers. See https://www.owasp.org/index.php/List_of_useful_HTTP_headers
header('X-Frame-Options: SAMEORIGIN');
header('X-XSS-Protection: 1; mode=block');
header('X-Content-Type-Options: nosniff');
header('X-Permitted-Cross-Domain-Policies: master-only');
......@@ -372,6 +372,16 @@ if (!defined('CLI')) {
}
// Don't print precise PHP version as an HTTP header
header_remove('x-powered-by');
// Allow LTI to load in an iframe
if ($csp_ancestor_exemption = $SESSION->get('csp-ancestor-exemption')) {
header("Content-Security-Policy: frame-ancestors 'self' $csp_ancestor_exemption");
header('X-Frame-Options: ALLOW-FROM '. $csp_ancestor_exemption);
}
else {
header("Content-Security-Policy: frame-ancestors 'self'");
header('X-Frame-Options: SAMEORIGIN');
}
}
// Only do authentication once we know the page theme, so that the login form
......
......@@ -1258,7 +1258,7 @@ class Collection {
* @param int $owner The owner of the collection (if not just $USER)
* @throws SystemException
*/
public function submit($group = null, $submittedhost = null, $owner = null) {
public function submit($group = null, $submittedhost = null, $owner = null, $sendnotification=true) {
global $USER;
if ($this->is_submitted()) {
......@@ -1318,7 +1318,7 @@ class Collection {
'name' => $this->name,
'group' => ($group) ? $group->id : null,
'groupname' => ($group) ? $group->name : null));
if ($group) {
if ($group && $sendnotification) {
activity_occurred(
'groupmessage',
array(
......
......@@ -2198,6 +2198,9 @@ function group_get_associated_groups($userid, $filter='all', $limit=20, $offset=
}
// TODO: make it work on other databases?
$ltijoin = is_plugin_active('lti', 'module') ? ' LEFT JOIN {lti_assessment} a ON g.id = a.group ' : '';
$ltiwhere = is_plugin_active('lti', 'module') ? ' AND a.id IS NULL ' : '';
// Different filters join on the different kinds of association
if ($filter == 'admin') {
$sql = "
......@@ -2273,7 +2276,9 @@ function group_get_associated_groups($userid, $filter='all', $limit=20, $offset=
}
}
$count = count_records_sql('SELECT COUNT(*) FROM {group} g ' . $sql . ' WHERE g.deleted = ?'.$catsql, $values);
$sql .= $ltijoin;
$count = count_records_sql('SELECT COUNT(*) FROM {group} g ' . $sql . ' WHERE g.deleted = ? ' . $ltiwhere . $catsql, $values);
// almost the same as query used in find - common parts should probably be pulled out
// gets the groups filtered by above
......@@ -2289,8 +2294,8 @@ function group_get_associated_groups($userid, $filter='all', $limit=20, $offset=
FROM {group} g
LEFT JOIN {group_member} gm ON (gm.group = g.id)' .
$sql . '
WHERE g.deleted = ?' .
$catsql . '
WHERE g.deleted = ? ' .
$ltiwhere . $catsql . '
GROUP BY g.id, g.name, g.description, g.public, g.jointype, g.request, g.grouptype, g.submittableto,
g.hidemembers, g.hidemembersfrommembers, g.groupparticipationreports, g.urlid, t.membershiptype, t.reason, t.role, g.editwindowstart, g.editwindowend
) g1
......@@ -2341,16 +2346,17 @@ function group_get_user_groups($userid=null, $roles=null, $sort=null, $limit=nul
}
if (!$fromcache || !isset($usergroups[$userid])) {
$ltijoin = is_plugin_active('lti', 'module') ? ' LEFT JOIN {lti_assessment} a ON g.id = a.group ' : '';
$ltiwhere = is_plugin_active('lti', 'module') ? ' AND a.id IS NULL ' : '';
$groups = get_records_sql_array("
SELECT g.id, g.name, gm.role, g.jointype, g.request, g.grouptype, gtr.see_submitted_views, g.category,
g.hidemembers, g.invitefriends, g.urlid, gm.ctime, gm1.role AS loggedinrole
FROM {group} g
JOIN {group_member} gm ON gm.group = g.id
JOIN {grouptype_roles} gtr ON g.grouptype = gtr.grouptype AND gm.role = gtr.role
LEFT OUTER JOIN {group_member} gm1 ON gm1.group = gm.group AND gm1.member = ?
LEFT OUTER JOIN {group_member} gm1 ON gm1.group = gm.group AND gm1.member = ?" . $ltijoin . "
WHERE gm.member = ?
AND g.deleted = 0
AND g.deleted = 0" . $ltiwhere . "
ORDER BY g.name, gm.role = 'admin' DESC, gm.role, g.id",
array($loggedinid, $userid)
);
......
......@@ -3963,6 +3963,7 @@ class View {
public static function get_myviews_data($limit=12, $offset=0, $query=null, $tag=null, $groupid=null, $institution=null, $orderby=null, $searchin=null, $alltags=false) {
global $USER;
$userid = (!$groupid && !$institution) ? $USER->get('id') : null;
$haslti = is_plugin_active('lti', 'module') ? true : false;
$select = '
SELECT v.id, v.id AS vid, v.title, v.title AS vtitle, v.description, v.type, v.ctime as vctime, v.mtime as vmtime, v.atime as vatime,
......@@ -4138,17 +4139,20 @@ class View {
if ($userid) {
$select .= ',v.submittedtime, v.submittedstatus,
g.id AS submitgroupid, g.name AS submitgroupname, g.urlid AS submitgroupurlid,
h.wwwroot AS submithostwwwroot, h.name AS submithostname';
h.wwwroot AS submithostwwwroot, h.name AS submithostname' . ($haslti ? ', a.id AS ltiassessment' : '');
$collselect .= ', c.submittedtime, c.submittedstatus,
g.id AS submitgroupid, g.name AS submitgroupname, g.urlid AS submitgroupurlid,
h.wwwroot AS submithostwwwroot, h.name AS submithostname';
h.wwwroot AS submithostwwwroot, h.name AS submithostname' . ($haslti ? ', a.id AS ltiassessment' : '');
$emptycollselect .= ', c.submittedtime, c.submittedstatus,
NULL AS submitgroupid, NULL AS submitgroupname, NULL AS submitgroupurlid,
NULL AS submithostwwwroot, NULL AS submithostname';
NULL AS submithostwwwroot, NULL AS submithostname' . ($haslti ? ', NULL AS ltiassessment' : '');
$fromstr = '
LEFT OUTER JOIN {group} g ON (v.submittedgroup = g.id AND g.deleted = 0)
LEFT OUTER JOIN {host} h ON (v.submittedhost = h.wwwroot)';
if ($haslti) {
$fromstr .= ' LEFT JOIN {lti_assessment} a ON g.id = a.group ';
}
$from .= $fromstr;
$collfrom .= $fromstr;
......@@ -4217,7 +4221,12 @@ class View {
if (!empty($data['submittedstatus'])) {
$status = $data['submittedstatus'];
if (!empty($data['submitgroupid'])) {
$url = group_homepage_url((object) array('id' => $data['submitgroupid'], 'urlid' => $data['submitgroupurlid']));
if ($haslti && $data['ltiassessment']) {
$url = '#';
}
else {
$url = group_homepage_url((object) array('id' => $data['submitgroupid'], 'urlid' => $data['submitgroupurlid']));
}
$name = hsc($data['submitgroupname']);
}
else if (!empty($data['submithostwwwroot'])) {
......@@ -6924,7 +6933,7 @@ class View {
return $data;
}
public function submit($group) {
public function submit($group, $sendnotification=true) {
global $USER;
if ($this->is_submitted()) {
......@@ -6939,31 +6948,34 @@ class View {
'name' => $this->title,
'group' => $group->id,
'groupname' => $group->name));
activity_occurred(
'groupmessage',
array(
'group' => $group->id,
'roles' => $group->roles,
'url' => $this->get_url(false),
'strings' => (object) array(
'urltext' => (object) array('key' => 'view'),
'subject' => (object) array(
'key' => 'viewsubmittedsubject1',
'section' => 'activity',
'args' => array($group->name),
),
'message' => (object) array(
'key' => 'viewsubmittedmessage1',
'section' => 'activity',
'args' => array(
display_name($USER, null, false, true),
$this->title,
$group->name,
if ($sendnotification) {
activity_occurred(
'groupmessage',
array(
'group' => $group->id,
'roles' => $group->roles,
'url' => $this->get_url(false),
'strings' => (object) array(
'urltext' => (object) array('key' => 'view'),
'subject' => (object) array(
'key' => 'viewsubmittedsubject1',
'section' => 'activity',
'args' => array($group->name),
),
'message' => (object) array(
'key' => 'viewsubmittedmessage1',
'section' => 'activity',
'args' => array(
display_name($USER, null, false, true),
$this->title,
$group->name,
),
),
),
),
)
);
)
);
}
}
/**
......
......@@ -828,7 +828,7 @@ class Framework {
return false;
}
$options = self::get_my_assessment_options_for_user($view->get('owner'), $evidence->framework);
$options = self::get_my_assessment_options_for_user($view, $evidence->framework);
if (!$options) {
// not allowed to set the assessment so we just show the current state as html
$choices = self::get_evidence_statuses($collection->get('framework'));
......@@ -942,26 +942,28 @@ class Framework {
/**
* Check to see if a user can set the assessment status for a piece of evidence.
*
* @param string $ownerid The owner of the smart evidence annotation
* @param string $view The view being assessed
* @param string $framework ID of the framework
*
* @return bool
*/
public static function can_assess_user($ownerid, $framework = null) {
return (boolean) static::get_my_assessment_options_for_user($ownerid, $framework);
public static function can_assess_user($view, $framework = null) {
return (boolean) static::get_my_assessment_options_for_user($view, $framework);
}
/**
* Get assessment status options for a piece of evidence.
*
* @param string $ownerid The owner of the smart evidence annotation
* @param string $view The view being assessed
* @param string $framework ID of the framework
* @return array Options for select dropdown
*/
public static function get_my_assessment_options_for_user($ownerid, $framework = null) {
public static function get_my_assessment_options_for_user($view, $framework = null) {
global $USER;
$ownerid = $view->get('owner');
if (empty($ownerid) || !is_numeric($ownerid)) {
return false;
}
......@@ -983,6 +985,11 @@ class Framework {
$isadminofowner = true;
}
}
else if (!empty($USER->get('id')) && !empty($view->get('submittedgroup')) && group_user_can_assess_submitted_views($view->get('submittedgroup'), $USER->get('id'))) {
if ($USER->get('id') != $owner->get('id')) {
$isadminofowner = true;
}
}
require_once(get_config('libroot') . 'institution.php');
$institution = new Institution($institution);
......
......@@ -97,7 +97,7 @@ else if ($action == 'evidence') {
}
require_once('view.php');
$view = new View($evidence->view);
if (!Framework::can_assess_user($view->get('owner'), $evidence->framework)) {
if (!Framework::can_assess_user($view, $evidence->framework)) {
json_reply(true, get_string('accessdenied', 'error'));
exit;
}
......
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="module/lti/db" VERSION="20180307" COMMENT="XMLDB file for lti related tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="lti_assessment">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
<FIELD NAME="oauthserver" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="resourcelinkid" TYPE="text" NOTNULL="true" />
<FIELD NAME="contextid" TYPE="text" NOTNULL="true" />
<FIELD NAME="lisoutcomeserviceurl" TYPE="text" NOTNULL="true" />
<FIELD NAME="contexttitle" TYPE="text" NOTNULL="false" />
<FIELD NAME="resourcelinktitle" TYPE="text" NOTNULL="false" />
<FIELD NAME="group" TYPE="int" NOTNULL="true" />
<FIELD NAME="emailnotifications" TYPE="int" LENGTH="1" DEFAULT="1" NOTNULL="true" />
<FIELD NAME="lock" TYPE="int" LENGTH="1" DEFAULT="1" NOTNULL="true" />
<FIELD NAME="archive" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="true" />
<FIELD NAME="timeconfigured" TYPE="datetime" NOTNULL="false" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
<KEY NAME="oauthserverregistryfk" TYPE="foreign" FIELDS="oauthserver" REFTABLE="oauth_server_registry" REFFIELDS="id" />
<KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
</KEYS>
<INDEXES>
<INDEX NAME="resourcelinkididx" UNIQUE="false" FIELDS="resourcelinkid" />
<INDEX NAME="contextididx" UNIQUE="false" FIELDS="contextid" />
</INDEXES>
</TABLE>
<TABLE NAME="lti_assessment_submission">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
<FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="ltiassessment" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="lisresultsourceid" TYPE="text" NOTNULL="true" />
<FIELD NAME="timesubmitted" TYPE="datetime" NOTNULL="true" />
<FIELD NAME="grade" TYPE="int" LENGTH="4" NOTNULL="false" />
<FIELD NAME="timegraded" TYPE="datetime" NOTNULL="false" />
<FIELD NAME="gradedbyusr" TYPE="int" LENGTH="10" NOTNULL="false" />
<FIELD NAME="collectionid" TYPE="int" LENGTH="10" NOTNULL="false" />
<FIELD NAME="viewid" TYPE="int" LENGTH="10" NOTNULL="false" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
<KEY NAME="userfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
<KEY NAME="collectionidfk" TYPE="foreign" FIELDS="collectionid" REFTABLE="collection" REFFIELDS="id" />
<KEY NAME="viewfk" TYPE="foreign" FIELDS="viewid" REFTABLE="view" REFFIELDS="id" />
<KEY NAME="ltiassessmentfk" TYPE="foreign" FIELDS="ltiassessment" REFTABLE="lti_assessment" REFFIELDS="id" />
</KEYS>
<INDEXES>
<INDEX NAME="lisresultsourceididx" UNIQUE="false" FIELDS="lisresultsourceid" />
</INDEXES>
</TABLE>
</TABLES>
</XMLDB>
<?php
/**
*
* @package mahara
* @subpackage module-lti
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
function xmldb_module_lti_upgrade($oldversion=0) {
$status = true;
/**
* Ensure that all the Web Services tables have been created - even if we
* are transitioning from artefact/webservice to webservice
*/
if ($oldversion < 2018071009) {
log_debug('Adding "lti_assessment" table');
$table = new XMLDBTable('lti_assessment');
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, XMLDB_SEQUENCE);
$table->addFieldInfo('oauthserver', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL);
$table->addFieldInfo('resourcelinkid', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL);
$table->addFieldInfo('contextid', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL);
$table->addFieldInfo('lisoutcomeserviceurl', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL);
$table->addFieldInfo('contexttitle', XMLDB_TYPE_TEXT);
$table->addFieldInfo('resourcelinktitle', XMLDB_TYPE_TEXT);
$table->addFieldInfo('group', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL);
$table->addFieldInfo('emailnotifications', XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, null, null, 1);
$table->addFieldInfo('lock', XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, null, null, 1);
$table->addFieldInfo('archive', XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, null, null, 0);
$table->addFieldInfo('timeconfigured', XMLDB_TYPE_DATETIME);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->addKeyInfo('oauthserverregistryfk', XMLDB_KEY_FOREIGN, array('oauthserver'), 'oauth_server_registry', array('id'));
$table->addKeyInfo('groupfk', XMLDB_KEY_FOREIGN, array('group'), 'group', array('id'));
$table->addIndexInfo('resourcelinkididx', XMLDB_INDEX_NOTUNIQUE, array('resourcelinkid'));
$table->addIndexInfo('contextididx', XMLDB_INDEX_NOTUNIQUE, array('contextid'));
create_table($table);
log_debug('Adding "lti_assessment_submission" table');
$table = new XMLDBTable('lti_assessment_submission');
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, XMLDB_SEQUENCE);
$table->addFieldInfo('usr', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL);
$table->addFieldInfo('ltiassessment', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL);
$table->addFieldInfo('lisresultsourceid', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL);
$table->addFieldInfo('timesubmitted', XMLDB_TYPE_DATETIME, null, null, XMLDB_NOTNULL);
$table->addFieldInfo('grade', XMLDB_TYPE_INTEGER, 4);
$table->addFieldInfo('timegraded', XMLDB_TYPE_DATETIME);
$table->addFieldInfo('gradedbyusr', XMLDB_TYPE_INTEGER, 10);
$table->addFieldInfo('collectionid', XMLDB_TYPE_INTEGER, 10);
$table->addFieldInfo('viewid', XMLDB_TYPE_INTEGER, 10);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->addKeyInfo('userfk', XMLDB_KEY_FOREIGN, array('usr'), 'usr', array('id'));
$table->addKeyInfo('collectionidfk', XMLDB_KEY_FOREIGN, array('collectionid'), 'collection', array('id'));
$table->addKeyInfo('ltiassessmentfk', XMLDB_KEY_FOREIGN, array('ltiassessment'), 'lti_assessment', array('id'));
$table->addKeyInfo('viewfk', XMLDB_KEY_FOREIGN, array('viewid'), 'view', array('id'));
$table->addIndexInfo('lisresultsourceididx', XMLDB_INDEX_NOTUNIQUE, array('lisresultsourceid'));
create_table($table);
}
return true;
}
\ No newline at end of file
<?php
/**
*
* @package mahara
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once(get_config('libroot') . 'collection.php');
require_once(get_config('libroot') . 'view.php');
// We relocated this file to view/index.php now that we have merged the pages and collections list.
// Redirect to the new URL.
$collectionid = param_integer('collectionid', 0);
$viewid = param_integer('viewid', 0);
if ($collectionid) {
$collection = new Collection($collectionid);
redirect($collection->get_url());
}
else if ($viewid) {
$view = new View($viewid);
redirect($view->get_url());
}
<!-- @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later -->
<!-- @copyright For copyright information on Mahara, please see the README file distributed with this software. -->
<h3>Grade</h3>
<p>Please select a grade from 0 - 100.</p>
......@@ -11,21 +11,52 @@
defined('INTERNAL') || die();
$string['archive'] = 'Archive when graded';
$string['archivedescription'] = 'After a grade has been awarded, a snapshot of the portfolio will be taken.';
$string['autoconfiguredesc'] = 'Automatically enable settings and configurations needed for LTI.';
$string['autoconfiguretitle'] = 'Auto-configure LTI';
$string['autocreateusers'] = 'Auto-create users';
$string['autocreationnotenabled'] = 'Auto-creation of user accounts is not enabled';
$string['configstep'] = 'Conguration item';
$string['portfolioname'] = 'Portfolio title';
$string['configstep'] = 'Configuration item';
$string['configstepstatus'] = 'Status';
$string['configuration'] = 'Assessment settings';
$string['configurationintro'] = 'You can change the submission settings as long as nobody has submitted a portfolio yet. Once there is a submission, the settings are locked in.';
$string['configurationsaved'] = 'Assessment settings saved';
$string['emailtutors'] = 'Email tutors on student submission';
$string['emailtutorsdescription'] = '';
$string['grade_description'] = '';
$string['grade'] = 'Grade';
$string['gradedby'] = 'Graded by';
$string['gradereceived'] = 'You were awarded a grade of %s out of 100 by %s at %s';
$string['gradesubmissions'] = 'Submissions for grading';
$string['gradesubmitted'] = 'Grade successfully submitted';
$string['groupname'] = 'Assessment submissions for "%s" - "%s"';
$string['institutiondenied'] = 'Access to "%s" is denied. Please contact your institution administrator.';
$string['lock'] = 'Keep portfolio locked after grading';
$string['lockdescription'] = 'Users make changes to their portfolio after it has been graded.';
$string['ltiserviceexists'] = 'The LTI service group is registered.';
$string['nocollections'] = 'You do not have any portfolios that can be submitted for assessment.';
$string['noticeenabled'] = 'The LTI API is enabled.';
$string['noticenotenabled'] = 'The LTI API is <b>not</b> enabled.';
$string['notconfigured'] = 'Currently, this activity does not allow submissions. Please check back later.';
$string['notreadylabel'] = 'Not ready';
$string['oauthprotocolenabled'] = 'OAuth protocol enabled';
$string['parentauthforlti'] = 'Parent authority';
$string['portfoliosubmitted'] = 'You submitted the portfolio "%s" for assessment on %s.';
$string['readylabel'] = 'Ready';
$string['restprotocolenabled'] = 'REST protocol enabled';
$string['usernameexists2'] = 'Username "%s" is not valid.';
$string['saveandrelease'] = 'Save and allow submissions';
$string['submitportfolio'] = 'Submit a portfolio for assessment';
$string['submitto'] = 'Submit this portfolio for assessment to %s, %s';
$string['submitintro'] = 'Select the page or collection that you want to submit to this activity. If you do not yet have a portfolio, <a href="%sview/index.php" target="_blank">create one</a>. Once you are done, reload the activity from the LMS.';
$string['timegraded'] = 'Time graded';
$string['timesubmitted'] = 'Time submitted';
$string['usernameexists1'] = 'Username "%s" already exists.';
$string['viewsubmittedmessage1'] = '%s has submitted "%s" to %s
Please grade this submission by clicking on the activity "%s" in your LMS';
$string['viewsubmittedsubject1'] = 'Assessment submission to %s';
$string['webserviceauthdisabled'] = 'Web service authentication is not enabled for this institution';
$string['webserviceproviderenabled'] = 'Incoming web service requests allowed';
$string['institutiondenied'] = 'Access to \'%s\' is denied. Please contact your institution administrator.';
$string['notreadylabel'] = 'Not ready';
$string['readylabel'] = 'Ready';
$string['parentauthforlti'] = 'Parent authority';
This diff is collapsed.
<?php
/**
*
* @package mahara
* @subpackage module-lti
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('MENUITEM', 'create/views');
define('SECTION_PLUGINTYPE', 'module');
define('SECTION_PLUGINNAME', 'lti');
define('SECTION_PAGE', 'submission');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('submitportfolio', 'module.lti'));
safe_require('module', 'lti');
if (PluginModuleLti::can_grade()) {
$form = PluginModuleLti::config_form();
}
else if (PluginModuleLti::can_submit_for_grading()) {
$form = PluginModuleLti::submit_for_grading_form();
}
$smarty = smarty();
if ($SESSION->get('lti.presentation_target') != 'window') {
$smarty->assign('SIDEBARS', false);
$smarty->assign('presentation', 'presentation-iframe');
}
if (PluginModuleLti::can_grade()) {
$smarty->assign('PAGEHEADING', get_string('gradesubmissions', 'module.lti'));
if (!$submissions = PluginModuleLti::get_all_submissions()) {
// Assessment configuration form
$smarty->assign('PAGEHEADING', get_string('configuration', 'module.lti'));
$smarty->assign('form', $form);
$smarty->display('module:lti:config.tpl');
}
else {
// List of submissions
$smarty->assign('submissions', $submissions);
$smarty->display('module:lti:submissions.tpl');
}
}
else if (PluginModuleLti::can_submit_for_grading()) {
$smarty->assign('PAGEHEADING', get_string('submitportfolio', 'module.lti'));
$sub = PluginModuleLti::get_submission();
if ($sub && $sub->is_submitted()) {
// Info on submitted collection
$info = $sub->get_portfolio_info();
$grader = $sub->get_grader();
$smarty->assign('title', $info->title);
$smarty->assign('link', $info->link);
$smarty->assign('timesubmitted', $sub->timesubmitted);
$smarty->assign('grade', $sub->grade);
$smarty->assign('gradedby', empty($grader) ? '' : display_name($grader));
$smarty->assign('timegraded', $sub->timegraded);
$smarty->display('module:lti:submittedforgrading.tpl');
}
else if (PluginModuleLTI::activity_configured()) {
// Assessment submission form