@@ -10,6 +10,9 @@ discard block |
||
| 10 | 10 | class HtmlList extends HtmlSemCollection { |
| 11 | 11 | protected $_hasCheckedList; |
| 12 | 12 | |
| 13 | + /** |
|
| 14 | + * @param string $identifier |
|
| 15 | + */ |
|
| 13 | 16 | public function __construct($identifier, $items=array()) { |
| 14 | 17 | parent::__construct($identifier, "div", "ui list"); |
| 15 | 18 | $this->addItems($items); |
@@ -22,6 +25,9 @@ discard block |
||
| 22 | 25 | return $item; |
| 23 | 26 | } |
| 24 | 27 | |
| 28 | + /** |
|
| 29 | + * @param integer $niveau |
|
| 30 | + */ |
|
| 25 | 31 | public function addHeader($niveau, $content) { |
| 26 | 32 | $header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
| 27 | 33 | $this->wrap($header); |
@@ -18,17 +18,17 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | protected function createItem($value) { |
| 20 | 20 | $count=$this->count(); |
| 21 | - $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
| 21 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
| 22 | 22 | return $item; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function addHeader($niveau, $content) { |
| 26 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
|
| 26 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page"); |
|
| 27 | 27 | $this->wrap($header); |
| 28 | 28 | return $header; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function getItemPart($index,$partName="header"){ |
|
| 31 | + public function getItemPart($index, $partName="header") { |
|
| 32 | 32 | return $this->getItem($index)->getPart($partName); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function asLink() { |
| 40 | - $this->addToPropertyCtrl("class", "link", array ("link" )); |
|
| 40 | + $this->addToPropertyCtrl("class", "link", array("link")); |
|
| 41 | 41 | return $this->contentAs("a"); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public function run(JsUtils $js) { |
| 63 | - if ($this->_hasCheckedList === true) { |
|
| 64 | - $jsCode=include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php'; |
|
| 65 | - $jsCode=\str_replace("%identifier%", "#" . $this->identifier, $jsCode); |
|
| 63 | + if ($this->_hasCheckedList===true) { |
|
| 64 | + $jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php'; |
|
| 65 | + $jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode); |
|
| 66 | 66 | $this->executeOnRun($jsCode); |
| 67 | 67 | } |
| 68 | 68 | return parent::run($js); |
@@ -86,24 +86,24 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | public function addCheckedList($items=array(), $masterItem=NULL, $values=array()) { |
| 88 | 88 | $count=$this->count(); |
| 89 | - $identifier=$this->identifier . "-" . $count; |
|
| 89 | + $identifier=$this->identifier."-".$count; |
|
| 90 | 90 | if (isset($masterItem)) { |
| 91 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem); |
|
| 91 | + $masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem); |
|
| 92 | 92 | $masterO->getField()->addToProperty("class", "master"); |
| 93 | 93 | $masterO->setClass("item"); |
| 94 | 94 | $this->addItem($masterO); |
| 95 | 95 | } |
| 96 | - $fields=array (); |
|
| 96 | + $fields=array(); |
|
| 97 | 97 | $i=0; |
| 98 | - foreach ( $items as $val => $caption ) { |
|
| 99 | - $itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child"); |
|
| 100 | - if (\array_search($val, $values) !== false) { |
|
| 98 | + foreach ($items as $val => $caption) { |
|
| 99 | + $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
|
| 100 | + if (\array_search($val, $values)!==false) { |
|
| 101 | 101 | $itemO->getField()->getField()->setProperty("checked", ""); |
| 102 | 102 | } |
| 103 | 103 | $itemO->setClass("item"); |
| 104 | 104 | $fields[]=$itemO; |
| 105 | 105 | } |
| 106 | - if (isset($masterO) === true) { |
|
| 106 | + if (isset($masterO)===true) { |
|
| 107 | 107 | $list=new HtmlList("", $fields); |
| 108 | 108 | $list->setClass("list"); |
| 109 | 109 | $masterO->addContent($list); |
@@ -10,6 +10,9 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | protected $params=array(); |
| 12 | 12 | |
| 13 | + /** |
|
| 14 | + * @param string $identifier |
|
| 15 | + */ |
|
| 13 | 16 | public function __construct( $identifier, $tagName="div", $baseClass="ui"){ |
| 14 | 17 | parent::__construct( $identifier, "div", "ui accordion"); |
| 15 | 18 | } |
@@ -29,6 +32,9 @@ discard block |
||
| 29 | 32 | return ($value instanceof HtmlAccordionItem)===false; |
| 30 | 33 | } |
| 31 | 34 | |
| 35 | + /** |
|
| 36 | + * @param string $title |
|
| 37 | + */ |
|
| 32 | 38 | public function addPanel($title,$content){ |
| 33 | 39 | return $this->addItem([$title,$content]); |
| 34 | 40 | } |
@@ -62,8 +62,9 @@ |
||
| 62 | 62 | * @see BaseHtml::run() |
| 63 | 63 | */ |
| 64 | 64 | public function run(JsUtils $js) { |
| 65 | - if(isset($this->_bsComponent)===false) |
|
| 66 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
| 65 | + if(isset($this->_bsComponent)===false) { |
|
| 66 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
| 67 | + } |
|
| 67 | 68 | $this->addEventsOnRun($js); |
| 68 | 69 | return $this->_bsComponent; |
| 69 | 70 | } |
@@ -6,31 +6,31 @@ discard block |
||
| 6 | 6 | use Ajax\semantic\html\content\HtmlAccordionItem; |
| 7 | 7 | use Ajax\JsUtils; |
| 8 | 8 | |
| 9 | -class HtmlAccordion extends HtmlSemCollection{ |
|
| 9 | +class HtmlAccordion extends HtmlSemCollection { |
|
| 10 | 10 | |
| 11 | 11 | protected $params=array(); |
| 12 | 12 | |
| 13 | - public function __construct( $identifier, $tagName="div", $baseClass="ui"){ |
|
| 14 | - parent::__construct( $identifier, "div", "ui accordion"); |
|
| 13 | + public function __construct($identifier, $tagName="div", $baseClass="ui") { |
|
| 14 | + parent::__construct($identifier, "div", "ui accordion"); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | |
| 18 | - protected function createItem($value){ |
|
| 18 | + protected function createItem($value) { |
|
| 19 | 19 | $count=$this->count(); |
| 20 | 20 | $title=$value; |
| 21 | 21 | $content=NULL; |
| 22 | - if(\is_array($value)){ |
|
| 23 | - $title=@$value[0];$content=@$value[1]; |
|
| 22 | + if (\is_array($value)) { |
|
| 23 | + $title=@$value[0]; $content=@$value[1]; |
|
| 24 | 24 | } |
| 25 | - return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title,$content); |
|
| 25 | + return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title, $content); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - protected function createCondition($value){ |
|
| 28 | + protected function createCondition($value) { |
|
| 29 | 29 | return ($value instanceof HtmlAccordionItem)===false; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function addPanel($title,$content){ |
|
| 33 | - return $this->addItem([$title,$content]); |
|
| 32 | + public function addPanel($title, $content) { |
|
| 33 | + return $this->addItem([$title, $content]); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * @param string $action a Phalcon action |
| 43 | 43 | * @param array $params |
| 44 | 44 | */ |
| 45 | - public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
| 46 | - return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params)); |
|
| 45 | + public function forwardPanel(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
| 46 | + return $this->addPanel($title, $js->forward($initialController, $controller, $action, $params)); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -54,30 +54,30 @@ discard block |
||
| 54 | 54 | * @param string $viewName |
| 55 | 55 | * @param $params The parameters to pass to the view |
| 56 | 56 | */ |
| 57 | - public function renderViewPanel(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
| 58 | - return $this->addPanel($title, $js->renderContent($initialController, $viewName,$params)); |
|
| 57 | + public function renderViewPanel(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
| 58 | + return $this->addPanel($title, $js->renderContent($initialController, $viewName, $params)); |
|
| 59 | 59 | } |
| 60 | 60 | /* |
| 61 | 61 | * (non-PHPdoc) |
| 62 | 62 | * @see BaseHtml::run() |
| 63 | 63 | */ |
| 64 | 64 | public function run(JsUtils $js) { |
| 65 | - if(isset($this->_bsComponent)===false) |
|
| 66 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
| 65 | + if (isset($this->_bsComponent)===false) |
|
| 66 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier, $this->params); |
|
| 67 | 67 | $this->addEventsOnRun($js); |
| 68 | 68 | return $this->_bsComponent; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function setStyled(){ |
|
| 71 | + public function setStyled() { |
|
| 72 | 72 | return $this->addToProperty("class", "styled"); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function activate($index){ |
|
| 75 | + public function activate($index) { |
|
| 76 | 76 | $this->getItem($index)->setActive(true); |
| 77 | 77 | return $this; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function setExclusive($value){ |
|
| 80 | + public function setExclusive($value) { |
|
| 81 | 81 | $this->params["exclusive"]=$value; |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | \ No newline at end of file |
@@ -14,6 +14,9 @@ discard block |
||
| 14 | 14 | protected $_params=array(); |
| 15 | 15 | protected $_paramParts=array(); |
| 16 | 16 | |
| 17 | + /** |
|
| 18 | + * @param string $identifier |
|
| 19 | + */ |
|
| 17 | 20 | public function __construct($identifier, $header="", $content="", $actions=array()) { |
| 18 | 21 | parent::__construct($identifier, "div","ui modal"); |
| 19 | 22 | if(isset($header)){ |
@@ -27,6 +30,9 @@ discard block |
||
| 27 | 30 | } |
| 28 | 31 | } |
| 29 | 32 | |
| 33 | + /** |
|
| 34 | + * @param string $value |
|
| 35 | + */ |
|
| 30 | 36 | public function setHeader($value) { |
| 31 | 37 | $this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value); |
| 32 | 38 | return $this; |
@@ -103,6 +109,9 @@ discard block |
||
| 103 | 109 | return $this->addElementInPart(new HtmlSemDoubleElement($part."-" . $this->identifier, "div", $uiClass, $content), $part); |
| 104 | 110 | } |
| 105 | 111 | |
| 112 | + /** |
|
| 113 | + * @param BaseHtml $element |
|
| 114 | + */ |
|
| 106 | 115 | private function addElementInPart($element,$part) { |
| 107 | 116 | $this->content[$part]->addContent($element); |
| 108 | 117 | return $element; |
@@ -145,7 +154,6 @@ discard block |
||
| 145 | 154 | /** |
| 146 | 155 | * render the content of $controller::$action and set the response to the modal content |
| 147 | 156 | * @param JsUtils $js |
| 148 | - * @param string $title The panel title |
|
| 149 | 157 | * @param Controller $initialControllerInstance |
| 150 | 158 | * @param string $controllerName the controller name |
| 151 | 159 | * @param string $actionName the action name |
@@ -43,8 +43,7 @@ discard block |
||
| 43 | 43 | foreach ($actions as $action){ |
| 44 | 44 | $this->addAction($action); |
| 45 | 45 | } |
| 46 | - } |
|
| 47 | - else{ |
|
| 46 | + } else{ |
|
| 48 | 47 | $this->addAction($actions); |
| 49 | 48 | } |
| 50 | 49 | return $this; |
@@ -60,8 +59,9 @@ discard block |
||
| 60 | 59 | $class="cancel"; |
| 61 | 60 | } |
| 62 | 61 | $action=new HtmlButton("action-".$this->identifier,$action); |
| 63 | - if($class!=="") |
|
| 64 | - $action->addToProperty("class", $class); |
|
| 62 | + if($class!=="") { |
|
| 63 | + $action->addToProperty("class", $class); |
|
| 64 | + } |
|
| 65 | 65 | } |
| 66 | 66 | return $this->addElementInPart($action, "actions"); |
| 67 | 67 | } |
@@ -169,8 +169,9 @@ discard block |
||
| 169 | 169 | * @see BaseHtml::run() |
| 170 | 170 | */ |
| 171 | 171 | public function run(JsUtils $js) { |
| 172 | - if(isset($this->_bsComponent)===false) |
|
| 173 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
| 172 | + if(isset($this->_bsComponent)===false) { |
|
| 173 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
| 174 | + } |
|
| 174 | 175 | $this->addEventsOnRun($js); |
| 175 | 176 | return $this->_bsComponent; |
| 176 | 177 | } |
@@ -15,117 +15,117 @@ discard block |
||
| 15 | 15 | protected $_paramParts=array(); |
| 16 | 16 | |
| 17 | 17 | public function __construct($identifier, $header="", $content="", $actions=array()) { |
| 18 | - parent::__construct($identifier, "div","ui modal"); |
|
| 19 | - if(isset($header)){ |
|
| 18 | + parent::__construct($identifier, "div", "ui modal"); |
|
| 19 | + if (isset($header)) { |
|
| 20 | 20 | $this->setHeader($header); |
| 21 | 21 | } |
| 22 | - if(isset($content)){ |
|
| 22 | + if (isset($content)) { |
|
| 23 | 23 | $this->setContent($content); |
| 24 | 24 | } |
| 25 | - if(isset($actions)){ |
|
| 25 | + if (isset($actions)) { |
|
| 26 | 26 | $this->setActions($actions); |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function setHeader($value) { |
| 31 | - $this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value); |
|
| 31 | + $this->content["header"]=new HtmlSemDoubleElement("header-".$this->identifier, "a", "header", $value); |
|
| 32 | 32 | return $this; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function setContent($value) { |
| 36 | - $this->content["content"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", $value); |
|
| 36 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", $value); |
|
| 37 | 37 | return $this; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function setActions($actions) { |
| 41 | - $this->content["actions"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "actions"); |
|
| 42 | - if(\is_array($actions)){ |
|
| 43 | - foreach ($actions as $action){ |
|
| 41 | + $this->content["actions"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "actions"); |
|
| 42 | + if (\is_array($actions)) { |
|
| 43 | + foreach ($actions as $action) { |
|
| 44 | 44 | $this->addAction($action); |
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | - else{ |
|
| 47 | + else { |
|
| 48 | 48 | $this->addAction($actions); |
| 49 | 49 | } |
| 50 | 50 | return $this; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function addAction($action){ |
|
| 54 | - if(!$action instanceof BaseHtml){ |
|
| 53 | + public function addAction($action) { |
|
| 54 | + if (!$action instanceof BaseHtml) { |
|
| 55 | 55 | $class=""; |
| 56 | - if(\array_search($action, ["Okay","Yes"])!==false){ |
|
| 56 | + if (\array_search($action, ["Okay", "Yes"])!==false) { |
|
| 57 | 57 | $class="approve"; |
| 58 | 58 | } |
| 59 | - if(\array_search($action, ["Cancel","No"])!==false){ |
|
| 59 | + if (\array_search($action, ["Cancel", "No"])!==false) { |
|
| 60 | 60 | $class="cancel"; |
| 61 | 61 | } |
| 62 | - $action=new HtmlButton("action-".$this->identifier,$action); |
|
| 63 | - if($class!=="") |
|
| 62 | + $action=new HtmlButton("action-".$this->identifier, $action); |
|
| 63 | + if ($class!=="") |
|
| 64 | 64 | $action->addToProperty("class", $class); |
| 65 | 65 | } |
| 66 | 66 | return $this->addElementInPart($action, "actions"); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function addContent($content,$before=false){ |
|
| 70 | - $this->content["content"]->addContent($content,$before); |
|
| 69 | + public function addContent($content, $before=false) { |
|
| 70 | + $this->content["content"]->addContent($content, $before); |
|
| 71 | 71 | return $this; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function addImageContent($image,$description=NULL){ |
|
| 74 | + public function addImageContent($image, $description=NULL) { |
|
| 75 | 75 | $content=$this->content["content"]; |
| 76 | - if(isset($description)){ |
|
| 77 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
| 78 | - $content->addContent($description,true); |
|
| 76 | + if (isset($description)) { |
|
| 77 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
| 78 | + $content->addContent($description, true); |
|
| 79 | 79 | } |
| 80 | - if($image!==""){ |
|
| 81 | - $img=new HtmlImage("image-".$this->identifier,$image,"","medium"); |
|
| 82 | - $content->addContent($img,true); |
|
| 83 | - $content->addToProperty("class","image"); |
|
| 80 | + if ($image!=="") { |
|
| 81 | + $img=new HtmlImage("image-".$this->identifier, $image, "", "medium"); |
|
| 82 | + $content->addContent($img, true); |
|
| 83 | + $content->addToProperty("class", "image"); |
|
| 84 | 84 | } |
| 85 | 85 | return $this; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - public function addIconContent($icon,$description=NULL){ |
|
| 88 | + public function addIconContent($icon, $description=NULL) { |
|
| 89 | 89 | $content=$this->content["content"]; |
| 90 | - if(isset($description)){ |
|
| 91 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
| 92 | - $content->addContent($description,true); |
|
| 90 | + if (isset($description)) { |
|
| 91 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
| 92 | + $content->addContent($description, true); |
|
| 93 | 93 | } |
| 94 | - if($icon!==""){ |
|
| 95 | - $img=new HtmlIcon("image-".$this->identifier,$icon); |
|
| 96 | - $content->addContent($img,true); |
|
| 97 | - $content->addToProperty("class","image"); |
|
| 94 | + if ($icon!=="") { |
|
| 95 | + $img=new HtmlIcon("image-".$this->identifier, $icon); |
|
| 96 | + $content->addContent($img, true); |
|
| 97 | + $content->addToProperty("class", "image"); |
|
| 98 | 98 | } |
| 99 | 99 | return $this; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - private function addContentInPart($content,$uiClass,$part) { |
|
| 103 | - return $this->addElementInPart(new HtmlSemDoubleElement($part."-" . $this->identifier, "div", $uiClass, $content), $part); |
|
| 102 | + private function addContentInPart($content, $uiClass, $part) { |
|
| 103 | + return $this->addElementInPart(new HtmlSemDoubleElement($part."-".$this->identifier, "div", $uiClass, $content), $part); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - private function addElementInPart($element,$part) { |
|
| 106 | + private function addElementInPart($element, $part) { |
|
| 107 | 107 | $this->content[$part]->addContent($element); |
| 108 | 108 | return $element; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public function showDimmer($value){ |
|
| 112 | - $value=$value?"show":"hide"; |
|
| 111 | + public function showDimmer($value) { |
|
| 112 | + $value=$value ? "show" : "hide"; |
|
| 113 | 113 | $this->_paramParts[]=["'".$value." dimmer'"]; |
| 114 | 114 | return $this; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - public function setInverted(){ |
|
| 117 | + public function setInverted() { |
|
| 118 | 118 | $this->_params["inverted"]=true; |
| 119 | 119 | return $this; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - public function setBasic(){ |
|
| 122 | + public function setBasic() { |
|
| 123 | 123 | return $this->addToProperty("class", "basic"); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
| 127 | - public function setTransition($value){ |
|
| 128 | - $this->_paramParts[]=["'setting'","'transition'","'".$value."'"]; |
|
| 127 | + public function setTransition($value) { |
|
| 128 | + $this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"]; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | * @param string $viewName |
| 136 | 136 | * @param $params The parameters to pass to the view |
| 137 | 137 | */ |
| 138 | - public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) { |
|
| 139 | - return $this->setContent($js->renderContent($initialController, $viewName,$params)); |
|
| 138 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
| 139 | + return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | * @param string $controllerName the controller name |
| 148 | 148 | * @param string $actionName the action name |
| 149 | 149 | */ |
| 150 | - public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
| 151 | - return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params)); |
|
| 150 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
| 151 | + return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 159 | 159 | */ |
| 160 | 160 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 161 | - $this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]); |
|
| 161 | + $this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]); |
|
| 162 | 162 | return parent::compile($js, $view); |
| 163 | 163 | } |
| 164 | 164 | /* |
@@ -166,8 +166,8 @@ discard block |
||
| 166 | 166 | * @see BaseHtml::run() |
| 167 | 167 | */ |
| 168 | 168 | public function run(JsUtils $js) { |
| 169 | - if(isset($this->_bsComponent)===false) |
|
| 170 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
| 169 | + if (isset($this->_bsComponent)===false) |
|
| 170 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts); |
|
| 171 | 171 | $this->addEventsOnRun($js); |
| 172 | 172 | return $this->_bsComponent; |
| 173 | 173 | } |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
| 6 | 6 | use Ajax\JsUtils; |
| 7 | 7 | use Ajax\service\JArray; |
| 8 | - |
|
| 9 | 8 | use Ajax\semantic\html\base\constants\State; |
| 10 | 9 | |
| 11 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |
@@ -9,26 +9,26 @@ discard block |
||
| 9 | 9 | use Ajax\semantic\html\base\constants\State; |
| 10 | 10 | |
| 11 | 11 | class HtmlProgress extends HtmlSemDoubleElement { |
| 12 | - private $_params=array (); |
|
| 12 | + private $_params=array(); |
|
| 13 | 13 | |
| 14 | 14 | public function __construct($identifier, $value=NULL, $label=NULL, $attributes=array()) { |
| 15 | 15 | parent::__construct($identifier, "div", "ui progress"); |
| 16 | - if (isset($value) === true) |
|
| 16 | + if (isset($value)===true) |
|
| 17 | 17 | $this->setProperty("data-percent", $value); |
| 18 | 18 | $this->createBar(); |
| 19 | - if (isset($label) === true) |
|
| 19 | + if (isset($label)===true) |
|
| 20 | 20 | $this->setLabel($label); |
| 21 | - $this->_states=[ State::SUCCESS,State::WARNING,State::ERROR,State::ACTIVE,State::DISABLED ]; |
|
| 21 | + $this->_states=[State::SUCCESS, State::WARNING, State::ERROR, State::ACTIVE, State::DISABLED]; |
|
| 22 | 22 | $this->addToProperty("class", $attributes); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function setLabel($label) { |
| 26 | - $this->content["label"]=new HtmlSemDoubleElement("lbl-" . $this->identifier, "div", "label", $label); |
|
| 26 | + $this->content["label"]=new HtmlSemDoubleElement("lbl-".$this->identifier, "div", "label", $label); |
|
| 27 | 27 | return $this; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | private function createBar() { |
| 31 | - $bar=new HtmlSemDoubleElement("bar-" . $this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-" . $this->identifier, "div", "progress")); |
|
| 31 | + $bar=new HtmlSemDoubleElement("bar-".$this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-".$this->identifier, "div", "progress")); |
|
| 32 | 32 | $this->content["bar"]=$bar; |
| 33 | 33 | return $this; |
| 34 | 34 | } |
@@ -68,20 +68,20 @@ discard block |
||
| 68 | 68 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 69 | 69 | */ |
| 70 | 70 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 71 | - $this->content=JArray::sortAssociative($this->content, [ "bar","label" ]); |
|
| 71 | + $this->content=JArray::sortAssociative($this->content, ["bar", "label"]); |
|
| 72 | 72 | return parent::compile($js, $view); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function jsSetValue($value) { |
| 76 | - return '$("#' . $this->identifier . '").progress({value:' . $value . '});'; |
|
| 76 | + return '$("#'.$this->identifier.'").progress({value:'.$value.'});'; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public function jsIncValue() { |
| 80 | - return '$("#' . $this->identifier . '").progress("increment");'; |
|
| 80 | + return '$("#'.$this->identifier.'").progress("increment");'; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | public function jsDecValue() { |
| 84 | - return '$("#' . $this->identifier . '").progress("decrement");'; |
|
| 84 | + return '$("#'.$this->identifier.'").progress("decrement");'; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @return HtmlProgress |
| 96 | 96 | */ |
| 97 | 97 | public function setTextValues($active=false, $error=false, $success=false, $warning=false, $percent="{percent}%", $ratio="{value} of {total}") { |
| 98 | - if (\is_array($active) == true) { |
|
| 98 | + if (\is_array($active)==true) { |
|
| 99 | 99 | $array=$active; |
| 100 | 100 | $active=JArray::getDefaultValue($array, "active", false); |
| 101 | 101 | $success=JArray::getDefaultValue($array, "success", $success); |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | $percent=JArray::getDefaultValue($array, "percent", $percent); |
| 104 | 104 | $ratio=JArray::getDefaultValue($array, "ratio", $ratio); |
| 105 | 105 | } |
| 106 | - $this->_params["text"]="%{active : " . \var_export($active, true) . ",error: " . \var_export($error, true) . ",success : " . \var_export($success, true) . ",warning : " . \var_export($warning, true) . ",percent : " . \var_export($percent, true) . ",ratio : " . \var_export($ratio, true) . "}%"; |
|
| 106 | + $this->_params["text"]="%{active : ".\var_export($active, true).",error: ".\var_export($error, true).",success : ".\var_export($success, true).",warning : ".\var_export($warning, true).",percent : ".\var_export($percent, true).",ratio : ".\var_export($ratio, true)."}%"; |
|
| 107 | 107 | return $this; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | public function onChange($jsCode) { |
| 111 | - return $this->_params["onChange"]="%function(percent, value, total){" . $jsCode . "}%"; |
|
| 111 | + return $this->_params["onChange"]="%function(percent, value, total){".$jsCode."}%"; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /* |
@@ -116,8 +116,8 @@ discard block |
||
| 116 | 116 | * @see BaseHtml::run() |
| 117 | 117 | */ |
| 118 | 118 | public function run(JsUtils $js) { |
| 119 | - if (isset($this->_bsComponent) === false) |
|
| 120 | - $this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params); |
|
| 119 | + if (isset($this->_bsComponent)===false) |
|
| 120 | + $this->_bsComponent=$js->semantic()->progress("#".$this->identifier, $this->_params); |
|
| 121 | 121 | $this->addEventsOnRun($js); |
| 122 | 122 | return $this->_bsComponent; |
| 123 | 123 | } |
@@ -13,11 +13,13 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | public function __construct($identifier, $value=NULL, $label=NULL, $attributes=array()) { |
| 15 | 15 | parent::__construct($identifier, "div", "ui progress"); |
| 16 | - if (isset($value) === true) |
|
| 17 | - $this->setProperty("data-percent", $value); |
|
| 16 | + if (isset($value) === true) { |
|
| 17 | + $this->setProperty("data-percent", $value); |
|
| 18 | + } |
|
| 18 | 19 | $this->createBar(); |
| 19 | - if (isset($label) === true) |
|
| 20 | - $this->setLabel($label); |
|
| 20 | + if (isset($label) === true) { |
|
| 21 | + $this->setLabel($label); |
|
| 22 | + } |
|
| 21 | 23 | $this->_states=[ State::SUCCESS,State::WARNING,State::ERROR,State::ACTIVE,State::DISABLED ]; |
| 22 | 24 | $this->addToProperty("class", $attributes); |
| 23 | 25 | } |
@@ -116,8 +118,9 @@ discard block |
||
| 116 | 118 | * @see BaseHtml::run() |
| 117 | 119 | */ |
| 118 | 120 | public function run(JsUtils $js) { |
| 119 | - if (isset($this->_bsComponent) === false) |
|
| 120 | - $this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params); |
|
| 121 | + if (isset($this->_bsComponent) === false) { |
|
| 122 | + $this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params); |
|
| 123 | + } |
|
| 121 | 124 | $this->addEventsOnRun($js); |
| 122 | 125 | return $this->_bsComponent; |
| 123 | 126 | } |
@@ -30,8 +30,6 @@ |
||
| 30 | 30 | /** |
| 31 | 31 | * |
| 32 | 32 | * @param string $identifier |
| 33 | - * @param int $rowCount |
|
| 34 | - * @param int $colCount |
|
| 35 | 33 | * @return HtmlRating |
| 36 | 34 | */ |
| 37 | 35 | public function htmlRating($identifier, $value, $max, $icon="") { |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | * @return HtmlModal |
| 80 | 80 | */ |
| 81 | 81 | public function htmlModal($identifier, $header="", $content="", $actions=array()) { |
| 82 | - return $this->addHtmlComponent(new HtmlModal($identifier, $header,$content,$actions)); |
|
| 82 | + return $this->addHtmlComponent(new HtmlModal($identifier, $header, $content, $actions)); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -24,8 +24,8 @@ |
||
| 24 | 24 | use Ajax\semantic\traits\SemanticHtmlViewsTrait; |
| 25 | 25 | |
| 26 | 26 | class Semantic extends BaseGui { |
| 27 | - use SemanticComponentsTrait,SemanticHtmlElementsTrait,SemanticHtmlCollectionsTrait, |
|
| 28 | - SemanticHtmlModulesTrait,SemanticHtmlViewsTrait; |
|
| 27 | + use SemanticComponentsTrait, SemanticHtmlElementsTrait, SemanticHtmlCollectionsTrait, |
|
| 28 | + SemanticHtmlModulesTrait, SemanticHtmlViewsTrait; |
|
| 29 | 29 | |
| 30 | 30 | public function __construct($autoCompile=true) { |
| 31 | 31 | parent::__construct($autoCompile=true); |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | * @param string $value default : swing |
| 31 | 31 | */ |
| 32 | 32 | public function setEasing($value) { |
| 33 | - $this->setParamCtrl("easing", $value, array ( |
|
| 33 | + $this->setParamCtrl("easing", $value, array( |
|
| 34 | 34 | "linear", |
| 35 | 35 | "swing", |
| 36 | 36 | "easeInQuad", |
@@ -74,8 +74,9 @@ |
||
| 74 | 74 | protected function setParamCtrl($key, $value, $typeCtrl) { |
| 75 | 75 | if (!$typeCtrl($value)) { |
| 76 | 76 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." à la position"); |
| 77 | - } else |
|
| 78 | - $this->setParam($key, $value); |
|
| 77 | + } else { |
|
| 78 | + $this->setParam($key, $value); |
|
| 79 | + } |
|
| 79 | 80 | } |
| 80 | 81 | |
| 81 | 82 | /* |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | public function __construct(JsUtils $js) { |
| 18 | 18 | parent::__construct($js); |
| 19 | - $this->params=array ( |
|
| 19 | + $this->params=array( |
|
| 20 | 20 | "active" => 0 |
| 21 | 21 | ); |
| 22 | 22 | $this->uiName="accordion"; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * @return $this |
| 113 | 113 | */ |
| 114 | 114 | public function setHeightStyle($value) { |
| 115 | - return $this->setParamCtrl("heightStyle", $value, array ( |
|
| 115 | + return $this->setParamCtrl("heightStyle", $value, array( |
|
| 116 | 116 | "auto", |
| 117 | 117 | "fill", |
| 118 | 118 | "content" |
@@ -49,9 +49,9 @@ |
||
| 49 | 49 | * @return $this |
| 50 | 50 | */ |
| 51 | 51 | public function setAnimate($value) { |
| 52 | - if ($value instanceof Animation) |
|
| 53 | - $value=$value->getParams(); |
|
| 54 | - else if (is_string($value)) { |
|
| 52 | + if ($value instanceof Animation) { |
|
| 53 | + $value=$value->getParams(); |
|
| 54 | + } else if (is_string($value)) { |
|
| 55 | 55 | $animation=new Animation(); |
| 56 | 56 | $animation->setEasing($value); |
| 57 | 57 | } |