Example #1
0
 /**
  * @param string $table
  * @param integer $id
  * @param array $record
  * @return array|NULL
  */
 protected function ensureRecordDataIsLoaded($table, $id, array $record)
 {
     if (TRUE === is_integer($id) && 0 === count($record)) {
         // patch: when a record is completely empty but a UID exists
         $loadedRecord = $this->recordService->getSingle($table, '*', $id);
         $record = TRUE === is_array($loadedRecord) ? $loadedRecord : $record;
     }
     return $record;
 }
 /**
  * @param integer $relativeRecordUid
  * @param string $fluxAreaName
  * @param array $whitelist
  * @param array $blacklist
  * @return array
  */
 protected function readWhitelistAndBlacklistFromColumn($relativeRecordUid, $fluxAreaName, $whitelist, $blacklist)
 {
     $relativeRecord = $this->recordService->getSingle('tt_content', '*', (int) $relativeRecordUid);
     $contentProviders = $this->configurationService->resolveConfigurationProviders('tt_content', NULL, $relativeRecord);
     foreach ($contentProviders as $contentProvider) {
         $grid = $contentProvider->getGrid($relativeRecord);
         if (NULL === $grid) {
             continue;
         }
         foreach ($grid->getRows() as $row) {
             foreach ($row->getColumns() as $column) {
                 if ($column->getName() === $fluxAreaName) {
                     list($whitelist, $blacklist) = $this->appendToWhiteAndBlacklistFromComponent($column, $whitelist, $blacklist);
                 }
             }
         }
     }
     return array($whitelist, $blacklist);
 }
 /**
  * @param integer $uid
  * @return array
  */
 public function getContentAreasDefinedInContentElement($uid)
 {
     $uid = (int) $uid;
     $record = $this->recordService->getSingle('tt_content', '*', $uid);
     /** @var $providers ProviderInterface[] */
     $providers = $this->fluxService->resolveConfigurationProviders('tt_content', NULL, $record);
     $columns = array();
     foreach ($providers as $provider) {
         $grid = $provider->getGrid($record);
         if (TRUE === empty($grid)) {
             continue;
         }
         $gridConfiguration = $grid->build();
         foreach ($gridConfiguration['rows'] as $row) {
             foreach ($row['columns'] as $column) {
                 array_push($columns, array($column['label'] . ' (' . $column['name'] . ')', $column['name']));
             }
         }
     }
     return array_unique($columns, SORT_REGULAR);
 }
Example #4
0
 /**
  * @param array $row
  * @param integer $uid
  * @return void
  */
 protected function updateRecordInDatabase(array $row, $uid = NULL)
 {
     if (NULL === $uid) {
         $uid = $row['uid'];
     }
     $uid = (int) $uid;
     if (FALSE === empty($uid)) {
         $row['uid'] = $uid;
         $this->workspacesAwareRecordService->update('tt_content', $row);
         // reload our record for the next bits to have access to all fields
         $row = $this->recordService->getSingle('tt_content', '*', $uid);
     }
     $versionedRecordUid = (int) (TRUE === isset($row['t3ver_oid']) && 0 < (int) $row['t3ver_oid'] ? $row['t3ver_oid'] : 0);
     if (0 < $versionedRecordUid) {
         // temporary record; duplicate key values of original record into temporary one.
         // Note: will continue to call this method until all temporary records in chain have been processed.
         $placeholder = $this->recordService->getSingle('tt_content', '*', $row['t3ver_oid']);
         $placeholder['tx_flux_parent'] = (int) $row['tx_flux_parent'];
         $placeholder['tx_flux_column'] = $row['tx_flux_column'];
         $this->updateRecordInDatabase($placeholder, $row['t3ver_oid']);
     }
 }
Example #5
0
 /**
  * @param integer $contentUid
  * @return array
  */
 protected function getPageTitleAndPidFromContentUid($contentUid)
 {
     return reset($this->recordService->get('tt_content t, pages p', 'p.title, t.pid', "t.uid = '" . $contentUid . "' AND p.uid = t.pid"));
 }
 /**
  * @param string $table
  * @param string $fields
  * @param string $condition
  * @param array $values
  * @return array
  */
 public function preparedGet($table, $fields, $condition, $values = array())
 {
     $records = parent::preparedGet($table, $fields, $condition, $values);
     return $this->overlayRecords($table, $records);
 }
 /**
  * @param string $table
  * @param integer $uid
  * @return integer
  */
 protected function getPageIdFromRecordUid($table, $uid)
 {
     $record = $this->recordService->getSingle($table, 'pid', $uid);
     return TRUE === is_array($record) ? $this->getPageIdFromRecord($record) : 0;
 }