示例#1
0
 /**
  * @return array
  */
 public function prepareConfig()
 {
     $configArray = ['tableId' => $this->getTableIdentifier(), 'class' => $this->tableClass, 'url' => $this->defaultUrl, 'header' => []];
     if ($this->getConfiguration() instanceof TableConfiguration) {
         $configTableArray = ['url' => $this->config->getUrl() === null ? $this->defaultUrl : $this->config->getUrl(), 'header' => $this->config->getHeader(), 'footer' => $this->config->getFooter(), 'order' => $this->getOrders($this->config), 'searchable' => $this->config->getSearchable(), 'sortable' => $this->config->getSortable(), 'pageLength' => $this->config->getPageLength()];
         $configArray = array_merge($configArray, $configTableArray);
     }
     return $configArray;
 }
示例#2
0
 /**
  * @inheritDoc
  * @throws \UnexpectedValueException
  * @throws \Spryker\Zed\Oms\Business\Exception\TransitionLogException
  */
 protected function configure(TableConfiguration $config)
 {
     $headers = [SpyOmsTransitionLogTableMap::COL_FK_SALES_ORDER_ITEM => 'Item', SpyOmsTransitionLogTableMap::COL_EVENT => 'Event', SpyOmsTransitionLogTableMap::COL_CONDITION => 'Condition', SpyOmsTransitionLogTableMap::COL_SOURCE_STATE => 'Source state', SpyOmsTransitionLogTableMap::COL_TARGET_STATE => 'Target state', SpyOmsTransitionLogTableMap::COL_COMMAND => 'Command', SpyOmsTransitionLogTableMap::COL_IS_ERROR => 'Is error', SpyOmsTransitionLogTableMap::COL_ERROR_MESSAGE => 'Error message', SpyOmsTransitionLogTableMap::COL_PATH => 'Path', SpyOmsTransitionLogTableMap::COL_HOSTNAME => 'Hostname', SpyOmsTransitionLogTableMap::COL_CREATED_AT => 'Date'];
     $config->setHeader($headers);
     $config->setUrl('table-ajax?id-order=' . $this->getIdOrder());
     $createdAtColumnIndex = array_search(SpyOmsTransitionLogTableMap::COL_CREATED_AT, array_keys($config->getHeader()));
     if ($createdAtColumnIndex === false) {
         throw new \UnexpectedValueException('Not a valid column index');
     }
     if (!$createdAtColumnIndex) {
         throw new TransitionLogException('Could not find "createdAd" column index');
     }
     $config->setDefaultSortColumnIndex($createdAtColumnIndex);
     $config->setDefaultSortDirection(TableConfiguration::SORT_DESC);
     $config->setSearchable([SpyOmsTransitionLogTableMap::COL_SOURCE_STATE]);
     $config->setSortable([SpyOmsTransitionLogTableMap::COL_CREATED_AT]);
     return $config;
 }
示例#3
0
 /**
  * @param \Propel\Runtime\ActiveQuery\ModelCriteria $query
  * @param \Spryker\Zed\Gui\Communication\Table\TableConfiguration $config
  *
  * @return array
  */
 protected function getColumnsList(ModelCriteria $query, TableConfiguration $config)
 {
     if ($config->getHeader()) {
         return array_keys($config->getHeader());
     }
     return array_keys($query->getTableMap()->getColumns());
 }