@@ -6,13 +6,13 @@ |
||
| 6 | 6 | * @author Zilvinas Vaira |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -class Button extends Tag{ |
|
| 9 | +class Button extends Tag { |
|
| 10 | 10 | |
| 11 | 11 | const SUBMIT_TYPE = 'submit'; |
| 12 | 12 | const RESET_TYPE = 'reset'; |
| 13 | 13 | const BUTTON_TYPE = 'button'; |
| 14 | 14 | |
| 15 | - public function __construct($title, $type = self::SUBMIT_TYPE, $name = '', $value = '', $class = '', $id = ''){ |
|
| 15 | + public function __construct($title, $type = self::SUBMIT_TYPE, $name = '', $value = '', $class = '', $id = '') { |
|
| 16 | 16 | parent::__construct('button'); |
| 17 | 17 | $this->addAttribute('type', $type); |
| 18 | 18 | $this->addAttribute('name', $name); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @return UnaryTag[] |
| 23 | 23 | */ |
| 24 | - public function getTags(){ |
|
| 24 | + public function getTags() { |
|
| 25 | 25 | return $this->tags; |
| 26 | 26 | } |
| 27 | 27 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @return number |
| 31 | 31 | */ |
| 32 | - public function size(){ |
|
| 32 | + public function size() { |
|
| 33 | 33 | return count($this->tags); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | * {@inheritDoc} |
| 39 | 39 | * @see \lib\html\Tag::composeInnerString() |
| 40 | 40 | */ |
| 41 | - protected function composeInnerString(){ |
|
| 41 | + protected function composeInnerString() { |
|
| 42 | 42 | $innerString = "\n\t" . $this->tab . $this->text; |
| 43 | 43 | foreach ($this->tags as $tag) { |
| 44 | - $tag->setTab("\t".$this->tab); |
|
| 44 | + $tag->setTab("\t" . $this->tab); |
|
| 45 | 45 | $innerString .= $tag; |
| 46 | 46 | } |
| 47 | 47 | return $innerString; |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | |
| 4 | 4 | use web\lib\admin\view\html\Attribute; |
| 5 | 5 | |
| 6 | -class TitledFormDecorator extends PageElementDecorator{ |
|
| 6 | +class TitledFormDecorator extends PageElementDecorator { |
|
| 7 | 7 | |
| 8 | 8 | const BEFORE = 0; |
| 9 | 9 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @var array |
| 36 | 36 | */ |
| 37 | - private $elements = array( self::BEFORE => array(), self::AFTER => array()); |
|
| 37 | + private $elements = array(self::BEFORE => array(), self::AFTER => array()); |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @param string $class |
| 43 | 43 | * @param string $title |
| 44 | 44 | */ |
| 45 | - public function __construct($element, $title, $action, $class = '', $method = 'post', $charset = 'UTF-8'){ |
|
| 45 | + public function __construct($element, $title, $action, $class = '', $method = 'post', $charset = 'UTF-8') { |
|
| 46 | 46 | parent::__construct($element, $class); |
| 47 | 47 | $this->title = $title; |
| 48 | 48 | $this->action = new Attribute('action', $action); |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | $this->charset = new Attribute('accept-charset', $charset); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function addHtmlElement($element, $position = self::AFTER){ |
|
| 53 | + public function addHtmlElement($element, $position = self::AFTER) { |
|
| 54 | 54 | $this->elements[$position][] = $element; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function render() { |
| 58 | 58 | ?> |
| 59 | - <form enctype="multipart/form-data"<?php echo $this->action.$this->method.$this->charset; ?>> |
|
| 59 | + <form enctype="multipart/form-data"<?php echo $this->action . $this->method . $this->charset; ?>> |
|
| 60 | 60 | <fieldset<?php echo $this->class; ?>> |
| 61 | 61 | <legend> |
| 62 | 62 | <strong><?php echo $this->title; ?></strong> |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | <?php |
| 66 | 66 | foreach ($this->elements[self::BEFORE] as $element) { |
| 67 | - echo "\n".$element; |
|
| 67 | + echo "\n" . $element; |
|
| 68 | 68 | } |
| 69 | 69 | ?> |
| 70 | 70 | |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | $this->element->render(); |
| 73 | 73 | ?> |
| 74 | 74 | |
| 75 | - <?php if(count($this->elements[self::AFTER]) > 0){ ?> |
|
| 75 | + <?php if (count($this->elements[self::AFTER]) > 0) { ?> |
|
| 76 | 76 | <div style="padding: 20px;"> |
| 77 | 77 | <?php |
| 78 | 78 | foreach ($this->elements[self::AFTER] as $element) { |
| 79 | - echo "\n".$element; |
|
| 79 | + echo "\n" . $element; |
|
| 80 | 80 | } |
| 81 | 81 | ?> |
| 82 | 82 | </div> |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | * @param string $name Name of an input element |
| 46 | 46 | * @param string $format Defines a format template for the date value |
| 47 | 47 | */ |
| 48 | - public function __construct($name, $format='yyyy-MM-dd'){ |
|
| 48 | + public function __construct($name, $format = 'yyyy-MM-dd') { |
|
| 49 | 49 | self::$COUNT++; |
| 50 | - $this->id = self::INPUT_CLASS.'-'.self::$COUNT; |
|
| 50 | + $this->id = self::INPUT_CLASS . '-' . self::$COUNT; |
|
| 51 | 51 | $this->name = $name; |
| 52 | 52 | $this->format = $format; |
| 53 | 53 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * {@inheritDoc} |
| 58 | 58 | * @see \web\lib\admin\view\PageElementInterface::render() |
| 59 | 59 | */ |
| 60 | - public function render(){ |
|
| 60 | + public function render() { |
|
| 61 | 61 | echo $this; |
| 62 | 62 | |
| 63 | 63 | /*?> |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function __toString(){ |
|
| 72 | + public function __toString() { |
|
| 73 | 73 | $div = new CompositeTag('div'); |
| 74 | 74 | $div->addAttribute('class', self::BLOCK_CLASS); |
| 75 | 75 | $input = new UnaryTag('input'); |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | use web\lib\admin\view\html\Table; |
| 5 | 5 | use web\lib\admin\view\html\Row; |
| 6 | 6 | |
| 7 | -class InfoBlockTable implements PageElementInterface{ |
|
| 7 | +class InfoBlockTable implements PageElementInterface { |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * |
@@ -18,22 +18,22 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | private $decorator; |
| 20 | 20 | |
| 21 | - public function __construct($title){ |
|
| 21 | + public function __construct($title) { |
|
| 22 | 22 | $this->table = new Table(); |
| 23 | 23 | $this->table->addAttribute("cellpadding", 5); |
| 24 | - $this->decorator = new TitledBlockDecorator($this->table, $title, PageElementInterface::INFOBLOCK_CLASS); |
|
| 24 | + $this->decorator = new TitledBlockDecorator($this->table, $title, PageElementInterface::INFOBLOCK_CLASS); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @param array $rowArray |
| 29 | 29 | */ |
| 30 | - public function addRow($rowArray){ |
|
| 30 | + public function addRow($rowArray) { |
|
| 31 | 31 | $row = new Row($rowArray); |
| 32 | 32 | $row->addCellAttribute(0, 'class', Table::TITLED_CELL_CLASS); |
| 33 | 33 | $this->table->addRow($row); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function render(){ |
|
| 36 | + public function render() { |
|
| 37 | 37 | $this->decorator->render(); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace web\lib\admin\view; |
| 3 | 3 | |
| 4 | -class TitledBlockDecorator extends PageElementDecorator{ |
|
| 4 | +class TitledBlockDecorator extends PageElementDecorator { |
|
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @param string $class |
| 16 | 16 | * @param string $title |
| 17 | 17 | */ |
| 18 | - public function __construct($element, $title, $class = ""){ |
|
| 18 | + public function __construct($element, $title, $class = "") { |
|
| 19 | 19 | parent::__construct($element, $class); |
| 20 | 20 | $this->title = $title; |
| 21 | 21 | |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | |
| 4 | 4 | use web\lib\admin\view\html\Attribute; |
| 5 | 5 | |
| 6 | -abstract class PageElementDecorator implements PageElementInterface{ |
|
| 6 | +abstract class PageElementDecorator implements PageElementInterface { |
|
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @author Zilvinas Vaira |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -class Row extends Tag{ |
|
| 9 | +class Row extends Tag { |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @param array $cells |
| 43 | 43 | */ |
| 44 | - public function setCells($cells){ |
|
| 44 | + public function setCells($cells) { |
|
| 45 | 45 | foreach ($cells as $key => $cell) { |
| 46 | 46 | $td = new CompositeTag('td'); |
| 47 | 47 | $td->addText($cell); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return number |
| 55 | 55 | */ |
| 56 | - public function size(){ |
|
| 56 | + public function size() { |
|
| 57 | 57 | return count($this->cells); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * |
| 62 | 62 | * @return \web\lib\admin\view\html\CompositeTag[] |
| 63 | 63 | */ |
| 64 | - public function getCells(){ |
|
| 64 | + public function getCells() { |
|
| 65 | 65 | return $this->cells; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | * @param string $name |
| 72 | 72 | * @param string $value |
| 73 | 73 | */ |
| 74 | - public function addCellAttribute($column, $name, $value){ |
|
| 75 | - if(isset($this->cells[$column])){ |
|
| 74 | + public function addCellAttribute($column, $name, $value) { |
|
| 75 | + if (isset($this->cells[$column])) { |
|
| 76 | 76 | $this->cells[$column]->addAttribute($name, $value); |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @param array $columns |
| 83 | 83 | */ |
| 84 | - public function setColumns($columns){ |
|
| 84 | + public function setColumns($columns) { |
|
| 85 | 85 | $this->columns = $columns; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | * @param string $column |
| 91 | 91 | * @param UnaryTag $element |
| 92 | 92 | */ |
| 93 | - public function addToCell($column, $element){ |
|
| 94 | - if(!isset($this->cells[$column])){ |
|
| 93 | + public function addToCell($column, $element) { |
|
| 94 | + if (!isset($this->cells[$column])) { |
|
| 95 | 95 | $this->cells[$column] = new CompositeTag('td'); |
| 96 | 96 | } |
| 97 | 97 | $this->cells[$column]->addTag($element); |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | * @param string $column |
| 103 | 103 | * @return \web\lib\admin\view\html\CompositeTag |
| 104 | 104 | */ |
| 105 | - public function getCell($column){ |
|
| 106 | - if(!isset($this->cells[$column])){ |
|
| 105 | + public function getCell($column) { |
|
| 106 | + if (!isset($this->cells[$column])) { |
|
| 107 | 107 | $this->cells[$column] = new CompositeTag('td'); |
| 108 | 108 | } |
| 109 | 109 | return $this->cells[$column]; |
@@ -114,19 +114,19 @@ discard block |
||
| 114 | 114 | * {@inheritDoc} |
| 115 | 115 | * @see \web\lib\admin\view\html\Tag::composeInnerString() |
| 116 | 116 | */ |
| 117 | - public function composeInnerString(){ |
|
| 118 | - if(count($this->columns)>0){ |
|
| 117 | + public function composeInnerString() { |
|
| 118 | + if (count($this->columns) > 0) { |
|
| 119 | 119 | $innerString = ""; |
| 120 | 120 | foreach ($this->columns as $column) { |
| 121 | - if(!isset($this->cells[$column])){ |
|
| 121 | + if (!isset($this->cells[$column])) { |
|
| 122 | 122 | $this->cells[$column] = new CompositeTag('td'); |
| 123 | 123 | } |
| 124 | - $this->cells[$column]->setTab("\t".$this->tab); |
|
| 124 | + $this->cells[$column]->setTab("\t" . $this->tab); |
|
| 125 | 125 | $innerString .= $this->cells[$column]; |
| 126 | 126 | |
| 127 | 127 | } |
| 128 | 128 | return $innerString; |
| 129 | - }else{ |
|
| 129 | + } else { |
|
| 130 | 130 | return parent::composeInnerString(); |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * @author Zilvinas Vaira |
| 6 | 6 | * |
| 7 | 7 | */ |
| 8 | -class Table extends Tag{ |
|
| 8 | +class Table extends Tag { |
|
| 9 | 9 | |
| 10 | 10 | const TITLED_CELL_CLASS = 'sb-titled-cell'; |
| 11 | 11 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | * @param array $rows |
| 26 | 26 | */ |
| 27 | - public function __construct($rows = array()){ |
|
| 27 | + public function __construct($rows = array()) { |
|
| 28 | 28 | parent::__construct('table'); |
| 29 | 29 | $this->setRows($rows); |
| 30 | 30 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * @return number |
| 35 | 35 | */ |
| 36 | - public function size(){ |
|
| 36 | + public function size() { |
|
| 37 | 37 | return count($this->rows); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | * @param int $row |
| 43 | 43 | * @param string $column |
| 44 | 44 | */ |
| 45 | - private function createRow($row, $column){ |
|
| 46 | - if(!in_array($column, $this->columns)){ |
|
| 45 | + private function createRow($row, $column) { |
|
| 46 | + if (!in_array($column, $this->columns)) { |
|
| 47 | 47 | $this->columns [] = $column; |
| 48 | 48 | } |
| 49 | - if(!isset($this->rows[$row])){ |
|
| 49 | + if (!isset($this->rows[$row])) { |
|
| 50 | 50 | $this->rows [$row] = new Row(); |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @param string $column |
| 58 | 58 | * @param UnaryTag $element |
| 59 | 59 | */ |
| 60 | - public function addToCell($row, $column, $element){ |
|
| 60 | + public function addToCell($row, $column, $element) { |
|
| 61 | 61 | $this->createRow($row, $column); |
| 62 | 62 | $this->rows[$row]->addToCell($column, $element); |
| 63 | 63 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @param string $column |
| 69 | 69 | * @return \web\lib\admin\view\html\CompositeTag |
| 70 | 70 | */ |
| 71 | - public function getCell($row, $column){ |
|
| 71 | + public function getCell($row, $column) { |
|
| 72 | 72 | $this->createRow($row, $column); |
| 73 | 73 | return $this->rows[$row]->getCell($column); |
| 74 | 74 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @param array $row |
| 79 | 79 | */ |
| 80 | - public function addRowArray($cells){ |
|
| 80 | + public function addRowArray($cells) { |
|
| 81 | 81 | $this->addRow(new Row($cells)); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @param Row $row |
| 87 | 87 | */ |
| 88 | - public function addRow($row){ |
|
| 89 | - if(count($row->size())>0){ |
|
| 88 | + public function addRow($row) { |
|
| 89 | + if (count($row->size()) > 0) { |
|
| 90 | 90 | $this->rows [] = $row; |
| 91 | 91 | $this->setColumns($row); |
| 92 | 92 | } |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | * |
| 97 | 97 | * @param array $rows |
| 98 | 98 | */ |
| 99 | - public function setRows($rows){ |
|
| 100 | - if(count($rows)>0){ |
|
| 99 | + public function setRows($rows) { |
|
| 100 | + if (count($rows) > 0) { |
|
| 101 | 101 | foreach ($rows as $cells) { |
| 102 | 102 | $this->addRowArray($cells); |
| 103 | 103 | } |
@@ -108,10 +108,10 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @param Row $row |
| 110 | 110 | */ |
| 111 | - private function setColumns($row){ |
|
| 111 | + private function setColumns($row) { |
|
| 112 | 112 | $cells = $row->getCells(); |
| 113 | 113 | foreach ($cells as $key => $value) { |
| 114 | - if(!in_array($key, $this->columns)){ |
|
| 114 | + if (!in_array($key, $this->columns)) { |
|
| 115 | 115 | $this->columns [] = $key; |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -121,11 +121,11 @@ discard block |
||
| 121 | 121 | * |
| 122 | 122 | * @return string |
| 123 | 123 | */ |
| 124 | - protected function composeInnerString(){ |
|
| 124 | + protected function composeInnerString() { |
|
| 125 | 125 | $innerString = ""; |
| 126 | 126 | foreach ($this->rows as $row) { |
| 127 | 127 | $row->setColumns($this->columns); |
| 128 | - $row->setTab("\t".$this->tab); |
|
| 128 | + $row->setTab("\t" . $this->tab); |
|
| 129 | 129 | $innerString .= $row; |
| 130 | 130 | } |
| 131 | 131 | return $innerString; |