aboutsummaryrefslogtreecommitdiff
path: root/views/default/admin/plugins/simple.php
blob: 9b989794418ca240c1bdc9d8110804f53aaaa52d (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
/**
 * Elgg administration simple plugin screen
 *
 * Shows an alphabetical list of "simple" plugins.
 *
 * @package Elgg
 * @subpackage Core
 */

regenerate_plugin_list();
$installed_plugins = get_installed_plugins();
$plugin_list = array();
$title = elgg_view_title(elgg_echo('admin:plugins'));

foreach ($installed_plugins as $installed_name => $plugin) {
	if (!isset($plugin['manifest']['admin_interface']) || $plugin['manifest']['admin_interface'] == 'advanced') {
		continue;
	}

	$plugin['installed_name'] = $installed_name;

	$plugin_list[$plugin['manifest']['name']] = $plugin;
}

ksort($plugin_list);
$form_body  .= <<<___END
	<div id="content_header" class="clearfix">
		<div class="content_header_title">$title</div>
	</div>
	<ul class="admin_plugins margin_top">
___END;

foreach ($plugin_list as $name => $info) {
	$manifest = $info['manifest'];
	$version_valid = (isset($manifest['elgg_version'])) ? check_plugin_compatibility($manifest['elgg_version']) : FALSE;
	if ($info['active']) {
		$active_class = 'active';
		$checked = 'checked="checked"';
	} else {
		$active_class = 'not_active';
		$checked = '';
	}

	$author = $link = $version = $settings = '';

	if (isset($manifest['author'])) {
		$author = elgg_echo('admin:plugins:author', array($manifest['author']));
	}

	if (isset($manifest['version'])) {
		$version = ' | ' . elgg_echo('admin:plugins:version', array($manifest['version']));
	}

	if (isset($manifest['website'])) {
		$link = " | <a href=\"{$manifest['website']}\">" . elgg_echo('admin:plugins:plugin_website') . '</a>';
	}

	if (elgg_view_exists("settings/{$info['installed_name']}/edit")) {
		$settings_href = elgg_get_site_url()."pg/admin/plugin_settings/{$info['installed_name']}";
		$settings = " | <a class='plugin_settings link' href='$settings_href'>". elgg_echo('settings') ."</a>";
	}

	$form_body .= <<<___END
	<li class="plugin_details $active_class">
		<span class="plugin_controls">
			<input type="checkbox" id="{$info['installed_name']}" class="plugin_enabled" $checked name="enabled_plugins[]" value="{$info['installed_name']}"/>
			<label for="{$info['installed_name']}">$name</label>
		</span>

		<span class="plugin_info">
			<span class="plugin_description">
				{$manifest['description']}
			</span>
			<span class="plugin_metadata small">
				$author
				$version
				$link
				$settings
			</span>
		</span>
	</li>
___END;
}

$form_body .= '</ul>';
$form_body .= elgg_view('input/submit', array('value' => elgg_echo('save')));
$form_body .= elgg_view('input/reset', array('value' => elgg_echo('reset'), 'class' => 'action_button disabled'));

echo elgg_view('input/form', array(
	'action' => "action/admin/plugins/simple_update_states",
	'body' => $form_body,
	'class' => 'admin_plugins_simpleview'
));