<?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'), 'iconGroups' => array('iconfont', 'font-awesome'), 'linkServer' => modstart_admin_url('widget/link_select'), '_hasIcon' => false)); } private function getValueItem() { goto uA4vl; C19yv: return $tFr5n; goto D2HbC; mPtkI: $tFr5n = array(); goto HHQXc; l7tUw: if (empty($tFr5n)) { $tFr5n = new \stdClass(); } goto C19yv; HHQXc: foreach ($Q1VPT as $NYTLP) { $tFr5n[$NYTLP['name']] = isset($NYTLP['defaultValue']) ? $NYTLP['defaultValue'] : null; } goto l7tUw; uA4vl: $Q1VPT = $this->getVariable('fields'); goto mPtkI; D2HbC: } public function iconServer($RlLfN) { $this->addVariables(array('iconServer' => $RlLfN)); return $this; } public function iconGroups($s309P) { $this->addVariables(array('iconGroups' => $s309P)); return $this; } public function linkServer($RlLfN) { $this->addVariables(array('linkServer' => $RlLfN)); return $this; } public function fields($cBDsM) { goto pM5Is; pM5Is: $this->addVariables(array('fields' => $cBDsM)); goto zziDA; anZq_: $ST0Uu = array(); goto Iwosk; Iwosk: foreach ($cBDsM as $NYTLP) { goto s6X9H; q8TPt: if ($NYTLP['type'] == 'icon') { $this->addVariables(array('_hasIcon' => true)); } goto hu9Gw; o3Ao6: $ST0Uu[$NYTLP['name']] = true; goto q8TPt; s6X9H: BizException::throwsIf('ComplexFieldsList.字段名重复 - ' . $NYTLP['name'], isset($ST0Uu[$NYTLP['name']])); goto o3Ao6; hu9Gw: } goto It8Qu; It8Qu: return $this; goto CkfiV; zziDA: $this->addVariables(array('valueItem' => $this->getValueItem())); goto anZq_; CkfiV: } public function unserializeValue($cBDsM, AbstractField $Ldet7) { goto AcJjH; AcJjH: $cBDsM = @json_decode($cBDsM, true); goto r1Cl1; r1Cl1: if (empty($cBDsM)) { $cBDsM = array(); } goto mgnsS; mgnsS: return $cBDsM; goto Q36Tr; Q36Tr: } public function serializeValue($cBDsM, $GMqtO) { return SerializeUtil::jsonEncode($cBDsM); } public function prepareInput($cBDsM, $GMqtO) { goto cjtsM; NoagK: if (empty($cBDsM)) { $cBDsM = array(); } goto KZAxE; KZAxE: return $cBDsM; goto F3Ylm; cjtsM: $cBDsM = @json_decode($cBDsM, true); goto NoagK; F3Ylm: } }