Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
moodle-mod_vpl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caseine
moodle-mod_vpl
Commits
c241ecf4
Commit
c241ecf4
authored
4 years ago
by
Astor Bizard
Browse files
Options
Downloads
Patches
Plain Diff
Various fixes: webservice url, groups pictures, etc.
parent
f49952d3
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
Dev: Submissions list rework, webservices and bugfixes
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
forms/submission.php
+2
-4
2 additions, 4 deletions
forms/submission.php
grade.php
+1
-1
1 addition, 1 deletion
grade.php
locallib.php
+4
-18
4 additions, 18 deletions
locallib.php
vpl.class.php
+11
-3
11 additions, 3 deletions
vpl.class.php
with
18 additions
and
26 deletions
forms/submission.php
+
2
−
4
View file @
c241ecf4
...
@@ -88,12 +88,10 @@ if ($fromform = $mform->get_data()) {
...
@@ -88,12 +88,10 @@ if ($fromform = $mform->get_data()) {
$data
=
iconv
(
$encode
,
'UTF-8'
,
$data
);
$data
=
iconv
(
$encode
,
'UTF-8'
,
$data
);
}
}
$files
[
$name
]
=
$data
;
$files
[
$name
]
=
$data
;
}
}
else
{
else
{
if
(
in_array
(
$name
.
'.b64'
,
$reqfiles
))
{
if
(
in_array
(
$name
.
'.b64'
,
$reqfiles
))
{
$files
[
$name
.
'.b64'
]
=
base64_encode
(
$data
);
$files
[
$name
.
'.b64'
]
=
base64_encode
(
$data
);
}
}
else
{
else
{
$files
[
$name
]
=
$data
;
$files
[
$name
]
=
$data
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
grade.php
+
1
−
1
View file @
c241ecf4
...
@@ -39,7 +39,7 @@ if ($vpl->has_capability( VPL_GRADE_CAPABILITY )) {
...
@@ -39,7 +39,7 @@ if ($vpl->has_capability( VPL_GRADE_CAPABILITY )) {
if
(
$userid
)
{
if
(
$userid
)
{
vpl_inmediate_redirect
(
vpl_mod_href
(
'forms/gradesubmission.php'
,
'id'
,
$id
,
'userid'
,
$userid
)
);
vpl_inmediate_redirect
(
vpl_mod_href
(
'forms/gradesubmission.php'
,
'id'
,
$id
,
'userid'
,
$userid
)
);
}
else
{
}
else
{
vpl_inmediate_redirect
(
vpl_mod_href
(
'views/submissionslist.php'
,
'id'
,
$id
)
);
vpl_inmediate_redirect
(
vpl_mod_href
(
'views/submissionslist.php'
,
'id'
,
$id
,
'showgrades'
,
1
)
);
}
}
}
else
{
}
else
{
vpl_inmediate_redirect
(
vpl_mod_href
(
'view.php'
,
'id'
,
$id
)
);
vpl_inmediate_redirect
(
vpl_mod_href
(
'view.php'
,
'id'
,
$id
)
);
...
...
This diff is collapsed.
Click to expand it.
locallib.php
+
4
−
18
View file @
c241ecf4
...
@@ -334,8 +334,7 @@ function vpl_url_add_param($url, $parm, $value) {
...
@@ -334,8 +334,7 @@ function vpl_url_add_param($url, $parm, $value) {
*/
*/
function
vpl_redirect
(
$link
,
$message
,
$type
=
'info'
,
$errorcode
=
''
)
{
function
vpl_redirect
(
$link
,
$message
,
$type
=
'info'
,
$errorcode
=
''
)
{
global
$OUTPUT
;
global
$OUTPUT
;
global
$CFG
;
if
(
!
$OUTPUT
->
has_started
())
{
if
(
!
mod_vpl
::
header_is_out
())
{
echo
$OUTPUT
->
header
();
echo
$OUTPUT
->
header
();
}
}
echo
$OUTPUT
->
notification
(
$message
,
$type
);
echo
$OUTPUT
->
notification
(
$message
,
$type
);
...
@@ -351,19 +350,7 @@ function vpl_redirect($link, $message, $type = 'info', $errorcode='') {
...
@@ -351,19 +350,7 @@ function vpl_redirect($link, $message, $type = 'info', $errorcode='') {
* @return void
* @return void
*/
*/
function
vpl_inmediate_redirect
(
$url
)
{
function
vpl_inmediate_redirect
(
$url
)
{
global
$OUTPUT
;
echo
vpl_include_js
(
'window.location.replace("'
.
html_entity_decode
(
urldecode
(
$url
))
.
'");'
);
if
(
!
mod_vpl
::
header_is_out
())
{
echo
$OUTPUT
->
header
();
}
static
$idcount
=
0
;
$idcount
++
;
$text
=
'<div class="continuebutton"><a id="vpl_red'
.
$idcount
.
'" href="'
;
$text
.
=
$url
.
'">'
.
get_string
(
'continue'
)
.
'</a></div>'
;
$deco
=
urldecode
(
$url
);
$deco
=
html_entity_decode
(
$deco
);
echo
vpl_include_js
(
'window.location.replace("'
.
$deco
.
'");'
);
echo
$text
;
echo
$OUTPUT
->
footer
();
die
();
die
();
}
}
/**
/**
...
@@ -886,11 +873,10 @@ function vpl_get_webservice_token($vpl) {
...
@@ -886,11 +873,10 @@ function vpl_get_webservice_token($vpl) {
return
''
;
return
''
;
}
}
$tokenrecord
=
$DB
->
get_record
(
'external_tokens'
,
array
(
$tokenrecord
=
$DB
->
get_record
(
'external_tokens'
,
array
(
'sid'
=>
session_id
(),
'userid'
=>
$USER
->
id
,
'userid'
=>
$USER
->
id
,
'externalserviceid'
=>
$service
->
id
'externalserviceid'
=>
$service
->
id
)
);
)
);
if
(
!
empty
(
$tokenrecord
)
and
$tokenrecord
->
validuntil
<
$now
)
{
if
(
!
empty
(
$tokenrecord
)
and
$tokenrecord
->
validuntil
>
0
and
$tokenrecord
->
validuntil
<
$now
)
{
unset
(
$tokenrecord
);
// Will be delete before creating a new one.
unset
(
$tokenrecord
);
// Will be delete before creating a new one.
}
}
if
(
empty
(
$tokenrecord
))
{
if
(
empty
(
$tokenrecord
))
{
...
@@ -933,7 +919,7 @@ function vpl_get_webservice_urlbase($vpl) {
...
@@ -933,7 +919,7 @@ function vpl_get_webservice_urlbase($vpl) {
if
(
$token
==
''
)
{
if
(
$token
==
''
)
{
return
''
;
return
''
;
}
}
return
$CFG
->
wwwroot
.
'/
mod/vpl/
webservice.php?moodlewsrestformat=json'
return
$CFG
->
wwwroot
.
'/webservice
/rest/server
.php?moodlewsrestformat=json'
.
'&wstoken='
.
$token
.
'&id='
.
$vpl
->
get_course_module
()
->
id
.
'&wsfunction='
;
.
'&wstoken='
.
$token
.
'&id='
.
$vpl
->
get_course_module
()
->
id
.
'&wsfunction='
;
}
}
...
...
This diff is collapsed.
Click to expand it.
vpl.class.php
+
11
−
3
View file @
c241ecf4
...
@@ -1068,7 +1068,15 @@ class mod_vpl {
...
@@ -1068,7 +1068,15 @@ class mod_vpl {
public
function
user_picture
(
$user
)
{
public
function
user_picture
(
$user
)
{
global
$OUTPUT
;
global
$OUTPUT
;
if
(
$this
->
is_group_activity
())
{
if
(
$this
->
is_group_activity
())
{
return
print_group_picture
(
$this
->
get_usergroup
(
$user
->
id
),
$this
->
get_course
()
->
id
,
false
,
true
);
$group
=
$this
->
get_usergroup
(
$user
->
id
);
$picture
=
print_group_picture
(
$group
,
$this
->
get_course
()
->
id
,
false
,
true
);
if
(
!
$picture
)
{
$url
=
vpl_abs_href
(
'/group/overview.php'
,
'id'
,
$this
->
get_course
()
->
id
,
'group'
,
$group
->
id
);
$picture
=
'<a href="'
.
$url
.
'" style="color: initial;">'
.
$OUTPUT
->
render
(
new
pix_icon
(
'group'
,
''
,
'mod_vpl'
))
.
'</a>'
;
}
return
$picture
;
}
else
{
}
else
{
$options
=
array
(
'courseid'
=>
$this
->
get_instance
()
->
course
,
'link'
=>
!
$this
->
use_seb
());
$options
=
array
(
'courseid'
=>
$this
->
get_instance
()
->
course
,
'link'
=>
!
$this
->
use_seb
());
return
$OUTPUT
->
user_picture
(
$user
,
$options
);
return
$OUTPUT
->
user_picture
(
$user
,
$options
);
...
@@ -1089,7 +1097,7 @@ class mod_vpl {
...
@@ -1089,7 +1097,7 @@ class mod_vpl {
$group
=
$this
->
get_usergroup
(
$user
->
id
);
$group
=
$this
->
get_usergroup
(
$user
->
id
);
if
(
$group
!==
false
)
{
if
(
$group
!==
false
)
{
if
(
$withlink
)
{
if
(
$withlink
)
{
$url
=
vpl_abs_href
(
'/
user/index
.php'
,
'id'
,
$this
->
get_course
()
->
id
,
'group'
,
$group
->
id
);
$url
=
vpl_abs_href
(
'/
group/overview
.php'
,
'id'
,
$this
->
get_course
()
->
id
,
'group'
,
$group
->
id
);
return
'<a href="'
.
$url
.
'">'
.
$group
->
name
.
'</a>'
;
return
'<a href="'
.
$url
.
'">'
.
$group
->
name
.
'</a>'
;
}
else
{
}
else
{
return
$group
->
name
;
return
$group
->
name
;
...
@@ -1778,7 +1786,7 @@ class mod_vpl {
...
@@ -1778,7 +1786,7 @@ class mod_vpl {
$this
->
print_restriction
(
'automaticgrading'
,
$noyes
[
1
],
false
,
false
);
$this
->
print_restriction
(
'automaticgrading'
,
$noyes
[
1
],
false
,
false
);
}
}
if
(
$instance
->
maxexetime
)
{
if
(
$instance
->
maxexetime
)
{
$this
->
print_restriction
(
'maxexetime'
,
$instance
->
maxexetime
.
' s'
,
false
,
false
);
$this
->
print_restriction
(
'maxexetime'
,
format_time
(
$instance
->
maxexetime
)
,
false
,
false
);
}
}
if
(
$instance
->
maxexememory
)
{
if
(
$instance
->
maxexememory
)
{
$this
->
print_restriction
(
'maxexememory'
,
vpl_conv_size_to_string
(
$instance
->
maxexememory
),
false
,
false
);
$this
->
print_restriction
(
'maxexememory'
,
vpl_conv_size_to_string
(
$instance
->
maxexememory
),
false
,
false
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment