@@ -1,39 +1,39 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace Ajax\php\ci; |
3 | 3 | |
4 | -class JsUtils extends \Ajax\JsUtils{ |
|
4 | +class JsUtils extends \Ajax\JsUtils { |
|
5 | 5 | protected $ci; |
6 | - protected $_my_controller_paths= array(); |
|
7 | - protected $_my_controllers= array(); |
|
6 | + protected $_my_controller_paths=array(); |
|
7 | + protected $_my_controllers=array(); |
|
8 | 8 | |
9 | - public function __construct($params=array(),$injected=NULL){ |
|
10 | - parent::__construct($params,$injected); |
|
11 | - $this->_my_controller_paths = array(APPPATH); |
|
9 | + public function __construct($params=array(), $injected=NULL) { |
|
10 | + parent::__construct($params, $injected); |
|
11 | + $this->_my_controller_paths=array(APPPATH); |
|
12 | 12 | } |
13 | - public function getUrl($url){ |
|
13 | + public function getUrl($url) { |
|
14 | 14 | return site_url($url); |
15 | 15 | } |
16 | 16 | |
17 | - public function getCi(){ |
|
18 | - if(isset($this->ci)===false){ |
|
19 | - $this->ci =& get_instance(); |
|
17 | + public function getCi() { |
|
18 | + if (isset($this->ci)===false) { |
|
19 | + $this->ci=& get_instance(); |
|
20 | 20 | $this->ci->load->helper('url'); |
21 | 21 | } |
22 | 22 | return $this->ci; |
23 | 23 | } |
24 | 24 | |
25 | - public function addViewElement($identifier,$content,&$view){ |
|
26 | - if(\array_key_exists("q", $view)===false){ |
|
25 | + public function addViewElement($identifier, $content, &$view) { |
|
26 | + if (\array_key_exists("q", $view)===false) { |
|
27 | 27 | $view["q"]=array(); |
28 | 28 | } |
29 | 29 | $view["q"][$identifier]=$content; |
30 | 30 | } |
31 | 31 | |
32 | - public function createScriptVariable(&$view,$view_var, $output){ |
|
32 | + public function createScriptVariable(&$view, $view_var, $output) { |
|
33 | 33 | $view[$view_var]=$output; |
34 | 34 | } |
35 | 35 | |
36 | - public function forward($initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
36 | + public function forward($initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
37 | 37 | $ci=$this->getCi(); |
38 | 38 | $controllerName=strtolower($controllerName); |
39 | 39 | $this->controller($controllerName); |
@@ -44,64 +44,64 @@ discard block |
||
44 | 44 | return $result; |
45 | 45 | } |
46 | 46 | |
47 | - public function renderContent($initialControllerInstance,$viewName, $params=NULL) { |
|
47 | + public function renderContent($initialControllerInstance, $viewName, $params=NULL) { |
|
48 | 48 | return $initialControllerInstance->load->view($viewName, $params, true); |
49 | 49 | } |
50 | 50 | |
51 | - public function fromDispatcher($dispatcher){ |
|
51 | + public function fromDispatcher($dispatcher) { |
|
52 | 52 | return array_values($dispatcher->uri->segment_array()); |
53 | 53 | } |
54 | 54 | |
55 | - public function controller($controller, $name = '', $db_conn = FALSE){ |
|
56 | - if (\is_array($controller)){ |
|
57 | - foreach ($controller as $babe){ |
|
55 | + public function controller($controller, $name='', $db_conn=FALSE) { |
|
56 | + if (\is_array($controller)) { |
|
57 | + foreach ($controller as $babe) { |
|
58 | 58 | $this->controller($babe); |
59 | 59 | } |
60 | 60 | return; |
61 | 61 | } |
62 | - if ($controller == ''){ |
|
62 | + if ($controller=='') { |
|
63 | 63 | return; |
64 | 64 | } |
65 | - $path = ''; |
|
65 | + $path=''; |
|
66 | 66 | // Is the controller in a sub-folder? If so, parse out the filename and path. |
67 | - if (($last_slash = strrpos($controller, '/')) !== FALSE){ |
|
67 | + if (($last_slash=strrpos($controller, '/'))!==FALSE) { |
|
68 | 68 | // The path is in front of the last slash |
69 | - $path = substr($controller, 0, $last_slash + 1); |
|
69 | + $path=substr($controller, 0, $last_slash+1); |
|
70 | 70 | // And the controller name behind it |
71 | - $controller = substr($controller, $last_slash + 1); |
|
71 | + $controller=substr($controller, $last_slash+1); |
|
72 | 72 | } |
73 | 73 | |
74 | - if ($name == ''){ |
|
75 | - $name = $controller; |
|
74 | + if ($name=='') { |
|
75 | + $name=$controller; |
|
76 | 76 | } |
77 | 77 | |
78 | - if (in_array($name, $this->_my_controllers, TRUE)){ |
|
78 | + if (in_array($name, $this->_my_controllers, TRUE)) { |
|
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
82 | - $CI =$this->getCi(); |
|
83 | - if (isset($CI->$name)){ |
|
82 | + $CI=$this->getCi(); |
|
83 | + if (isset($CI->$name)) { |
|
84 | 84 | show_error('The controller name you are loading is the name of a resource that is already being used: '.$name); |
85 | 85 | } |
86 | - $controller = strtolower($controller); |
|
87 | - foreach ($this->_my_controller_paths as $mod_path){ |
|
88 | - if ( ! file_exists($mod_path.'controllers/'.$path.$controller.'.php')){ |
|
86 | + $controller=strtolower($controller); |
|
87 | + foreach ($this->_my_controller_paths as $mod_path) { |
|
88 | + if (!file_exists($mod_path.'controllers/'.$path.$controller.'.php')) { |
|
89 | 89 | continue; |
90 | 90 | } |
91 | - if ($db_conn !== FALSE && ! class_exists('CI_DB')){ |
|
92 | - if ($db_conn === TRUE){ |
|
93 | - $db_conn = ''; |
|
91 | + if ($db_conn!==FALSE && !class_exists('CI_DB')) { |
|
92 | + if ($db_conn===TRUE) { |
|
93 | + $db_conn=''; |
|
94 | 94 | } |
95 | 95 | $CI->load->database($db_conn, FALSE, TRUE); |
96 | 96 | } |
97 | - if ( ! class_exists('CI_Controller')){ |
|
97 | + if (!class_exists('CI_Controller')) { |
|
98 | 98 | load_class('Controller', 'core'); |
99 | 99 | } |
100 | 100 | require_once($mod_path.'controllers/'.$path.$controller.'.php'); |
101 | - $controller = ucfirst($controller); |
|
102 | - $CI->$name = new $controller(); |
|
101 | + $controller=ucfirst($controller); |
|
102 | + $CI->$name=new $controller(); |
|
103 | 103 | |
104 | - $this->_my_controllers[] = $name; |
|
104 | + $this->_my_controllers[]=$name; |
|
105 | 105 | return; |
106 | 106 | } |
107 | 107 | show_error('Unable to locate the controller you have specified: '.$controller); |
@@ -12,19 +12,19 @@ discard block |
||
12 | 12 | * @property boolean $_visibleHover |
13 | 13 | * @property InstanceViewer $_instanceViewer |
14 | 14 | */ |
15 | -trait DataTableFieldAsTrait{ |
|
15 | +trait DataTableFieldAsTrait { |
|
16 | 16 | abstract public function addField($field); |
17 | - abstract public function insertField($index,$field); |
|
18 | - abstract public function insertInField($index,$field); |
|
19 | - abstract public function fieldAs($index,$type,$attributes=NULL); |
|
17 | + abstract public function insertField($index, $field); |
|
18 | + abstract public function insertInField($index, $field); |
|
19 | + abstract public function fieldAs($index, $type, $attributes=NULL); |
|
20 | 20 | /** |
21 | 21 | * @param string $caption |
22 | 22 | * @param callable $callback |
23 | 23 | * @param boolean $visibleHover |
24 | 24 | * @return callable |
25 | 25 | */ |
26 | - private function getFieldButtonCallable($caption,$visibleHover=true,$callback=null){ |
|
27 | - return $this->getCallable("getFieldButton",[$caption,$visibleHover],$callback); |
|
26 | + private function getFieldButtonCallable($caption, $visibleHover=true, $callback=null) { |
|
27 | + return $this->getCallable("getFieldButton", [$caption, $visibleHover], $callback); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | * @param callable $callback |
34 | 34 | * @return callable |
35 | 35 | */ |
36 | - private function getCallable($thisCallback,$parameters,$callback=null){ |
|
37 | - $result=function($instance) use($thisCallback,$parameters,$callback){ |
|
38 | - $object=call_user_func_array(array($this,$thisCallback), $parameters); |
|
39 | - if(isset($callback)){ |
|
40 | - if(\is_callable($callback)){ |
|
41 | - $callback($object,$instance); |
|
36 | + private function getCallable($thisCallback, $parameters, $callback=null) { |
|
37 | + $result=function($instance) use($thisCallback, $parameters, $callback){ |
|
38 | + $object=call_user_func_array(array($this, $thisCallback), $parameters); |
|
39 | + if (isset($callback)) { |
|
40 | + if (\is_callable($callback)) { |
|
41 | + $callback($object, $instance); |
|
42 | 42 | } |
43 | 43 | } |
44 | - if($object instanceof HtmlSemDoubleElement){ |
|
45 | - $object->setProperty("data-ajax",$this->_instanceViewer->getIdentifier()); |
|
46 | - if($object->propertyContains("class","visibleover")){ |
|
44 | + if ($object instanceof HtmlSemDoubleElement) { |
|
45 | + $object->setProperty("data-ajax", $this->_instanceViewer->getIdentifier()); |
|
46 | + if ($object->propertyContains("class", "visibleover")) { |
|
47 | 47 | $this->_visibleHover=true; |
48 | - $object->setProperty("style","visibility:hidden;"); |
|
48 | + $object->setProperty("style", "visibility:hidden;"); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | return $object; |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | * @param string $caption |
58 | 58 | * @return HtmlButton |
59 | 59 | */ |
60 | - private function getFieldButton($caption,$visibleHover=true){ |
|
61 | - $bt= new HtmlButton("",$caption); |
|
62 | - if($visibleHover) |
|
60 | + private function getFieldButton($caption, $visibleHover=true) { |
|
61 | + $bt=new HtmlButton("", $caption); |
|
62 | + if ($visibleHover) |
|
63 | 63 | $this->_visibleOver($bt); |
64 | 64 | return $bt; |
65 | 65 | } |
@@ -73,19 +73,19 @@ discard block |
||
73 | 73 | * @param array $attributes associative array (<b>ajax</b> key is for ajax post) |
74 | 74 | * @return \Ajax\semantic\widgets\datatable\DataTable |
75 | 75 | */ |
76 | - public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){ |
|
77 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index,$attributes){ |
|
78 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
79 | - $button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]); |
|
80 | - if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
|
76 | + public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) { |
|
77 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $index, $attributes){ |
|
78 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
79 | + $button->postOnClick($url, "$(event.target).closest('tr').find(':input').serialize()", $responseElement, $attributes["ajax"]); |
|
80 | + if (!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
|
81 | 81 | $this->_visibleOver($button); |
82 | 82 | return $button; |
83 | - }, $index,$attributes); |
|
83 | + }, $index, $attributes); |
|
84 | 84 | } |
85 | 85 | |
86 | - protected function _visibleOver($element){ |
|
86 | + protected function _visibleOver($element) { |
|
87 | 87 | $this->_visibleHover=true; |
88 | - return $element->addToProperty("class", "visibleover")->setProperty("style","visibility:hidden;"); |
|
88 | + return $element->addToProperty("class", "visibleover")->setProperty("style", "visibility:hidden;"); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | * @param boolean $visibleHover |
96 | 96 | * @return \Ajax\semantic\widgets\datatable\DataTable |
97 | 97 | */ |
98 | - public function addFieldButton($caption,$visibleHover=true,$callback=null){ |
|
99 | - $this->addField($this->getCallable("getFieldButton",[$caption,$visibleHover],$callback)); |
|
98 | + public function addFieldButton($caption, $visibleHover=true, $callback=null) { |
|
99 | + $this->addField($this->getCallable("getFieldButton", [$caption, $visibleHover], $callback)); |
|
100 | 100 | return $this; |
101 | 101 | } |
102 | 102 | |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | * @param callable $callback |
108 | 108 | * @return \Ajax\semantic\widgets\datatable\DataTable |
109 | 109 | */ |
110 | - public function insertFieldButton($index,$caption,$visibleHover=true,$callback=null){ |
|
111 | - $this->insertField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback)); |
|
110 | + public function insertFieldButton($index, $caption, $visibleHover=true, $callback=null) { |
|
111 | + $this->insertField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback)); |
|
112 | 112 | return $this; |
113 | 113 | } |
114 | 114 | |
@@ -119,25 +119,25 @@ discard block |
||
119 | 119 | * @param callable $callback |
120 | 120 | * @return \Ajax\semantic\widgets\datatable\DataTable |
121 | 121 | */ |
122 | - public function insertInFieldButton($index,$caption,$visibleHover=true,$callback=null){ |
|
123 | - $this->insertInField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback)); |
|
122 | + public function insertInFieldButton($index, $caption, $visibleHover=true, $callback=null) { |
|
123 | + $this->insertInField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback)); |
|
124 | 124 | return $this; |
125 | 125 | } |
126 | 126 | |
127 | - private function addDefaultButton($icon,$class=null,$visibleHover=true,$callback=null){ |
|
128 | - $this->addField($this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback)); |
|
127 | + private function addDefaultButton($icon, $class=null, $visibleHover=true, $callback=null) { |
|
128 | + $this->addField($this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback)); |
|
129 | 129 | return $this; |
130 | 130 | } |
131 | 131 | |
132 | - private function insertDefaultButtonIn($index,$icon,$class=null,$visibleHover=true,$callback=null){ |
|
133 | - $this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback)); |
|
132 | + private function insertDefaultButtonIn($index, $icon, $class=null, $visibleHover=true, $callback=null) { |
|
133 | + $this->insertInField($index, $this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback)); |
|
134 | 134 | return $this; |
135 | 135 | } |
136 | 136 | |
137 | - private function getDefaultButton($icon,$class=null,$visibleHover=true){ |
|
138 | - $bt=$this->getFieldButton("",$visibleHover); |
|
137 | + private function getDefaultButton($icon, $class=null, $visibleHover=true) { |
|
138 | + $bt=$this->getFieldButton("", $visibleHover); |
|
139 | 139 | $bt->asIcon($icon); |
140 | - if(isset($class)) |
|
140 | + if (isset($class)) |
|
141 | 141 | $bt->addClass($class); |
142 | 142 | return $bt; |
143 | 143 | } |
@@ -148,30 +148,30 @@ discard block |
||
148 | 148 | * @param callable $callback |
149 | 149 | * @return DataTable |
150 | 150 | */ |
151 | - public function addDeleteButton($visibleHover=true,$deleteBehavior=[],$callback=null){ |
|
151 | + public function addDeleteButton($visibleHover=true, $deleteBehavior=[], $callback=null) { |
|
152 | 152 | $this->_deleteBehavior=$deleteBehavior; |
153 | - return $this->addDefaultButton("remove","_delete red basic",$visibleHover,$callback); |
|
153 | + return $this->addDefaultButton("remove", "_delete red basic", $visibleHover, $callback); |
|
154 | 154 | } |
155 | 155 | |
156 | - public function addEditButton($visibleHover=true,$editBehavior=[],$callback=null){ |
|
156 | + public function addEditButton($visibleHover=true, $editBehavior=[], $callback=null) { |
|
157 | 157 | $this->_editBehavior=$editBehavior; |
158 | - return $this->addDefaultButton("edit","_edit basic",$visibleHover,$callback); |
|
158 | + return $this->addDefaultButton("edit", "_edit basic", $visibleHover, $callback); |
|
159 | 159 | } |
160 | 160 | |
161 | - public function addEditDeleteButtons($visibleHover=true,$behavior=[],$callbackEdit=null,$callbackDelete=null){ |
|
162 | - $this->addEditButton($visibleHover,$behavior,$callbackEdit); |
|
161 | + public function addEditDeleteButtons($visibleHover=true, $behavior=[], $callbackEdit=null, $callbackDelete=null) { |
|
162 | + $this->addEditButton($visibleHover, $behavior, $callbackEdit); |
|
163 | 163 | $index=$this->_instanceViewer->visiblePropertiesCount()-1; |
164 | - $this->insertDeleteButtonIn($index,$visibleHover,$behavior,$callbackDelete); |
|
164 | + $this->insertDeleteButtonIn($index, $visibleHover, $behavior, $callbackDelete); |
|
165 | 165 | return $this; |
166 | 166 | } |
167 | 167 | |
168 | - public function insertDeleteButtonIn($index,$visibleHover=true,$deleteBehavior=[],$callback=null){ |
|
168 | + public function insertDeleteButtonIn($index, $visibleHover=true, $deleteBehavior=[], $callback=null) { |
|
169 | 169 | $this->_deleteBehavior=$deleteBehavior; |
170 | - return $this->insertDefaultButtonIn($index,"remove","_delete red basic",$visibleHover,$callback); |
|
170 | + return $this->insertDefaultButtonIn($index, "remove", "_delete red basic", $visibleHover, $callback); |
|
171 | 171 | } |
172 | 172 | |
173 | - public function insertEditButtonIn($index,$visibleHover=true,$editBehavior=[],$callback=null){ |
|
173 | + public function insertEditButtonIn($index, $visibleHover=true, $editBehavior=[], $callback=null) { |
|
174 | 174 | $this->_editBehavior=$editBehavior; |
175 | - return $this->insertDefaultButtonIn($index,"edit","_edit basic",$visibleHover,$callback); |
|
175 | + return $this->insertDefaultButtonIn($index, "edit", "_edit basic", $visibleHover, $callback); |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | \ No newline at end of file |
@@ -16,24 +16,24 @@ discard block |
||
16 | 16 | |
17 | 17 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
18 | 18 | parent::__construct($identifier, "div", "ui buttons"); |
19 | - if ($asIcons === true) |
|
19 | + if ($asIcons===true) |
|
20 | 20 | $this->asIcons(); |
21 | 21 | $this->addElements($elements, $asIcons); |
22 | 22 | } |
23 | - protected function createItem($value){ |
|
23 | + protected function createItem($value) { |
|
24 | 24 | return new HtmlButton("", $value); |
25 | 25 | } |
26 | 26 | |
27 | 27 | |
28 | 28 | public function addElement($element, $asIcon=false) { |
29 | 29 | $item=$this->addItem($element); |
30 | - if($asIcon) |
|
30 | + if ($asIcon) |
|
31 | 31 | $item->asIcon($element); |
32 | 32 | return $item; |
33 | 33 | } |
34 | 34 | |
35 | 35 | public function addElements($elements, $asIcons=false) { |
36 | - foreach ( $elements as $element ) { |
|
36 | + foreach ($elements as $element) { |
|
37 | 37 | $this->addElement($element, $asIcons); |
38 | 38 | } |
39 | 39 | return $this; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function insertOr($aferIndex=0, $or="or") { |
43 | 43 | $orElement=new HtmlSemDoubleElement("", "div", "or"); |
44 | 44 | $orElement->setProperty("data-text", $or); |
45 | - array_splice($this->content, $aferIndex + 1, 0, array ($orElement )); |
|
45 | + array_splice($this->content, $aferIndex+1, 0, array($orElement)); |
|
46 | 46 | return $this; |
47 | 47 | } |
48 | 48 | |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | public function asIcons() { |
58 | - foreach ( $this->content as $item ) { |
|
59 | - if($item instanceof HtmlButton) |
|
58 | + foreach ($this->content as $item) { |
|
59 | + if ($item instanceof HtmlButton) |
|
60 | 60 | $item->asIcon($item->getContent()); |
61 | 61 | } |
62 | 62 | return $this->addToProperty("class", "icons"); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
90 | 90 | */ |
91 | 91 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
92 | - foreach ( $this->content as $element ) { |
|
92 | + foreach ($this->content as $element) { |
|
93 | 93 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
94 | 94 | } |
95 | 95 | return $this; |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | |
102 | 102 | public function addClasses($classes=array()) { |
103 | 103 | $i=0; |
104 | - if(!\is_array($classes)){ |
|
105 | - $classes=array_fill (0,$this->count(),$classes); |
|
104 | + if (!\is_array($classes)) { |
|
105 | + $classes=array_fill(0, $this->count(), $classes); |
|
106 | 106 | } |
107 | - foreach ( $this->content as $button ) { |
|
107 | + foreach ($this->content as $button) { |
|
108 | 108 | $button->addToProperty("class", $classes[$i++]); |
109 | 109 | } |
110 | 110 | return $this; |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | $this->addElement($function($object)); |
119 | 119 | } |
120 | 120 | |
121 | - public function run(JsUtils $js){ |
|
122 | - $result= parent::run($js); |
|
121 | + public function run(JsUtils $js) { |
|
122 | + $result=parent::run($js); |
|
123 | 123 | return $result->setItemSelector(".ui.button"); |
124 | 124 | } |
125 | 125 | } |
126 | 126 | \ No newline at end of file |
@@ -14,44 +14,44 @@ discard block |
||
14 | 14 | */ |
15 | 15 | abstract class HtmlCollection extends HtmlDoubleElement { |
16 | 16 | |
17 | - public function __construct($identifier,$tagName="div"){ |
|
18 | - parent::__construct($identifier,$tagName); |
|
17 | + public function __construct($identifier, $tagName="div") { |
|
18 | + parent::__construct($identifier, $tagName); |
|
19 | 19 | $this->content=array(); |
20 | 20 | } |
21 | 21 | |
22 | - public function addItems($items){ |
|
23 | - if(JArray::isAssociative($items)){ |
|
24 | - foreach ($items as $k=>$v){ |
|
25 | - $this->addItem([$k,$v]); |
|
22 | + public function addItems($items) { |
|
23 | + if (JArray::isAssociative($items)) { |
|
24 | + foreach ($items as $k=>$v) { |
|
25 | + $this->addItem([$k, $v]); |
|
26 | 26 | } |
27 | - }else{ |
|
28 | - foreach ($items as $item){ |
|
27 | + } else { |
|
28 | + foreach ($items as $item) { |
|
29 | 29 | $this->addItem($item); |
30 | 30 | } |
31 | 31 | } |
32 | 32 | return $this; |
33 | 33 | } |
34 | 34 | |
35 | - public function setItems($items){ |
|
35 | + public function setItems($items) { |
|
36 | 36 | $this->content=$items; |
37 | 37 | return $this; |
38 | 38 | } |
39 | 39 | |
40 | - public function getItems(){ |
|
40 | + public function getItems() { |
|
41 | 41 | return $this->content; |
42 | 42 | } |
43 | 43 | |
44 | - protected function getItemToAdd($item){ |
|
44 | + protected function getItemToAdd($item) { |
|
45 | 45 | $itemO=$item; |
46 | - if($this->createCondition($item)===true){ |
|
46 | + if ($this->createCondition($item)===true) { |
|
47 | 47 | $itemO=$this->createItem($item); |
48 | 48 | } |
49 | 49 | return $itemO; |
50 | 50 | } |
51 | 51 | |
52 | - protected function setItemIdentifier($item,$classname,$index){ |
|
53 | - if($item instanceof BaseWidget){ |
|
54 | - if($item->getIdentifier()===""){ |
|
52 | + protected function setItemIdentifier($item, $classname, $index) { |
|
53 | + if ($item instanceof BaseWidget) { |
|
54 | + if ($item->getIdentifier()==="") { |
|
55 | 55 | $item->setIdentifier($classname."-".$this->identifier."-".$index); |
56 | 56 | } |
57 | 57 | } |
@@ -62,15 +62,15 @@ discard block |
||
62 | 62 | * @param HtmlDoubleElement|string|array $item |
63 | 63 | * @return \Ajax\common\html\HtmlDoubleElement |
64 | 64 | */ |
65 | - public function addItem($item){ |
|
65 | + public function addItem($item) { |
|
66 | 66 | $itemO=$this->getItemToAdd($item); |
67 | 67 | $this->addContent($itemO); |
68 | 68 | return $itemO; |
69 | 69 | } |
70 | 70 | |
71 | - public function insertItem($item,$position=0){ |
|
71 | + public function insertItem($item, $position=0) { |
|
72 | 72 | $itemO=$this->getItemToAdd($item); |
73 | - \array_splice( $this->content, $position, 0, array($itemO)); |
|
73 | + \array_splice($this->content, $position, 0, array($itemO)); |
|
74 | 74 | return $itemO; |
75 | 75 | } |
76 | 76 | |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | return $this; |
94 | 94 | } |
95 | 95 | |
96 | - public function removeItem($index){ |
|
96 | + public function removeItem($index) { |
|
97 | 97 | return array_splice($this->content, $index, 1); |
98 | 98 | } |
99 | 99 | |
100 | - public function count(){ |
|
100 | + public function count() { |
|
101 | 101 | return \sizeof($this->content); |
102 | 102 | } |
103 | 103 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | return $this->addItem($function($object)); |
109 | 109 | } |
110 | 110 | |
111 | - public function apply($callBack){ |
|
112 | - foreach ($this->content as $item){ |
|
111 | + public function apply($callBack) { |
|
112 | + foreach ($this->content as $item) { |
|
113 | 113 | $callBack($item); |
114 | 114 | } |
115 | 115 | return $this; |
@@ -129,40 +129,40 @@ discard block |
||
129 | 129 | */ |
130 | 130 | abstract protected function createItem($value); |
131 | 131 | |
132 | - protected function createCondition($value){ |
|
132 | + protected function createCondition($value) { |
|
133 | 133 | return \is_object($value)===false; |
134 | 134 | } |
135 | 135 | |
136 | - protected function contentAs($tagName){ |
|
137 | - foreach ($this->content as $item){ |
|
136 | + protected function contentAs($tagName) { |
|
137 | + foreach ($this->content as $item) { |
|
138 | 138 | $item->setTagName($tagName); |
139 | 139 | } |
140 | 140 | return $this; |
141 | 141 | } |
142 | 142 | |
143 | - public function setProperties($properties){ |
|
143 | + public function setProperties($properties) { |
|
144 | 144 | $i=0; |
145 | - foreach ($properties as $k=>$v){ |
|
145 | + foreach ($properties as $k=>$v) { |
|
146 | 146 | $c=$this->content[$i++]; |
147 | - if(isset($c)) |
|
148 | - $c->setProperty($k,$v); |
|
147 | + if (isset($c)) |
|
148 | + $c->setProperty($k, $v); |
|
149 | 149 | else |
150 | 150 | return $this; |
151 | 151 | } |
152 | 152 | return $this; |
153 | 153 | } |
154 | 154 | |
155 | - public function setPropertyValues($property,$values){ |
|
155 | + public function setPropertyValues($property, $values) { |
|
156 | 156 | $i=0; |
157 | - if(\is_array($values)===false){ |
|
158 | - $values=\array_fill(0, $this->count(),$values); |
|
157 | + if (\is_array($values)===false) { |
|
158 | + $values=\array_fill(0, $this->count(), $values); |
|
159 | 159 | } |
160 | - foreach ($values as $value){ |
|
160 | + foreach ($values as $value) { |
|
161 | 161 | $c=$this->content[$i++]; |
162 | - if(isset($c)){ |
|
163 | - $c->setProperty($property,$value); |
|
162 | + if (isset($c)) { |
|
163 | + $c->setProperty($property, $value); |
|
164 | 164 | } |
165 | - else{ |
|
165 | + else { |
|
166 | 166 | return $this; |
167 | 167 | } |
168 | 168 | } |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
173 | 173 | $index=0; |
174 | 174 | $classname=\strtolower(JReflection::shortClassName($this)); |
175 | - foreach ($this->content as $item){ |
|
176 | - $this->setItemIdentifier($item,$classname,$index++); |
|
175 | + foreach ($this->content as $item) { |
|
176 | + $this->setItemIdentifier($item, $classname, $index++); |
|
177 | 177 | } |
178 | - return parent::compile($js,$view); |
|
178 | + return parent::compile($js, $view); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | \ No newline at end of file |
@@ -10,17 +10,17 @@ discard block |
||
10 | 10 | * @author jc |
11 | 11 | * @property string identifier |
12 | 12 | */ |
13 | -trait HasCheckboxesTrait{ |
|
13 | +trait HasCheckboxesTrait { |
|
14 | 14 | protected $_hasCheckboxes; |
15 | 15 | protected $_hasCheckedMessage=false; |
16 | 16 | protected $_checkedMessage; |
17 | 17 | protected $_checkedClass; |
18 | 18 | |
19 | - abstract public function addInToolbar($element,$callback=NULL); |
|
19 | + abstract public function addInToolbar($element, $callback=NULL); |
|
20 | 20 | |
21 | - protected function _runCheckboxes(JsUtils $js){ |
|
21 | + protected function _runCheckboxes(JsUtils $js) { |
|
22 | 22 | $checkedMessageCall=""; |
23 | - if($this->_hasCheckedMessage){ |
|
23 | + if ($this->_hasCheckedMessage) { |
|
24 | 24 | $msg=$this->getCheckedMessage(); |
25 | 25 | $checkedMessageFunction="function updateChecked(){var msg='".$msg[0]."',count=\$('#{$this->identifier} [name=\"selection[]\"]:checked').length,all=\$('#{$this->identifier} [name=\"selection[]\"]').length; |
26 | 26 | if(count==1) msg='".$msg[1]."'; |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | \$('#checked-count-".$this->identifier."').contents().filter(function() {return this.nodeType == 3;}).each(function(){this.textContent = msg.replace('{count}',count);}); |
29 | 29 | \$('#toolbar-{$this->identifier} .visibleOnChecked').toggle(count>0);}\$('#toolbar-".$this->identifier." .visibleOnChecked').hide();"; |
30 | 30 | $checkedMessageCall="updateChecked();"; |
31 | - if(isset($this->_checkedClass)){ |
|
31 | + if (isset($this->_checkedClass)) { |
|
32 | 32 | $checkedMessageCall.="$(this).closest('tr').toggleClass('".$this->_checkedClass."',$(this).prop('checked'));"; |
33 | 33 | } |
34 | - $js->exec($checkedMessageFunction,true); |
|
34 | + $js->exec($checkedMessageFunction, true); |
|
35 | 35 | } |
36 | 36 | $js->execOn("change", "#".$this->identifier." [name='selection[]']", " |
37 | 37 | var \$parentCheckbox=\$('#ck-main-ck-{$this->identifier}'),\$checkbox=\$('#{$this->identifier} [name=\"selection[]\"]'),allChecked=true,allUnchecked=true; |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | if(allChecked) {\$parentCheckbox.checkbox('set checked');}else if(allUnchecked){\$parentCheckbox.checkbox('set unchecked');}else{\$parentCheckbox.checkbox('set indeterminate');};".$checkedMessageCall); |
40 | 40 | } |
41 | 41 | |
42 | - protected function _generateMainCheckbox(&$captions){ |
|
43 | - $ck=new HtmlCheckbox("main-ck-".$this->identifier,""); |
|
42 | + protected function _generateMainCheckbox(&$captions) { |
|
43 | + $ck=new HtmlCheckbox("main-ck-".$this->identifier, ""); |
|
44 | 44 | $checkedMessageCall=""; |
45 | - if($this->_hasCheckedMessage) |
|
45 | + if ($this->_hasCheckedMessage) |
|
46 | 46 | $checkedMessageCall="updateChecked();"; |
47 | 47 | |
48 | 48 | $ck->setOnChecked($this->_setAllChecked("true").$checkedMessageCall); |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | \array_unshift($captions, $ck); |
51 | 51 | } |
52 | 52 | |
53 | - protected function _setAllChecked($checked){ |
|
53 | + protected function _setAllChecked($checked) { |
|
54 | 54 | $result="$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',".$checked.");"; |
55 | - if(isset($this->_checkedClass)){ |
|
55 | + if (isset($this->_checkedClass)) { |
|
56 | 56 | $result.="$('#".$this->identifier." tr').toggleClass('".$this->_checkedClass."',".$checked.");"; |
57 | 57 | } |
58 | 58 | return $result; |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | protected function getCheckedMessage() { |
71 | - $result= $this->_checkedMessage; |
|
72 | - if(!isset($result)){ |
|
73 | - $result=[0=>"none selected",1=>"one item selected","other"=>"{count} items selected"]; |
|
71 | + $result=$this->_checkedMessage; |
|
72 | + if (!isset($result)) { |
|
73 | + $result=[0=>"none selected", 1=>"one item selected", "other"=>"{count} items selected"]; |
|
74 | 74 | } |
75 | 75 | return $result; |
76 | 76 | } |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | * @param array $checkedMessage |
91 | 91 | * @param callable $callback |
92 | 92 | */ |
93 | - public function addCountCheckedInToolbar(array $checkedMessage=null,$callback=null){ |
|
94 | - if(isset($checkedMessage)) |
|
93 | + public function addCountCheckedInToolbar(array $checkedMessage=null, $callback=null) { |
|
94 | + if (isset($checkedMessage)) |
|
95 | 95 | $this->_checkedMessage=$checkedMessage; |
96 | 96 | $checkedMessage=$this->getCheckedMessage(); |
97 | 97 | $this->_hasCheckboxes=true; |
98 | 98 | $this->_hasCheckedMessage=true; |
99 | - $element=new HtmlLabel("checked-count-".$this->identifier,$checkedMessage[0]); |
|
100 | - $this->addInToolbar($element,$callback); |
|
99 | + $element=new HtmlLabel("checked-count-".$this->identifier, $checkedMessage[0]); |
|
100 | + $this->addInToolbar($element, $callback); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | public function setCheckedClass($_checkedClass) { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | */ |
23 | 23 | class DataTable extends Widget { |
24 | - use TableTrait,DataTableFieldAsTrait,HasCheckboxesTrait; |
|
24 | + use TableTrait, DataTableFieldAsTrait, HasCheckboxesTrait; |
|
25 | 25 | protected $_searchField; |
26 | 26 | protected $_urls; |
27 | 27 | protected $_pagination; |
@@ -32,33 +32,33 @@ discard block |
||
32 | 32 | protected $_targetSelector; |
33 | 33 | |
34 | 34 | |
35 | - public function __construct($identifier,$model,$modelInstance=NULL) { |
|
36 | - parent::__construct($identifier, $model,$modelInstance); |
|
37 | - $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0,0), false); |
|
35 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
36 | + parent::__construct($identifier, $model, $modelInstance); |
|
37 | + $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false); |
|
38 | 38 | $this->_urls=[]; |
39 | 39 | } |
40 | 40 | |
41 | - public function run(JsUtils $js){ |
|
42 | - if($this->_hasCheckboxes && isset($js)){ |
|
41 | + public function run(JsUtils $js) { |
|
42 | + if ($this->_hasCheckboxes && isset($js)) { |
|
43 | 43 | $this->_runCheckboxes($js); |
44 | 44 | } |
45 | - if($this->_visibleHover){ |
|
46 | - $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]); |
|
47 | - $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]); |
|
45 | + if ($this->_visibleHover) { |
|
46 | + $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');", ["preventDefault"=>false, "stopPropagation"=>true]); |
|
47 | + $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');", ["preventDefault"=>false, "stopPropagation"=>true]); |
|
48 | 48 | } |
49 | - if(\is_array($this->_deleteBehavior)) |
|
50 | - $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
51 | - if(\is_array($this->_editBehavior)) |
|
52 | - $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
49 | + if (\is_array($this->_deleteBehavior)) |
|
50 | + $this->_generateBehavior("delete", $this->_deleteBehavior, $js); |
|
51 | + if (\is_array($this->_editBehavior)) |
|
52 | + $this->_generateBehavior("edit", $this->_editBehavior, $js); |
|
53 | 53 | return parent::run($js); |
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | 57 | |
58 | - protected function _generateBehavior($op,$params,JsUtils $js){ |
|
59 | - if(isset($this->_urls[$op])){ |
|
60 | - $params=\array_merge($params,["attr"=>"data-ajax"]); |
|
61 | - $js->getOnClick("#".$this->identifier." ._".$op, $this->_urls[$op],$this->getTargetSelector(),$params); |
|
58 | + protected function _generateBehavior($op, $params, JsUtils $js) { |
|
59 | + if (isset($this->_urls[$op])) { |
|
60 | + $params=\array_merge($params, ["attr"=>"data-ajax"]); |
|
61 | + $js->getOnClick("#".$this->identifier." ._".$op, $this->_urls[$op], $this->getTargetSelector(), $params); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -71,62 +71,62 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | |
74 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
75 | - if(!$this->_generated){ |
|
74 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
75 | + if (!$this->_generated) { |
|
76 | 76 | $this->_instanceViewer->setInstance($this->_model); |
77 | 77 | $captions=$this->_instanceViewer->getCaptions(); |
78 | 78 | |
79 | 79 | $table=$this->content["table"]; |
80 | 80 | |
81 | - if($this->_hasCheckboxes){ |
|
81 | + if ($this->_hasCheckboxes) { |
|
82 | 82 | $this->_generateMainCheckbox($captions); |
83 | 83 | } |
84 | 84 | |
85 | 85 | $table->setRowCount(0, \sizeof($captions)); |
86 | 86 | $table->setHeaderValues($captions); |
87 | - if(isset($this->_compileParts)) |
|
87 | + if (isset($this->_compileParts)) |
|
88 | 88 | $table->setCompileParts($this->_compileParts); |
89 | 89 | |
90 | - if(isset($this->_searchField) && isset($js)){ |
|
91 | - if(isset($this->_urls["refresh"])) |
|
92 | - $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
90 | + if (isset($this->_searchField) && isset($js)) { |
|
91 | + if (isset($this->_urls["refresh"])) |
|
92 | + $this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(this).val()}", "#".$this->identifier." tbody", ["preventDefault"=>false, "jqueryDone"=>"replaceWith"]); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | $this->_generateContent($table); |
96 | 96 | |
97 | - if($this->_hasCheckboxes && $table->hasPart("thead")){ |
|
97 | + if ($this->_hasCheckboxes && $table->hasPart("thead")) { |
|
98 | 98 | $table->getHeader()->getCell(0, 0)->addClass("no-sort"); |
99 | 99 | } |
100 | 100 | |
101 | - if(isset($this->_pagination) && $this->_pagination->getVisible()){ |
|
101 | + if (isset($this->_pagination) && $this->_pagination->getVisible()) { |
|
102 | 102 | $this->_generatePagination($table); |
103 | 103 | } |
104 | - if(isset($this->_toolbar)){ |
|
104 | + if (isset($this->_toolbar)) { |
|
105 | 105 | $this->_setToolbarPosition($table, $captions); |
106 | 106 | } |
107 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]); |
|
107 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]); |
|
108 | 108 | $this->_compileForm(); |
109 | 109 | $this->_generated=true; |
110 | 110 | } |
111 | - return parent::compile($js,$view); |
|
111 | + return parent::compile($js, $view); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
115 | 115 | |
116 | - protected function _generateContent($table){ |
|
116 | + protected function _generateContent($table) { |
|
117 | 117 | $objects=$this->_modelInstance; |
118 | - if(isset($this->_pagination)){ |
|
118 | + if (isset($this->_pagination)) { |
|
119 | 119 | $objects=$this->_pagination->getObjects($this->_modelInstance); |
120 | 120 | } |
121 | 121 | InstanceViewer::setIndex(0); |
122 | 122 | $table->fromDatabaseObjects($objects, function($instance) use($table){ |
123 | 123 | $this->_instanceViewer->setInstance($instance); |
124 | 124 | InstanceViewer::$index++; |
125 | - $values= $this->_instanceViewer->getValues(); |
|
126 | - if($this->_hasCheckboxes){ |
|
127 | - $ck=new HtmlCheckbox("ck-".$this->identifier,""); |
|
125 | + $values=$this->_instanceViewer->getValues(); |
|
126 | + if ($this->_hasCheckboxes) { |
|
127 | + $ck=new HtmlCheckbox("ck-".$this->identifier, ""); |
|
128 | 128 | $field=$ck->getField(); |
129 | - $field->setProperty("value",$this->_instanceViewer->getIdentifier()); |
|
129 | + $field->setProperty("value", $this->_instanceViewer->getIdentifier()); |
|
130 | 130 | $field->setProperty("name", "selection[]"); |
131 | 131 | \array_unshift($values, $ck); |
132 | 132 | } |
@@ -137,37 +137,37 @@ discard block |
||
137 | 137 | }); |
138 | 138 | } |
139 | 139 | |
140 | - private function _generatePagination($table){ |
|
140 | + private function _generatePagination($table) { |
|
141 | 141 | $footer=$table->getFooter(); |
142 | 142 | $footer->mergeCol(); |
143 | - $menu=new HtmlPaginationMenu("pagination-".$this->identifier,$this->_pagination->getPagesNumbers()); |
|
143 | + $menu=new HtmlPaginationMenu("pagination-".$this->identifier, $this->_pagination->getPagesNumbers()); |
|
144 | 144 | $menu->floatRight(); |
145 | 145 | $menu->setActiveItem($this->_pagination->getPage()-1); |
146 | 146 | $footer->setValues($menu); |
147 | - if(isset($this->_urls["refresh"])) |
|
148 | - $menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
147 | + if (isset($this->_urls["refresh"])) |
|
148 | + $menu->postOnClick($this->_urls["refresh"], "{'p':$(this).attr('data-page')}", "#".$this->identifier." tbody", ["preventDefault"=>false, "jqueryDone"=>"replaceWith"]); |
|
149 | 149 | } |
150 | 150 | |
151 | - protected function _getFieldName($index){ |
|
151 | + protected function _getFieldName($index) { |
|
152 | 152 | return parent::_getFieldName($index)."[]"; |
153 | 153 | } |
154 | 154 | |
155 | - protected function _getFieldCaption($index){ |
|
155 | + protected function _getFieldCaption($index) { |
|
156 | 156 | return null; |
157 | 157 | } |
158 | 158 | |
159 | - protected function _setToolbarPosition($table,$captions=NULL){ |
|
160 | - switch ($this->_toolbarPosition){ |
|
159 | + protected function _setToolbarPosition($table, $captions=NULL) { |
|
160 | + switch ($this->_toolbarPosition) { |
|
161 | 161 | case PositionInTable::BEFORETABLE: |
162 | 162 | case PositionInTable::AFTERTABLE: |
163 | - if(isset($this->_compileParts)===false){ |
|
163 | + if (isset($this->_compileParts)===false) { |
|
164 | 164 | $this->content[$this->_toolbarPosition]=$this->_toolbar; |
165 | 165 | } |
166 | 166 | break; |
167 | 167 | case PositionInTable::HEADER: |
168 | 168 | case PositionInTable::FOOTER: |
169 | 169 | case PositionInTable::BODY: |
170 | - $this->addToolbarRow($this->_toolbarPosition,$table, $captions); |
|
170 | + $this->addToolbarRow($this->_toolbarPosition, $table, $captions); |
|
171 | 171 | break; |
172 | 172 | } |
173 | 173 | } |
@@ -179,23 +179,23 @@ discard block |
||
179 | 179 | * @param callable $callback function called after the field compilation |
180 | 180 | * @return \Ajax\semantic\widgets\datatable\DataTable |
181 | 181 | */ |
182 | - public function afterCompile($index,$callback){ |
|
183 | - $this->_instanceViewer->afterCompile($index,$callback); |
|
182 | + public function afterCompile($index, $callback) { |
|
183 | + $this->_instanceViewer->afterCompile($index, $callback); |
|
184 | 184 | return $this; |
185 | 185 | } |
186 | 186 | |
187 | - private function addToolbarRow($part,$table,$captions){ |
|
187 | + private function addToolbarRow($part, $table, $captions) { |
|
188 | 188 | $hasPart=$table->hasPart($part); |
189 | - if($hasPart){ |
|
189 | + if ($hasPart) { |
|
190 | 190 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
191 | - }else{ |
|
191 | + } else { |
|
192 | 192 | $row=$table->getPart($part)->getRow(0); |
193 | 193 | } |
194 | 194 | $row->mergeCol(); |
195 | 195 | $row->setValues([$this->_toolbar]); |
196 | 196 | } |
197 | 197 | |
198 | - public function getHtmlComponent(){ |
|
198 | + public function getHtmlComponent() { |
|
199 | 199 | return $this->content["table"]; |
200 | 200 | } |
201 | 201 | |
@@ -209,36 +209,36 @@ discard block |
||
209 | 209 | * @return \Ajax\semantic\widgets\datatable\DataTable |
210 | 210 | */ |
211 | 211 | public function setUrls($urls) { |
212 | - if(\is_array($urls)){ |
|
213 | - $this->_urls["refresh"]=JArray::getValue($urls, "refresh",0); |
|
214 | - $this->_urls["edit"]=JArray::getValue($urls, "edit",1); |
|
215 | - $this->_urls["delete"]=JArray::getValue($urls, "delete",2); |
|
216 | - }else{ |
|
217 | - $this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls]; |
|
212 | + if (\is_array($urls)) { |
|
213 | + $this->_urls["refresh"]=JArray::getValue($urls, "refresh", 0); |
|
214 | + $this->_urls["edit"]=JArray::getValue($urls, "edit", 1); |
|
215 | + $this->_urls["delete"]=JArray::getValue($urls, "delete", 2); |
|
216 | + } else { |
|
217 | + $this->_urls=["refresh"=>$urls, "edit"=>$urls, "delete"=>$urls]; |
|
218 | 218 | } |
219 | 219 | return $this; |
220 | 220 | } |
221 | 221 | |
222 | - public function paginate($items_per_page=10,$page=1){ |
|
223 | - $this->_pagination=new Pagination($items_per_page,4,$page); |
|
222 | + public function paginate($items_per_page=10, $page=1) { |
|
223 | + $this->_pagination=new Pagination($items_per_page, 4, $page); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
227 | 227 | |
228 | - public function refresh($compileParts=["tbody"]){ |
|
228 | + public function refresh($compileParts=["tbody"]) { |
|
229 | 229 | $this->_compileParts=$compileParts; |
230 | 230 | return $this; |
231 | 231 | } |
232 | 232 | |
233 | 233 | |
234 | - public function addSearchInToolbar($position=Direction::RIGHT){ |
|
234 | + public function addSearchInToolbar($position=Direction::RIGHT) { |
|
235 | 235 | return $this->addInToolbar($this->getSearchField())->setPosition($position); |
236 | 236 | } |
237 | 237 | |
238 | - public function getSearchField(){ |
|
239 | - if(isset($this->_searchField)===false){ |
|
240 | - $this->_searchField=new HtmlInput("search-".$this->identifier,"search","","Search..."); |
|
241 | - $this->_searchField->addIcon("search",Direction::RIGHT); |
|
238 | + public function getSearchField() { |
|
239 | + if (isset($this->_searchField)===false) { |
|
240 | + $this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search..."); |
|
241 | + $this->_searchField->addIcon("search", Direction::RIGHT); |
|
242 | 242 | } |
243 | 243 | return $this->_searchField; |
244 | 244 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | return $this; |
255 | 255 | } |
256 | 256 | |
257 | - public function asForm(){ |
|
257 | + public function asForm() { |
|
258 | 258 | return $this->getForm(); |
259 | 259 | } |
260 | 260 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | |
263 | 263 | protected function getTargetSelector() { |
264 | 264 | $result=$this->_targetSelector; |
265 | - if(!isset($result)) |
|
265 | + if (!isset($result)) |
|
266 | 266 | $result="#".$this->identifier; |
267 | 267 | return $result; |
268 | 268 | } |
@@ -18,207 +18,207 @@ discard block |
||
18 | 18 | |
19 | 19 | public static $index=0; |
20 | 20 | |
21 | - public function __construct($identifier,$instance=NULL,$captions=NULL){ |
|
21 | + public function __construct($identifier, $instance=NULL, $captions=NULL) { |
|
22 | 22 | $this->widgetIdentifier=$identifier; |
23 | 23 | $this->values=[]; |
24 | 24 | $this->afterCompile=[]; |
25 | - if(isset($instance)) |
|
25 | + if (isset($instance)) |
|
26 | 26 | $this->setInstance($instance); |
27 | 27 | $this->setCaptions($captions); |
28 | 28 | $this->captionCallback=NULL; |
29 | - $this->defaultValueFunction=function($name,$value){return $value;}; |
|
29 | + $this->defaultValueFunction=function($name, $value) {return $value; }; |
|
30 | 30 | } |
31 | 31 | |
32 | - public function moveFieldTo($from,$to){ |
|
33 | - if(JArray::moveElementTo($this->visibleProperties, $from, $to)){ |
|
32 | + public function moveFieldTo($from, $to) { |
|
33 | + if (JArray::moveElementTo($this->visibleProperties, $from, $to)) { |
|
34 | 34 | return JArray::moveElementTo($this->values, $from, $to); |
35 | 35 | } |
36 | 36 | return false; |
37 | 37 | } |
38 | 38 | |
39 | - public function swapFields($index1,$index2){ |
|
40 | - if(JArray::swapElements($this->visibleProperties, $index1, $index2)){ |
|
39 | + public function swapFields($index1, $index2) { |
|
40 | + if (JArray::swapElements($this->visibleProperties, $index1, $index2)) { |
|
41 | 41 | return JArray::swapElements($this->values, $index1, $index2); |
42 | 42 | } |
43 | 43 | return false; |
44 | 44 | } |
45 | 45 | |
46 | - public function removeField($index){ |
|
47 | - \array_splice($this->visibleProperties,$index,1); |
|
48 | - \array_splice($this->values,$index,1); |
|
49 | - \array_splice($this->captions,$index,1); |
|
46 | + public function removeField($index) { |
|
47 | + \array_splice($this->visibleProperties, $index, 1); |
|
48 | + \array_splice($this->values, $index, 1); |
|
49 | + \array_splice($this->captions, $index, 1); |
|
50 | 50 | return $this; |
51 | 51 | } |
52 | 52 | |
53 | - public function getValues(){ |
|
53 | + public function getValues() { |
|
54 | 54 | $values=[]; |
55 | 55 | $index=0; |
56 | 56 | $count=$this->count(); |
57 | - while($index<$count){ |
|
57 | + while ($index<$count) { |
|
58 | 58 | $values[]=$this->getValue($index++); |
59 | 59 | } |
60 | 60 | return $values; |
61 | 61 | } |
62 | 62 | |
63 | - public function getIdentifier($index=NULL){ |
|
64 | - if(!isset($index)) |
|
63 | + public function getIdentifier($index=NULL) { |
|
64 | + if (!isset($index)) |
|
65 | 65 | $index=self::$index; |
66 | 66 | $value=$index; |
67 | - if(isset($this->values["identifier"])) |
|
68 | - $value=$this->values["identifier"]($index,$this->instance); |
|
67 | + if (isset($this->values["identifier"])) |
|
68 | + $value=$this->values["identifier"]($index, $this->instance); |
|
69 | 69 | return $value; |
70 | 70 | } |
71 | 71 | |
72 | - public function getValue($index){ |
|
72 | + public function getValue($index) { |
|
73 | 73 | $property=$this->properties[$index]; |
74 | 74 | return $this->_getValue($property, $index); |
75 | 75 | } |
76 | 76 | |
77 | - protected function _beforeAddProperty($index,&$field){ |
|
77 | + protected function _beforeAddProperty($index, &$field) { |
|
78 | 78 | |
79 | 79 | } |
80 | 80 | |
81 | - protected function _getDefaultValue($name,$value,$index){ |
|
81 | + protected function _getDefaultValue($name, $value, $index) { |
|
82 | 82 | $func=$this->defaultValueFunction; |
83 | - return $func($name,$value,$index,$this->instance); |
|
83 | + return $func($name, $value, $index, $this->instance); |
|
84 | 84 | } |
85 | 85 | |
86 | - protected function _getPropertyValue(\ReflectionProperty $property,$index){ |
|
86 | + protected function _getPropertyValue(\ReflectionProperty $property, $index) { |
|
87 | 87 | $property->setAccessible(true); |
88 | 88 | $value=$property->getValue($this->instance); |
89 | - if(isset($this->values[$index])){ |
|
90 | - $value= $this->values[$index]($value,$this->instance,$index); |
|
91 | - }else{ |
|
92 | - $value=$this->_getDefaultValue($property->getName(),$value, $index); |
|
89 | + if (isset($this->values[$index])) { |
|
90 | + $value=$this->values[$index]($value, $this->instance, $index); |
|
91 | + } else { |
|
92 | + $value=$this->_getDefaultValue($property->getName(), $value, $index); |
|
93 | 93 | } |
94 | 94 | return $value; |
95 | 95 | } |
96 | 96 | |
97 | - protected function _getValue($property,$index){ |
|
97 | + protected function _getValue($property, $index) { |
|
98 | 98 | $value=null; |
99 | - if($property instanceof \ReflectionProperty){ |
|
99 | + if ($property instanceof \ReflectionProperty) { |
|
100 | 100 | $value=$this->_getPropertyValue($property, $index); |
101 | - }else{ |
|
102 | - if(\is_callable($property)) |
|
101 | + } else { |
|
102 | + if (\is_callable($property)) |
|
103 | 103 | $value=$property($this->instance); |
104 | - elseif(\is_array($property)){ |
|
105 | - $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
|
104 | + elseif (\is_array($property)) { |
|
105 | + $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index); }, $property); |
|
106 | 106 | $value=\implode("", $values); |
107 | - }else{ |
|
108 | - if(isset($this->values[$index])){ |
|
109 | - $value= $this->values[$index]($property,$this->instance,$index); |
|
110 | - }elseif(isset($this->instance->{$property})){ |
|
107 | + } else { |
|
108 | + if (isset($this->values[$index])) { |
|
109 | + $value=$this->values[$index]($property, $this->instance, $index); |
|
110 | + }elseif (isset($this->instance->{$property})) { |
|
111 | 111 | $value=$this->instance->{$property}; |
112 | 112 | } |
113 | 113 | } |
114 | 114 | } |
115 | - if(isset($this->afterCompile[$index])){ |
|
116 | - if(\is_callable($this->afterCompile[$index])){ |
|
117 | - $this->afterCompile[$index]($value,$this->instance,$index); |
|
115 | + if (isset($this->afterCompile[$index])) { |
|
116 | + if (\is_callable($this->afterCompile[$index])) { |
|
117 | + $this->afterCompile[$index]($value, $this->instance, $index); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | return $value; |
121 | 121 | } |
122 | 122 | |
123 | - public function insertField($index,$field){ |
|
124 | - array_splice( $this->visibleProperties, $index, 0, $field ); |
|
123 | + public function insertField($index, $field) { |
|
124 | + array_splice($this->visibleProperties, $index, 0, $field); |
|
125 | 125 | return $this; |
126 | 126 | } |
127 | 127 | |
128 | - public function insertInField($index,$field){ |
|
128 | + public function insertInField($index, $field) { |
|
129 | 129 | $vb=$this->visibleProperties; |
130 | - if(isset($vb[$index])){ |
|
131 | - if(\is_array($vb[$index])){ |
|
130 | + if (isset($vb[$index])) { |
|
131 | + if (\is_array($vb[$index])) { |
|
132 | 132 | $this->visibleProperties[$index][]=$field; |
133 | - }else{ |
|
134 | - $this->visibleProperties[$index]=[$vb[$index],$field]; |
|
133 | + } else { |
|
134 | + $this->visibleProperties[$index]=[$vb[$index], $field]; |
|
135 | 135 | } |
136 | - }else{ |
|
136 | + } else { |
|
137 | 137 | return $this->insertField($index, $field); |
138 | 138 | } |
139 | 139 | return $this; |
140 | 140 | } |
141 | 141 | |
142 | - public function addField($field){ |
|
142 | + public function addField($field) { |
|
143 | 143 | $this->visibleProperties[]=$field; |
144 | 144 | return $this; |
145 | 145 | } |
146 | 146 | |
147 | - public function count(){ |
|
147 | + public function count() { |
|
148 | 148 | return \sizeof($this->properties); |
149 | 149 | } |
150 | 150 | |
151 | - public function visiblePropertiesCount(){ |
|
151 | + public function visiblePropertiesCount() { |
|
152 | 152 | return \sizeof($this->visibleProperties); |
153 | 153 | } |
154 | 154 | |
155 | - public function getProperty($index){ |
|
155 | + public function getProperty($index) { |
|
156 | 156 | return $this->properties[$index]; |
157 | 157 | } |
158 | 158 | |
159 | - public function getFieldName($index){ |
|
159 | + public function getFieldName($index) { |
|
160 | 160 | $property=$this->getProperty($index); |
161 | - if($property instanceof \ReflectionProperty){ |
|
161 | + if ($property instanceof \ReflectionProperty) { |
|
162 | 162 | $result=$property->getName(); |
163 | - }elseif(\is_callable($property)){ |
|
163 | + }elseif (\is_callable($property)) { |
|
164 | 164 | $result=$this->visibleProperties[$index]; |
165 | - }else{ |
|
165 | + } else { |
|
166 | 166 | $result=$property; |
167 | 167 | } |
168 | 168 | return $result; |
169 | 169 | } |
170 | 170 | |
171 | 171 | |
172 | - protected function showableProperty(\ReflectionProperty $rProperty){ |
|
173 | - return JString::startswith($rProperty->getName(),"_")===false; |
|
172 | + protected function showableProperty(\ReflectionProperty $rProperty) { |
|
173 | + return JString::startswith($rProperty->getName(), "_")===false; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | public function setInstance($instance) { |
177 | - if(\is_string($instance)){ |
|
177 | + if (\is_string($instance)) { |
|
178 | 178 | $instance=new $instance(); |
179 | 179 | } |
180 | 180 | $this->instance=$instance; |
181 | 181 | $this->properties=[]; |
182 | 182 | $this->reflect=new \ReflectionClass($instance); |
183 | - if(\sizeof($this->visibleProperties)===0){ |
|
183 | + if (\sizeof($this->visibleProperties)===0) { |
|
184 | 184 | $this->properties=$this->getDefaultProperties(); |
185 | - }else{ |
|
186 | - foreach ($this->visibleProperties as $property){ |
|
185 | + } else { |
|
186 | + foreach ($this->visibleProperties as $property) { |
|
187 | 187 | $this->setInstanceProperty($property); |
188 | 188 | } |
189 | 189 | } |
190 | 190 | return $this; |
191 | 191 | } |
192 | 192 | |
193 | - private function setInstanceProperty($property){ |
|
194 | - if(\is_callable($property)){ |
|
193 | + private function setInstanceProperty($property) { |
|
194 | + if (\is_callable($property)) { |
|
195 | 195 | $this->properties[]=$property; |
196 | - }elseif(\is_string($property)){ |
|
197 | - try{ |
|
196 | + }elseif (\is_string($property)) { |
|
197 | + try { |
|
198 | 198 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
199 | 199 | $rProperty=$this->reflect->getProperty($property); |
200 | 200 | $this->properties[]=$rProperty; |
201 | - }catch(\Exception $e){ |
|
201 | + }catch (\Exception $e) { |
|
202 | 202 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
203 | 203 | $this->properties[]=$property; |
204 | 204 | } |
205 | - }elseif(\is_int($property)){ |
|
205 | + }elseif (\is_int($property)) { |
|
206 | 206 | $props=$this->getDefaultProperties(); |
207 | - if(isset($props[$property])) |
|
207 | + if (isset($props[$property])) |
|
208 | 208 | $this->properties[]=$props[$property]; |
209 | 209 | else |
210 | 210 | $this->properties[]=$property; |
211 | - }else{ |
|
211 | + } else { |
|
212 | 212 | $this->properties[]=$property; |
213 | 213 | } |
214 | 214 | } |
215 | 215 | |
216 | - protected function getDefaultProperties(){ |
|
216 | + protected function getDefaultProperties() { |
|
217 | 217 | $result=[]; |
218 | 218 | $properties=$this->reflect->getProperties(); |
219 | - foreach ($properties as $property){ |
|
219 | + foreach ($properties as $property) { |
|
220 | 220 | $showable=$this->showableProperty($property); |
221 | - if($showable!==false){ |
|
221 | + if ($showable!==false) { |
|
222 | 222 | $result[]=$property; |
223 | 223 | } |
224 | 224 | } |
@@ -230,12 +230,12 @@ discard block |
||
230 | 230 | return $this; |
231 | 231 | } |
232 | 232 | |
233 | - public function setValueFunction($index,$callback){ |
|
233 | + public function setValueFunction($index, $callback) { |
|
234 | 234 | $this->values[$index]=$callback; |
235 | 235 | return $this; |
236 | 236 | } |
237 | 237 | |
238 | - public function setIdentifierFunction($callback){ |
|
238 | + public function setIdentifierFunction($callback) { |
|
239 | 239 | $this->values["identifier"]=$callback; |
240 | 240 | return $this; |
241 | 241 | } |
@@ -248,41 +248,41 @@ discard block |
||
248 | 248 | return $this->properties; |
249 | 249 | } |
250 | 250 | |
251 | - public function getCaption($index){ |
|
252 | - if(isset($this->captions[$index])){ |
|
251 | + public function getCaption($index) { |
|
252 | + if (isset($this->captions[$index])) { |
|
253 | 253 | return $this->captions[$index]; |
254 | 254 | } |
255 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
255 | + if ($this->properties[$index] instanceof \ReflectionProperty) |
|
256 | 256 | return $this->properties[$index]->getName(); |
257 | - elseif(\is_callable($this->properties[$index])) |
|
257 | + elseif (\is_callable($this->properties[$index])) |
|
258 | 258 | return ""; |
259 | 259 | else |
260 | 260 | return $this->properties[$index]; |
261 | 261 | } |
262 | 262 | |
263 | - public function getCaptions(){ |
|
264 | - if(isset($this->captions)){ |
|
265 | - $captions= \array_values($this->captions); |
|
266 | - for($i=\sizeof($captions);$i<$this->count();$i++){ |
|
263 | + public function getCaptions() { |
|
264 | + if (isset($this->captions)) { |
|
265 | + $captions=\array_values($this->captions); |
|
266 | + for ($i=\sizeof($captions); $i<$this->count(); $i++) { |
|
267 | 267 | $captions[]=""; |
268 | 268 | } |
269 | - }else{ |
|
269 | + } else { |
|
270 | 270 | $captions=[]; |
271 | 271 | $index=0; |
272 | 272 | $count=$this->count(); |
273 | - while($index<$count){ |
|
273 | + while ($index<$count) { |
|
274 | 274 | $captions[]=$this->getCaption($index++); |
275 | 275 | } |
276 | 276 | } |
277 | - if(isset($this->captionCallback) && \is_callable($this->captionCallback)){ |
|
277 | + if (isset($this->captionCallback) && \is_callable($this->captionCallback)) { |
|
278 | 278 | $callback=$this->captionCallback; |
279 | - $callback($captions,$this->instance); |
|
279 | + $callback($captions, $this->instance); |
|
280 | 280 | } |
281 | 281 | return $captions; |
282 | 282 | } |
283 | 283 | |
284 | - public function setCaption($index,$caption){ |
|
285 | - if(isset($this->captions)===false) |
|
284 | + public function setCaption($index, $caption) { |
|
285 | + if (isset($this->captions)===false) |
|
286 | 286 | $this->captions=[]; |
287 | 287 | $this->captions[$index]=$caption; |
288 | 288 | return $this; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @param callable $callback function called after the field compilation |
301 | 301 | * @return \Ajax\semantic\widgets\datatable\InstanceViewer |
302 | 302 | */ |
303 | - public function afterCompile($index,$callback){ |
|
303 | + public function afterCompile($index, $callback) { |
|
304 | 304 | $this->afterCompile[$index]=$callback; |
305 | 305 | return $this; |
306 | 306 | } |
@@ -12,10 +12,10 @@ |
||
12 | 12 | parent::__construct($identifier, $instance, $captions); |
13 | 13 | } |
14 | 14 | |
15 | - public function getValue($index){ |
|
15 | + public function getValue($index) { |
|
16 | 16 | $result=parent::getValue($index); |
17 | - if($result instanceof HtmlFormField){ |
|
18 | - $lbl=new HtmlSemDoubleElement("lbl-".$this->widgetIdentifier."-".$index,"label","",$this->getCaption($index)); |
|
17 | + if ($result instanceof HtmlFormField) { |
|
18 | + $lbl=new HtmlSemDoubleElement("lbl-".$this->widgetIdentifier."-".$index, "label", "", $this->getCaption($index)); |
|
19 | 19 | $lbl->setProperty("for", $result->getDataField()->getIdentifier()); |
20 | 20 | $this->captions[$index]=$lbl; |
21 | 21 | } |
@@ -18,49 +18,49 @@ discard block |
||
18 | 18 | class DataElement extends Widget { |
19 | 19 | |
20 | 20 | public function __construct($identifier, $modelInstance=NULL) { |
21 | - parent::__construct($identifier, null,$modelInstance); |
|
22 | - $this->_init(new DeInstanceViewer($identifier), "table", new HtmlTable($identifier, 0,2), false); |
|
21 | + parent::__construct($identifier, null, $modelInstance); |
|
22 | + $this->_init(new DeInstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 2), false); |
|
23 | 23 | $this->content["table"]->setDefinition(); |
24 | 24 | } |
25 | 25 | |
26 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
27 | - if(!$this->_generated){ |
|
26 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
27 | + if (!$this->_generated) { |
|
28 | 28 | $this->_instanceViewer->setInstance($this->_modelInstance); |
29 | 29 | |
30 | 30 | $table=$this->content["table"]; |
31 | 31 | $this->_generateContent($table); |
32 | 32 | |
33 | - if(isset($this->_toolbar)){ |
|
33 | + if (isset($this->_toolbar)) { |
|
34 | 34 | $this->_setToolbarPosition($table); |
35 | 35 | } |
36 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]); |
|
36 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]); |
|
37 | 37 | $this->_compileForm(); |
38 | 38 | $this->_generated=true; |
39 | 39 | } |
40 | - return parent::compile($js,$view); |
|
40 | + return parent::compile($js, $view); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @param HtmlTable $table |
45 | 45 | */ |
46 | - protected function _generateContent($table){ |
|
47 | - $values= $this->_instanceViewer->getValues(); |
|
46 | + protected function _generateContent($table) { |
|
47 | + $values=$this->_instanceViewer->getValues(); |
|
48 | 48 | $captions=$this->_instanceViewer->getCaptions(); |
49 | 49 | $count=$this->_instanceViewer->count(); |
50 | - for($i=0;$i<$count;$i++){ |
|
51 | - $table->addRow([$captions[$i],$values[$i]]); |
|
50 | + for ($i=0; $i<$count; $i++) { |
|
51 | + $table->addRow([$captions[$i], $values[$i]]); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - protected function _getFieldName($index){ |
|
55 | + protected function _getFieldName($index) { |
|
56 | 56 | return $this->_instanceViewer->getFieldName($index); |
57 | 57 | } |
58 | 58 | |
59 | - protected function _getFieldCaption($index){ |
|
59 | + protected function _getFieldCaption($index) { |
|
60 | 60 | return null; |
61 | 61 | } |
62 | 62 | |
63 | - protected function _getFieldIdentifier($prefix,$name=""){ |
|
63 | + protected function _getFieldIdentifier($prefix, $name="") { |
|
64 | 64 | return $this->identifier."-{$prefix}-".$name; |
65 | 65 | } |
66 | 66 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | return $this; |
93 | 93 | } |
94 | 94 | |
95 | - public function asForm(){ |
|
95 | + public function asForm() { |
|
96 | 96 | return $this->getForm(); |
97 | 97 | } |
98 | 98 | } |
99 | 99 | \ No newline at end of file |