Gitlab CSE Unil
Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
M. Chardon
moodle-assignfeedback_editpdfplus
Commits
c3ad9fef
Commit
c3ad9fef
authored
Oct 05, 2016
by
M. Chardon
Browse files
maj du pdf par l'étudiant
parent
5abe70d6
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
ajax.php
View file @
c3ad9fef
...
...
@@ -131,7 +131,8 @@ if ($action == 'loadallpages') {
require_capability
(
'mod/assign:grade'
,
$context
);
$response
=
new
stdClass
();
$grade
=
$assignment
->
get_user_grade
(
$userid
,
true
);
$file
=
document_services
::
generate_feedback_document
(
$assignment
,
$userid
,
$attemptnumber
);
$refresh
=
optional_param
(
'refresh'
,
false
,
PARAM_BOOL
);
$file
=
document_services
::
generate_feedback_document
(
$assignment
,
$userid
,
$attemptnumber
,
$refresh
);
$response
->
url
=
''
;
if
(
$file
)
{
...
...
classes/document_services.php
View file @
c3ad9fef
...
...
@@ -607,7 +607,7 @@ EOD;
* @param int $attemptnumber (-1 means latest attempt)
* @return stored_file
*/
public
static
function
generate_feedback_document
(
$assignment
,
$userid
,
$attemptnumber
)
{
public
static
function
generate_feedback_document
(
$assignment
,
$userid
,
$attemptnumber
,
$refresh
=
false
)
{
$assignment
=
self
::
get_assignment_from_param
(
$assignment
);
...
...
@@ -630,26 +630,6 @@ EOD;
$pdf
=
new
pdf
();
/* $defaultstamps = array('twoway_h.png', 'twoway_v.png');
// Stamp file object.
$filerecord = new stdClass;
$filerecord->component = 'assignfeedback_editpdfplus';
$filerecord->contextid = context_system::instance()->id;
$filerecord->userid = get_admin()->id;
$filerecord->filearea = 'stamps';
$filerecord->filepath = '/';
$filerecord->itemid = 0;
$fs = \get_file_storage();
// Load all default stamps.
foreach ($defaultstamps as $stamp) {
$filerecord->filename = $stamp;
$fs->create_file_from_pathname($filerecord,
$CFG->dirroot . '/mod/assign/feedback/editpdfplus/pix/' . $filerecord->filename);
} */
$fs
=
\
get_file_storage
();
$stamptmpdir
=
\
make_temp_directory
(
'assignfeedback_editpdfplus/stamps/'
.
self
::
hash
(
$assignment
,
$userid
,
$attemptnumber
));
$grade
=
$assignment
->
get_user_grade
(
$userid
,
true
,
$attemptnumber
);
...
...
@@ -664,7 +644,9 @@ EOD;
$pagecount
=
$pdf
->
set_pdf
(
$combined
);
$grade
=
$assignment
->
get_user_grade
(
$userid
,
true
,
$attemptnumber
);
page_editor
::
release_drafts
(
$grade
->
id
);
if
(
!
$refresh
)
{
page_editor
::
release_drafts
(
$grade
->
id
);
}
$annotation_index
=
[];
$compteur
=
1
;
...
...
@@ -700,10 +682,16 @@ EOD;
$pdf
->
Write
(
5
,
$index
.
" : "
,
''
,
false
,
'L'
,
false
);
if
(
$annot
->
answerrequested
)
{
$pdf
->
SetTextColor
(
255
,
0
,
0
);
$pdf
->
Write
(
5
,
"[
réponse attendue
] "
,
''
,
false
,
'L'
,
true
);
$pdf
->
Write
(
5
,
"[
question
] "
,
''
,
false
,
'L'
,
true
);
$pdf
->
SetTextColor
(
0
,
0
,
0
);
}
$pdf
->
Write
(
5
,
$annot
->
textannot
,
''
,
false
,
'L'
,
true
);
if
(
$annot
->
studentanswer
)
{
$pdf
->
SetTextColor
(
0
,
0
,
255
);
$pdf
->
Write
(
5
,
"[réponse]"
,
''
,
false
,
'L'
,
true
);
$pdf
->
Write
(
5
,
$annot
->
studentanswer
,
''
,
false
,
'L'
,
true
);
$pdf
->
SetTextColor
(
0
,
0
,
0
);
}
$pdf
->
Write
(
0
,
""
,
''
,
false
,
'L'
,
true
);
}
}
...
...
classes/renderer.php
View file @
c3ad9fef
...
...
@@ -250,15 +250,18 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
}
$toolbarCostumdiv
.
=
$axischoice
;
}
else
{
$toolbaraxis
=
"<div class='navigation' style='padding-left:10px;
margin-left:10px;
'><div style='display:inline;margin-right:5px;text-align:left;'>"
;
$toolbaraxis
=
"<div class='navigation' style='padding-left:10px;'><div style='display:inline;margin-right:5px;text-align:left;'>"
;
$axis
=
$widget
->
axis
;
foreach
(
$axis
as
$ax
)
{
$toolbaraxis
.
=
$this
->
render_toolbar_axis
(
$ax
);
$toolbaraxis
.
=
"</div><div style='display:inline;margin-left:5px;
margin-right:5px;
text-align:left;'>"
;
$toolbaraxis
.
=
"</div><div style='display:inline;margin-left:5px;text-align:left;'>"
;
}
$toolbaraxis
.
=
"</div></div>"
;
$axischoice
=
html_writer
::
div
(
html_writer
::
select
([
"Tous"
,
"Non traité"
,
"OK"
,
"non OK"
],
'statutselection'
,
0
,
FALSE
),
'toolbar '
,
array
(
'role'
=>
'toolbar'
));
$toolbaraxis
.
=
$axischoice
;
$axischoice
=
html_writer
::
select
([
"Tous"
,
"Non traité"
,
"OK"
,
"non OK"
],
'statutselection'
,
0
,
FALSE
);
//$toolbaraxis .= $axischoice;
$validatebutton
=
html_writer
::
tag
(
'button'
,
'Valider feedback'
,
array
(
'class'
=>
'button'
,
'id'
=>
'student_valide_button'
));
$toolbaraxis
.
=
html_writer
::
div
(
$validatebutton
,
'toolbar '
,
array
(
'role'
=>
'toolbar'
));
$toolbaraxis
.
=
html_writer
::
div
(
$axischoice
,
'toolbar '
,
array
(
'role'
=>
'toolbar'
));
}
// Toobars written in reverse order because they are floated right.
...
...
@@ -286,7 +289,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
));
$changesmessage
=
html_writer
::
div
(
$changesmessage
,
'unsaved-changes'
);
$canvas
.
=
$changesmessage
;
$changesmessage2
=
html_writer
::
tag
(
'div'
,
get_string
(
'nodraftchangessaved'
,
'assignfeedback_editpdfplus'
),
array
(
'class'
=>
'assignfeedback_editpdfplus_unsavedchanges_edit warning label label-info'
));
...
...
yui/build/moodle-assignfeedback_editpdfplus-editor/moodle-assignfeedback_editpdfplus-editor-debug.js
View file @
c3ad9fef
...
...
@@ -50,7 +50,8 @@ SELECTOR = {
CUSTOMTOOLBARS
:
'
.customtoolbar
'
,
AXISCUSTOMTOOLBAR
:
'
.menuaxisselection
'
,
CUSTOMTOOLBARBUTTONS
:
'
.costumtoolbarbutton
'
,
STATUTSELECTOR
:
'
#menustatutselection
'
STATUTSELECTOR
:
'
#menustatutselection
'
,
STUDENTVALIDATION
:
'
#student_valide_button
'
},
SELECTEDBORDERCOLOUR
=
'
rgba(200, 200, 255, 0.9)
'
,
SELECTEDFILLCOLOUR
=
'
rgba(200, 200, 255, 0.5)
'
,
...
...
@@ -6031,6 +6032,9 @@ EDITOR.prototype = {
var
statutselector
=
this
.
get_dialogue_element
(
SELECTOR
.
STATUTSELECTOR
);
statutselector
.
on
(
'
change
'
,
this
.
update_visu_annotation
,
this
);
var
studentvalidation
=
this
.
get_dialogue_element
(
SELECTOR
.
STUDENTVALIDATION
);
studentvalidation
.
on
(
'
click
'
,
this
.
update_student_feedback
,
this
);
return
;
}
...
...
@@ -6074,6 +6078,9 @@ EDITOR.prototype = {
context
:
this
});
},
update_student_feedback
:
function
(){
this
.
refresh_pdf
();
},
update_visu_annotation
:
function
()
{
var
statusselector
=
this
.
get_dialogue_element
(
SELECTOR
.
STATUTSELECTOR
+
'
option:checked
'
);
var
statusid
=
parseInt
(
statusselector
.
get
(
'
value
'
))
-
1
;
...
...
@@ -6535,6 +6542,53 @@ EDITOR.prototype = {
}
return
false
;
},
refresh_pdf
:
function
()
{
var
ajaxurl
=
AJAXBASE
,
config
;
config
=
{
method
:
'
post
'
,
context
:
this
,
sync
:
false
,
data
:
{
'
sesskey
'
:
M
.
cfg
.
sesskey
,
'
action
'
:
'
generatepdf
'
,
'
userid
'
:
this
.
get
(
'
userid
'
),
'
attemptnumber
'
:
this
.
get
(
'
attemptnumber
'
),
'
assignmentid
'
:
this
.
get
(
'
assignmentid
'
),
'
refresh
'
:
true
},
on
:
{
success
:
function
(
tid
,
response
)
{
var
jsondata
;
try
{
jsondata
=
Y
.
JSON
.
parse
(
response
.
responseText
);
if
(
jsondata
.
error
)
{
return
new
M
.
core
.
ajaxException
(
jsondata
);
}
Y
.
one
(
SELECTOR
.
UNSAVEDCHANGESINPUT
).
set
(
'
value
'
,
'
true
'
);
Y
.
one
(
SELECTOR
.
UNSAVEDCHANGESDIV
).
setStyle
(
'
opacity
'
,
1
);
Y
.
one
(
SELECTOR
.
UNSAVEDCHANGESDIV
).
setStyle
(
'
display
'
,
'
inline-block
'
);
Y
.
one
(
SELECTOR
.
UNSAVEDCHANGESDIV
).
transition
({
duration
:
1
,
delay
:
2
,
opacity
:
0
},
function
()
{
Y
.
one
(
SELECTOR
.
UNSAVEDCHANGESDIV
).
setStyle
(
'
display
'
,
'
none
'
);
});
}
catch
(
e
)
{
return
new
M
.
core
.
exception
(
e
);
}
},
failure
:
function
(
tid
,
response
)
{
return
new
M
.
core
.
exception
(
response
.
responseText
);
}
}
};
Y
.
io
(
ajaxurl
,
config
);
},
/**
* Save all the annotations and comments for the current page.
* @protected
...
...
yui/build/moodle-assignfeedback_editpdfplus-editor/moodle-assignfeedback_editpdfplus-editor-min.js
View file @
c3ad9fef
This diff is collapsed.
Click to expand it.
yui/build/moodle-assignfeedback_editpdfplus-editor/moodle-assignfeedback_editpdfplus-editor.js
View file @
c3ad9fef
...
...
@@ -50,7 +50,8 @@ SELECTOR = {
CUSTOMTOOLBARS
:
'
.customtoolbar
'
,
AXISCUSTOMTOOLBAR
:
'
.menuaxisselection
'
,
CUSTOMTOOLBARBUTTONS
:
'
.costumtoolbarbutton
'
,
STATUTSELECTOR
:
'
#menustatutselection
'
STATUTSELECTOR
:
'
#menustatutselection
'
,
STUDENTVALIDATION
:
'
#student_valide_button
'
},
SELECTEDBORDERCOLOUR
=
'
rgba(200, 200, 255, 0.9)
'
,
SELECTEDFILLCOLOUR
=
'
rgba(200, 200, 255, 0.5)
'
,
...
...
@@ -6025,6 +6026,9 @@ EDITOR.prototype = {
var
statutselector
=
this
.
get_dialogue_element
(
SELECTOR
.
STATUTSELECTOR
);
statutselector
.
on
(
'
change
'
,
this
.
update_visu_annotation
,
this
);
var
studentvalidation
=
this
.
get_dialogue_element
(
SELECTOR
.
STUDENTVALIDATION
);
studentvalidation
.
on
(
'
click
'
,
this
.
update_student_feedback
,
this
);
return
;
}
...
...
@@ -6068,6 +6072,9 @@ EDITOR.prototype = {
context
:
this
});
},
update_student_feedback
:
function
(){
this
.
refresh_pdf
();
},
update_visu_annotation
:
function
()
{
var
statusselector
=
this
.
get_dialogue_element
(
SELECTOR
.
STATUTSELECTOR
+
'
option:checked
'
);
var
statusid
=
parseInt
(
statusselector
.
get
(
'
value
'
))
-
1
;
...
...
@@ -6526,6 +6533,53 @@ EDITOR.prototype = {
}
return
false
;
},
refresh_pdf
:
function
()
{
var
ajaxurl
=
AJAXBASE
,
config
;
config
=
{
method
:
'
post
'
,
context
:
this
,
sync
:
false
,
data
:
{
'
sesskey
'
:
M
.
cfg
.
sesskey
,
'
action
'
:
'
generatepdf
'
,
'
userid
'
:
this
.
get
(
'
userid
'
),
'
attemptnumber
'
:
this
.
get
(
'
attemptnumber
'
),
'
assignmentid
'
:
this
.
get
(
'
assignmentid
'
),
'
refresh
'
:
true
},
on
:
{
success
:
function
(
tid
,
response
)
{
var
jsondata
;
try
{
jsondata
=
Y
.
JSON
.
parse
(
response
.
responseText
);
if
(
jsondata
.
error
)
{
return
new
M
.
core
.
ajaxException
(
jsondata
);
}
Y
.
one
(
SELECTOR
.
UNSAVEDCHANGESINPUT
).
set
(
'
value
'
,
'
true
'
);
Y
.
one
(
SELECTOR
.
UNSAVEDCHANGESDIV
).
setStyle
(
'
opacity
'
,
1
);
Y
.
one
(
SELECTOR
.
UNSAVEDCHANGESDIV
).
setStyle
(
'
display
'
,
'
inline-block
'
);
Y
.
one
(
SELECTOR
.
UNSAVEDCHANGESDIV
).
transition
({
duration
:
1
,
delay
:
2
,
opacity
:
0
},
function
()
{
Y
.
one
(
SELECTOR
.
UNSAVEDCHANGESDIV
).
setStyle
(
'
display
'
,
'
none
'
);
});
}
catch
(
e
)
{
return
new
M
.
core
.
exception
(
e
);
}
},
failure
:
function
(
tid
,
response
)
{
return
new
M
.
core
.
exception
(
response
.
responseText
);
}
}
};
Y
.
io
(
ajaxurl
,
config
);
},
/**
* Save all the annotations and comments for the current page.
* @protected
...
...
yui/src/editor/js/editor.js
View file @
c3ad9fef
...
...
@@ -607,6 +607,9 @@ EDITOR.prototype = {
var
statutselector
=
this
.
get_dialogue_element
(
SELECTOR
.
STATUTSELECTOR
);
statutselector
.
on
(
'
change
'
,
this
.
update_visu_annotation
,
this
);
var
studentvalidation
=
this
.
get_dialogue_element
(
SELECTOR
.
STUDENTVALIDATION
);
studentvalidation
.
on
(
'
click
'
,
this
.
update_student_feedback
,
this
);
return
;
}
...
...
@@ -650,6 +653,9 @@ EDITOR.prototype = {
context
:
this
});
},
update_student_feedback
:
function
(){
this
.
refresh_pdf
();
},
update_visu_annotation
:
function
()
{
var
statusselector
=
this
.
get_dialogue_element
(
SELECTOR
.
STATUTSELECTOR
+
'
option:checked
'
);
var
statusid
=
parseInt
(
statusselector
.
get
(
'
value
'
))
-
1
;
...
...
@@ -1111,6 +1117,53 @@ EDITOR.prototype = {
}
return
false
;
},
refresh_pdf
:
function
()
{
var
ajaxurl
=
AJAXBASE
,
config
;
config
=
{
method
:
'
post
'
,
context
:
this
,
sync
:
false
,
data
:
{
'
sesskey
'
:
M
.
cfg
.
sesskey
,
'
action
'
:
'
generatepdf
'
,
'
userid
'
:
this
.
get
(
'
userid
'
),
'
attemptnumber
'
:
this
.
get
(
'
attemptnumber
'
),
'
assignmentid
'
:
this
.
get
(
'
assignmentid
'
),
'
refresh
'
:
true
},
on
:
{
success
:
function
(
tid
,
response
)
{
var
jsondata
;
try
{
jsondata
=
Y
.
JSON
.
parse
(
response
.
responseText
);
if
(
jsondata
.
error
)
{
return
new
M
.
core
.
ajaxException
(
jsondata
);
}
Y
.
one
(
SELECTOR
.
UNSAVEDCHANGESINPUT
).
set
(
'
value
'
,
'
true
'
);
Y
.
one
(
SELECTOR
.
UNSAVEDCHANGESDIV
).
setStyle
(
'
opacity
'
,
1
);
Y
.
one
(
SELECTOR
.
UNSAVEDCHANGESDIV
).
setStyle
(
'
display
'
,
'
inline-block
'
);
Y
.
one
(
SELECTOR
.
UNSAVEDCHANGESDIV
).
transition
({
duration
:
1
,
delay
:
2
,
opacity
:
0
},
function
()
{
Y
.
one
(
SELECTOR
.
UNSAVEDCHANGESDIV
).
setStyle
(
'
display
'
,
'
none
'
);
});
}
catch
(
e
)
{
return
new
M
.
core
.
exception
(
e
);
}
},
failure
:
function
(
tid
,
response
)
{
return
new
M
.
core
.
exception
(
response
.
responseText
);
}
}
};
Y
.
io
(
ajaxurl
,
config
);
},
/**
* Save all the annotations and comments for the current page.
* @protected
...
...
yui/src/editor/js/globals.js
View file @
c3ad9fef
...
...
@@ -48,7 +48,8 @@ SELECTOR = {
CUSTOMTOOLBARS
:
'
.customtoolbar
'
,
AXISCUSTOMTOOLBAR
:
'
.menuaxisselection
'
,
CUSTOMTOOLBARBUTTONS
:
'
.costumtoolbarbutton
'
,
STATUTSELECTOR
:
'
#menustatutselection
'
STATUTSELECTOR
:
'
#menustatutselection
'
,
STUDENTVALIDATION
:
'
#student_valide_button
'
},
SELECTEDBORDERCOLOUR
=
'
rgba(200, 200, 255, 0.9)
'
,
SELECTEDFILLCOLOUR
=
'
rgba(200, 200, 255, 0.5)
'
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment