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
LabNbook
LabNbook-Moodle
Commits
5b7c2f3a
Commit
5b7c2f3a
authored
Mar 05, 2019
by
Francois Gannaz
Browse files
view: partially realized
parent
91ef6945
Changes
4
Hide whitespace changes
Inline
Side-by-side
classes/session.php
View file @
5b7c2f3a
...
...
@@ -103,6 +103,12 @@ class mod_labnbook_session
return
$DB
->
get_field
(
"labnbook"
,
"labnbook_missionid"
,
[
'id'
=>
$instanceId
]);
}
public
function
getReportId
(
$missionId
)
{
$userId
=
$this
->
getUserId
();
return
$this
->
fetch
(
'GET'
,
"/report"
,
null
,
[
'userid'
=>
$userId
,
'missionid'
=>
$missionId
]);
}
/**
* Return an URL that will authenticate the user in LabNbook
*
...
...
templates/view_student.mustache
0 → 100644
View file @
5b7c2f3a
<section>
<h2>
{{
title
}}
</h2>
<div>
{{{
description
}}}
</div>
<p>
<a
href=
"
{{
url
}}
"
class=
"btn btn-primary"
>
Modifier le rapport LabNbook
</a>
</p>
</section>
templates/view_teacher.mustache
0 → 100644
View file @
5b7c2f3a
view.php
View file @
5b7c2f3a
...
...
@@ -22,6 +22,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use
\
mod_labnbook_session
as
session
;
require
(
__DIR__
.
'/../../config.php'
);
require_once
(
__DIR__
.
'/lib.php'
);
...
...
@@ -64,4 +66,19 @@ $PAGE->set_context($modulecontext);
echo
$OUTPUT
->
header
();
$lnb
=
session
::
load
();
if
(
has_capability
(
'moodle/course:manageactivities'
,
context_course
::
instance
(
$course
->
id
)))
{
// editing teacher view
// ...
}
else
{
// student view
$reportId
=
$lnb
->
getReportId
(
$moduleinstance
->
labnbook_missionid
);
$data
=
[
'title'
=>
$moduleinstance
->
name
,
'description'
=>
format_text
(
$moduleinstance
->
intro
,
$moduleinstance
->
introformat
,
[
'context'
=>
$modulecontext
]),
'url'
=>
$lnb
->
createAuthenticatedUrl
(
'/page/report.php?idr='
.
$reportId
),
];
$OUTPUT
->
render_from_template
(
'mod_labnbook/view_student'
,
$data
);
}
echo
$OUTPUT
->
footer
();
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