Beispiel #1
0
 /**
  * This method executes the requested commands and applies the changes to
  * the template.
  *
  * @param $actionResult
  * @throws RuntimeException
  * @throws UnexpectedValueException
  * @return string Rendered plugin content
  */
 protected function render($actionResult)
 {
     $allCommands = Tx_Solr_CommandResolver::getAllPluginCommandsList();
     $commandList = $this->getCommandList();
     // render commands matching the plugin's requirements
     foreach ($commandList as $commandName) {
         $GLOBALS['TT']->push('solr-' . $commandName);
         $commandContent = '';
         $commandVariables = $this->executeCommand($commandName);
         if (!is_null($commandVariables)) {
             $commandContent = $this->renderCommand($commandName, $commandVariables);
         }
         $this->template->addSubpart('solr_search_' . $commandName, $commandContent);
         unset($subpartTemplate);
         $GLOBALS['TT']->pull($commandContent);
     }
     // remove subparts for commands that are registered but not matching the requirements
     $nonMatchingCommands = array_diff($allCommands, $commandList);
     foreach ($nonMatchingCommands as $nonMatchingCommand) {
         $this->template->addSubpart('solr_search_' . $nonMatchingCommand, '');
     }
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr'][$this->getPluginKey()]['renderTemplate'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr'][$this->getPluginKey()]['renderTemplate'] as $classReference) {
             $templateModifier =& \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classReference);
             if ($templateModifier instanceof Tx_Solr_TemplateModifier) {
                 $templateModifier->modifyTemplate($this->template);
             } else {
                 throw new UnexpectedValueException(get_class($templateModifier) . ' must implement interface Tx_Solr_TemplateModifier', 1310387230);
             }
         }
     }
     $this->javascriptManager->addJavascriptToPage();
     return $this->template->render(Tx_Solr_Template::CLEAN_TEMPLATE_YES);
 }
Beispiel #2
0
 /**
  * Retrieves the list of commands to process for the results view.
  *
  * @return	array	An array of command names to process for the result view
  */
 protected function getCommandList()
 {
     $requirements = Tx_Solr_PluginCommand::REQUIREMENT_NONE;
     $commandList = array();
     if ($this->search->hasSearched()) {
         $requirements = Tx_Solr_PluginCommand::REQUIREMENT_HAS_SEARCHED;
         if ($this->search->getNumberOfResults() > 0) {
             $requirements += Tx_Solr_PluginCommand::REQUIREMENT_HAS_RESULTS;
         } else {
             $requirements += Tx_Solr_PluginCommand::REQUIREMENT_NO_RESULTS;
         }
     }
     $commandList = Tx_Solr_CommandResolver::getPluginCommands('results', $requirements);
     return $commandList;
 }
 /**
  * Retrievs the list of commands we have to process for the results view
  *
  * @return	array	Array of command names to process for the result view
  */
 protected function getCommandList()
 {
     $commandList = Tx_Solr_CommandResolver::getPluginCommands('frequentsearches');
     return $commandList;
 }
