@@ -9,7 +9,7 @@ |
||
9 | 9 | * @see \Ajax\common\SimpleComponent::compileEvents() |
10 | 10 | */ |
11 | 11 | protected function compileEvents() { |
12 | - foreach ( $this->events as $event => $jsCode ) { |
|
12 | + foreach ($this->events as $event => $jsCode) { |
|
13 | 13 | if ($event==="buttonClick") { |
14 | 14 | $this->jquery_code_for_compile []="$( \"#split-".preg_replace('/[^a-zA-Z0-9\-.]/s', '', $this->attachTo)."\" ).on(\"click\" , function( event, data ) {".$jsCode."});"; |
15 | 15 | } else { |
@@ -17,7 +17,7 @@ discard block |
||
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"]; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | if(isset($title)===true){ |
33 | 33 | $this->setTitle($title,$desc); |
34 | 34 | } |
35 | - }else{ |
|
35 | + } else{ |
|
36 | 36 | $this->setContent($content); |
37 | 37 | } |
38 | 38 | } |
@@ -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 | } |
@@ -1,39 +1,39 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace Ajax\php\ci; |
3 | 3 | |
4 | -class JsUtils extends \Ajax\JsUtils{ |
|
4 | +class JsUtils extends \Ajax\JsUtils { |
|
5 | 5 | protected $ci; |
6 | - protected $_my_controller_paths= array(); |
|
7 | - protected $_my_controllers= array(); |
|
6 | + protected $_my_controller_paths=array(); |
|
7 | + protected $_my_controllers=array(); |
|
8 | 8 | |
9 | - public function __construct($params=array(),$injected=NULL){ |
|
10 | - parent::__construct($params,$injected); |
|
11 | - $this->_my_controller_paths = array(APPPATH); |
|
9 | + public function __construct($params=array(), $injected=NULL) { |
|
10 | + parent::__construct($params, $injected); |
|
11 | + $this->_my_controller_paths=array(APPPATH); |
|
12 | 12 | } |
13 | - public function getUrl($url){ |
|
13 | + public function getUrl($url) { |
|
14 | 14 | return site_url($url); |
15 | 15 | } |
16 | 16 | |
17 | - public function getCi(){ |
|
18 | - if(isset($this->ci)===false){ |
|
19 | - $this->ci =& get_instance(); |
|
17 | + public function getCi() { |
|
18 | + if (isset($this->ci)===false) { |
|
19 | + $this->ci=& get_instance(); |
|
20 | 20 | $this->ci->load->helper('url'); |
21 | 21 | } |
22 | 22 | return $this->ci; |
23 | 23 | } |
24 | 24 | |
25 | - public function addViewElement($identifier,$content,&$view){ |
|
26 | - if(\array_key_exists("q", $view)===false){ |
|
25 | + public function addViewElement($identifier, $content, &$view) { |
|
26 | + if (\array_key_exists("q", $view)===false) { |
|
27 | 27 | $view["q"]=array(); |
28 | 28 | } |
29 | 29 | $view["q"][$identifier]=$content; |
30 | 30 | } |
31 | 31 | |
32 | - public function createScriptVariable(&$view,$view_var, $output){ |
|
32 | + public function createScriptVariable(&$view, $view_var, $output) { |
|
33 | 33 | $view[$view_var]=$output; |
34 | 34 | } |
35 | 35 | |
36 | - public function forward($initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
36 | + public function forward($initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
37 | 37 | $ci=$this->getCi(); |
38 | 38 | $controllerName=strtolower($controllerName); |
39 | 39 | $this->controller($controllerName); |
@@ -44,64 +44,64 @@ discard block |
||
44 | 44 | return $result; |
45 | 45 | } |
46 | 46 | |
47 | - public function renderContent($initialControllerInstance,$viewName, $params=NULL) { |
|
47 | + public function renderContent($initialControllerInstance, $viewName, $params=NULL) { |
|
48 | 48 | return $initialControllerInstance->load->view($viewName, $params, true); |
49 | 49 | } |
50 | 50 | |
51 | - public function fromDispatcher($dispatcher){ |
|
51 | + public function fromDispatcher($dispatcher) { |
|
52 | 52 | return array_values($dispatcher->uri->segment_array()); |
53 | 53 | } |
54 | 54 | |
55 | - public function controller($controller, $name = '', $db_conn = FALSE){ |
|
56 | - if (is_array($controller)){ |
|
57 | - foreach ($controller as $babe){ |
|
55 | + public function controller($controller, $name='', $db_conn=FALSE) { |
|
56 | + if (is_array($controller)) { |
|
57 | + foreach ($controller as $babe) { |
|
58 | 58 | $this->controller($babe); |
59 | 59 | } |
60 | 60 | return; |
61 | 61 | } |
62 | - if ($controller == ''){ |
|
62 | + if ($controller=='') { |
|
63 | 63 | return; |
64 | 64 | } |
65 | - $path = ''; |
|
65 | + $path=''; |
|
66 | 66 | // Is the controller in a sub-folder? If so, parse out the filename and path. |
67 | - if (($last_slash = strrpos($controller, '/')) !== FALSE){ |
|
67 | + if (($last_slash=strrpos($controller, '/'))!==FALSE) { |
|
68 | 68 | // The path is in front of the last slash |
69 | - $path = substr($controller, 0, $last_slash + 1); |
|
69 | + $path=substr($controller, 0, $last_slash+1); |
|
70 | 70 | // And the controller name behind it |
71 | - $controller = substr($controller, $last_slash + 1); |
|
71 | + $controller=substr($controller, $last_slash+1); |
|
72 | 72 | } |
73 | 73 | |
74 | - if ($name == ''){ |
|
75 | - $name = $controller; |
|
74 | + if ($name=='') { |
|
75 | + $name=$controller; |
|
76 | 76 | } |
77 | 77 | |
78 | - if (in_array($name, $this->_my_controllers, TRUE)){ |
|
78 | + if (in_array($name, $this->_my_controllers, TRUE)) { |
|
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
82 | - $CI =$this->getCi(); |
|
83 | - if (isset($CI->$name)){ |
|
82 | + $CI=$this->getCi(); |
|
83 | + if (isset($CI->$name)) { |
|
84 | 84 | show_error('The controller name you are loading is the name of a resource that is already being used: '.$name); |
85 | 85 | } |
86 | - $controller = strtolower($controller); |
|
87 | - foreach ($this->_my_controller_paths as $mod_path){ |
|
88 | - if ( ! file_exists($mod_path.'controllers/'.$path.$controller.'.php')){ |
|
86 | + $controller=strtolower($controller); |
|
87 | + foreach ($this->_my_controller_paths as $mod_path) { |
|
88 | + if (!file_exists($mod_path.'controllers/'.$path.$controller.'.php')) { |
|
89 | 89 | continue; |
90 | 90 | } |
91 | - if ($db_conn !== FALSE AND ! class_exists('CI_DB')){ |
|
92 | - if ($db_conn === TRUE){ |
|
93 | - $db_conn = ''; |
|
91 | + if ($db_conn!==FALSE AND !class_exists('CI_DB')) { |
|
92 | + if ($db_conn===TRUE) { |
|
93 | + $db_conn=''; |
|
94 | 94 | } |
95 | 95 | $CI->load->database($db_conn, FALSE, TRUE); |
96 | 96 | } |
97 | - if ( ! class_exists('CI_Controller')){ |
|
97 | + if (!class_exists('CI_Controller')) { |
|
98 | 98 | load_class('Controller', 'core'); |
99 | 99 | } |
100 | 100 | require_once($mod_path.'controllers/'.$path.$controller.'.php'); |
101 | - $controller = ucfirst($controller); |
|
102 | - $CI->$name = new $controller(); |
|
101 | + $controller=ucfirst($controller); |
|
102 | + $CI->$name=new $controller(); |
|
103 | 103 | |
104 | - $this->_my_controllers[] = $name; |
|
104 | + $this->_my_controllers[]=$name; |
|
105 | 105 | return; |
106 | 106 | } |
107 | 107 | show_error('Unable to locate the controller you have specified: '.$controller); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | $viewVars=$view->viewVars; |
14 | 14 | if (isset($viewVars["q"]) === false) { |
15 | 15 | $controls=array (); |
16 | - }else{ |
|
16 | + } else{ |
|
17 | 17 | $controls=$viewVars["q"]; |
18 | 18 | } |
19 | 19 | $controls[$identifier]=$content; |
@@ -8,23 +8,23 @@ discard block |
||
8 | 8 | use Cake\Network\Response; |
9 | 9 | use Cake\Core\App; |
10 | 10 | |
11 | -class _JsUtils extends \Ajax\JsUtils{ |
|
12 | - public function getUrl($url){ |
|
11 | +class _JsUtils extends \Ajax\JsUtils { |
|
12 | + public function getUrl($url) { |
|
13 | 13 | return Router::url($url); |
14 | 14 | } |
15 | - public function addViewElement($identifier,$content,&$view){ |
|
15 | + public function addViewElement($identifier, $content, &$view) { |
|
16 | 16 | $viewVars=$view->viewVars; |
17 | - if (isset($viewVars["q"]) === false) { |
|
18 | - $controls=array (); |
|
19 | - }else{ |
|
17 | + if (isset($viewVars["q"])===false) { |
|
18 | + $controls=array(); |
|
19 | + } else { |
|
20 | 20 | $controls=$viewVars["q"]; |
21 | 21 | } |
22 | 22 | $controls[$identifier]=$content; |
23 | 23 | $view->set("q", $controls); |
24 | 24 | } |
25 | 25 | |
26 | - public function createScriptVariable(&$view,$view_var, $output){ |
|
27 | - $view->set($view_var,$output); |
|
26 | + public function createScriptVariable(&$view, $view_var, $output) { |
|
27 | + $view->set($view_var, $output); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -34,18 +34,18 @@ discard block |
||
34 | 34 | * @param array $params |
35 | 35 | * @see \Ajax\JsUtils::forward() |
36 | 36 | */ |
37 | - public function forward($initialControllerInstance,$controllerName,$actionName,$params=array()){ |
|
37 | + public function forward($initialControllerInstance, $controllerName, $actionName, $params=array()) { |
|
38 | 38 | \ob_start(); |
39 | - if(isset($params) && \is_array($params)===false){ |
|
39 | + if (isset($params) && \is_array($params)===false) { |
|
40 | 40 | $params=[$params]; |
41 | 41 | } |
42 | 42 | $url=h(Router::url(\array_merge([ |
43 | 43 | 'controller' => $controllerName, |
44 | - 'action' => $actionName],$params),false |
|
44 | + 'action' => $actionName], $params), false |
|
45 | 45 | )); |
46 | 46 | $base=Router::url("/"); |
47 | - if (substr($url, 0, strlen($base)) == $base) { |
|
48 | - $url = substr($url, strlen($base)); |
|
47 | + if (substr($url, 0, strlen($base))==$base) { |
|
48 | + $url=substr($url, strlen($base)); |
|
49 | 49 | } |
50 | 50 | $initialControllerInstance->requestAction($url); |
51 | 51 | $result=\ob_get_contents(); |
@@ -53,17 +53,17 @@ discard block |
||
53 | 53 | return $result; |
54 | 54 | } |
55 | 55 | |
56 | - public function renderContent($initialControllerInstance,$viewName, $params=NULL) { |
|
57 | - $view = new View(Router::getRequest(true), new Response()); |
|
58 | - if(\is_array($params)){ |
|
59 | - foreach ($params as $k=>$v){ |
|
56 | + public function renderContent($initialControllerInstance, $viewName, $params=NULL) { |
|
57 | + $view=new View(Router::getRequest(true), new Response()); |
|
58 | + if (\is_array($params)) { |
|
59 | + foreach ($params as $k=>$v) { |
|
60 | 60 | $view->set($k, $v); |
61 | 61 | } |
62 | 62 | } |
63 | 63 | return $view->render($viewName); |
64 | 64 | } |
65 | 65 | |
66 | - public function fromDispatcher($dispatcher){ |
|
66 | + public function fromDispatcher($dispatcher) { |
|
67 | 67 | return \explode("/", Router::getRequest(true)->url); |
68 | 68 | } |
69 | 69 | } |
70 | 70 | \ No newline at end of file |
@@ -11,10 +11,10 @@ |
||
11 | 11 | * @var Ajax\php\cakephp\_JsUtils |
12 | 12 | */ |
13 | 13 | public $jquery; |
14 | - public function initialize(array $config){ |
|
14 | + public function initialize(array $config) { |
|
15 | 15 | \extract($config); |
16 | 16 | $this->jquery=new _JsUtils(); |
17 | - if(isset($semantic)){ |
|
17 | + if (isset($semantic)) { |
|
18 | 18 | $this->jquery->semantic(new Semantic()); |
19 | 19 | } |
20 | 20 | } |
@@ -4,34 +4,34 @@ |
||
4 | 4 | |
5 | 5 | use micro\controllers\Startup; |
6 | 6 | use micro\utils\RequestUtils; |
7 | -class JsUtils extends \Ajax\JsUtils{ |
|
7 | +class JsUtils extends \Ajax\JsUtils { |
|
8 | 8 | |
9 | - public function getUrl($url){ |
|
9 | + public function getUrl($url) { |
|
10 | 10 | return RequestUtils::getUrl($url); |
11 | 11 | } |
12 | 12 | |
13 | - public function addViewElement($identifier,$content,&$view){ |
|
13 | + public function addViewElement($identifier, $content, &$view) { |
|
14 | 14 | $controls=$view->getVar("q"); |
15 | - if (isset($controls) === false) { |
|
16 | - $controls=array (); |
|
15 | + if (isset($controls)===false) { |
|
16 | + $controls=array(); |
|
17 | 17 | } |
18 | 18 | $controls[$identifier]=$content; |
19 | 19 | $view->setVar("q", $controls); |
20 | 20 | } |
21 | 21 | |
22 | - public function createScriptVariable(&$view,$view_var, $output){ |
|
23 | - $view->setVar($view_var,$output); |
|
22 | + public function createScriptVariable(&$view, $view_var, $output) { |
|
23 | + $view->setVar($view_var, $output); |
|
24 | 24 | } |
25 | 25 | |
26 | - public function forward($initialController,$controller,$action,$params=array()){ |
|
27 | - return $initialController->forward($controller,$action,$params,true,true,true); |
|
26 | + public function forward($initialController, $controller, $action, $params=array()) { |
|
27 | + return $initialController->forward($controller, $action, $params, true, true, true); |
|
28 | 28 | } |
29 | 29 | |
30 | - public function renderContent($initialControllerInstance,$viewName, $params=NULL) { |
|
31 | - return $initialControllerInstance->loadView($viewName,$params,true); |
|
30 | + public function renderContent($initialControllerInstance, $viewName, $params=NULL) { |
|
31 | + return $initialControllerInstance->loadView($viewName, $params, true); |
|
32 | 32 | } |
33 | 33 | |
34 | - public function fromDispatcher($dispatcher){ |
|
34 | + public function fromDispatcher($dispatcher) { |
|
35 | 35 | return Startup::$urlParts; |
36 | 36 | } |
37 | 37 | } |
38 | 38 | \ No newline at end of file |
@@ -17,7 +17,7 @@ discard block |
||
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"]; |
@@ -32,16 +32,17 @@ discard block |
||
32 | 32 | if(isset($title)===true){ |
33 | 33 | $this->setTitle($title,$desc); |
34 | 34 | } |
35 | - }else{ |
|
35 | + } else{ |
|
36 | 36 | $this->setContent($content); |
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setActive($value=true){ |
41 | - if($value) |
|
42 | - $this->setStatus(StepStatus::ACTIVE); |
|
43 | - else |
|
44 | - $this->setStatus(StepStatus::NONE); |
|
41 | + if($value) { |
|
42 | + $this->setStatus(StepStatus::ACTIVE); |
|
43 | + } else { |
|
44 | + $this->setStatus(StepStatus::NONE); |
|
45 | + } |
|
45 | 46 | return $this; |
46 | 47 | } |
47 | 48 |
@@ -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 |
@@ -67,8 +67,9 @@ discard block |
||
67 | 67 | if($index<$menu->count()){ |
68 | 68 | if(isset($this->content[$index])===false){ |
69 | 69 | $this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index)->getIdentifier()); |
70 | - }else |
|
71 | - $this->content[$index]->setContent($content); |
|
70 | + } else { |
|
71 | + $this->content[$index]->setContent($content); |
|
72 | + } |
|
72 | 73 | } |
73 | 74 | return $this; |
74 | 75 | } |
@@ -228,15 +229,17 @@ discard block |
||
228 | 229 | * @see BaseHtml::run() |
229 | 230 | */ |
230 | 231 | public function run(JsUtils $js) { |
231 | - if(isset($this->_bsComponent)===false) |
|
232 | - $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
232 | + if(isset($this->_bsComponent)===false) { |
|
233 | + $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
234 | + } |
|
233 | 235 | $this->addEventsOnRun($js); |
234 | 236 | return $this->_bsComponent; |
235 | 237 | } |
236 | 238 | |
237 | 239 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
238 | - if($this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
239 | - $this->activate(0); |
|
240 | + if($this->content["menu"]->count()>0 && \sizeof($this->content)>1) { |
|
241 | + $this->activate(0); |
|
242 | + } |
|
240 | 243 | return parent::compile($js,$view); |
241 | 244 | } |
242 | 245 | } |
243 | 246 | \ No newline at end of file |
@@ -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 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * @param string $placeholder |
27 | 27 | * @param string $icon |
28 | - * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
|
28 | + * @return MenuItemTrait |
|
29 | 29 | */ |
30 | 30 | public function asSearchInput($placeholder=NULL,$icon=NULL){ |
31 | 31 | $this->setClass("ui icon search input"); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | - * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
|
42 | + * @return MenuItemTrait |
|
43 | 43 | */ |
44 | 44 | public function asDivider(){ |
45 | 45 | $this->content=NULL; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * @param string $caption |
53 | 53 | * @param string $icon |
54 | - * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
|
54 | + * @return MenuItemTrait |
|
55 | 55 | */ |
56 | 56 | public function asHeader($caption=NULL,$icon=NULL){ |
57 | 57 | $this->setClass("header"); |
@@ -8,16 +8,16 @@ discard block |
||
8 | 8 | |
9 | 9 | trait MenuItemTrait { |
10 | 10 | |
11 | - public function setContent($content){ |
|
12 | - if($content==="-"){ |
|
11 | + public function setContent($content) { |
|
12 | + if ($content==="-") { |
|
13 | 13 | $this->asDivider(); |
14 | - }elseif($content==="-search-"){ |
|
15 | - $values=\explode(",",$content,-1); |
|
16 | - $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
|
17 | - }elseif(JString::startswith($content, "-")){ |
|
18 | - $content=\ltrim($content,"-"); |
|
14 | + }elseif ($content==="-search-") { |
|
15 | + $values=\explode(",", $content, -1); |
|
16 | + $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."), JArray::getDefaultValue($values, 1, "search")); |
|
17 | + }elseif (JString::startswith($content, "-")) { |
|
18 | + $content=\ltrim($content, "-"); |
|
19 | 19 | $this->asHeader($content); |
20 | - }else |
|
20 | + } else |
|
21 | 21 | parent::setContent($content); |
22 | 22 | return $this; |
23 | 23 | } |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | * @param string $icon |
28 | 28 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
29 | 29 | */ |
30 | - public function asSearchInput($placeholder=NULL,$icon=NULL){ |
|
30 | + public function asSearchInput($placeholder=NULL, $icon=NULL) { |
|
31 | 31 | $this->setClass("ui icon search input"); |
32 | 32 | $input=new HtmlInput("search-".$this->identifier); |
33 | - if(isset($placeholder)) |
|
33 | + if (isset($placeholder)) |
|
34 | 34 | $input->setProperty("placeholder", $placeholder); |
35 | 35 | $this->content=$input; |
36 | - if(isset($icon)) |
|
36 | + if (isset($icon)) |
|
37 | 37 | $this->addIcon($icon); |
38 | 38 | return $this; |
39 | 39 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
43 | 43 | */ |
44 | - public function asDivider(){ |
|
44 | + public function asDivider() { |
|
45 | 45 | $this->content=NULL; |
46 | 46 | $this->tagName="div"; |
47 | 47 | $this->setClass("divider"); |
@@ -53,16 +53,16 @@ discard block |
||
53 | 53 | * @param string $icon |
54 | 54 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
55 | 55 | */ |
56 | - public function asHeader($caption=NULL,$icon=NULL){ |
|
56 | + public function asHeader($caption=NULL, $icon=NULL) { |
|
57 | 57 | $this->setClass("header"); |
58 | 58 | $this->tagName="div"; |
59 | 59 | $this->content=$caption; |
60 | - if(isset($icon)) |
|
61 | - $this->addIcon($icon,Direction::LEFT); |
|
60 | + if (isset($icon)) |
|
61 | + $this->addIcon($icon, Direction::LEFT); |
|
62 | 62 | return $this; |
63 | 63 | } |
64 | 64 | |
65 | - public function setPosition($direction){ |
|
66 | - $this->addToProperty("class",$direction); |
|
65 | + public function setPosition($direction) { |
|
66 | + $this->addToProperty("class", $direction); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | \ No newline at end of file |
@@ -11,14 +11,15 @@ discard block |
||
11 | 11 | public function setContent($content){ |
12 | 12 | if($content==="-"){ |
13 | 13 | $this->asDivider(); |
14 | - }elseif($content==="-search-"){ |
|
14 | + } elseif($content==="-search-"){ |
|
15 | 15 | $values=\explode(",",$content,-1); |
16 | 16 | $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
17 | - }elseif(JString::startswith($content, "-")){ |
|
17 | + } elseif(JString::startswith($content, "-")){ |
|
18 | 18 | $content=\ltrim($content,"-"); |
19 | 19 | $this->asHeader($content); |
20 | - }else |
|
21 | - parent::setContent($content); |
|
20 | + } else { |
|
21 | + parent::setContent($content); |
|
22 | + } |
|
22 | 23 | return $this; |
23 | 24 | } |
24 | 25 | |
@@ -30,11 +31,13 @@ discard block |
||
30 | 31 | public function asSearchInput($placeholder=NULL,$icon=NULL){ |
31 | 32 | $this->setClass("ui icon search input"); |
32 | 33 | $input=new HtmlInput("search-".$this->identifier); |
33 | - if(isset($placeholder)) |
|
34 | - $input->setProperty("placeholder", $placeholder); |
|
34 | + if(isset($placeholder)) { |
|
35 | + $input->setProperty("placeholder", $placeholder); |
|
36 | + } |
|
35 | 37 | $this->content=$input; |
36 | - if(isset($icon)) |
|
37 | - $this->addIcon($icon); |
|
38 | + if(isset($icon)) { |
|
39 | + $this->addIcon($icon); |
|
40 | + } |
|
38 | 41 | return $this; |
39 | 42 | } |
40 | 43 | |
@@ -57,8 +60,9 @@ discard block |
||
57 | 60 | $this->setClass("header"); |
58 | 61 | $this->tagName="div"; |
59 | 62 | $this->content=$caption; |
60 | - if(isset($icon)) |
|
61 | - $this->addIcon($icon,Direction::LEFT); |
|
63 | + if(isset($icon)) { |
|
64 | + $this->addIcon($icon,Direction::LEFT); |
|
65 | + } |
|
62 | 66 | return $this; |
63 | 67 | } |
64 | 68 |