Skip to content

Commit

Permalink
Merge pull request #2 from poleumdev/correction_modiftitre
Browse files Browse the repository at this point in the history
correction modification carnet bord
  • Loading branch information
poleumdev authored Feb 1, 2021
2 parents e044105 + 6461be7 commit d414951
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 24 deletions.
7 changes: 3 additions & 4 deletions changeconversationparams.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,8 @@
if ($datas->subject != $valdefault['subject']) {
$request = " UPDATE {dialoguegrade_conversations}
SET subject = ?
WHERE course = ? and dialogueid = ?";

$DB->execute($request, array($datas->subject, $course->id, $dialogueid));
WHERE id = ?";
$DB->execute($request, array($datas->subject, $conversationid));
}

$messageid = $conversation->__get('messageid');
Expand Down Expand Up @@ -206,4 +205,4 @@ function chgt_teacher($conversationid, $dialogueid, $messageid, $newteacher, $ol
WHERE userid = ? and conversationid = ? and dialogueid = ? and messageid = ?";
$DB->execute($request, array($newteacher, $oldteacher, $conversationid,
$dialogueid, $messageid));
}
}
1 change: 0 additions & 1 deletion cli/cleanuporphans.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
$starttime = microtime();
mtrace("Server Time: ".date('r')."\n");

// Do work!
$sql = "SELECT dm.*
FROM {dialoguegrade_messages} dm
WHERE NOT EXISTS (SELECT dc.id
Expand Down
10 changes: 5 additions & 5 deletions conversation/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@
if ($form->is_validated()) {
$conversation->save_form_data();
$conversation->send();
$sendmessage = get_string('conversationopened', 'dialoguegrade');
// Trigger conversation created event.
$eventparams = array(
$sendmessage = get_string('conversationopened', 'dialoguegrade');
// Trigger conversation created event.
$eventparams = array(
'context' => $context,
'objectid' => $conversation->conversationid
);
$event = \mod_dialoguegrade\event\conversation_created::create($eventparams);
$event->trigger();
$event = \mod_dialoguegrade\event\conversation_created::create($eventparams);
$event->trigger();
redirect($returnurl, $sendmessage);
}
break; // Leave switch to display form page.
Expand Down
7 changes: 7 additions & 0 deletions db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,12 @@
'editingteacher' => CAP_ALLOW,
)
),
'mod/dialoguegrade:modifytitle' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'manager' => CAP_ALLOW
)
),

);
2 changes: 2 additions & 0 deletions lang/en/dialoguegrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,5 @@
$string['updatedialoguegrade'] = 'Changing the logbook';
$string['updateok'] = 'Modifications made';
$string['proofreader'] = 'Teacher';
$string['helpediticon'] = 'Modify the subject and/or the corrector.';
$string['dialoguegrade:modifytitle'] = 'Changing the title and the corrector of a log book';
3 changes: 2 additions & 1 deletion lang/fr/dialoguegrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,5 @@
$string['updatedialoguegrade'] = 'Modifier le carnet de bord';
$string['updateok'] = 'Modifications réalisées';
$string['proofreader'] = 'Correcteur';

$string['helpediticon'] = 'Modifier le sujet et/ou le correcteur';
$string['dialoguegrade:modifytitle'] = 'Modifier le sujet et/ou le correcteur d\'un carnet de bord';
23 changes: 13 additions & 10 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,17 @@ public function render_conversation(mod_dialoguegrade\conversation $conversation
$html .= html_writer::start_div('conversation-heading');
$html .= html_writer::tag('span', $conversation->subject, array('style' => 'font-size: 1.75rem;'));

$html .= html_writer::start_tag('ul', array('class' => "message-actions pull-right"));
$html .= html_writer::start_tag('li');
$editicon = html_writer::tag('i', '', array('class' => "fa fa-pencil-square-o"));
$editurl = new moodle_url('/mod/dialoguegrade/changeconversationparams.php');
$editurl->param('id', $cm->id);
$editurl->param('conversationid', $conversation->conversationid);
$html .= html_writer::link($editurl, $editicon);
$html .= html_writer::end_tag('li');
$html .= html_writer::end_tag('ul');
if (has_capability('mod/dialoguegrade:modifytitle', $context)) {
$html .= html_writer::start_tag('ul', array('class' => "message-actions pull-right"));
$html .= html_writer::start_tag('li');
$editicon = html_writer::tag('i', '', array('class' => "fa fa-pencil-square-o"));
$editurl = new moodle_url('/mod/dialoguegrade/changeconversationparams.php');
$editurl->param('id', $cm->id);
$editurl->param('conversationid', $conversation->conversationid);
$html .= html_writer::link($editurl, $editicon, array('title' => get_string('helpediticon', 'dialoguegrade')));
$html .= html_writer::end_tag('li');
$html .= html_writer::end_tag('ul');
}

$html .= html_writer::end_div(); // Close header.

Expand Down Expand Up @@ -358,8 +360,9 @@ public function render_attachments(array $attachments) {
$html .= html_writer::start_tag('tbody');
$html .= html_writer::start_tag('tr');
$html .= html_writer::start_tag('td');

$html .= html_writer::link($downloadurl, html_writer::empty_tag('img',
array('src' => $this->output->pix_url(file_mimetype_icon($mimetype)),
array('src' => $this->output->image_url(file_mimetype_icon($mimetype)),
'class' => 'icon',
'alt' => $mimetype)));
$html .= html_writer::end_tag('td');
Expand Down
6 changes: 3 additions & 3 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
*/
defined('MOODLE_INTERNAL') || die();

$plugin->version = 2021010409;
$plugin->requires = 2016111500; // See http://docs.moodle.org/dev/Moodle_Versions
$plugin->component = 'mod_dialoguegrade'; // Full name of the plugin (used for diagnostics)
$plugin->version = 2021020103;
$plugin->requires = 2016111500; // See http://docs.moodle.org/dev/Moodle_Versions .
$plugin->component = 'mod_dialoguegrade'; // Full name of the plugin (used for diagnostics).
$plugin->release = '1.1.0 (clone of dialogue)';// Ajout reset cours.
$plugin->maturity = MATURITY_STABLE; // This version's maturity level.
$plugin->dependencies = array();

0 comments on commit d414951

Please sign in to comment.