1 | <?php |
||
9 | class FormInstanceViewer extends InstanceViewer { |
||
10 | protected $separators; |
||
11 | |||
12 | public function __construct($identifier,$instance=NULL, $captions=NULL) { |
||
13 | parent::__construct($identifier,$instance=NULL, $captions=NULL); |
||
14 | $this->separators=[-1]; |
||
15 | $this->defaultValueFunction=function($name,$value,$index){ |
||
16 | $caption=$this->getCaption($index); |
||
17 | $input=new HtmlFormInput($this->widgetIdentifier."-".$name,$caption,"text",$value); |
||
18 | $input->setName($name); |
||
19 | return $input; |
||
20 | }; |
||
21 | } |
||
22 | |||
23 | protected function _beforeAddProperty($index,&$field){ |
||
24 | if(JString::endswith($field, "\n")===true){ |
||
25 | $this->addSeparatorAfter($index); |
||
26 | } |
||
27 | if($index>1 && JString::startswith($field, "\n")===true){ |
||
28 | $this->addSeparatorAfter($index-1); |
||
29 | } |
||
30 | $field=\str_replace("\n", "", $field); |
||
31 | } |
||
32 | |||
33 | public function getFieldName($index){ |
||
34 | $property=$this->getProperty($index); |
||
35 | if($property instanceof \ReflectionProperty){ |
||
36 | $result=$property->getName(); |
||
37 | }elseif(\is_callable($property)){ |
||
38 | $result=$this->visibleProperties[$index]; |
||
39 | }else{ |
||
40 | $result=$property; |
||
41 | } |
||
42 | return $result; |
||
43 | } |
||
44 | |||
45 | public function addSeparatorAfter($fieldNum){ |
||
50 | |||
51 | public function getSeparators() { |
||
54 | |||
55 | public function setSeparators($separators) { |
||
59 | |||
60 | } |