91334a46b5
Co-authored-by: Cursor <cursoragent@cursor.com>
131 lines
4.8 KiB
PHP
131 lines
4.8 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/>.
|
|
|
|
/**
|
|
* View page renderable.
|
|
*
|
|
* @package mod_meetletacbfree
|
|
* @copyright 2026 MeetLet
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
*/
|
|
|
|
namespace mod_meetletacbfree\output;
|
|
|
|
use mod_meetletacbfree\local\featureaccess;
|
|
use mod_meetletacbfree\local\icons;
|
|
use mod_meetletacbfree\local\instance;
|
|
use mod_meetletacbfree\local\meetingstatus;
|
|
use renderable;
|
|
use renderer_base;
|
|
use templatable;
|
|
|
|
defined('MOODLE_INTERNAL') || die();
|
|
|
|
/**
|
|
* Main activity shell with tabs.
|
|
*/
|
|
class view_page implements renderable, templatable {
|
|
/** @var instance */
|
|
protected $instance;
|
|
/** @var bool */
|
|
protected $configured;
|
|
/** @var array|null */
|
|
protected $lifecycle;
|
|
/** @var bool */
|
|
protected $registrationusable = true;
|
|
|
|
public function __construct(
|
|
instance $instance,
|
|
bool $configured,
|
|
?array $lifecycle = null,
|
|
bool $registrationusable = true
|
|
) {
|
|
$this->instance = $instance;
|
|
$this->configured = $configured;
|
|
$this->lifecycle = $lifecycle;
|
|
$this->registrationusable = $registrationusable;
|
|
}
|
|
|
|
public function export_for_template(renderer_base $output): array {
|
|
global $USER;
|
|
|
|
$rec = $this->instance->record;
|
|
$lifecycle = $this->lifecycle ?? meetingstatus::resolve_local($this->instance, (int)$USER->id);
|
|
$status = $lifecycle['status'];
|
|
$statuslabel = $lifecycle['statuslabel'];
|
|
$startts = (int)$lifecycle['starttime'];
|
|
$endts = (int)$lifecycle['endtime'];
|
|
|
|
$intro = format_module_intro('meetletacbfree', $rec, $this->instance->cm->id);
|
|
$tabs = [
|
|
[
|
|
'id' => 'details',
|
|
'label' => get_string('tabdetails', 'meetletacbfree'),
|
|
'icon' => icons::svg('details'),
|
|
'active' => true,
|
|
],
|
|
];
|
|
if (featureaccess::allowed(featureaccess::RECORDINGS, $this->instance->context, $rec)) {
|
|
$tabs[] = [
|
|
'id' => 'recordings',
|
|
'label' => get_string('tabrecordings', 'meetletacbfree'),
|
|
'icon' => icons::svg('recordings'),
|
|
'active' => false,
|
|
];
|
|
}
|
|
if (featureaccess::allowed(featureaccess::CONTENT, $this->instance->context, $rec)) {
|
|
$tabs[] = [
|
|
'id' => 'content',
|
|
'label' => get_string('tabcontent', 'meetletacbfree'),
|
|
'icon' => icons::svg('content'),
|
|
'active' => false,
|
|
];
|
|
}
|
|
|
|
$featurejoin = featureaccess::allowed(featureaccess::JOIN, $this->instance->context, $rec);
|
|
$joinable = $featurejoin && !empty($lifecycle['joinable']);
|
|
|
|
return [
|
|
'cmid' => (int)$this->instance->cm->id,
|
|
'groupid' => (int)$this->instance->groupid,
|
|
'name' => format_string($rec->name),
|
|
'intro' => $intro,
|
|
'hasintro' => trim(strip_tags($intro)) !== '',
|
|
'detailstitle' => get_string('tabdetails', 'meetletacbfree'),
|
|
'emptydetails' => get_string('emptydetails', 'meetletacbfree'),
|
|
'configured' => $this->configured,
|
|
'notconfiguredmsg' => get_string('notconfigured', 'meetletacbfree'),
|
|
'subtitle' => get_string('subtitle', 'meetletacbfree'),
|
|
'logourl' => $output->image_url('adobeconnect', 'meetletacbfree')->out(false),
|
|
'status' => $status,
|
|
'statuslabel' => $statuslabel,
|
|
'statusmessage' => (string)$lifecycle['message'],
|
|
'starttime' => $startts ? userdate($startts) : '',
|
|
'endtime' => $endts ? userdate($endts) : '',
|
|
'hasend' => !empty($endts),
|
|
'tabs' => $tabs,
|
|
'loading' => get_string('loading', 'meetletacbfree'),
|
|
'joining' => get_string('joining', 'meetletacbfree'),
|
|
'joiningtitle' => get_string('joiningtitle', 'meetletacbfree'),
|
|
'joinlabel' => get_string('joinmeeting', 'meetletacbfree'),
|
|
'canjoin' => $featurejoin,
|
|
'joinable' => $joinable,
|
|
'statuspollseconds' => $this->registrationusable ? 15 : 0,
|
|
'registrationusable' => $this->registrationusable,
|
|
];
|
|
}
|
|
}
|