lite.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Get field list.
  4. *
  5. * @param string $module
  6. * @param string $method
  7. * @access public
  8. * @return array
  9. */
  10. public function getFieldList($module, $method = '')
  11. {
  12. /* Load corresponding module. */
  13. if(!isset($this->config->$module)) $this->loadModel($module);
  14. $config = $this->config->$module;
  15. if(!empty($method) && isset($config->$method) && isset($config->$method->dtable)) $config = $config->$method;
  16. $fieldList = $config->dtable->fieldList;
  17. /* If doesn't need product, remove 'product' field. */
  18. if($this->session->hasProduct == 0 && (strpos($this->config->datatable->noProductModule, ",$module,") !== false))
  19. {
  20. $productIndex = array_search('product', $config->dtable->defaultField);
  21. if($productIndex) unset($config->dtable->defaultField[$productIndex]);
  22. if(isset($fieldList['product'])) unset($fieldList['product']);
  23. }
  24. /* Nomal product without 'branch' field. */
  25. if($this->session->currentProductType === 'normal') unset($config->fieldList['branch']);
  26. foreach($fieldList as $fieldName => $items)
  27. {
  28. /* Translate field title. */
  29. if(!isset($items['title'])) $items['title'] = $fieldName;
  30. $title = zget($this->lang->$module, $items['title'], zget($this->lang, $items['title'], $items['title']));
  31. $fieldList[$fieldName]['title'] = $title;
  32. /* Set col config default value. */
  33. if(!empty($items['type']) && isset($this->config->datatable->defaultColConfig[$items['type']]))
  34. {
  35. $fieldList[$fieldName] = array_merge($this->config->datatable->defaultColConfig[$items['type']], $fieldList[$fieldName]);
  36. }
  37. }
  38. /* Logic except open source version .*/
  39. if($this->config->edition != 'open' and $module != 'story') $fieldList += $this->appendWorkflowFields($module, $method);
  40. return $fieldList;
  41. }