本文整理汇总了PHP中Module::getInstalled方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::getInstalled方法的具体用法?PHP Module::getInstalled怎么用?PHP Module::getInstalled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module::getInstalled方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
function indexAction()
{
$this->view->setTitle('Настройка доступа к разделам сайта');
$defaultConfig = $this->module->config['access']['accessTree'];
$modules = Module::getInstalled(\App::$cur->primary);
$this->view->page(['data' => compact('modules', 'defaultConfig')]);
}
示例2: scanModules
function scanModules()
{
$modules = Module::getInstalled(App::$primary);
$map = [];
foreach ($modules as $module) {
$map[$module] = App::$cur->{$module}->sitemap();
if (!$map[$module]) {
unset($map[$module]);
}
}
return $map;
}
示例3: configureAction
public function configureAction()
{
$appOptions = Apps\App::get(filter_input(INPUT_GET, 'item_pk', FILTER_SANITIZE_NUMBER_INT));
$app = new App();
$app->name = $appOptions->name;
$app->system = true;
$app->staticPath = "/" . $appOptions->dir . "/static";
$app->templatesPath = "/" . $appOptions->dir . "/static/templates";
$app->path = INJI_PROGRAM_DIR . '/' . $appOptions->dir;
$app->type = 'app';
$app->installed = true;
$app->params = [];
$app->config = Config::app($app);
$modules = Module::getInstalled($app, $app);
$inputs = [];
foreach ($modules as $module) {
$info = Module::getInfo($module);
if (!empty($info['configure'])) {
$config = Config::module($module, false, $app);
foreach ($info['configure'] as $optionName => $params) {
if (filter_input(INPUT_POST, $optionName)) {
$config[$optionName] = filter_input(INPUT_POST, $optionName);
Config::save('module', $config, $module, $app);
}
$input = [];
$input['name'] = $optionName;
$input['type'] = $params['type'];
$input['label'] = $params['label'];
$input['options']['value'] = !empty($config[$optionName]) ? $config[$optionName] : '';
$input['options']['values'] = ['' => 'Не выбрано'];
$input['options']['values'] += $params['model']::getList(['forSelect' => true, 'key' => $params['col']]);
$inputs[] = $input;
}
}
}
if (!empty($_POST)) {
Tools::redirect('/setup');
}
$this->view->page(['data' => compact('inputs')]);
}
示例4: array_flip
<h1>Установка модулей</h1>
<form>
<?php
$config = Config::app(App::$primary ? App::$primary : App::$cur);
$modules = array_flip(Module::getInstalled(App::$cur));
$systemModules = array_slice(scandir(INJI_SYSTEM_DIR . '/modules'), 2);
foreach ($systemModules as $module) {
$info = Module::getInfo($module);
if (!$info || isset($modules[$module])) {
continue;
}
?>
<div class ="form-group">
<div class="checkbox">
<label>
<input type ="checkbox" name ="modules[]" value ="<?php
echo $module;
?>
" /> <?php
echo $info['name'];
?>
</label>
</div>
</div>
<?php
}
?>
<button class="btn btn-primary">Установить</button>
</form>
示例5: install
public function install($module, $params = [])
{
$installed = Module::getInstalled(App::$primary);
if (in_array($module, $installed)) {
return true;
}
$info = Module::getInfo($module);
if (!empty($info['requires'])) {
foreach ($info['requires'] as $requireModuleName) {
$this->install($requireModuleName);
}
}
$config = Config::app();
$type = 'modules';
$path = INJI_SYSTEM_DIR . '/modules/';
$location = 'modules';
$config[$location][] = $module;
if (!empty($info['autoload'])) {
$config['autoloadModules'][] = $module;
}
if (!empty($info['menu'])) {
foreach ($info['menu'] as $appType => $items) {
$this->addInMenu($items, $appType);
}
}
Config::save('app', $config, null, App::$primary);
if (file_exists($path . $module . '/install_script.php')) {
$installFunction = (include $path . $module . '/install_script.php');
$installFunction(1, $params);
}
}
示例6: foreach
<?php
$table = new Ui\Table();
$table->name = 'Установленные модули';
$table->addButton(['href' => '/admin/modules/create', 'text' => 'Создать']);
$table->addButton(['href' => '/admin/modules/install', 'text' => 'Установить']);
$table->setCols(['Модуль', 'Панель администратора', 'Публичная часть', 'Управление', 'По умолчанию']);
$default = !empty(App::$primary->config['defaultModule']) ? App::$primary->config['defaultModule'] : '';
foreach (Module::getInstalled(App::$cur) as $module) {
$info = Module::getInfo($module);
$table->addRow([empty($info['name']) ? $module : $info['name'], '', '', "<a class = 'btn btn-primary btn-xs' href = '/admin/modules/editor/{$module}'>Редактировать</a>", $default == $module ? 'По умолчанию' : "<a class = 'btn btn-primary btn-xs' href = '/admin/modules/setDefault/{$module}'>Установить по умолчанию</a>"]);
}
$table->draw();
示例7: getExtensions
/**
* Return extensions for type
*
* @param string $extensionType
* @param string $request
* @return array
*/
public function getExtensions($extensionType, $request)
{
$extensions = [];
$modules = Module::getInstalled(App::$cur);
$method = 'get' . ucfirst($extensionType);
foreach ($modules as $module) {
$extensions = array_merge($extensions, $this->{$method}($request, false, "/extensions/{$this->moduleName}/" . $extensionType, $module));
}
return $extensions;
}