/**
  * Add the configurations to the given Plugin configuration
  *
  * @param array $config
  *
  * @return array
  */
 public function addConfig($config)
 {
     foreach (Register::getRegister() as $key => $configuration) {
         $config['items'][] = array($configuration['title'], $key);
     }
     return $config;
 }
 /**
  * Handle CMD
  *
  * @param string $command
  * @param string $table
  * @param int $id
  * @param $value
  * @param DataHandler $handler
  * @param $pasteUpdate
  * @param $pasteDatamap
  */
 public function processCmdmap_postProcess($command, $table, $id, $value, $handler, $pasteUpdate, $pasteDatamap)
 {
     $register = Register::getRegister();
     foreach ($register as $key => $configuration) {
         if ($configuration['tableName'] == $table) {
             $indexer = GeneralUtility::makeInstance('HDNET\\Calendarize\\Service\\IndexerService');
             $indexer->reindex($key, $table, $id);
         }
     }
 }
Example #3
0
    /**
     * Get  the calendarize string for the registered tables
     *
     * @return string
     */
    protected function getCalendarizeDatabaseString()
    {
        $sql = [];
        foreach (Register::getRegister() as $configuration) {
            $sql[] = 'CREATE TABLE ' . $configuration['tableName'] . ' (
			calendarize tinytext
			);';
        }
        return implode(LF, $sql);
    }
 /**
  * Run the delete action
  *
  * @param string      $table
  * @param int         $id
  * @param             $recordToDelete
  * @param             $recordWasDeleted
  * @param DataHandler $dataHandler
  */
 public function processCmdmap_deleteAction($table, $id, $recordToDelete, &$recordWasDeleted, DataHandler $dataHandler)
 {
     $register = Register::getRegister();
     foreach ($register as $key => $configuration) {
         if ($configuration['tableName'] == $table) {
             $indexer = HelperUtility::create('HDNET\\Calendarize\\Service\\IndexerService');
             $dataHandler->deleteEl($table, $id);
             $recordWasDeleted = TRUE;
             $indexer->reindex($key, $table, $id);
         }
     }
 }
 /**
  * Process the reindex after all operations
  *
  * @param DataHandler $dataHandler
  *
  * @return void
  */
 public function processDatamap_afterAllOperations(DataHandler $dataHandler)
 {
     if (!$this->indexItems) {
         return;
     }
     $register = Register::getRegister();
     /** @var \HDNET\Calendarize\Service\IndexerService $indexer */
     $indexer = HelperUtility::create('HDNET\\Calendarize\\Service\\IndexerService');
     foreach ($register as $key => $configuration) {
         foreach ($this->indexItems as $table => $identifiers) {
             if ($table === $configuration['tableName']) {
                 foreach ($identifiers as $uid) {
                     $indexer->reindex($key, $table, $uid);
                 }
             }
         }
     }
     $this->indexItems = array();
 }
Example #6
0
 /**
  * Remove index Items of configurations that are not valid anymore
  *
  * @return bool
  */
 protected function removeInvalidConfigurationIndex()
 {
     $validKeys = array_keys(Register::getRegister());
     $databaseConnection = HelperUtility::getDatabaseConnection();
     if ($validKeys) {
         foreach ($validKeys as $key => $value) {
             $validKeys[$key] = $databaseConnection->fullQuoteStr($value, IndexerService::TABLE_NAME);
         }
         return (bool) $databaseConnection->exec_DELETEquery(self::TABLE_NAME, 'unique_register_key NOT IN (' . implode(',', $validKeys) . ')');
     }
     return (bool) $databaseConnection->exec_TRUNCATEquery(self::TABLE_NAME);
 }
 /**
  * Get the current configurations
  *
  * @return array
  */
 protected function getCurrentConfigurations()
 {
     $configurations = GeneralUtility::trimExplode(',', $this->settings['configuration'], TRUE);
     $return = array();
     foreach (Register::getRegister() as $key => $configuration) {
         if (in_array($key, $configurations)) {
             $return[] = $configuration;
         }
     }
     return $return;
 }
Example #8
0
 /**
  * Get the current configuration
  *
  * @return null|array
  */
 public function getConfiguration()
 {
     foreach (Register::getRegister() as $key => $configuration) {
         if ($this->getUniqueRegisterKey() == $key) {
             return $configuration;
         }
     }
     return NULL;
 }