@@ -6,27 +6,27 @@ discard block |
||
| 6 | 6 | use Symfony\Component\HttpFoundation\Request; |
| 7 | 7 | use Symfony\Component\HttpKernel\HttpKernelInterface; |
| 8 | 8 | use Ajax\service\JString; |
| 9 | -class JsUtils extends \Ajax\JsUtils{ |
|
| 10 | - public function getUrl($url){ |
|
| 9 | +class JsUtils extends \Ajax\JsUtils { |
|
| 10 | + public function getUrl($url) { |
|
| 11 | 11 | //$request = Request::createFromGlobals(); |
| 12 | 12 | $router=$this->getInjected(); |
| 13 | - if(isset($router)){ |
|
| 13 | + if (isset($router)) { |
|
| 14 | 14 | try { |
| 15 | 15 | $url=$router->generate($url); |
| 16 | - }catch (\Exception $e){ |
|
| 16 | + }catch (\Exception $e) { |
|
| 17 | 17 | return $router->getContext()->getBaseUrl(); |
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | return $url; |
| 21 | 21 | } |
| 22 | - public function addViewElement($identifier,$content,&$view){ |
|
| 23 | - if(\array_key_exists("q", $view)===false){ |
|
| 22 | + public function addViewElement($identifier, $content, &$view) { |
|
| 23 | + if (\array_key_exists("q", $view)===false) { |
|
| 24 | 24 | $view["q"]=array(); |
| 25 | 25 | } |
| 26 | 26 | $view["q"][$identifier]=$content; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function createScriptVariable(&$view,$view_var, $output){ |
|
| 29 | + public function createScriptVariable(&$view, $view_var, $output) { |
|
| 30 | 30 | $view[$view_var]=$output; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -37,17 +37,17 @@ discard block |
||
| 37 | 37 | * @param array $params |
| 38 | 38 | * @see \Ajax\JsUtils::forward() |
| 39 | 39 | */ |
| 40 | - public function forward($initialControllerInstance,$controllerName,$actionName,$params=array()){ |
|
| 40 | + public function forward($initialControllerInstance, $controllerName, $actionName, $params=array()) { |
|
| 41 | 41 | $path=$params; |
| 42 | - $request = $initialControllerInstance->get('request_stack')->getCurrentRequest(); |
|
| 43 | - $path['_forwarded'] = $request->attributes; |
|
| 44 | - $path['_controller'] = $controllerName.":".$actionName; |
|
| 45 | - $subRequest = $request->duplicate([], null, $path); |
|
| 46 | - $response= $initialControllerInstance->get('http_kernel')->handle($subRequest, HttpKernelInterface::SUB_REQUEST); |
|
| 42 | + $request=$initialControllerInstance->get('request_stack')->getCurrentRequest(); |
|
| 43 | + $path['_forwarded']=$request->attributes; |
|
| 44 | + $path['_controller']=$controllerName.":".$actionName; |
|
| 45 | + $subRequest=$request->duplicate([], null, $path); |
|
| 46 | + $response=$initialControllerInstance->get('http_kernel')->handle($subRequest, HttpKernelInterface::SUB_REQUEST); |
|
| 47 | 47 | return $response->getContent(); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function renderContent($initialControllerInstance,$viewName, $params=NULL) { |
|
| 50 | + public function renderContent($initialControllerInstance, $viewName, $params=NULL) { |
|
| 51 | 51 | if ($initialControllerInstance->has('templating')) { |
| 52 | 52 | return $initialControllerInstance->get('templating')->render($viewName, $params); |
| 53 | 53 | } |
@@ -59,10 +59,10 @@ discard block |
||
| 59 | 59 | return $initialControllerInstance->get('twig')->render($viewName, $params); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function fromDispatcher($dispatcher){ |
|
| 63 | - $request = $dispatcher->get('request_stack')->getCurrentRequest(); |
|
| 62 | + public function fromDispatcher($dispatcher) { |
|
| 63 | + $request=$dispatcher->get('request_stack')->getCurrentRequest(); |
|
| 64 | 64 | $uri=$request->getPathInfo(); |
| 65 | - if(JString::startswith($uri, "/")){ |
|
| 65 | + if (JString::startswith($uri, "/")) { |
|
| 66 | 66 | $uri=\substr($uri, 1); |
| 67 | 67 | } |
| 68 | 68 | return \explode("/", $uri); |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | use Ajax\common\html\HtmlDoubleElement; |
| 10 | 10 | use Ajax\semantic\html\base\constants\Side; |
| 11 | 11 | |
| 12 | -class HtmlStep extends HtmlSemCollection{ |
|
| 12 | +class HtmlStep extends HtmlSemCollection { |
|
| 13 | 13 | protected $_activeStep; |
| 14 | 14 | |
| 15 | - public function __construct( $identifier,$steps=array()){ |
|
| 16 | - parent::__construct( $identifier,"div", "ui steps"); |
|
| 15 | + public function __construct($identifier, $steps=array()) { |
|
| 16 | + parent::__construct($identifier, "div", "ui steps"); |
|
| 17 | 17 | $this->addItems($steps); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 24 | 24 | */ |
| 25 | 25 | protected function createItem($value) { |
| 26 | - $itemO=new HtmlStepItem("item-".\sizeof($this->content),$value); |
|
| 26 | + $itemO=new HtmlStepItem("item-".\sizeof($this->content), $value); |
|
| 27 | 27 | return $itemO; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -31,50 +31,50 @@ discard block |
||
| 31 | 31 | * @param string|array $step |
| 32 | 32 | * @return HtmlStepItem |
| 33 | 33 | */ |
| 34 | - public function addStep($step){ |
|
| 34 | + public function addStep($step) { |
|
| 35 | 35 | return $this->addItem($step); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function setOrdered(){ |
|
| 38 | + public function setOrdered() { |
|
| 39 | 39 | return $this->addToProperty("class", "ordered"); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function isOrdered(){ |
|
| 42 | + public function isOrdered() { |
|
| 43 | 43 | return $this->propertyContains("class", "ordered"); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function setVertical(){ |
|
| 46 | + public function setVertical() { |
|
| 47 | 47 | return $this->addToProperty("class", "vertical"); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - protected function defineActiveStep(){ |
|
| 50 | + protected function defineActiveStep() { |
|
| 51 | 51 | $activestep=$this->_activeStep; |
| 52 | 52 | $count=$this->count(); |
| 53 | - if($this->isOrdered()){ |
|
| 54 | - for($i=0;$i<$count;$i++){ |
|
| 53 | + if ($this->isOrdered()) { |
|
| 54 | + for ($i=0; $i<$count; $i++) { |
|
| 55 | 55 | $step=$this->content[$i]; |
| 56 | 56 | $step->removeStatus(); |
| 57 | - if($i<$activestep) |
|
| 57 | + if ($i<$activestep) |
|
| 58 | 58 | $step->setCompleted(); |
| 59 | 59 | elseif ($i===$activestep) |
| 60 | 60 | $step->setActive(); |
| 61 | 61 | else |
| 62 | 62 | $step->setDisabled(); |
| 63 | 63 | } |
| 64 | - }else{ |
|
| 65 | - foreach ($this->content as $step){ |
|
| 64 | + } else { |
|
| 65 | + foreach ($this->content as $step) { |
|
| 66 | 66 | $step->removeStatus(); |
| 67 | 67 | } |
| 68 | - if($activestep<$count) |
|
| 68 | + if ($activestep<$count) |
|
| 69 | 69 | $this->content[$activestep]->setActive(); |
| 70 | 70 | } |
| 71 | 71 | return $this; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 75 | - if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
| 75 | + if (isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
| 76 | 76 | $this->defineActiveStep(); |
| 77 | - return parent::compile($js,$view); |
|
| 77 | + return parent::compile($js, $view); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | public function setActiveStep($_activeStep) { |
@@ -82,15 +82,15 @@ discard block |
||
| 82 | 82 | return $this; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - public function setAttached($side="",HtmlDoubleElement $toElement=NULL){ |
|
| 86 | - if(isset($toElement)){ |
|
| 87 | - $toElement->addToPropertyCtrl("class", "attached",array("attached")); |
|
| 85 | + public function setAttached($side="", HtmlDoubleElement $toElement=NULL) { |
|
| 86 | + if (isset($toElement)) { |
|
| 87 | + $toElement->addToPropertyCtrl("class", "attached", array("attached")); |
|
| 88 | 88 | } |
| 89 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
| 89 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function asLink(){ |
|
| 93 | - foreach ($this->content as $step){ |
|
| 92 | + public function asLink() { |
|
| 93 | + foreach ($this->content as $step) { |
|
| 94 | 94 | $step->asLink(); |
| 95 | 95 | } |
| 96 | 96 | return $this; |
@@ -13,49 +13,49 @@ discard block |
||
| 13 | 13 | use Ajax\semantic\html\collections\form\traits\FieldTrait; |
| 14 | 14 | |
| 15 | 15 | class HtmlDropdown extends HtmlSemDoubleElement { |
| 16 | - use FieldTrait,LabeledIconTrait { |
|
| 16 | + use FieldTrait, LabeledIconTrait { |
|
| 17 | 17 | addIcon as addIconP; |
| 18 | 18 | } |
| 19 | 19 | protected $mClass="menu"; |
| 20 | 20 | protected $mTagName="div"; |
| 21 | - protected $items=array (); |
|
| 22 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
| 21 | + protected $items=array(); |
|
| 22 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
| 23 | 23 | protected $input; |
| 24 | 24 | protected $value; |
| 25 | 25 | protected $_associative; |
| 26 | 26 | |
| 27 | - public function __construct($identifier, $value="", $items=array(),$associative=true) { |
|
| 27 | + public function __construct($identifier, $value="", $items=array(), $associative=true) { |
|
| 28 | 28 | parent::__construct($identifier, "div"); |
| 29 | 29 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
| 30 | 30 | $this->setProperty("class", "ui dropdown"); |
| 31 | - $content=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
| 31 | + $content=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
| 32 | 32 | $content->setClass("text"); |
| 33 | 33 | $this->setValue($value); |
| 34 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
| 34 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
| 35 | 35 | $this->content=array($content); |
| 36 | 36 | $this->tagName="div"; |
| 37 | 37 | $this->_associative=$associative; |
| 38 | 38 | $this->addItems($items); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function getField(){ |
|
| 41 | + public function getField() { |
|
| 42 | 42 | return $this->input; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function addItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
| 46 | - $itemO=$this->beforeAddItem($item,$value,$image,$description); |
|
| 45 | + public function addItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 46 | + $itemO=$this->beforeAddItem($item, $value, $image, $description); |
|
| 47 | 47 | $this->items[]=$itemO; |
| 48 | 48 | return $itemO; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
| 52 | - $this->addIconP($icon,$before,$labeled); |
|
| 51 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 52 | + $this->addIconP($icon, $before, $labeled); |
|
| 53 | 53 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function addIcons($icons){ |
|
| 56 | + public function addIcons($icons) { |
|
| 57 | 57 | $count=$this->count(); |
| 58 | - for ($i=0;$i<\sizeof($icons) && $i<$count;$i++){ |
|
| 58 | + for ($i=0; $i<\sizeof($icons) && $i<$count; $i++) { |
|
| 59 | 59 | $this->getItem($i)->addIcon($icons[$i]); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -66,26 +66,26 @@ discard block |
||
| 66 | 66 | * @param number $position |
| 67 | 67 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 68 | 68 | */ |
| 69 | - public function insertItem($item,$position=0){ |
|
| 69 | + public function insertItem($item, $position=0) { |
|
| 70 | 70 | $itemO=$this->beforeAddItem($item); |
| 71 | - $start = array_slice($this->items, 0, $position); |
|
| 72 | - $end = array_slice($this->items, $position); |
|
| 73 | - $start[] = $item; |
|
| 71 | + $start=array_slice($this->items, 0, $position); |
|
| 72 | + $end=array_slice($this->items, $position); |
|
| 73 | + $start[]=$item; |
|
| 74 | 74 | $this->items=array_merge($start, $end); |
| 75 | 75 | return $itemO; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
| 78 | + protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 79 | 79 | $itemO=$item; |
| 80 | - if(\is_array($item)){ |
|
| 80 | + if (\is_array($item)) { |
|
| 81 | 81 | $description=JArray::getValue($item, "description", 3); |
| 82 | 82 | $value=JArray::getValue($item, "value", 1); |
| 83 | 83 | $image=JArray::getValue($item, "image", 2); |
| 84 | 84 | $item=JArray::getValue($item, "item", 0); |
| 85 | 85 | } |
| 86 | - if(!$item instanceof HtmlDropdownItem){ |
|
| 87 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
|
| 88 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 86 | + if (!$item instanceof HtmlDropdownItem) { |
|
| 87 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description); |
|
| 88 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
| 89 | 89 | $this->addToProperty("class", "vertical"); |
| 90 | 90 | } |
| 91 | 91 | return $itemO; |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | $this->addItem($function($object)); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - public function addInput($name){ |
|
| 102 | - if(!isset($name)) |
|
| 101 | + public function addInput($name) { |
|
| 102 | + if (!isset($name)) |
|
| 103 | 103 | $name="input-".$this->identifier; |
| 104 | 104 | $this->setAction("activate"); |
| 105 | - $this->input=new HtmlInput($name,"hidden"); |
|
| 105 | + $this->input=new HtmlInput($name, "hidden"); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -111,15 +111,15 @@ discard block |
||
| 111 | 111 | * @param string $icon |
| 112 | 112 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 113 | 113 | */ |
| 114 | - public function addSearchInputItem($placeHolder=NULL,$icon=NULL){ |
|
| 115 | - return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon)); |
|
| 114 | + public function addSearchInputItem($placeHolder=NULL, $icon=NULL) { |
|
| 115 | + return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon)); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
| 119 | 119 | * Adds a divider item |
| 120 | 120 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 121 | 121 | */ |
| 122 | - public function addDividerItem(){ |
|
| 122 | + public function addDividerItem() { |
|
| 123 | 123 | return $this->addItem(HtmlDropdownItem::divider()); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | * @param string $icon |
| 130 | 130 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 131 | 131 | */ |
| 132 | - public function addHeaderItem($caption=NULL,$icon=NULL){ |
|
| 133 | - return $this->addItem(HtmlDropdownItem::header($caption,$icon)); |
|
| 132 | + public function addHeaderItem($caption=NULL, $icon=NULL) { |
|
| 133 | + return $this->addItem(HtmlDropdownItem::header($caption, $icon)); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @param string $color |
| 140 | 140 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 141 | 141 | */ |
| 142 | - public function addCircularLabelItem($caption,$color){ |
|
| 142 | + public function addCircularLabelItem($caption, $color) { |
|
| 143 | 143 | return $this->addItem(HtmlDropdownItem::circular($caption, $color)); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -148,87 +148,87 @@ discard block |
||
| 148 | 148 | * @param string $image |
| 149 | 149 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 150 | 150 | */ |
| 151 | - public function addMiniAvatarImageItem($caption,$image){ |
|
| 151 | + public function addMiniAvatarImageItem($caption, $image) { |
|
| 152 | 152 | return $this->addItem(HtmlDropdownItem::avatar($caption, $image)); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - public function addItems($items){ |
|
| 156 | - if(\is_array($items) && $this->_associative){ |
|
| 157 | - foreach ($items as $k=>$v){ |
|
| 155 | + public function addItems($items) { |
|
| 156 | + if (\is_array($items) && $this->_associative) { |
|
| 157 | + foreach ($items as $k=>$v) { |
|
| 158 | 158 | $this->addItem($v)->setData($k); |
| 159 | 159 | } |
| 160 | - }else{ |
|
| 161 | - foreach ($items as $item){ |
|
| 160 | + } else { |
|
| 161 | + foreach ($items as $item) { |
|
| 162 | 162 | $this->addItem($item); |
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - public function getItem($index){ |
|
| 167 | + public function getItem($index) { |
|
| 168 | 168 | return $this->items[$index]; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | 172 | * @return int |
| 173 | 173 | */ |
| 174 | - public function count(){ |
|
| 174 | + public function count() { |
|
| 175 | 175 | return \sizeof($this->items); |
| 176 | 176 | } |
| 177 | 177 | /** |
| 178 | 178 | * @param boolean $dropdown |
| 179 | 179 | */ |
| 180 | - public function asDropdown($dropdown){ |
|
| 181 | - if($dropdown===false){ |
|
| 180 | + public function asDropdown($dropdown) { |
|
| 181 | + if ($dropdown===false) { |
|
| 182 | 182 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 183 | 183 | $dropdown="menu"; |
| 184 | - }else{ |
|
| 184 | + } else { |
|
| 185 | 185 | $dropdown="dropdown"; |
| 186 | 186 | $this->mClass="menu"; |
| 187 | 187 | } |
| 188 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
| 188 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - public function setVertical(){ |
|
| 192 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
| 191 | + public function setVertical() { |
|
| 192 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - public function setInline(){ |
|
| 196 | - return $this->addToPropertyCtrl("class", "inline",["inline"]); |
|
| 195 | + public function setInline() { |
|
| 196 | + return $this->addToPropertyCtrl("class", "inline", ["inline"]); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - public function setSimple(){ |
|
| 200 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
| 199 | + public function setSimple() { |
|
| 200 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - public function asButton($floating=false){ |
|
| 204 | - if($floating) |
|
| 203 | + public function asButton($floating=false) { |
|
| 204 | + if ($floating) |
|
| 205 | 205 | $this->addToProperty("class", "floating"); |
| 206 | 206 | $this->removePropertyValue("class", "selection"); |
| 207 | 207 | return $this->addToProperty("class", "button"); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
| 211 | - if(isset($name)) |
|
| 210 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 211 | + if (isset($name)) |
|
| 212 | 212 | $this->addInput($name); |
| 213 | - if($multiple) |
|
| 213 | + if ($multiple) |
|
| 214 | 214 | $this->addToProperty("class", "multiple"); |
| 215 | - if ($selection){ |
|
| 216 | - if($this->propertyContains("class", "button")===false) |
|
| 217 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 215 | + if ($selection) { |
|
| 216 | + if ($this->propertyContains("class", "button")===false) |
|
| 217 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
| 218 | 218 | } |
| 219 | 219 | return $this; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - public function asSearch($name=NULL,$multiple=false,$selection=true){ |
|
| 223 | - $this->asSelect($name,$multiple,$selection); |
|
| 222 | + public function asSearch($name=NULL, $multiple=false, $selection=true) { |
|
| 223 | + $this->asSelect($name, $multiple, $selection); |
|
| 224 | 224 | return $this->addToProperty("class", "search"); |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - public function setSelect($name=NULL,$multiple=false){ |
|
| 228 | - if(!isset($name)) |
|
| 227 | + public function setSelect($name=NULL, $multiple=false) { |
|
| 228 | + if (!isset($name)) |
|
| 229 | 229 | $name="select-".$this->identifier; |
| 230 | 230 | $this->input=null; |
| 231 | - if($multiple){ |
|
| 231 | + if ($multiple) { |
|
| 232 | 232 | $this->setProperty("multiple", true); |
| 233 | 233 | $this->addToProperty("class", "multiple"); |
| 234 | 234 | } |
@@ -236,37 +236,37 @@ discard block |
||
| 236 | 236 | $this->tagName="select"; |
| 237 | 237 | $this->setProperty("name", $name); |
| 238 | 238 | $this->content=null; |
| 239 | - foreach ($this->items as $item){ |
|
| 239 | + foreach ($this->items as $item) { |
|
| 240 | 240 | $item->asOption(); |
| 241 | 241 | } |
| 242 | 242 | return $this; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - public function asSubmenu($pointing=NULL){ |
|
| 245 | + public function asSubmenu($pointing=NULL) { |
|
| 246 | 246 | $this->setClass("ui dropdown link item"); |
| 247 | - if(isset($pointing)){ |
|
| 247 | + if (isset($pointing)) { |
|
| 248 | 248 | $this->setPointing($pointing); |
| 249 | 249 | } |
| 250 | 250 | return $this; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - public function setPointing($value=Direction::NONE){ |
|
| 254 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
| 253 | + public function setPointing($value=Direction::NONE) { |
|
| 254 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - public function setValue($value){ |
|
| 257 | + public function setValue($value) { |
|
| 258 | 258 | $this->value=$value; |
| 259 | 259 | return $this; |
| 260 | 260 | } |
| 261 | - private function applyValue(){ |
|
| 261 | + private function applyValue() { |
|
| 262 | 262 | $value=$this->value; |
| 263 | - if(isset($this->input) && isset($value)){ |
|
| 263 | + if (isset($this->input) && isset($value)) { |
|
| 264 | 264 | $this->input->setProperty("value", $value); |
| 265 | - }else{ |
|
| 265 | + } else { |
|
| 266 | 266 | $this->setProperty("value", $value); |
| 267 | 267 | } |
| 268 | 268 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 269 | - if(isset($textElement)) |
|
| 269 | + if (isset($textElement)) |
|
| 270 | 270 | $textElement->setContent($value); |
| 271 | 271 | return $this; |
| 272 | 272 | } |
@@ -276,29 +276,29 @@ discard block |
||
| 276 | 276 | * @see BaseHtml::run() |
| 277 | 277 | */ |
| 278 | 278 | public function run(JsUtils $js) { |
| 279 | - if($this->propertyContains("class", "simple")===false){ |
|
| 280 | - if(isset($this->_bsComponent)===false) |
|
| 281 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 279 | + if ($this->propertyContains("class", "simple")===false) { |
|
| 280 | + if (isset($this->_bsComponent)===false) |
|
| 281 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
| 282 | 282 | $this->addEventsOnRun($js); |
| 283 | 283 | return $this->_bsComponent; |
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - public function setCompact(){ |
|
| 287 | + public function setCompact() { |
|
| 288 | 288 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - public function setAction($action){ |
|
| 291 | + public function setAction($action) { |
|
| 292 | 292 | $this->_params["action"]=$action; |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - public function setFullTextSearch($value){ |
|
| 295 | + public function setFullTextSearch($value) { |
|
| 296 | 296 | $this->_params["fullTextSearch"]=$value; |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 300 | 300 | $this->applyValue(); |
| 301 | - return parent::compile($js,$view); |
|
| 301 | + return parent::compile($js, $view); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | public function getInput() { |
@@ -14,14 +14,14 @@ discard block |
||
| 14 | 14 | * @author jc |
| 15 | 15 | * @version 1.001 |
| 16 | 16 | */ |
| 17 | -class HtmlTab extends HtmlSemCollection{ |
|
| 17 | +class HtmlTab extends HtmlSemCollection { |
|
| 18 | 18 | |
| 19 | 19 | protected $params=array("debug"=>true); |
| 20 | 20 | |
| 21 | - public function __construct( $identifier, $tabs=array()){ |
|
| 22 | - parent::__construct( $identifier, "div", ""); |
|
| 21 | + public function __construct($identifier, $tabs=array()) { |
|
| 22 | + parent::__construct($identifier, "div", ""); |
|
| 23 | 23 | $menu=new HtmlMenu("menu".$this->identifier); |
| 24 | - $menu->asTab(false)->setAttachment(NULL,Side::TOP); |
|
| 24 | + $menu->asTab(false)->setAttachment(NULL, Side::TOP); |
|
| 25 | 25 | $this->content["menu"]=$menu; |
| 26 | 26 | $this->addItems($tabs); |
| 27 | 27 | } |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 32 | 32 | * @return HtmlSegment |
| 33 | 33 | */ |
| 34 | - protected function createItem($value){ |
|
| 34 | + protected function createItem($value) { |
|
| 35 | 35 | $count=$this->count(); |
| 36 | 36 | $title=$value; |
| 37 | 37 | $content=NULL; |
| 38 | - if(\is_array($value)){ |
|
| 39 | - $title=@$value[0];$content=@$value[1]; |
|
| 38 | + if (\is_array($value)) { |
|
| 39 | + $title=@$value[0]; $content=@$value[1]; |
|
| 40 | 40 | } |
| 41 | 41 | $menuItem=$this->content["menu"]->addItem($title); |
| 42 | 42 | $menuItem->addToProperty("data-tab", $menuItem->getIdentifier()); |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | * @param string $datatab |
| 51 | 51 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 52 | 52 | */ |
| 53 | - private function createSegment($count,$content,$datatab){ |
|
| 53 | + private function createSegment($count, $content, $datatab) { |
|
| 54 | 54 | $segment=new HtmlSegment("item-".$this->identifier."-".$count, $content); |
| 55 | - $segment->setAttachment(NULL,Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab",$datatab); |
|
| 55 | + $segment->setAttachment(NULL, Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab", $datatab); |
|
| 56 | 56 | return $segment; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -62,12 +62,12 @@ discard block |
||
| 62 | 62 | * @param String $content new content |
| 63 | 63 | * @return \Ajax\semantic\html\modules\HtmlTab |
| 64 | 64 | */ |
| 65 | - public function setTabContent($index,$content){ |
|
| 65 | + public function setTabContent($index, $content) { |
|
| 66 | 66 | $menu=$this->content["menu"]; |
| 67 | - if($index<$menu->count()){ |
|
| 68 | - if(isset($this->content[$index])===false){ |
|
| 67 | + if ($index<$menu->count()) { |
|
| 68 | + if (isset($this->content[$index])===false) { |
|
| 69 | 69 | $this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index)->getIdentifier()); |
| 70 | - }else |
|
| 70 | + } else |
|
| 71 | 71 | $this->content[$index]->setContent($content); |
| 72 | 72 | } |
| 73 | 73 | return $this; |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | * @param array $contents |
| 79 | 79 | * @return \Ajax\semantic\html\modules\HtmlTab |
| 80 | 80 | */ |
| 81 | - public function setTabsContent($contents){ |
|
| 82 | - for($i=0;$i<\sizeof($contents);$i++){ |
|
| 81 | + public function setTabsContent($contents) { |
|
| 82 | + for ($i=0; $i<\sizeof($contents); $i++) { |
|
| 83 | 83 | $this->setTabContent($i, $contents[$i]); |
| 84 | 84 | } |
| 85 | 85 | return $this; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @param int $index |
| 91 | 91 | * @return \Ajax\semantic\html\modules\HtmlTab |
| 92 | 92 | */ |
| 93 | - public function activate($index){ |
|
| 93 | + public function activate($index) { |
|
| 94 | 94 | $this->content["menu"]->getItem($index)->setActive(true); |
| 95 | 95 | $this->content[$index]->setActive(true); |
| 96 | 96 | return $this; |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | * @param string $content |
| 103 | 103 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 104 | 104 | */ |
| 105 | - public function addTab($title,$content){ |
|
| 106 | - return $this->addItem([$title,$content]); |
|
| 105 | + public function addTab($title, $content) { |
|
| 106 | + return $this->addItem([$title, $content]); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | * @param array $params |
| 118 | 118 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 119 | 119 | */ |
| 120 | - public function forwardTab($index,JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
| 121 | - if(\array_key_exists($index, $this->content)){ |
|
| 122 | - $this->content[$index]=$js->forward($initialController, $controller, $action,$params); |
|
| 120 | + public function forwardTab($index, JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
| 121 | + if (\array_key_exists($index, $this->content)) { |
|
| 122 | + $this->content[$index]=$js->forward($initialController, $controller, $action, $params); |
|
| 123 | 123 | return $this->content[$index]; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - return $this->addAndForwardTab($js, $title, $initialController, $controller, $action,$params); |
|
| 126 | + return $this->addAndForwardTab($js, $title, $initialController, $controller, $action, $params); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | * @param $params The parameters to pass to the view |
| 137 | 137 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 138 | 138 | */ |
| 139 | - public function renderViewTab($index,JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
| 140 | - if(\array_key_exists($index, $this->content)){ |
|
| 141 | - $this->content[$index]=$js->renderContent($initialController, $viewName,$params); |
|
| 139 | + public function renderViewTab($index, JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
| 140 | + if (\array_key_exists($index, $this->content)) { |
|
| 141 | + $this->content[$index]=$js->renderContent($initialController, $viewName, $params); |
|
| 142 | 142 | return $this->content[$index]; |
| 143 | 143 | } |
| 144 | - return $this->addAndRenderViewTab($js, $title, $initialController, $viewName,$params); |
|
| 144 | + return $this->addAndRenderViewTab($js, $title, $initialController, $viewName, $params); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | * @param array $params |
| 156 | 156 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 157 | 157 | */ |
| 158 | - public function addAndForwardTab(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
| 159 | - return $this->addTab($title, $js->forward($initialController, $controller, $action,$params)); |
|
| 158 | + public function addAndForwardTab(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
| 159 | + return $this->addTab($title, $js->forward($initialController, $controller, $action, $params)); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | * @param $params The parameters to pass to the view |
| 169 | 169 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 170 | 170 | */ |
| 171 | - public function addAndRenderViewTab(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
| 172 | - return $this->addTab($title, $js->renderContent($initialController, $viewName,$params)); |
|
| 171 | + public function addAndRenderViewTab(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
| 172 | + return $this->addTab($title, $js->renderContent($initialController, $viewName, $params)); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | public function setPointing($value=Direction::NONE) { |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * @param int $index |
| 186 | 186 | * @return Ajax\semantic\html\content\HtmlMenuItem |
| 187 | 187 | */ |
| 188 | - public function getMenuTab($index){ |
|
| 188 | + public function getMenuTab($index) { |
|
| 189 | 189 | return $this->content["menu"]->getItem($index); |
| 190 | 190 | } |
| 191 | 191 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * @param int $index |
| 195 | 195 | * @return HtmlSegment |
| 196 | 196 | */ |
| 197 | - public function getTab($index){ |
|
| 197 | + public function getTab($index) { |
|
| 198 | 198 | return $this->content[$index]; |
| 199 | 199 | } |
| 200 | 200 | |
@@ -203,20 +203,20 @@ discard block |
||
| 203 | 203 | * @param HtmlMenu $menu |
| 204 | 204 | * @return \Ajax\semantic\html\modules\HtmlTab |
| 205 | 205 | */ |
| 206 | - public function setMenu($menu){ |
|
| 207 | - for($i=0;$i<\sizeof($this->content);$i++){ |
|
| 208 | - if($menu->getItem($i)!==NULL){ |
|
| 209 | - if(isset($this->content[$i])){ |
|
| 210 | - $menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab")); |
|
| 206 | + public function setMenu($menu) { |
|
| 207 | + for ($i=0; $i<\sizeof($this->content); $i++) { |
|
| 208 | + if ($menu->getItem($i)!==NULL) { |
|
| 209 | + if (isset($this->content[$i])) { |
|
| 210 | + $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
|
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | - for($i=0;$i<$menu->count();$i++){ |
|
| 214 | + for ($i=0; $i<$menu->count(); $i++) { |
|
| 215 | 215 | $menu->getItem($i)->removeProperty("href"); |
| 216 | - if(isset($this->content[$i])===false){ |
|
| 216 | + if (isset($this->content[$i])===false) { |
|
| 217 | 217 | $this->content[$i]=$this->createSegment($i, "New content", $menu->getItem($i)->getIdentifier()); |
| 218 | 218 | } |
| 219 | - $menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab")); |
|
| 219 | + $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | $this->content["menu"]=$menu; |
@@ -228,15 +228,15 @@ discard block |
||
| 228 | 228 | * @see BaseHtml::run() |
| 229 | 229 | */ |
| 230 | 230 | public function run(JsUtils $js) { |
| 231 | - if(isset($this->_bsComponent)===false) |
|
| 232 | - $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
| 231 | + if (isset($this->_bsComponent)===false) |
|
| 232 | + $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item", $this->params); |
|
| 233 | 233 | $this->addEventsOnRun($js); |
| 234 | 234 | return $this->_bsComponent; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 238 | - if($this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
| 238 | + if ($this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
| 239 | 239 | $this->activate(0); |
| 240 | - return parent::compile($js,$view); |
|
| 240 | + return parent::compile($js, $view); |
|
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | \ No newline at end of file |
@@ -8,52 +8,52 @@ |
||
| 8 | 8 | class HtmlStepItem extends HtmlAbsractItem { |
| 9 | 9 | |
| 10 | 10 | public function __construct($identifier, $content) { |
| 11 | - parent::__construct($identifier,"step",$content); |
|
| 11 | + parent::__construct($identifier, "step", $content); |
|
| 12 | 12 | } |
| 13 | - protected function initContent($content){ |
|
| 14 | - if(\is_array($content)){ |
|
| 15 | - if(JArray::isAssociative($content)===false){ |
|
| 13 | + protected function initContent($content) { |
|
| 14 | + if (\is_array($content)) { |
|
| 15 | + if (JArray::isAssociative($content)===false) { |
|
| 16 | 16 | $icon=@$content[0]; |
| 17 | 17 | $title=@$content[1]; |
| 18 | 18 | $desc=@$content[2]; |
| 19 | 19 | $status=@$content[3]; |
| 20 | - }else{ |
|
| 20 | + } else { |
|
| 21 | 21 | $icon=@$content["icon"]; |
| 22 | 22 | $title=@$content["title"]; |
| 23 | 23 | $desc=@$content["description"]; |
| 24 | 24 | $status=@$content["status"]; |
| 25 | 25 | } |
| 26 | - if(isset($icon)){ |
|
| 26 | + if (isset($icon)) { |
|
| 27 | 27 | $this->setIcon($icon); |
| 28 | 28 | } |
| 29 | - if(isset($status)){ |
|
| 29 | + if (isset($status)) { |
|
| 30 | 30 | $this->setStatus($status); |
| 31 | 31 | } |
| 32 | - if(isset($title)){ |
|
| 33 | - $this->setTitle($title,$desc); |
|
| 32 | + if (isset($title)) { |
|
| 33 | + $this->setTitle($title, $desc); |
|
| 34 | 34 | } |
| 35 | - }else{ |
|
| 35 | + } else { |
|
| 36 | 36 | $this->setContent($content); |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function setActive($value=true){ |
|
| 41 | - if($value) |
|
| 40 | + public function setActive($value=true) { |
|
| 41 | + if ($value) |
|
| 42 | 42 | $this->setStatus(StepStatus::ACTIVE); |
| 43 | 43 | else |
| 44 | 44 | $this->setStatus(StepStatus::NONE); |
| 45 | 45 | return $this; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function setCompleted(){ |
|
| 48 | + public function setCompleted() { |
|
| 49 | 49 | return $this->setStatus(StepStatus::COMPLETED); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function setStatus($status){ |
|
| 52 | + public function setStatus($status) { |
|
| 53 | 53 | return $this->addToPropertyCtrl("class", $status, StepStatus::getConstants()); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function removeStatus(){ |
|
| 56 | + public function removeStatus() { |
|
| 57 | 57 | $this->removePropertyValues("class", StepStatus::getConstants()); |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | \ No newline at end of file |
@@ -9,27 +9,27 @@ |
||
| 9 | 9 | class HtmlMenuItem extends HtmlSemDoubleElement { |
| 10 | 10 | use MenuItemTrait; |
| 11 | 11 | public function __construct($identifier, $content) { |
| 12 | - parent::__construct($identifier,"div","item",$content); |
|
| 12 | + parent::__construct($identifier, "div", "item", $content); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - protected function initContent($content){ |
|
| 16 | - if(\is_array($content)){ |
|
| 17 | - if(JArray::isAssociative($content)===false){ |
|
| 15 | + protected function initContent($content) { |
|
| 16 | + if (\is_array($content)) { |
|
| 17 | + if (JArray::isAssociative($content)===false) { |
|
| 18 | 18 | $icon=@$content[0]; |
| 19 | 19 | $title=@$content[1]; |
| 20 | 20 | $desc=@$content[2]; |
| 21 | - }else{ |
|
| 21 | + } else { |
|
| 22 | 22 | $icon=@$content["icon"]; |
| 23 | 23 | $title=@$content["title"]; |
| 24 | 24 | $desc=@$content["description"]; |
| 25 | 25 | } |
| 26 | - if(isset($icon)){ |
|
| 26 | + if (isset($icon)) { |
|
| 27 | 27 | $this->addIcon($icon); |
| 28 | 28 | } |
| 29 | - if(isset($title)){ |
|
| 30 | - $this->setTitle($title,$desc); |
|
| 29 | + if (isset($title)) { |
|
| 30 | + $this->setTitle($title, $desc); |
|
| 31 | 31 | } |
| 32 | - }else{ |
|
| 32 | + } else { |
|
| 33 | 33 | $this->setContent($content); |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -9,15 +9,15 @@ discard block |
||
| 9 | 9 | protected $image; |
| 10 | 10 | |
| 11 | 11 | public function __construct($identifier, $content=NULL) { |
| 12 | - parent::__construct($identifier,"item",$content); |
|
| 12 | + parent::__construct($identifier, "item", $content); |
|
| 13 | 13 | } |
| 14 | - protected function initContent($content){ |
|
| 15 | - if(\is_array($content)){ |
|
| 16 | - if(JArray::isAssociative($content)===false){ |
|
| 14 | + protected function initContent($content) { |
|
| 15 | + if (\is_array($content)) { |
|
| 16 | + if (JArray::isAssociative($content)===false) { |
|
| 17 | 17 | $icon=@$content[0]; |
| 18 | 18 | $title=@$content[1]; |
| 19 | 19 | $desc=@$content[2]; |
| 20 | - }else{ |
|
| 20 | + } else { |
|
| 21 | 21 | $icon=@$content["icon"]; |
| 22 | 22 | $image=@$content["image"]; |
| 23 | 23 | $title=@$content["title"]; |
@@ -25,21 +25,21 @@ discard block |
||
| 25 | 25 | $desc=@$content["description"]; |
| 26 | 26 | $items=@$content["items"]; |
| 27 | 27 | } |
| 28 | - if(isset($icon)){ |
|
| 28 | + if (isset($icon)) { |
|
| 29 | 29 | $this->setIcon($icon); |
| 30 | 30 | } |
| 31 | - if(isset($image)){ |
|
| 31 | + if (isset($image)) { |
|
| 32 | 32 | $this->setImage($image); |
| 33 | 33 | } |
| 34 | - if(isset($title)){ |
|
| 35 | - $this->setTitle($title,$desc); |
|
| 36 | - }elseif (isset($header)===true){ |
|
| 37 | - $this->setTitle($header,$desc,"header"); |
|
| 34 | + if (isset($title)) { |
|
| 35 | + $this->setTitle($title, $desc); |
|
| 36 | + }elseif (isset($header)===true) { |
|
| 37 | + $this->setTitle($header, $desc, "header"); |
|
| 38 | 38 | } |
| 39 | - if(isset($items)){ |
|
| 39 | + if (isset($items)) { |
|
| 40 | 40 | $this->addList($items); |
| 41 | 41 | } |
| 42 | - }else{ |
|
| 42 | + } else { |
|
| 43 | 43 | $this->setContent($content); |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | return $list; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function getList(){ |
|
| 53 | + public function getList() { |
|
| 54 | 54 | return $this->content["list"]; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public function getItem($index){ |
|
| 57 | + public function getItem($index) { |
|
| 58 | 58 | return $this->getList()->getItem($index); |
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | \ No newline at end of file |
@@ -14,34 +14,34 @@ discard block |
||
| 14 | 14 | use FieldTrait; |
| 15 | 15 | protected $_container; |
| 16 | 16 | protected $_validation; |
| 17 | - public function __construct($identifier, $field,$label=NULL) { |
|
| 18 | - parent::__construct($identifier, "div","field"); |
|
| 17 | + public function __construct($identifier, $field, $label=NULL) { |
|
| 18 | + parent::__construct($identifier, "div", "field"); |
|
| 19 | 19 | $this->content=array(); |
| 20 | - $this->_states=[State::ERROR,State::DISABLED]; |
|
| 21 | - if(isset($label)) |
|
| 20 | + $this->_states=[State::ERROR, State::DISABLED]; |
|
| 21 | + if (isset($label)) |
|
| 22 | 22 | $this->setLabel($label); |
| 23 | 23 | $this->setField($field); |
| 24 | 24 | $this->_validation=NULL; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function addPointingLabel($label,$pointing=Direction::NONE){ |
|
| 28 | - $labelO=new HtmlLabel("",$label); |
|
| 27 | + public function addPointingLabel($label, $pointing=Direction::NONE) { |
|
| 28 | + $labelO=new HtmlLabel("", $label); |
|
| 29 | 29 | $labelO->setPointing($pointing); |
| 30 | - $this->addContent($labelO,$pointing==="below" || $pointing==="right"); |
|
| 30 | + $this->addContent($labelO, $pointing==="below" || $pointing==="right"); |
|
| 31 | 31 | return $labelO; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function setLabel($label){ |
|
| 34 | + public function setLabel($label) { |
|
| 35 | 35 | $labelO=$label; |
| 36 | - if(\is_string($label)){ |
|
| 37 | - $labelO=new HtmlSemDoubleElement("","label",""); |
|
| 36 | + if (\is_string($label)) { |
|
| 37 | + $labelO=new HtmlSemDoubleElement("", "label", ""); |
|
| 38 | 38 | $labelO->setContent($label); |
| 39 | - $labelO->setProperty("for", \str_replace("field-", "",$this->identifier)); |
|
| 39 | + $labelO->setProperty("for", \str_replace("field-", "", $this->identifier)); |
|
| 40 | 40 | } |
| 41 | 41 | $this->content["label"]=$labelO; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function setField($field){ |
|
| 44 | + public function setField($field) { |
|
| 45 | 45 | $this->content["field"]=$field; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | * Returns the label or null |
| 50 | 50 | * @return mixed |
| 51 | 51 | */ |
| 52 | - public function getLabel(){ |
|
| 53 | - if(\array_key_exists("label", $this->content)) |
|
| 52 | + public function getLabel() { |
|
| 53 | + if (\array_key_exists("label", $this->content)) |
|
| 54 | 54 | return $this->content["label"]; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * Return the field |
| 59 | 59 | * @return mixed |
| 60 | 60 | */ |
| 61 | - public function getField(){ |
|
| 61 | + public function getField() { |
|
| 62 | 62 | return $this->content["field"]; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -66,14 +66,14 @@ discard block |
||
| 66 | 66 | * Return the field with data |
| 67 | 67 | * @return mixed |
| 68 | 68 | */ |
| 69 | - public function getDataField(){ |
|
| 69 | + public function getDataField() { |
|
| 70 | 70 | return $this->content["field"]; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * puts the label before or behind |
| 75 | 75 | */ |
| 76 | - public function swapLabel(){ |
|
| 76 | + public function swapLabel() { |
|
| 77 | 77 | $label=$this->getLabel(); |
| 78 | 78 | unset($this->content["label"]); |
| 79 | 79 | $this->content["label"]=$label; |
@@ -84,31 +84,31 @@ discard block |
||
| 84 | 84 | * @param int $width |
| 85 | 85 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
| 86 | 86 | */ |
| 87 | - public function setWidth($width){ |
|
| 88 | - if(\is_int($width)){ |
|
| 87 | + public function setWidth($width) { |
|
| 88 | + if (\is_int($width)) { |
|
| 89 | 89 | $width=Wide::getConstants()["W".$width]; |
| 90 | 90 | } |
| 91 | 91 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 92 | - if(isset($this->_container)){ |
|
| 92 | + if (isset($this->_container)) { |
|
| 93 | 93 | $this->_container->setEqualWidth(false); |
| 94 | 94 | } |
| 95 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
| 95 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * Field displays an error state |
| 100 | 100 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
| 101 | 101 | */ |
| 102 | - public function setError(){ |
|
| 102 | + public function setError() { |
|
| 103 | 103 | return $this->addToProperty("class", "error"); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - public function setInline(){ |
|
| 106 | + public function setInline() { |
|
| 107 | 107 | return $this->addToProperty("class", "inline"); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public function jsState($state){ |
|
| 111 | - return $this->jsDoJquery("addClass",$state); |
|
| 110 | + public function jsState($state) { |
|
| 111 | + return $this->jsDoJquery("addClass", $state); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | public function setContainer($_container) { |
@@ -116,26 +116,26 @@ discard block |
||
| 116 | 116 | return $this; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public function setReadonly(){ |
|
| 119 | + public function setReadonly() { |
|
| 120 | 120 | $this->getField()->setProperty("readonly", ""); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function addRule($type,$prompt=NULL,$value=NULL){ |
|
| 123 | + public function addRule($type, $prompt=NULL, $value=NULL) { |
|
| 124 | 124 | $field=$this->getDataField(); |
| 125 | - if(isset($field)){ |
|
| 126 | - if(!isset($this->_validation)){ |
|
| 125 | + if (isset($field)) { |
|
| 126 | + if (!isset($this->_validation)) { |
|
| 127 | 127 | $this->_validation=new FieldValidation($field->getIdentifier()); |
| 128 | 128 | } |
| 129 | - if($type==="empty"){ |
|
| 130 | - $this->addToProperty("class","required"); |
|
| 129 | + if ($type==="empty") { |
|
| 130 | + $this->addToProperty("class", "required"); |
|
| 131 | 131 | } |
| 132 | - $this->_validation->addRule($type,$prompt,$value); |
|
| 132 | + $this->_validation->addRule($type, $prompt, $value); |
|
| 133 | 133 | } |
| 134 | 134 | return $this; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - public function addRules(array $rules){ |
|
| 138 | - foreach ($rules as $rule){ |
|
| 137 | + public function addRules(array $rules) { |
|
| 138 | + foreach ($rules as $rule) { |
|
| 139 | 139 | $this->addRule($rule); |
| 140 | 140 | } |
| 141 | 141 | return $this; |
@@ -39,20 +39,20 @@ discard block |
||
| 39 | 39 | * @return \Ajax\semantic\html\collections\HtmlMenu |
| 40 | 40 | */ |
| 41 | 41 | public function setType($type="") { |
| 42 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
| 42 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public function setActiveItem($index) { |
| 46 | 46 | $item=$this->getItem($index); |
| 47 | - if ($item !== null) { |
|
| 47 | + if ($item!==null) { |
|
| 48 | 48 | $item->addToProperty("class", "active"); |
| 49 | 49 | } |
| 50 | 50 | return $this; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | private function getItemToInsert($item) { |
| 54 | - if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButtonGroups || $item instanceof HtmlButton ) { |
|
| 55 | - $itemO=new HtmlMenuItem("item-" . $this->identifier . "-" . \sizeof($this->content) , $item); |
|
| 54 | + if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButtonGroups || $item instanceof HtmlButton) { |
|
| 55 | + $itemO=new HtmlMenuItem("item-".$this->identifier."-".\sizeof($this->content), $item); |
|
| 56 | 56 | $item=$itemO; |
| 57 | 57 | } |
| 58 | 58 | return $item; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | private function afterInsert($item) { |
| 62 | 62 | if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) |
| 63 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 63 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
| 64 | 64 | else { |
| 65 | 65 | $this->setSecondary(); |
| 66 | 66 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | public function addItem($item) { |
| 77 | 77 | $number=$item; |
| 78 | 78 | $item=parent::addItem($this->getItemToInsert($item)); |
| 79 | - if(\is_int($number)) |
|
| 79 | + if (\is_int($number)) |
|
| 80 | 80 | $item->setProperty("data-page", $number); |
| 81 | 81 | return $this->afterInsert($item); |
| 82 | 82 | } |
@@ -94,15 +94,15 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | public function generateMenuAsItem($menu, $header=null) { |
| 96 | 96 | $count=$this->count(); |
| 97 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
| 97 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
| 98 | 98 | if (isset($header)) { |
| 99 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
| 99 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
| 100 | 100 | $headerItem->setContent($header); |
| 101 | 101 | $item->addContent($headerItem); |
| 102 | 102 | $this->_itemHeader=$headerItem; |
| 103 | 103 | } |
| 104 | - if(\is_array($menu)){ |
|
| 105 | - $menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu); |
|
| 104 | + if (\is_array($menu)) { |
|
| 105 | + $menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu); |
|
| 106 | 106 | } |
| 107 | 107 | $menu->setClass("menu"); |
| 108 | 108 | $item->addContent($menu); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
| 118 | 118 | $value->addContent(new HtmlIcon("", "dropdown")); |
| 119 | 119 | $value=$this->addItem($value); |
| 120 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
| 120 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
| 121 | 121 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
| 122 | 122 | $this->wrap("", $popup); |
| 123 | 123 | return $popup; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | public function addDropdownAsItem($value, $items=NULL) { |
| 127 | 127 | $dd=$value; |
| 128 | 128 | if (\is_string($value)) { |
| 129 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
| 129 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
| 130 | 130 | } |
| 131 | 131 | $this->addItem($dd); |
| 132 | 132 | return $dd; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 140 | 140 | */ |
| 141 | 141 | protected function createItem($value) { |
| 142 | - $itemO=new HtmlMenuItem($this->identifier."-item-" . \sizeof($this->content),""); |
|
| 142 | + $itemO=new HtmlMenuItem($this->identifier."-item-".\sizeof($this->content), ""); |
|
| 143 | 143 | $itemO->setTagName("a"); |
| 144 | 144 | $itemO->setContent($value); |
| 145 | 145 | return $itemO; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | public function setSecondary($value=true) { |
| 153 | - if($value) |
|
| 153 | + if ($value) |
|
| 154 | 154 | $this->addToProperty("class", "secondary"); |
| 155 | 155 | else |
| 156 | 156 | $this->removePropertyValue("class", "secondary"); |
@@ -158,28 +158,28 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | public function setVertical() { |
| 161 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
| 161 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | public function setPosition($value="right") { |
| 165 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
| 165 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | public function setPointing($value=Direction::NONE) { |
| 169 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
| 169 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | public function asTab($vertical=false) { |
| 173 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 173 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
| 174 | 174 | $item->setTagName("a"); |
| 175 | 175 | }); |
| 176 | - if ($vertical === true) |
|
| 176 | + if ($vertical===true) |
|
| 177 | 177 | $this->setVertical(); |
| 178 | 178 | return $this->addToProperty("class", "tabular"); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | public function asPagination() { |
| 182 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 182 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
| 183 | 183 | $item->setTagName("a"); |
| 184 | 184 | }); |
| 185 | 185 | return $this->addToProperty("class", "pagination"); |
@@ -216,10 +216,10 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | public function setWidth($width) { |
| 218 | 218 | if (\is_int($width)) { |
| 219 | - $width=Wide::getConstants()["W" . $width]; |
|
| 219 | + $width=Wide::getConstants()["W".$width]; |
|
| 220 | 220 | } |
| 221 | 221 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 222 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 222 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | public function addImage($identifier, $src="", $alt="") { |
@@ -234,8 +234,8 @@ discard block |
||
| 234 | 234 | return $this->_itemHeader; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - public function run(JsUtils $js){ |
|
| 238 | - $result= parent::run($js); |
|
| 237 | + public function run(JsUtils $js) { |
|
| 238 | + $result=parent::run($js); |
|
| 239 | 239 | return $result->setItemSelector(".item"); |
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | \ No newline at end of file |