|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* (c) Kitodo. Key to digital objects e.V. <[email protected]> |
|
5
|
|
|
* |
|
6
|
|
|
* This file is part of the Kitodo and TYPO3 projects. |
|
7
|
|
|
* |
|
8
|
|
|
* @license GNU General Public License version 3 or later. |
|
9
|
|
|
* For the full copyright and license information, please read the |
|
10
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
11
|
|
|
*/ |
|
12
|
|
|
namespace Kitodo\Dlf\Task; |
|
13
|
|
|
|
|
14
|
|
|
use TYPO3\CMS\Core\Database\Connection; |
|
15
|
|
|
use TYPO3\CMS\Core\Database\ConnectionPool; |
|
16
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
17
|
|
|
use TYPO3\CMS\Scheduler\Controller\SchedulerModuleController; |
|
18
|
|
|
use TYPO3\CMS\Scheduler\Task\Enumeration\Action; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Additional fields for building the suggestion dictionary task. |
|
22
|
|
|
* |
|
23
|
|
|
* @package TYPO3 |
|
24
|
|
|
* @subpackage dlf |
|
25
|
|
|
* |
|
26
|
|
|
* @access public |
|
27
|
|
|
*/ |
|
28
|
|
|
class SuggestBuildAdditionalFieldProvider extends BaseAdditionalFieldProvider |
|
29
|
|
|
{ |
|
30
|
|
|
/** |
|
31
|
|
|
* Gets additional fields to render in the form to add/edit a task |
|
32
|
|
|
* |
|
33
|
|
|
* @param array $taskInfo Values of the fields from the add/edit task form |
|
34
|
|
|
* @param BaseTask $task The task object being edited. Null when adding a task! |
|
35
|
|
|
* @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule Reference to the scheduler backend module |
|
36
|
|
|
* @return array A two dimensional array, array('Identifier' => array('fieldId' => array('code' => '', 'label' => '', 'cshKey' => '', 'cshLabel' => '')) |
|
37
|
|
|
*/ |
|
38
|
|
|
public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) |
|
39
|
|
|
{ |
|
40
|
|
|
$currentSchedulerModuleAction = $schedulerModule->getCurrentAction(); |
|
41
|
|
|
|
|
42
|
|
|
/** @var BaseTask $task */ |
|
43
|
|
|
if ($currentSchedulerModuleAction->equals(Action::EDIT)) { |
|
44
|
|
|
$taskInfo['solr'] = $task->getSolr(); |
|
45
|
|
|
} else { |
|
46
|
|
|
$taskInfo['solr'] = - 1; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
$additionalFields = []; |
|
50
|
|
|
|
|
51
|
|
|
// DropDown for Solr core |
|
52
|
|
|
$additionalFields['solr'] = $this->getSolrField($taskInfo['solr']); |
|
53
|
|
|
|
|
54
|
|
|
return $additionalFields; |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|