<?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 bz3Ct; ypJNd: foreach ($tB45T as $ZT1n0) { $lBzfA[$ZT1n0['name']] = isset($ZT1n0['defaultValue']) ? $ZT1n0['defaultValue'] : null; } goto s9XaM; AqDax: $lBzfA = array(); goto ypJNd; BtyK2: return $lBzfA; goto HGWiA; bz3Ct: $tB45T = $this->getVariable('fields'); goto AqDax; s9XaM: if (empty($lBzfA)) { $lBzfA = new \stdClass(); } goto BtyK2; HGWiA: } public function iconServer($GBwzV) { $this->addVariables(array('iconServer' => $GBwzV)); return $this; } public function fields($mdHu1) { goto RlHJh; x6iwc: $IRxqo = array(); goto QXptw; QXptw: foreach ($mdHu1 as $ZT1n0) { goto g4e0d; RqUn8: if ($ZT1n0['type'] == 'icon') { $this->addVariables(array('hasIcon' => true)); } goto yKQ3q; G2nXi: $IRxqo[$ZT1n0['name']] = true; goto RqUn8; g4e0d: BizException::throwsIf('ComplexFieldsList.字段名重复 - ' . $ZT1n0['name'], isset($IRxqo[$ZT1n0['name']])); goto G2nXi; yKQ3q: } goto WejCP; WejCP: return $this; goto f_OUf; SrRG7: $this->addVariables(array('valueItem' => $this->getValueItem())); goto x6iwc; RlHJh: $this->addVariables(array('fields' => $mdHu1)); goto SrRG7; f_OUf: } public function unserializeValue($mdHu1, AbstractField $Mk6lP) { goto L_2gK; L_2gK: $mdHu1 = @json_decode($mdHu1, true); goto AK9XZ; AK9XZ: if (empty($mdHu1)) { $mdHu1 = array(); } goto mQvVV; mQvVV: return $mdHu1; goto BbQ2b; BbQ2b: } public function serializeValue($mdHu1, $DRh9Q) { return json_encode($mdHu1, JSON_UNESCAPED_UNICODE); } public function prepareInput($mdHu1, $DRh9Q) { goto N68t4; q3HFt: return $mdHu1; goto Asbdb; pSAjX: if (empty($mdHu1)) { $mdHu1 = array(); } goto q3HFt; N68t4: $mdHu1 = @json_decode($mdHu1, true); goto pSAjX; Asbdb: } }