Commit b5e90ced authored by Astor Bizard's avatar Astor Bizard
Browse files

Added a button to return to own activity (when on a student's activity).

parent cdf5ca50
......@@ -232,6 +232,7 @@ $string ['resetvpl'] = 'Reset {$a}';
$string ['resourcelimits'] = 'Resources limits';
$string ['restrictededitor'] = 'Dissable external file upload, paste and drop external content';
$string ['retrieve'] = 'Retrieve results';
$string ['returntoownactivity'] = 'Return to own activity';
$string ['run'] = 'Run';
$string ['running'] = 'Running';
$string ['runscript'] = 'Run script';
......
......@@ -503,7 +503,9 @@ function mod_vpl_get_fontawesome_icon_map() {
'mod_vpl:gradercomments' => 'fa-check-square',
'mod_vpl:downloadsubmissions' => 'fa-cloud-download',
'mod_vpl:downloadallsubmissions' => 'fa-history',
'mod_vpl:user' => 'fa-user',
'mod_vpl:group' => 'fa-group',
'mod_vpl:exitrole' => 'fa-close',
];
}
......
/* ############################## */
/* ## Exit student role button ## */
/* ############################## */
.path-mod-vpl .exit-activity-student-role {
cursor: pointer;
padding-left: .5em;
}
/* ############################## */
/* ##### Submissions charts ##### */
/* ############################## */
......
......@@ -1441,7 +1441,7 @@ class mod_vpl {
*/
public function print_view_tabs($path) {
// TODO refactor using functions.
global $CFG, $USER, $DB, $OUTPUT;
global $USER, $DB, $OUTPUT, $PAGE;
$active = basename( $path );
$cmid = $this->cm->id;
$userid = optional_param( 'userid', null, PARAM_INT );
......@@ -1457,20 +1457,14 @@ class mod_vpl {
}
$level2 = $grader || $manager || $similarity;
$strdescription = get_string( 'description', VPL );
$strsubmission = get_string( 'submission', VPL );
$stredit = get_string( 'edit', VPL );
$strsubmissionview = get_string( 'submissionview', VPL );
$maintabs = array ();
$tabs = array ();
$baseurl = $CFG->wwwroot . '/mod/' . VPL . '/';
$href = vpl_mod_href( 'view.php', 'id', $cmid, 'userid', $userid );
$viewtab = vpl_create_tabobject('view.php', $href, 'description' );
if ($level2) {
if ($viewer) {
$maintabs [] = $viewtab;
}
$strsubmissionslist = get_string( 'submissionslist', VPL );
$href = vpl_mod_href( 'views/submissionslist.php', 'id', $cmid );
$maintabs [] = vpl_create_tabobject( 'submissionslist.php', $href, 'submissionslist' );
// Similarity.
......@@ -1480,7 +1474,6 @@ class mod_vpl {
} else {
$tabname = 'similarity';
}
$strsubmissionslist = get_string( 'similarity', VPL );
$href = vpl_mod_href( 'similarity/similarity_form.php', 'id', $cmid );
$maintabs [] = vpl_create_tabobject( $tabname, $href, 'similarity' );
}
......@@ -1502,11 +1495,19 @@ class mod_vpl {
) );
if ($this->is_group_activity()) {
$text = get_string( 'group' ) . ' ';
$icon = vpl_get_awesome_icon('group') . ' ';
} else {
$text = get_string( 'user' ) . ' ';
$icon = vpl_get_awesome_icon('user') . ' ';
}
$text .= $this->fullname( $user, false );
$maintabs [] = new tabobject( $tabname, $href, $text, $text );
$url = $PAGE->url->out( false, array( 'userid' => $USER->id ) );
$buttonexit = html_writer::tag('span', vpl_get_awesome_icon('exitrole'), array(
'class' => 'exit-activity-student-role btn-link',
'title' => get_string('returntoownactivity', VPL),
'onclick' => 'event.preventDefault(); window.location.href=\'' . $url . '\';'
));
$maintabs [] = new tabobject( $tabname, $href, $icon . $text . $buttonexit, $text );
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment