<?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 a86Qx; Oq4Dq: if (empty($SLn59)) { $SLn59 = new \stdClass(); } goto O1n_F; iJphS: foreach ($Bhd90 as $Qf9vs) { $SLn59[$Qf9vs['name']] = isset($Qf9vs['defaultValue']) ? $Qf9vs['defaultValue'] : null; } goto Oq4Dq; O1n_F: return $SLn59; goto tdN61; a86Qx: $Bhd90 = $this->getVariable('fields'); goto JYoIo; JYoIo: $SLn59 = array(); goto iJphS; tdN61: } public function iconServer($Tkur1) { $this->addVariables(array('iconServer' => $Tkur1)); return $this; } public function fields($Mczr_) { goto sPRK7; sPRK7: $this->addVariables(array('fields' => $Mczr_)); goto Arfc6; h79qC: return $this; goto GdfV1; f25Vy: foreach ($Mczr_ as $Qf9vs) { goto U4Qtf; Rll6X: $d2Lez[$Qf9vs['name']] = true; goto Mi1sV; Mi1sV: if ($Qf9vs['type'] == 'icon') { $this->addVariables(array('hasIcon' => true)); } goto Tr3ji; U4Qtf: BizException::throwsIf('ComplexFieldsList.字段名重复 - ' . $Qf9vs['name'], isset($d2Lez[$Qf9vs['name']])); goto Rll6X; Tr3ji: } goto h79qC; lq807: $d2Lez = array(); goto f25Vy; Arfc6: $this->addVariables(array('valueItem' => $this->getValueItem())); goto lq807; GdfV1: } public function unserializeValue($Mczr_, AbstractField $rZfgs) { goto QjhNs; WGTIC: if (empty($Mczr_)) { $Mczr_ = array(); } goto S2_sF; S2_sF: return $Mczr_; goto N_O_V; QjhNs: $Mczr_ = @json_decode($Mczr_, true); goto WGTIC; N_O_V: } public function serializeValue($Mczr_, $vn_cr) { return SerializeUtil::jsonEncode($Mczr_); } public function prepareInput($Mczr_, $vn_cr) { goto K34mD; K34mD: $Mczr_ = @json_decode($Mczr_, true); goto frmxJ; engjI: return $Mczr_; goto p7OnH; frmxJ: if (empty($Mczr_)) { $Mczr_ = array(); } goto engjI; p7OnH: } }