|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
|
6
|
|
|
|
|
7
|
|
|
namespace Chamilo\CoreBundle\Controller\Admin; |
|
8
|
|
|
|
|
9
|
|
|
use AppPlugin; |
|
10
|
|
|
use Chamilo\CoreBundle\Controller\BaseController; |
|
11
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; |
|
12
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; |
|
13
|
|
|
use Symfony\Component\HttpFoundation\Response; |
|
14
|
|
|
use Symfony\Component\Routing\Annotation\Route; |
|
15
|
|
|
|
|
16
|
|
|
#[Route('/plugins')] |
|
17
|
|
|
class PluginsController extends BaseController |
|
18
|
|
|
{ |
|
19
|
|
|
#[IsGranted('ROLE_ADMIN')] |
|
20
|
|
|
#[Route('/', name: 'chamilo_core_plugins', methods:['GET', 'POST'])] |
|
21
|
|
|
public function index(): Response |
|
22
|
|
|
{ |
|
23
|
|
|
$appPlugin = new AppPlugin(); |
|
24
|
|
|
$installedPlugins = $appPlugin->getInstalledPlugins(); |
|
25
|
|
|
|
|
26
|
|
|
return $this->render( |
|
27
|
|
|
'@ChamiloCore/Admin/Settings/plugins.html.twig', |
|
28
|
|
|
[ |
|
29
|
|
|
'plugins' => $installedPlugins, |
|
30
|
|
|
] |
|
31
|
|
|
); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @Security("is_granted('ROLE_ADMIN')") |
|
36
|
|
|
* |
|
37
|
|
|
* @Route("/add") |
|
38
|
|
|
*/ |
|
39
|
|
|
public function pluginsAddAction(): Response |
|
40
|
|
|
{ |
|
41
|
|
|
$appPlugin = new AppPlugin(); |
|
42
|
|
|
$allPlugins = $appPlugin->read_plugins_from_path(); |
|
43
|
|
|
$allPluginsList = []; |
|
44
|
|
|
foreach ($allPlugins as $pluginName) { |
|
45
|
|
|
/*$file = api_get_path(SYS_PLUGIN_PATH).$pluginName.'/plugin.php'; |
|
46
|
|
|
|
|
47
|
|
|
if (is_file($file)) { |
|
48
|
|
|
$pluginInfo = require $file; |
|
49
|
|
|
var_dump($pluginInfo);exit; |
|
50
|
|
|
$allPluginsList[] = $pluginInfo; |
|
51
|
|
|
}*/ |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
$installedPlugins = $appPlugin->getInstalledPlugins(); |
|
55
|
|
|
|
|
56
|
|
|
return $this->render( |
|
57
|
|
|
'@ChamiloCore/Admin/Settings/pluginsAdd.html.twig', |
|
58
|
|
|
[ |
|
59
|
|
|
'plugins' => $allPluginsList, |
|
60
|
|
|
'installed_plugins' => $installedPlugins, |
|
61
|
|
|
] |
|
62
|
|
|
); |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|