You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.4 KiB
PHP
44 lines
1.4 KiB
PHP
<?php
|
|
class OrderExportModalWidget extends ZcWidget {
|
|
/**
|
|
* @var OrderPrintService
|
|
*/
|
|
private $orderPrintService;
|
|
|
|
public function __construct() {
|
|
$this->orderPrintService = Zc::singleton('OrderPrintService');
|
|
}
|
|
|
|
public function render($data = array()) {
|
|
$mallId = $_SESSION[SessionConst::mallId];
|
|
$subAccountId = $_SESSION[SessionConst::mallSubAccountId] ?: 0;
|
|
if (empty($data['opSetting'])) {
|
|
$data['opSetting'] = $this->orderPrintService->getUserOpSetting($mallId);
|
|
}
|
|
|
|
if (empty($data['opPageSetting'])) {
|
|
$data['opPageSetting'] = $this->orderPrintService->getUserOpPageSetting($mallId, $subAccountId);
|
|
}
|
|
|
|
$exportOrderFieldsInfo = $data['opPageSetting']['default_export_order_fields'] ?: $data['opSetting']['default_export_order_fields'];
|
|
|
|
$data['exportOrderFieldsInfo'] = $this->getExportOrderFieldsInfo($exportOrderFieldsInfo);
|
|
return $this->renderFile('order/order_export_modal', $data);
|
|
}
|
|
|
|
private function getExportOrderFieldsInfo($defaultExportOrderFields) {
|
|
$fieldsMap = OrderPrintTool::getExportFieldsMap();
|
|
|
|
$data = array();
|
|
foreach ($fieldsMap as $group => $fields) {
|
|
foreach ($fields as $field => $name) {
|
|
$data[$group][] = array(
|
|
'field' => $field,
|
|
'name' => $name,
|
|
'checked' => in_array($field, $defaultExportOrderFields[$group])
|
|
);
|
|
}
|
|
}
|
|
return $data;
|
|
}
|
|
} |