91334a46b5
Co-authored-by: Cursor <cursoragent@cursor.com>
159 lines
6.2 KiB
PHP
159 lines
6.2 KiB
PHP
<?php
|
|
// This file is part of Moodle - http://moodle.org/
|
|
//
|
|
// Moodle is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// Moodle is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
/**
|
|
* Admin HTML for Adobe Connect server setup guide.
|
|
*
|
|
* @package mod_meetletacbfree
|
|
* @copyright 2026 MeetLet
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
*/
|
|
|
|
namespace mod_meetletacbfree\local;
|
|
|
|
defined('MOODLE_INTERNAL') || die();
|
|
|
|
/**
|
|
* Renders the “Server setup” admin help tab.
|
|
*/
|
|
class server_guide {
|
|
/**
|
|
* Build guide HTML (safe for admin settings heading).
|
|
*/
|
|
public static function render(): string {
|
|
$plugin = 'meetletacbfree';
|
|
|
|
$match = \html_writer::tag('h4', get_string('serverguide_match_title', $plugin)) .
|
|
\html_writer::tag('p', get_string('serverguide_match_intro', $plugin)) .
|
|
self::table([
|
|
[get_string('admin_httpauth', $plugin), \html_writer::tag('code', s(get_string('serverguide_placeholder_httpauth', $plugin)))],
|
|
[get_string('host', $plugin), \html_writer::tag('code', s(get_string('serverguide_placeholder_apiurl', $plugin)))],
|
|
[get_string('meethost', $plugin), \html_writer::tag('code', s(get_string('serverguide_placeholder_meethost', $plugin)))],
|
|
]);
|
|
|
|
$customini = self::section(
|
|
'customini',
|
|
get_string('serverguide_customini_title', $plugin),
|
|
get_string('serverguide_customini_body', $plugin) .
|
|
\html_writer::tag('pre', s(get_string('serverguide_customini_sample', $plugin)), [
|
|
'class' => 'meetlet-guide__code',
|
|
])
|
|
);
|
|
|
|
$webxml = self::section(
|
|
'webxml',
|
|
get_string('serverguide_webxml_title', $plugin),
|
|
get_string('serverguide_webxml_body', $plugin) .
|
|
\html_writer::tag('pre', s(get_string('serverguide_webxml_sample', $plugin)), [
|
|
'class' => 'meetlet-guide__code',
|
|
])
|
|
);
|
|
|
|
$serverxml = self::section(
|
|
'serverxml',
|
|
get_string('serverguide_serverxml_title', $plugin),
|
|
get_string('serverguide_serverxml_body', $plugin) .
|
|
\html_writer::tag('pre', s(get_string('serverguide_serverxml_sample', $plugin)), [
|
|
'class' => 'meetlet-guide__code',
|
|
])
|
|
);
|
|
|
|
$upgrade = \html_writer::div(
|
|
\html_writer::tag('strong', get_string('serverguide_upgrade_title', $plugin)) .
|
|
\html_writer::div(get_string('serverguide_upgrade_body', $plugin), 'meetlet-guide__body'),
|
|
'meetlet-guide__callout meetlet-guide__callout--warn',
|
|
['id' => 'meetlet-guide-upgrade']
|
|
);
|
|
|
|
$codes = self::errorcodes_section();
|
|
|
|
return \html_writer::div(
|
|
\html_writer::tag('h3', get_string('serverguide_heading', $plugin), ['class' => 'meetlet-guide__heading']) .
|
|
\html_writer::tag('p', get_string('serverguide_intro', $plugin), ['class' => 'meetlet-guide__intro']) .
|
|
\html_writer::div($match, 'meetlet-guide__section meetlet-guide__section--match') .
|
|
$customini .
|
|
$webxml .
|
|
$serverxml .
|
|
$upgrade .
|
|
$codes,
|
|
'meetlet-guide meetlet-settings-card'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Help-code table so an admin can match a student-reported ML- code.
|
|
*/
|
|
protected static function errorcodes_section(): string {
|
|
$plugin = 'meetletacbfree';
|
|
$head = \html_writer::tag('tr',
|
|
\html_writer::tag('th', get_string('serverguide_errorcodes_col_code', $plugin)) .
|
|
\html_writer::tag('th', get_string('serverguide_errorcodes_col_meaning', $plugin)) .
|
|
\html_writer::tag('th', get_string('serverguide_errorcodes_col_fix', $plugin))
|
|
);
|
|
$body = '';
|
|
foreach (usererror::catalog() as $item) {
|
|
$body .= \html_writer::tag('tr',
|
|
\html_writer::tag('td', \html_writer::tag('code', s($item['label'])), ['class' => 'meetlet-guide__code-cell']) .
|
|
\html_writer::tag('td', get_string($item['titlekey'], $plugin)) .
|
|
\html_writer::tag('td', get_string($item['fixkey'], $plugin))
|
|
);
|
|
}
|
|
$table = \html_writer::tag(
|
|
'table',
|
|
\html_writer::tag('thead', $head) . \html_writer::tag('tbody', $body),
|
|
['class' => 'meetlet-guide__table generaltable']
|
|
);
|
|
return self::section(
|
|
'errorcodes',
|
|
get_string('serverguide_errorcodes_title', $plugin),
|
|
\html_writer::tag('p', get_string('serverguide_errorcodes_intro', $plugin)) . $table
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @param string $id Section id for anchoring.
|
|
* @param string $title Section title.
|
|
* @param string $bodyhtml Trusted HTML from lang strings (admin-only).
|
|
*/
|
|
protected static function section(string $id, string $title, string $bodyhtml): string {
|
|
return \html_writer::div(
|
|
\html_writer::tag('h4', $title) .
|
|
\html_writer::div($bodyhtml, 'meetlet-guide__body'),
|
|
'meetlet-guide__section',
|
|
['id' => 'meetlet-guide-' . $id]
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @param array<int, array{0:string,1:string}> $rows Label / value (value may contain HTML).
|
|
*/
|
|
protected static function table(array $rows): string {
|
|
$trs = '';
|
|
foreach ($rows as $row) {
|
|
$trs .= \html_writer::tag(
|
|
'tr',
|
|
\html_writer::tag('th', $row[0], ['scope' => 'row']) .
|
|
\html_writer::tag('td', $row[1])
|
|
);
|
|
}
|
|
return \html_writer::tag(
|
|
'table',
|
|
\html_writer::tag('tbody', $trs),
|
|
['class' => 'meetlet-guide__table generaltable']
|
|
);
|
|
}
|
|
}
|