<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Field; use ModStart\Core\Exception\BizException; use ModStart\Core\Util\SerializeUtil; 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 HgGjV; HgGjV: $WJIdC = $this->getVariable('fields'); goto JF5fP; JF5fP: $nqpMZ = array(); goto qDg3l; miNgG: return $nqpMZ; goto D67d7; FpppU: if (empty($nqpMZ)) { $nqpMZ = new \stdClass(); } goto miNgG; qDg3l: foreach ($WJIdC as $Sch6x) { $nqpMZ[$Sch6x['name']] = isset($Sch6x['defaultValue']) ? $Sch6x['defaultValue'] : null; } goto FpppU; D67d7: } public function iconServer($YSNPl) { $this->addVariables(array('iconServer' => $YSNPl)); return $this; } public function fields($HDpl6) { goto ibdCN; i51gA: return $this; goto MA1mo; E56ji: $yDyxD = array(); goto iezK8; iezK8: foreach ($HDpl6 as $Sch6x) { goto OvD9e; A9UK2: if ($Sch6x['type'] == 'icon') { $this->addVariables(array('hasIcon' => true)); } goto f4Tre; pELw5: $yDyxD[$Sch6x['name']] = true; goto A9UK2; OvD9e: BizException::throwsIf('ComplexFieldsList.字段名重复 - ' . $Sch6x['name'], isset($yDyxD[$Sch6x['name']])); goto pELw5; f4Tre: } goto i51gA; QdR7d: $this->addVariables(array('valueItem' => $this->getValueItem())); goto E56ji; ibdCN: $this->addVariables(array('fields' => $HDpl6)); goto QdR7d; MA1mo: } public function unserializeValue($HDpl6, AbstractField $E8QRJ) { goto tq0b9; zsi1x: if (empty($HDpl6)) { $HDpl6 = array(); } goto r7HI0; r7HI0: return $HDpl6; goto YpZ8i; tq0b9: $HDpl6 = @json_decode($HDpl6, true); goto zsi1x; YpZ8i: } public function serializeValue($HDpl6, $xTADA) { return SerializeUtil::jsonEncode($HDpl6); } public function prepareInput($HDpl6, $xTADA) { goto uG9up; EUzl5: return $HDpl6; goto Kn119; dzYos: if (empty($HDpl6)) { $HDpl6 = array(); } goto EUzl5; uG9up: $HDpl6 = @json_decode($HDpl6, true); goto dzYos; Kn119: } }