Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iena-competency-block
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
iena
iena-competency-block
Commits
92335883
Commit
92335883
authored
3 years ago
by
DELARUELLE Myriam
Browse files
Options
Downloads
Patches
Plain Diff
fetch linked activities in evaluation modal and create a link with the student name when possible
parent
8d46e50a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
competency_iena_competencies_2.php
+20
-5
20 additions, 5 deletions
competency_iena_competencies_2.php
js/dropdown.js
+2
-1
2 additions, 1 deletion
js/dropdown.js
with
22 additions
and
6 deletions
competency_iena_competencies_2.php
+
20
−
5
View file @
92335883
...
...
@@ -3,6 +3,7 @@
require_once
(
'../../config.php'
);
require_once
(
'entity/block_competency_iena_student.php'
);
require_once
(
'../../user/lib.php'
);
global
$COURSE
,
$DB
,
$USER
,
$CFG
;
...
...
@@ -27,31 +28,45 @@ if (!has_capability('moodle/course:update', $context = context_course::instance(
}
}
//fetch the linked activities for a competency/student and create a link to the corresponding page when possible
if
(
isset
(
$_GET
[
"action"
])
&&
$_GET
[
'action'
]
==
"get_links"
){
$competencyid
=
$_GET
[
"competencyid"
];
$courseid
=
$_GET
[
"courseid"
];
if
(
isset
(
$_GET
[
"studentid"
])){
$studentid
=
$_GET
[
"studentid"
];
}
else
{
$studentid
=
$USER
->
id
;
}
$cm_ids
=
\core_competency\api
::
list_course_modules_using_competency
(
$competencyid
,
$courseid
);
$data
=
array
();
if
(
count
(
$cm_ids
)
!==
0
)
{
$modules
=
array
();
$modinfo
=
get_fast_modinfo
(
$courseid
);
foreach
(
$cm_ids
as
$cm_id
)
{
$module
=
new
StdClass
();
//if the activity is an assignment or a quiz we'll try to redirect to the student submissions specifically
$is_assign
=
strpos
(
$modinfo
->
cms
[
$cm_id
]
->
url
->
out
(),
'/mod/assign'
)
!==
false
;
$is_quiz
=
strpos
(
$modinfo
->
cms
[
$cm_id
]
->
url
->
out
(),
'/mod/quiz'
)
!==
false
;
$module
->
url
=
$modinfo
->
cms
[
$cm_id
]
->
url
->
out
();
$user
=
$DB
->
get_record
(
"user"
,
array
(
"id"
=>
$studentid
));
//for the moment we don't manage accents in names
if
(
has_capability
(
'mod/assign:grade'
,
$context
=
context_course
::
instance
(
$courseid
),
$USER
->
id
)
&&
$is_assign
)
{
$module
->
url
=
$module
->
url
.
"&action=grading&tifirst="
.
$user
->
firstname
[
0
]
.
"&tilast="
.
$user
->
lastname
[
0
];
}
else
if
(
has_capability
(
'mod/quiz:grade'
,
$context
=
context_course
::
instance
(
$courseid
),
$USER
->
id
)
&&
$is_quiz
)
{
$module
->
url
=
$module
->
url
.
"&mode=responses&tifirst="
.
$user
->
firstname
[
0
]
.
"&tilast="
.
$user
->
lastname
[
0
];
}
$module
->
link_icon
=
$CFG
->
wwwroot
.
"/theme/image.php/boost/"
.
$modinfo
->
cms
[
$cm_id
]
->
modname
.
"/1/icon"
;
$module
->
name
=
$modinfo
->
cms
[
$cm_id
]
->
name
;
array_push
(
$modules
,
$module
);
}
$data
[
"modules"
]
=
$modules
;
$renderer
=
$PAGE
->
get_renderer
(
'block_competency_iena'
);
echo
$renderer
->
get_linked_activities
(
$data
);
//echo json_encode($html);
return
;
}
echo
"false"
;
return
;
...
...
This diff is collapsed.
Click to expand it.
js/dropdown.js
+
2
−
1
View file @
92335883
...
...
@@ -179,10 +179,11 @@
});
function
loadLinkedActivities
(
courseid
,
competencyid
){
user
=
document
.
getElementById
(
'
studentid_sel
'
).
value
;
$
.
ajax
({
url
:
window
.
location
.
href
,
type
:
'
GET
'
,
data
:
{
competencyid
:
competencyid
,
courseid
:
courseid
,
action
:
"
get_links
"
},
data
:
{
competencyid
:
competencyid
,
courseid
:
courseid
,
user
:
user
,
action
:
"
get_links
"
},
success
:
function
(
html
)
{
if
(
html
==
'
false
'
){
html
=
"
<p><i>Il n'y a aucune activité liée</i></p>
"
...
...
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