<?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 thQ3o; vWY0I: if (empty($Xg23q)) { $Xg23q = new \stdClass(); } goto dCseS; thQ3o: $cclNa = $this->getVariable('fields'); goto F8_Uv; dCseS: return $Xg23q; goto T7VD5; UVFjR: foreach ($cclNa as $gyP3E) { $Xg23q[$gyP3E['name']] = isset($gyP3E['defaultValue']) ? $gyP3E['defaultValue'] : null; } goto vWY0I; F8_Uv: $Xg23q = array(); goto UVFjR; T7VD5: } public function iconServer($GyeYJ) { $this->addVariables(array('iconServer' => $GyeYJ)); return $this; } public function fields($wvO30) { goto tYMuj; tYMuj: $this->addVariables(array('fields' => $wvO30)); goto Ncfh7; IgBmS: return $this; goto EOzuE; Ncfh7: $this->addVariables(array('valueItem' => $this->getValueItem())); goto Hdm3m; Hdm3m: $FTa1c = array(); goto UGVEX; UGVEX: foreach ($wvO30 as $gyP3E) { goto Tfot3; sdnVo: $FTa1c[$gyP3E['name']] = true; goto Fyf0n; Tfot3: BizException::throwsIf('ComplexFieldsList.字段名重复 - ' . $gyP3E['name'], isset($FTa1c[$gyP3E['name']])); goto sdnVo; Fyf0n: if ($gyP3E['type'] == 'icon') { $this->addVariables(array('hasIcon' => true)); } goto CDAo_; CDAo_: } goto IgBmS; EOzuE: } public function unserializeValue($wvO30, AbstractField $Lgjfa) { goto xTvQb; p7CB7: if (empty($wvO30)) { $wvO30 = array(); } goto YIPAp; YIPAp: return $wvO30; goto d8u4x; xTvQb: $wvO30 = @json_decode($wvO30, true); goto p7CB7; d8u4x: } public function serializeValue($wvO30, $w5oww) { return json_encode($wvO30, JSON_UNESCAPED_UNICODE); } public function prepareInput($wvO30, $w5oww) { goto aTaL3; h3jL0: if (empty($wvO30)) { $wvO30 = array(); } goto UkCso; UkCso: return $wvO30; goto l6okT; aTaL3: $wvO30 = @json_decode($wvO30, true); goto h3jL0; l6okT: } }