Skip to content

Commit

Permalink
MDL-71912 course modules: Toggle heading depending on navigation.
Browse files Browse the repository at this point in the history
If the secondary navigation is on then the activity header does
not need to be displayed twice.
  • Loading branch information
abgreeve committed Nov 9, 2021
1 parent c4c00f4 commit 7520614
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
4 changes: 2 additions & 2 deletions mod/chat/lang/en/chat.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
$string['deletesession'] = 'Delete this session';
$string['deletesessionsure'] = 'Are you sure you want to delete this session?';
$string['donotusechattime'] = 'Don\'t publish any chat times';
$string['enterchat'] = 'Click here to enter the chat now';
$string['enterchat'] = 'Enter the chat';
$string['errornousers'] = 'Could not find any users!';
$string['explaingeneralconfig'] = 'These settings are <strong>always</strong> used';
$string['explainmethoddaemon'] = 'These settings only have an effect if \'Chat server daemon\' is selected as chat method.';
Expand Down Expand Up @@ -174,7 +174,7 @@
* Emoting - You can start a line with "/me" or ":" to emote, for example if your name is Kim and you type ":laughs!" or "/me laughs!" then everyone will see "Kim laughs!"
* Beeps - You can send a sound to other participants by clicking the "beep" link next to their name. A useful shortcut to beep all the people in the chat at once is to type "beep all".
* HTML - If you know some HTML code, you can use it in your text to do things like insert images, play sounds or create different coloured text';
$string['viewreport'] = 'View past chat sessions';
$string['viewreport'] = 'Past sessions';

// Deprecated since Moodle 3.11.
$string['sessionstart'] = 'The next chat session will start on {$a->date}, ({$a->fromnow} from now)';
Expand Down
25 changes: 16 additions & 9 deletions mod/chat/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@
$groupparam = "";
}

echo $OUTPUT->heading(format_string($chat->name), 2);
if (!$PAGE->has_secondary_navigation()) {
echo $OUTPUT->heading(format_string($chat->name), 2);
}

// Render the activity information.
$cminfo = cm_info::create($cm);
Expand All @@ -124,28 +126,33 @@
$chattime = $chat->chattime ?? 0;
$span = $chattime - $now;
if (!empty($chat->schedule) && $span > 0) {
echo html_writer::tag('p', get_string('sessionstartsin', 'chat', format_time($span)));
$attributes = ['class' => 'border bg-light rounded p-2'];
echo html_writer::tag('p', get_string('sessionstartsin', 'chat', format_time($span)), $attributes);
}

$params['id'] = $chat->id;
$chattarget = new moodle_url("/mod/chat/gui_$CFG->chat_method/index.php", $params);
echo '<p>';
echo html_writer::start_div('container-fluid');
echo html_writer::start_div('row');
echo html_writer::start_div('col-xs-6 mr-3');
echo $OUTPUT->action_link($chattarget,
$strenterchat,
new popup_action('click', $chattarget, "chat{$course->id}_{$chat->id}{$groupparam}",
array('height' => 500, 'width' => 700)));
echo '</p>';
array('height' => 500, 'width' => 700)), ['class' => 'btn btn-primary']);
echo html_writer::end_div();
echo html_writer::start_div('col-xs-6');

$params['id'] = $chat->id;
$link = new moodle_url('/mod/chat/gui_basic/index.php', $params);
$action = new popup_action('click', $link, "chat{$course->id}_{$chat->id}{$groupparam}",
array('height' => 500, 'width' => 700));
echo '<p>';
echo $OUTPUT->action_link($link, get_string('noframesjs', 'message'), $action,
array('title' => get_string('modulename', 'chat')));
echo '</p>';
array('title' => get_string('modulename', 'chat'), 'class' => 'btn btn-secondary'));
echo html_writer::end_div();
echo html_writer::end_div();
echo html_writer::end_div();

if ($chat->studentlogs or has_capability('mod/chat:readlog', $context)) {
if (($chat->studentlogs or has_capability('mod/chat:readlog', $context)) && !$PAGE->has_secondary_navigation()) {
if ($msg = chat_get_session_messages($chat->id, $currentgroup)) {
echo '<p>';
echo html_writer::link(new moodle_url('/mod/chat/report.php', array('id' => $cm->id)),
Expand Down
4 changes: 3 additions & 1 deletion mod/lti/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@

if ($lti->showtitlelaunch) {
// Print the main part of the page.
echo $OUTPUT->heading(format_string($lti->name, true, array('context' => $context)));
if (!$PAGE->has_secondary_navigation()) {
echo $OUTPUT->heading(format_string($lti->name, true, array('context' => $context)));
}
}

// Display any activity information (eg completion requirements / dates).
Expand Down

0 comments on commit 7520614

Please sign in to comment.