Beispiel #4
0
// register plugin commands
#Tx_Solr_CommandResolver::registerPluginCommand(
#	'results',
#	'advanced_form',
#	'Tx_Solr_PiResults_AdvancedFormCommand',
#	Tx_Solr_PluginCommand::REQUIREMENT_NONE
#);
Tx_Solr_CommandResolver::registerPluginCommand('results, frequentsearches', 'frequentSearches', 'Tx_Solr_PiResults_FrequentSearchesCommand', Tx_Solr_PluginCommand::REQUIREMENT_NONE);
Tx_Solr_CommandResolver::registerPluginCommand('search, results', 'form', 'Tx_Solr_PiResults_FormCommand', Tx_Solr_PluginCommand::REQUIREMENT_NONE);
Tx_Solr_CommandResolver::registerPluginCommand('results', 'resultsPerPageSwitch', 'Tx_Solr_PiResults_ResultsPerPageSwitchCommand', Tx_Solr_PluginCommand::REQUIREMENT_HAS_SEARCHED + Tx_Solr_PluginCommand::REQUIREMENT_HAS_RESULTS);
Tx_Solr_CommandResolver::registerPluginCommand('search, results', 'errors', 'Tx_Solr_PiResults_ErrorsCommand', Tx_Solr_PluginCommand::REQUIREMENT_NONE);
Tx_Solr_CommandResolver::registerPluginCommand('results', 'lastSearches', 'Tx_Solr_PiResults_LastSearchesCommand', Tx_Solr_PluginCommand::REQUIREMENT_NONE);
Tx_Solr_CommandResolver::registerPluginCommand('results', 'no_results', 'Tx_Solr_PiResults_NoResultsCommand', Tx_Solr_PluginCommand::REQUIREMENT_HAS_SEARCHED + Tx_Solr_PluginCommand::REQUIREMENT_NO_RESULTS);
Tx_Solr_CommandResolver::registerPluginCommand('results', 'faceting', 'Tx_Solr_PiResults_FacetingCommand', Tx_Solr_PluginCommand::REQUIREMENT_HAS_SEARCHED + Tx_Solr_PluginCommand::REQUIREMENT_HAS_RESULTS + Tx_Solr_PluginCommand::REQUIREMENT_NO_RESULTS);
Tx_Solr_CommandResolver::registerPluginCommand('results', 'results', 'Tx_Solr_PiResults_ResultsCommand', Tx_Solr_PluginCommand::REQUIREMENT_HAS_SEARCHED + Tx_Solr_PluginCommand::REQUIREMENT_HAS_RESULTS);
Tx_Solr_CommandResolver::registerPluginCommand('results', 'sorting', 'Tx_Solr_PiResults_SortingCommand', Tx_Solr_PluginCommand::REQUIREMENT_HAS_SEARCHED + Tx_Solr_PluginCommand::REQUIREMENT_HAS_RESULTS);
# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
// registering facet types
Tx_Solr_Facet_FacetRendererFactory::registerFacetType('numericRange', 'Tx_Solr_Facet_NumericRangeFacetRenderer', 'Tx_Solr_Query_FilterEncoder_Range', 'Tx_Solr_Query_FilterEncoder_Range');
Tx_Solr_Facet_FacetRendererFactory::registerFacetType('dateRange', 'Tx_Solr_Facet_DateRangeFacetRenderer', 'Tx_Solr_Query_FilterEncoder_DateRange', 'Tx_Solr_Query_FilterEncoder_DateRange');
Tx_Solr_Facet_FacetRendererFactory::registerFacetType('hierarchy', 'Tx_Solr_Facet_HierarchicalFacetRenderer', 'Tx_Solr_Query_FilterEncoder_Hierarchy');
Tx_Solr_Facet_FacetRendererFactory::registerFacetType('queryGroup', 'Tx_Solr_Facet_QueryGroupFacetRenderer', 'Tx_Solr_Query_FilterEncoder_QueryGroup', 'Tx_Solr_Query_FilterEncoder_QueryGroup');
# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
// adding scheduler tasks
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['Tx_Solr_Scheduler_ReIndexTask'] = array('extension' => $_EXTKEY, 'title' => 'LLL:EXT:solr/Resources/Private/Language/ModuleScheduler.xml:reindex_title', 'description' => 'LLL:EXT:solr/Resources/Private/Language/ModuleScheduler.xml:reindex_description', 'additionalFields' => 'Tx_Solr_Scheduler_ReIndexTaskAdditionalFieldProvider');
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['Tx_Solr_Scheduler_IndexQueueWorkerTask'] = array('extension' => $_EXTKEY, 'title' => 'LLL:EXT:solr/Resources/Private/Language/ModuleScheduler.xml:indexqueueworker_title', 'description' => 'LLL:EXT:solr/Resources/Private/Language/ModuleScheduler.xml:indexqueueworker_description', 'additionalFields' => 'Tx_Solr_Scheduler_IndexQueueWorkerTaskAdditionalFieldProvider');
# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
// TODO move into pi_results, initializeSearch, add only when features are activated
$TYPO3_CONF_VARS['EXTCONF']['solr']['modifySearchForm']['keepParameters'] = 'Tx_Solr_PiResults_ParameterKeepingFormModifier';
$TYPO3_CONF_VARS['EXTCONF']['solr']['modifySearchForm']['spellcheck'] = 'Tx_Solr_PiResults_SpellCheckFormModifier';
$TYPO3_CONF_VARS['EXTCONF']['solr']['modifySearchForm']['suggest'] = 'Tx_Solr_PiResults_SuggestFormModifier';