aboutsummaryrefslogtreecommitdiff
path: root/app/views/helpers/extension/details.phtml
blob: d1f7730204364e9bb40955ad3e07415d933ed329 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
	declare(strict_types=1);
	/** @var FreshRSS_View $this */
	if ($this->ext_details === null) {
		throw new FreshRSS_Context_Exception('Extension not initialised!');
	}

	$name_encoded = urlencode($this->ext_details->getName());
	$ext_enabled = $this->ext_details->isEnabled();
	if ($ext_enabled) {
		$button_class = ' active';
		$name_class = '';
		$action = 'disable';
		$title = _t('gen.action.disable');
	} else {
		$button_class = '';
		$name_class = ' disabled';
		$action = 'enable';
		$title = _t('gen.action.enable');
	}
	if ($this->ext_details->getType() === 'user' || FreshRSS_Auth::hasAccess('admin')) {?>
	<button class="switch<?= $button_class ?>" form="form-extension" formaction="<?= _url('extension', $action, 'e', $name_encoded) ?>" title="<?= _t('gen.action.enable') ?>"></button>
	<a class="open-slider configure" title="<?= _t('gen.action.manage') ?>" href="<?= _url('extension', 'configure', 'e', $name_encoded) ?>"><?= _i('configure') ?></a>
	<span class="ext_name<?= $name_class ?>"><?= $this->ext_details->getName() ?></span>
<?php } else { ?>
	<button class="switch<?= $button_class ?>" title="<?= _t('admin.extensions.system.no_rights') ?>" disabled="disabled"></button>
	<span class="ext_name<?= $name_class ?>"><?= $this->ext_details->getName() ?></span>
<?php } ?>