<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Field; use ModStart\Core\Exception\BizException; class ComplexFieldsList extends AbstractField { protected $value = array(); protected $width = 300; protected $listable = false; protected function setup() { $this->addVariables(array('fields' => array(), 'valueItem' => new \stdClass(), 'iconServer' => modstart_admin_url('widget/icon'), 'hasIcon' => false)); } private function getValueItem() { goto rQ87r; rQ87r: $BpSP0 = $this->getVariable('fields'); goto PbsVe; pTnD6: foreach ($BpSP0 as $rFWFp) { $HcnUr[$rFWFp['name']] = isset($rFWFp['defaultValue']) ? $rFWFp['defaultValue'] : null; } goto Ciurf; PbsVe: $HcnUr = array(); goto pTnD6; Ciurf: if (empty($HcnUr)) { $HcnUr = new \stdClass(); } goto LpRoh; LpRoh: return $HcnUr; goto NSAJY; NSAJY: } public function iconServer($P6Nu0) { $this->addVariables(array('iconServer' => $P6Nu0)); return $this; } public function fields($Gttsd) { goto doFmW; L_u1Z: return $this; goto OxxVU; doFmW: $this->addVariables(array('fields' => $Gttsd)); goto bGWah; iWxlm: $zf5XD = array(); goto EWnS3; EWnS3: foreach ($Gttsd as $rFWFp) { goto juKpu; Euxm3: if ($rFWFp['type'] == 'icon') { $this->addVariables(array('hasIcon' => true)); } goto ZHNvi; juKpu: BizException::throwsIf('ComplexFieldsList.字段名重复 - ' . $rFWFp['name'], isset($zf5XD[$rFWFp['name']])); goto NNqn2; NNqn2: $zf5XD[$rFWFp['name']] = true; goto Euxm3; ZHNvi: } goto L_u1Z; bGWah: $this->addVariables(array('valueItem' => $this->getValueItem())); goto iWxlm; OxxVU: } public function unserializeValue($Gttsd, AbstractField $acdQI) { goto JPQbw; JPQbw: $Gttsd = @json_decode($Gttsd, true); goto kfI0o; pS68D: return $Gttsd; goto G4x0Q; kfI0o: if (empty($Gttsd)) { $Gttsd = array(); } goto pS68D; G4x0Q: } public function serializeValue($Gttsd, $BWo2e) { return json_encode($Gttsd, JSON_UNESCAPED_UNICODE); } public function prepareInput($Gttsd, $BWo2e) { goto qFUrV; V38zm: if (empty($Gttsd)) { $Gttsd = array(); } goto S8eG2; S8eG2: return $Gttsd; goto kwTME; qFUrV: $Gttsd = @json_decode($Gttsd, true); goto V38zm; kwTME: } }