mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 12:33:26 +00:00

Conflicts: lib/Alchemy/Phrasea/Command/Developer/JavascriptBuilder.php lib/Alchemy/Phrasea/Controller/Prod/Basket.php lib/Alchemy/Phrasea/Core/Provider/TaskManagerServiceProvider.php lib/classes/Exception/Feed/ItemNotFound.php lib/classes/Exception/Feed/PublisherNotFound.php lib/classes/Feed/Abstract.php lib/classes/Feed/Adapter.php lib/classes/Feed/Aggregate.php lib/classes/Feed/Collection.php lib/classes/Feed/CollectionInterface.php lib/classes/Feed/Entry/Adapter.php lib/classes/Feed/Entry/Collection.php lib/classes/Feed/Entry/Interface.php lib/classes/Feed/Entry/Item.php lib/classes/Feed/Entry/ItemInterface.php lib/classes/Feed/Interface.php lib/classes/Feed/Link.php lib/classes/Feed/LinkInterface.php lib/classes/Feed/Publisher/Adapter.php lib/classes/Feed/Publisher/Interface.php lib/classes/Feed/Token.php lib/classes/Feed/TokenAggregate.php lib/classes/Feed/XML/Abstract.php lib/classes/Feed/XML/Atom.php lib/classes/Feed/XML/Cooliris.php lib/classes/Feed/XML/Interface.php lib/classes/Feed/XML/RSS.php lib/classes/Feed/XML/RSS/ImageInterface.php lib/classes/http/request.php lib/classes/module/console/schedulerStart.php lib/classes/module/console/schedulerState.php lib/classes/module/console/schedulerStop.php lib/classes/module/console/taskState.php lib/classes/module/console/tasklist.php lib/classes/module/console/taskrun.php lib/classes/registry.php lib/classes/registryInterface.php lib/classes/set/order.php lib/classes/system/url.php lib/classes/task/Scheduler.php lib/classes/task/appboxAbstract.php lib/classes/task/databoxAbstract.php lib/classes/task/manager.php lib/classes/task/period/RecordMover.php lib/classes/task/period/apibridge.php lib/classes/task/period/archive.php lib/classes/task/period/cindexer.php lib/classes/task/period/emptyColl.php lib/classes/task/period/ftp.php lib/classes/task/period/ftpPull.php lib/classes/task/period/subdef.php lib/classes/task/period/test.php lib/classes/task/period/writemeta.php lib/conf.d/PhraseaFixture/AbstractWZ.php lib/conf.d/PhraseaFixture/Basket/LoadFiveBaskets.php lib/conf.d/PhraseaFixture/Basket/LoadOneBasket.php lib/conf.d/PhraseaFixture/Basket/LoadOneBasketEnv.php lib/conf.d/PhraseaFixture/Lazaret/LoadOneFile.php lib/conf.d/PhraseaFixture/Story/LoadOneStory.php lib/conf.d/PhraseaFixture/UsrLists/ListAbstract.php lib/conf.d/PhraseaFixture/UsrLists/UsrList.php lib/conf.d/PhraseaFixture/UsrLists/UsrListEntry.php lib/conf.d/PhraseaFixture/UsrLists/UsrListOwner.php lib/conf.d/PhraseaFixture/ValidationParticipant/LoadOneParticipant.php lib/conf.d/PhraseaFixture/ValidationParticipant/LoadParticipantWithSession.php lib/conf.d/PhraseaFixture/ValidationSession/LoadOneValidationSession.php
102 lines
3.3 KiB
PHP
102 lines
3.3 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\Helper;
|
|
|
|
class Prod extends Helper
|
|
{
|
|
|
|
public function get_search_datas()
|
|
{
|
|
$search_datas = [
|
|
'bases' => [],
|
|
'dates' => [],
|
|
'fields' => []
|
|
];
|
|
|
|
$bases = $fields = $dates = [];
|
|
|
|
if (! $this->app['authentication']->getUser() instanceof \User_Adapter) {
|
|
return $search_datas;
|
|
}
|
|
|
|
$searchSet = json_decode($this->app['authentication']->getUser()->getPrefs('search'), true);
|
|
$saveSettings = $this->app['authentication']->getUser()->getPrefs('advanced_search_reload');
|
|
|
|
foreach ($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_sbas() as $databox) {
|
|
$sbas_id = $databox->get_sbas_id();
|
|
|
|
$bases[$sbas_id] = [
|
|
'thesaurus' => (trim($databox->get_thesaurus()) != ""),
|
|
'cterms' => false,
|
|
'collections' => [],
|
|
'sbas_id' => $sbas_id
|
|
];
|
|
|
|
foreach ($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base([], [$databox->get_sbas_id()]) as $coll) {
|
|
$selected = $saveSettings ? ((isset($searchSet['bases']) && isset($searchSet['bases'][$sbas_id])) ? (in_array($coll->get_base_id(), $searchSet['bases'][$sbas_id])) : true) : true;
|
|
$bases[$sbas_id]['collections'][] =
|
|
[
|
|
'selected' => $selected,
|
|
'base_id' => $coll->get_base_id()
|
|
];
|
|
}
|
|
|
|
$meta_struct = $databox->get_meta_structure();
|
|
foreach ($meta_struct as $meta) {
|
|
if ( ! $meta->is_indexable())
|
|
continue;
|
|
$id = $meta->get_id();
|
|
$name = $meta->get_name();
|
|
if ($meta->get_type() == 'date') {
|
|
if (isset($dates[$id]))
|
|
$dates[$id]['sbas'][] = $sbas_id;
|
|
else
|
|
$dates[$id] = ['sbas' => [$sbas_id], 'fieldname' => $name];
|
|
}
|
|
|
|
if (isset($fields[$name])) {
|
|
$fields[$name]['sbas'][] = $sbas_id;
|
|
} else {
|
|
$fields[$name] = [
|
|
'sbas' => [$sbas_id]
|
|
, 'fieldname' => $name
|
|
, 'type' => $meta->get_type()
|
|
, 'id' => $id
|
|
];
|
|
}
|
|
}
|
|
|
|
if (! $bases[$sbas_id]['thesaurus']) {
|
|
continue;
|
|
}
|
|
if ( ! $this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_sbas($sbas_id, 'bas_modif_th')) {
|
|
continue;
|
|
}
|
|
|
|
if (false !== simplexml_load_string($databox->get_cterms())) {
|
|
$bases[$sbas_id]['cterms'] = true;
|
|
}
|
|
}
|
|
|
|
$search_datas['fields'] = $fields;
|
|
$search_datas['dates'] = $dates;
|
|
$search_datas['bases'] = $bases;
|
|
|
|
return $search_datas;
|
|
}
|
|
|
|
public function getRandom()
|
|
{
|
|
return md5(time() . mt_rand(100000, 999999));
|
|
}
|
|
}
|