Skip to content

Commit f58e0b8

Browse files
committed
target href added !
1 parent 41f0f31 commit f58e0b8

File tree

6 files changed

+31
-21
lines changed

6 files changed

+31
-21
lines changed

Ajax/semantic/html/base/HtmlSemDoubleElement.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@ public function attachLabel($label,$side=Side::TOP,$direction=Direction::NONE,$i
8282
*
8383
* @return \Ajax\semantic\html\base\HtmlSemDoubleElement
8484
*/
85-
public function asLink($href=NULL) {
85+
public function asLink($href=NULL,$target=NULL) {
8686
if (isset($href))
8787
$this->setProperty("href", $href);
88+
if(isset($target))
89+
$this->setProperty("target", $target);
8890
return $this->setTagName("a");
8991
}
9092

Ajax/semantic/html/elements/HtmlButton.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ public static function icon($identifier, $icon) {
195195
return $result;
196196
}
197197

198-
public function asLink($href=NULL) {
199-
$lnk=new HtmlLink("lnk-".$this->identifier,$href,$this->content);
198+
public function asLink($href=NULL,$target=NULL) {
199+
$lnk=new HtmlLink("lnk-".$this->identifier,$href,$this->content,$target);
200200
$this->content=$lnk;
201201
return $this;
202202
}

Ajax/semantic/html/elements/html5/HtmlLink.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
class HtmlLink extends HtmlSemDoubleElement {
1111
use HtmlLinkTrait;
1212

13-
public function __construct($identifier, $href="#", $content="Link") {
13+
public function __construct($identifier, $href="#", $content="Link",$target=NULL) {
1414
parent::__construct($identifier, "a", "");
1515
$this->setHref($href);
16+
if(isset($target))
17+
$this->setTarget($target);
1618
$this->content=$content;
1719
}
1820

Ajax/semantic/widgets/dataform/DataForm.php

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,25 +62,29 @@ protected function _generateContent($form){
6262
}else{
6363
$separators[]=$count;
6464
for($i=0;$i<$size;$i++){
65-
$wrapper=null;
66-
$fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]);
67-
if(isset($headers[$separators[$i]+1]))
68-
$form->addHeader($headers[$separators[$i]+1],4,true);
69-
if(isset($wrappers[$separators[$i]+1])){
70-
$wrapper=$wrappers[$separators[$i]+1];
71-
}
72-
//TODO check why $fields is empty
73-
if(\sizeof($fields)===1){
74-
$added=$form->addField($fields[0]);
75-
}elseif(\sizeof($fields)>1){
76-
$added=$form->addFields($fields);
77-
}
78-
if(isset($wrapper))
79-
$added->wrap($wrapper[0],$wrapper[1]);
65+
$this->_generateFields($form, $values, $headers, $separators[$i], $separators[$i+1], $wrappers);
8066
}
8167
}
8268
}
8369

70+
protected function _generateFields($form,$values,$headers,$sepFirst,$sepLast,$wrappers){
71+
$wrapper=null;
72+
$fields=\array_slice($values, $sepFirst+1,$sepLast-$sepFirst);
73+
if(isset($headers[$sepFirst+1]))
74+
$form->addHeader($headers[$sepFirst+1],4,true);
75+
if(isset($wrappers[$sepFirst+1])){
76+
$wrapper=$wrappers[$sepFirst+1];
77+
}
78+
//TODO check why $fields is empty
79+
if(\sizeof($fields)===1){
80+
$added=$form->addField($fields[0]);
81+
}elseif(\sizeof($fields)>1){
82+
$added=$form->addFields($fields);
83+
}
84+
if(isset($wrapper))
85+
$added->wrap($wrapper[0],$wrapper[1]);
86+
}
87+
8488
/**
8589
* {@inheritDoc}
8690
* @see \Ajax\common\Widget::getForm()

Ajax/semantic/widgets/datatable/HasCheckboxesTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* used in DataTable
1010
* @author jc
1111
* @property string identifier
12-
* @property $_compileParts
12+
* @property array $_compileParts
1313
*/
1414
trait HasCheckboxesTrait{
1515
protected $_hasCheckboxes;

Ajax/service/JReflection.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ public static function jsonObject($classname){
2121
if($class->getProperty($property)!==null){
2222
\call_user_func_array([$object,$name],[$value]);
2323
}
24-
}catch(\Exception $e){}
24+
}catch(\Exception $e){
25+
//Nothing to do
26+
}
2527
}
2628
}
2729
return $object;

0 commit comments

Comments
 (0)