mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 21:13:26 +00:00
68 lines
1.6 KiB
PHP
68 lines
1.6 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Phraseanet
|
|
*
|
|
* (c) 2005-2014 Alchemy
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Alchemy\Phrasea\SearchEngine\Elastic;
|
|
|
|
use Alchemy\Phrasea\Application;
|
|
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
|
|
use Alchemy\Phrasea\SearchEngine\AbstractConfigurationPanel;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
class ConfigurationPanel extends AbstractConfigurationPanel
|
|
{
|
|
private $searchEngine;
|
|
|
|
public function __construct(ElasticSearchEngine $engine, PropertyAccess $conf)
|
|
{
|
|
$this->searchEngine = $engine;
|
|
$this->conf = $conf;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function getName()
|
|
{
|
|
return 'elastic-search-engine';
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function get(Application $app, Request $request)
|
|
{
|
|
return $app['twig']->render('admin/search-engine/elastic-search.html.twig', ['configuration' => $this->getConfiguration()]);
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function post(Application $app, Request $request)
|
|
{
|
|
$configuration = $this->getConfiguration();
|
|
|
|
$configuration['host'] = $request->request->get('host');
|
|
$configuration['port'] = $request->request->get('port');
|
|
|
|
$this->saveConfiguration($configuration);
|
|
|
|
return $app->redirectPath('admin_searchengine_get');
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function getConfiguration()
|
|
{
|
|
return $this->conf->get(['main', 'search-engine', 'options'], []);
|
|
}
|
|
}
|