Gitlab CSE Unil

Commit da51fa54 authored by M. Chardon's avatar M. Chardon
Browse files

envoi mail + correction deployement

parent 7ddd2d25
......@@ -127,11 +127,15 @@ if ($action == 'loadallpages') {
echo json_encode($response);
die();
} else if ($action == 'generatepdf') {
$refresh = optional_param('refresh', false, PARAM_BOOL);
require_capability('mod/assign:grade', $context);
if (!$refresh) {
require_capability('mod/assign:grade', $context);
} else {
require_capability('mod/assign:submit', $context);
}
$response = new stdClass();
$grade = $assignment->get_user_grade($userid, true);
$refresh = optional_param('refresh', false, PARAM_BOOL);
$file = document_services::generate_feedback_document($assignment, $userid, $attemptnumber, $refresh);
$response->url = '';
......@@ -141,6 +145,17 @@ if ($action == 'loadallpages') {
$response->filename = $file->get_filename();
}
if ($refresh) {
$teachers = get_users_by_capability($context, 'mod/assign:grade');
$body = "La correction du devoir a été mise à jour. Vous pouvez accéder au document en suivant ce lien : " . $response->url . "\n\nCeci est un mail automatique.";
$bodyhtml = "<html><b>Information Moodle</b><br/>"
. "<p>La correction du devoir a été mise à jour. Vous pouvez accéder au document en suivant ce <a href='" . $response->url . "'>lien</a></p>"
. "<i>Ceci est un mail automatique.</i></html>";
foreach ($teachers as $teacher) {
$res = email_to_user($teacher, $USER, "[Moodle] Mise à jour devoir", $body, $bodyhtml);
}
}
echo json_encode($response);
die();
} else if ($action == 'loadquicklist') {
......@@ -189,7 +204,7 @@ if ($action == 'loadallpages') {
echo json_encode($result);
die();
} else if ($action == 'updatestudentview') {
require_capability('mod/assign:grade', $context);
require_capability('mod/assign:submit', $context);
$response = new stdClass();
$response->errors = array();
......
......@@ -611,10 +611,10 @@ EOD;
$assignment = self::get_assignment_from_param($assignment);
if (!$assignment->can_view_submission($userid)) {
if (!$refresh && !$assignment->can_view_submission($userid)) {
\print_error('nopermission');
}
if (!$assignment->can_grade()) {
if (!$refresh && !$assignment->can_grade()) {
\print_error('nopermission');
}
......
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Capability definitions for this module.
*
* @package mod_assign
* @copyright 2012 NetSpot {@link http://www.netspot.com.au}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$capabilities = array(
'mod/assignfeedback_editpdf:use' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
)
)
);
......@@ -43,7 +43,7 @@
<FIELD NAME="displaylock" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
<FIELD NAME="displayrotation" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="borderstyle" TYPE="char" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="parent_annot" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="true"/>
<FIELD NAME="parent_annot" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
......@@ -117,5 +117,17 @@
<KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
</KEYS>
</TABLE>
<TABLE NAME="assignfeedback_editpp_axis" COMMENT="assignfeedback_editpp_axis table retrofitted from MySQL">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="18" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="contextid" TYPE="int" LENGTH="18" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="label" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="order" TYPE="int" LENGTH="5" NOTNULL="false" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
</KEYS>
</TABLE>
</TABLES>
</XMLDB>
\ No newline at end of file
......@@ -103,3 +103,4 @@ $string['yellowlemon'] = 'Lemon yellow';
$string['draftchangessaved'] = 'Draft annotations saved';
$string['nodraftchangessaved'] = 'Changes saved';
$string['preparesubmissionsforannotation'] = 'Prepare submissions for annotation';
$string['mod/assignfeedback_editpdf:use'] = 'Utiliser le plugin';
......@@ -317,11 +317,10 @@ class assign_feedback_editpdfplus extends assign_feedback_plugin {
* @return bool
*/
public function is_enabled() {
if ($this->enabledcache === null) {
$testpath = assignfeedback_editpdfplus\pdf::test_gs_path(false);
$this->enabledcache = ($testpath->status == assignfeedback_editpdfplus\pdf::GSPATH_OK) && $this->get_config('enabled');
if ($this->assignment->get_context()) {
return has_capability('mod/assignfeedback_editpdf:use', $this->assignment->get_context());
}
return $this->enabledcache;
return false;
}
/**
......@@ -330,7 +329,7 @@ class assign_feedback_editpdfplus extends assign_feedback_plugin {
* @return bool false
*/
public function is_configurable() {
return true;
return false;
}
/**
......
......@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2016071200;
$plugin->version = 2016101700;
$plugin->requires = 2016051900;
$plugin->dependencies = array(
'assignfeedback_editpdf' => 2016052300
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment