@@ -60,20 +60,20 @@ discard block |
||
| 60 | 60 | var $config = array();//updater configuration |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | - * Constructor |
|
| 63 | + * Constructor |
|
| 64 | 64 | * |
| 65 | - * @access public |
|
| 66 | - */ |
|
| 65 | + * @access public |
|
| 66 | + */ |
|
| 67 | 67 | public function __construct() |
| 68 | 68 | { |
| 69 | 69 | $this->init(); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | - * Constructor |
|
| 73 | + * Constructor |
|
| 74 | 74 | * |
| 75 | - * @access public |
|
| 76 | - */ |
|
| 75 | + * @access public |
|
| 76 | + */ |
|
| 77 | 77 | public function dbStructUpdater() |
| 78 | 78 | { |
| 79 | 79 | $this->init(); |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | - * merges current updater config with the given one |
|
| 99 | + * merges current updater config with the given one |
|
| 100 | 100 | * |
| 101 | - * @param assoc_array $config new configuration values |
|
| 102 | - */ |
|
| 101 | + * @param assoc_array $config new configuration values |
|
| 102 | + */ |
|
| 103 | 103 | public function setConfig($config=array()) |
| 104 | 104 | { |
| 105 | 105 | if (is_array($config)) { |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | - * Returns array of update SQL with default options, $source, $dest - database structures |
|
| 111 | + * Returns array of update SQL with default options, $source, $dest - database structures |
|
| 112 | 112 | * |
| 113 | - * @access public |
|
| 114 | - * @param string $source structure dump of database to update |
|
| 115 | - * @param string $dest structure dump of the reference database |
|
| 116 | - * @param bool $asString if true - result will be a string, otherwise - array |
|
| 117 | - * @return array|string update sql statements - in array or string (separated with ';') |
|
| 118 | - */ |
|
| 113 | + * @access public |
|
| 114 | + * @param string $source structure dump of database to update |
|
| 115 | + * @param string $dest structure dump of the reference database |
|
| 116 | + * @param bool $asString if true - result will be a string, otherwise - array |
|
| 117 | + * @return array|string update sql statements - in array or string (separated with ';') |
|
| 118 | + */ |
|
| 119 | 119 | public function getUpdates($source, $dest, $asString=false) |
| 120 | 120 | { |
| 121 | 121 | $result = $asString?'':array(); |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | - * Filters comparison result and lefts only sync actions allowed by 'updateTypes' option |
|
| 139 | - */ |
|
| 138 | + * Filters comparison result and lefts only sync actions allowed by 'updateTypes' option |
|
| 139 | + */ |
|
| 140 | 140 | public function filterDiffs($compRes) |
| 141 | 141 | { |
| 142 | 142 | $result = array(); |
@@ -185,9 +185,9 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /** |
| 188 | - * Gets structured general info about the databases diff : |
|
| 189 | - * array(sourceOrphans=>array(...), destOrphans=>array(...), different=>array(...)) |
|
| 190 | - */ |
|
| 188 | + * Gets structured general info about the databases diff : |
|
| 189 | + * array(sourceOrphans=>array(...), destOrphans=>array(...), different=>array(...)) |
|
| 190 | + */ |
|
| 191 | 191 | public function getDiffInfo($compRes) |
| 192 | 192 | {
|
| 193 | 193 | if (!is_array($compRes)) { |
@@ -211,20 +211,20 @@ discard block |
||
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | - * Makes comparison of the given database structures, support some options |
|
| 214 | + * Makes comparison of the given database structures, support some options |
|
| 215 | 215 | * |
| 216 | - * @access private |
|
| 217 | - * @param string $source and $dest are strings - database tables structures |
|
| 218 | - * @return array |
|
| 219 | - * - table (array) |
|
| 220 | - * - destOrphan (boolean) |
|
| 221 | - * - sourceOrphan (boolean) |
|
| 222 | - * - differs (array) OR (boolean) false if no diffs |
|
| 223 | - * - [0](array) |
|
| 224 | - * - source (string) structure definition line in the out-of-date table |
|
| 225 | - * - dest (string) structure definition line in the reference table |
|
| 226 | - * - [1](array) ... |
|
| 227 | - */ |
|
| 216 | + * @access private |
|
| 217 | + * @param string $source and $dest are strings - database tables structures |
|
| 218 | + * @return array |
|
| 219 | + * - table (array) |
|
| 220 | + * - destOrphan (boolean) |
|
| 221 | + * - sourceOrphan (boolean) |
|
| 222 | + * - differs (array) OR (boolean) false if no diffs |
|
| 223 | + * - [0](array) |
|
| 224 | + * - source (string) structure definition line in the out-of-date table |
|
| 225 | + * - dest (string) structure definition line in the reference table |
|
| 226 | + * - [1](array) ... |
|
| 227 | + */ |
|
| 228 | 228 | private function compare($source, $dest) |
| 229 | 229 | { |
| 230 | 230 | $this->sourceStruct = $source; |
@@ -270,11 +270,11 @@ discard block |
||
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
| 273 | - * Retrieves list of table names from the database structure dump |
|
| 273 | + * Retrieves list of table names from the database structure dump |
|
| 274 | 274 | * |
| 275 | - * @access private |
|
| 276 | - * @param string $struct database structure listing |
|
| 277 | - */ |
|
| 275 | + * @access private |
|
| 276 | + * @param string $struct database structure listing |
|
| 277 | + */ |
|
| 278 | 278 | private function getTableList($struct) |
| 279 | 279 | { |
| 280 | 280 | $result = array(); |
@@ -288,14 +288,14 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | /** |
| 291 | - * Retrieves table structure definition from the database structure dump |
|
| 291 | + * Retrieves table structure definition from the database structure dump |
|
| 292 | 292 | * |
| 293 | - * @access private |
|
| 294 | - * @param string $struct database structure listing |
|
| 295 | - * @param string $tab table name |
|
| 296 | - * @param bool $removeDatabase - either to remove database name in "CREATE TABLE database.tab"-like declarations |
|
| 297 | - * @return string table structure definition |
|
| 298 | - */ |
|
| 293 | + * @access private |
|
| 294 | + * @param string $struct database structure listing |
|
| 295 | + * @param string $tab table name |
|
| 296 | + * @param bool $removeDatabase - either to remove database name in "CREATE TABLE database.tab"-like declarations |
|
| 297 | + * @return string table structure definition |
|
| 298 | + */ |
|
| 299 | 299 | private function getTabSql($struct, $tab, $removeDatabase=true) |
| 300 | 300 | { |
| 301 | 301 | $result = ''; |
@@ -323,8 +323,8 @@ discard block |
||
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | /** |
| 326 | - * Splits table sql into indexed array |
|
| 327 | - */ |
|
| 326 | + * Splits table sql into indexed array |
|
| 327 | + */ |
|
| 328 | 328 | public function splitTabSql($sql) |
| 329 | 329 | { |
| 330 | 330 | $result = array(); |
@@ -365,18 +365,18 @@ discard block |
||
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | /** |
| 368 | - * returns array of fields or keys definitions that differs in the given tables structure |
|
| 368 | + * returns array of fields or keys definitions that differs in the given tables structure |
|
| 369 | 369 | * |
| 370 | - * @access private |
|
| 371 | - * @param sring $sourceSql table structure |
|
| 372 | - * @param sring $destSql right table structure supports some $options |
|
| 373 | - * supports some $options |
|
| 374 | - * @return array |
|
| 375 | - * - [0] |
|
| 376 | - * - source (string) out-of-date table field definition |
|
| 377 | - * - dest (string) reference table field definition |
|
| 378 | - * - [1]... |
|
| 379 | - */ |
|
| 370 | + * @access private |
|
| 371 | + * @param sring $sourceSql table structure |
|
| 372 | + * @param sring $destSql right table structure supports some $options |
|
| 373 | + * supports some $options |
|
| 374 | + * @return array |
|
| 375 | + * - [0] |
|
| 376 | + * - source (string) out-of-date table field definition |
|
| 377 | + * - dest (string) reference table field definition |
|
| 378 | + * - [1]... |
|
| 379 | + */ |
|
| 380 | 380 | private function compareSql($sourceSql, $destSql)//$sourceSql, $destSql |
| 381 | 381 | { |
| 382 | 382 | $result = array(); |
@@ -439,14 +439,14 @@ discard block |
||
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | /** |
| 442 | - * Transforms table structure defnition line into key=>value pair where the key is a string that uniquely |
|
| 443 | - * defines field or key desribed |
|
| 442 | + * Transforms table structure defnition line into key=>value pair where the key is a string that uniquely |
|
| 443 | + * defines field or key desribed |
|
| 444 | 444 | * |
| 445 | - * @access private |
|
| 446 | - * @param string $line field definition string |
|
| 447 | - * @return array array with single key=>value pair as described in the description |
|
| 448 | - * implements some options |
|
| 449 | - */ |
|
| 445 | + * @access private |
|
| 446 | + * @param string $line field definition string |
|
| 447 | + * @return array array with single key=>value pair as described in the description |
|
| 448 | + * implements some options |
|
| 449 | + */ |
|
| 450 | 450 | private function processLine($line) |
| 451 | 451 | { |
| 452 | 452 | $options = $this->config; |
@@ -484,14 +484,14 @@ discard block |
||
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | /** |
| 487 | - * Takes an output of compare() method to generate the set of sql needed to update source table to make it |
|
| 488 | - * look as a destination one |
|
| 487 | + * Takes an output of compare() method to generate the set of sql needed to update source table to make it |
|
| 488 | + * look as a destination one |
|
| 489 | 489 | * |
| 490 | - * @access private |
|
| 491 | - * @param array $diff compare() method output |
|
| 492 | - * @return array list of sql statements |
|
| 493 | - * supports query generation options |
|
| 494 | - */ |
|
| 490 | + * @access private |
|
| 491 | + * @param array $diff compare() method output |
|
| 492 | + * @return array list of sql statements |
|
| 493 | + * supports query generation options |
|
| 494 | + */ |
|
| 495 | 495 | private function getDiffSql($diff)//maybe add option to ommit or force 'IF NOT EXISTS', skip autoincrement |
| 496 | 496 | { |
| 497 | 497 | $options = $this->config; |
@@ -548,14 +548,14 @@ discard block |
||
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | /** |
| 551 | - * Compiles update sql |
|
| 551 | + * Compiles update sql |
|
| 552 | 552 | * |
| 553 | - * @access private |
|
| 554 | - * @param string $action - 'drop', 'add' or 'modify' |
|
| 555 | - * @param string $tab table name |
|
| 556 | - * @param string $sql definition of the element to change |
|
| 557 | - * @return string update sql |
|
| 558 | - */ |
|
| 553 | + * @access private |
|
| 554 | + * @param string $action - 'drop', 'add' or 'modify' |
|
| 555 | + * @param string $tab table name |
|
| 556 | + * @param string $sql definition of the element to change |
|
| 557 | + * @return string update sql |
|
| 558 | + */ |
|
| 559 | 559 | private function getActionSql($action, $tab, $sql) |
| 560 | 560 | { |
| 561 | 561 | $result = 'ALTER TABLE `'.$tab.'` '; |
@@ -621,14 +621,14 @@ discard block |
||
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | /** |
| 624 | - * Searches for the position of the next delimiter which is not inside string literal like 'this ; ' or |
|
| 625 | - * like "this ; ". |
|
| 626 | - * |
|
| 627 | - * Handles escaped \" and \'. Also handles sql comments. |
|
| 628 | - * Actualy it is regex-based Finit State Machine (FSN) |
|
| 629 | - * |
|
| 630 | - * $skipInBrackets - if true, delimiter will be skipped if located inside (brackets) which are not string literals or comment parts |
|
| 631 | - */ |
|
| 624 | + * Searches for the position of the next delimiter which is not inside string literal like 'this ; ' or |
|
| 625 | + * like "this ; ". |
|
| 626 | + * |
|
| 627 | + * Handles escaped \" and \'. Also handles sql comments. |
|
| 628 | + * Actualy it is regex-based Finit State Machine (FSN) |
|
| 629 | + * |
|
| 630 | + * $skipInBrackets - if true, delimiter will be skipped if located inside (brackets) which are not string literals or comment parts |
|
| 631 | + */ |
|
| 632 | 632 | public function getDelimPos($string, $offset=0, $delim=';', $skipInBrackets=false) |
| 633 | 633 | { |
| 634 | 634 | $stack = array(); |
@@ -701,9 +701,9 @@ discard block |
||
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | /** |
| 704 | - * works the same as getDelimPos except returns position of the first occurence of the delimiter starting from |
|
| 705 | - * the end of the string |
|
| 706 | - */ |
|
| 704 | + * works the same as getDelimPos except returns position of the first occurence of the delimiter starting from |
|
| 705 | + * the end of the string |
|
| 706 | + */ |
|
| 707 | 707 | public function getDelimRpos($string, $offset=0, $delim=';', $skipInBrackets=false) |
| 708 | 708 | { |
| 709 | 709 | $pos = $this->getDelimPos($string, $offset, $delim, $skipInBrackets); |
@@ -25,23 +25,23 @@ discard block |
||
| 25 | 25 | class Table extends Element |
| 26 | 26 | { |
| 27 | 27 | /** @var \UIComponents\Template\Template $template */ |
| 28 | - public $template = null; |
|
| 28 | + public $template = null; |
|
| 29 | 29 | |
| 30 | - /** @var array $data */ |
|
| 31 | - public $data = array(); |
|
| 30 | + /** @var array $data */ |
|
| 31 | + public $data = array(); |
|
| 32 | 32 | |
| 33 | - /** @var array $options */ |
|
| 34 | - public $options = array(); |
|
| 33 | + /** @var array $options */ |
|
| 34 | + public $options = array(); |
|
| 35 | 35 | |
| 36 | - /** @var array $tags */ |
|
| 37 | - public $tags = array( |
|
| 38 | - "container" => "table", |
|
| 39 | - "row" => "tr", |
|
| 40 | - "cell" => "td", |
|
| 41 | - "headcell" => "th" |
|
| 42 | - ); |
|
| 36 | + /** @var array $tags */ |
|
| 37 | + public $tags = array( |
|
| 38 | + "container" => "table", |
|
| 39 | + "row" => "tr", |
|
| 40 | + "cell" => "td", |
|
| 41 | + "headcell" => "th" |
|
| 42 | + ); |
|
| 43 | 43 | |
| 44 | - /** |
|
| 44 | + /** |
|
| 45 | 45 | * View helper entry point: |
| 46 | 46 | * Retrieves helper and optionally sets component options to operate on |
| 47 | 47 | * |
@@ -106,235 +106,235 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function render() |
| 108 | 108 | { |
| 109 | - return $this->buildMarkup(); |
|
| 109 | + return $this->buildMarkup(); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * generate table header HTML |
|
| 114 | - * @param mixed $aHTMLTableColumns |
|
| 115 | - * @return self |
|
| 116 | - */ |
|
| 117 | - public function buildHeaderCells ($aHTMLTableColumns) { |
|
| 118 | - $sHTMLTableHeader = ""; |
|
| 119 | - $sHTMLTableColumnGroup = ""; |
|
| 120 | - $aColumns = array(); |
|
| 121 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 122 | - if ($aColumn["field"]) { |
|
| 123 | - $aColumns[] = $aColumn["field"]; |
|
| 124 | - $sHTMLTableHeader .= "<".$this->tags->headcell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->headcell.">"; |
|
| 125 | - $sHTMLTableColumnGroup .= "<column class=\"".$aColumn["field"]."\" />"; |
|
| 126 | - } else { |
|
| 127 | - $sHTMLTableHeader .= "<".$this->tags->headcell." class=\"col_".$iColumn."\">".$aColumn["title"]."</".$this->tags->headcell.">"; |
|
| 128 | - $sHTMLTableColumnGroup .= "<column class=\"col_".$iColumn."\" />"; |
|
| 129 | - } |
|
| 130 | - } |
|
| 131 | - $this->getTemplate()->set('s', 'HEADERCELLS', $sHTMLTableHeader); |
|
| 132 | - $this->getTemplate()->set('s', 'COLUMNGROUP', "<columns>".$sHTMLTableColumnGroup."</columns>"); |
|
| 133 | - return ($this); |
|
| 134 | - } |
|
| 112 | + /** |
|
| 113 | + * generate table header HTML |
|
| 114 | + * @param mixed $aHTMLTableColumns |
|
| 115 | + * @return self |
|
| 116 | + */ |
|
| 117 | + public function buildHeaderCells ($aHTMLTableColumns) { |
|
| 118 | + $sHTMLTableHeader = ""; |
|
| 119 | + $sHTMLTableColumnGroup = ""; |
|
| 120 | + $aColumns = array(); |
|
| 121 | + foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 122 | + if ($aColumn["field"]) { |
|
| 123 | + $aColumns[] = $aColumn["field"]; |
|
| 124 | + $sHTMLTableHeader .= "<".$this->tags->headcell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->headcell.">"; |
|
| 125 | + $sHTMLTableColumnGroup .= "<column class=\"".$aColumn["field"]."\" />"; |
|
| 126 | + } else { |
|
| 127 | + $sHTMLTableHeader .= "<".$this->tags->headcell." class=\"col_".$iColumn."\">".$aColumn["title"]."</".$this->tags->headcell.">"; |
|
| 128 | + $sHTMLTableColumnGroup .= "<column class=\"col_".$iColumn."\" />"; |
|
| 129 | + } |
|
| 130 | + } |
|
| 131 | + $this->getTemplate()->set('s', 'HEADERCELLS', $sHTMLTableHeader); |
|
| 132 | + $this->getTemplate()->set('s', 'COLUMNGROUP', "<columns>".$sHTMLTableColumnGroup."</columns>"); |
|
| 133 | + return ($this); |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - /** |
|
| 137 | - * generate table footer HTML |
|
| 138 | - * @param mixed $aHTMLTableColumns |
|
| 139 | - * @return self |
|
| 140 | - */ |
|
| 141 | - public function buildFooterCells ($aHTMLTableColumns) { |
|
| 142 | - $sHTMLTableFooter = ""; |
|
| 143 | - $aColumns = array(); |
|
| 144 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 145 | - if ($aColumn["field"]) { |
|
| 146 | - $aColumns[] = $aColumn["field"]; |
|
| 147 | - $sHTMLTableFooter .= "<".$this->tags->cell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->cell.">"; |
|
| 148 | - } else { |
|
| 149 | - $sHTMLTableFooter .= "<".$this->tags->cell." class=\"col_".$iColumn."\">".$aColumn["title"]."</".$this->tags->cell.">"; |
|
| 150 | - } |
|
| 151 | - } |
|
| 152 | - $this->getTemplate()->set('s', 'FOOTERCELLS', $sHTMLTableFooter); |
|
| 153 | - return ($this); |
|
| 154 | - } |
|
| 136 | + /** |
|
| 137 | + * generate table footer HTML |
|
| 138 | + * @param mixed $aHTMLTableColumns |
|
| 139 | + * @return self |
|
| 140 | + */ |
|
| 141 | + public function buildFooterCells ($aHTMLTableColumns) { |
|
| 142 | + $sHTMLTableFooter = ""; |
|
| 143 | + $aColumns = array(); |
|
| 144 | + foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 145 | + if ($aColumn["field"]) { |
|
| 146 | + $aColumns[] = $aColumn["field"]; |
|
| 147 | + $sHTMLTableFooter .= "<".$this->tags->cell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->cell.">"; |
|
| 148 | + } else { |
|
| 149 | + $sHTMLTableFooter .= "<".$this->tags->cell." class=\"col_".$iColumn."\">".$aColumn["title"]."</".$this->tags->cell.">"; |
|
| 150 | + } |
|
| 151 | + } |
|
| 152 | + $this->getTemplate()->set('s', 'FOOTERCELLS', $sHTMLTableFooter); |
|
| 153 | + return ($this); |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | - /** |
|
| 157 | - * generate table body HTML |
|
| 158 | - * @param array $aRowData |
|
| 159 | - * @param mixed $aHTMLTableColumns |
|
| 160 | - * @return array |
|
| 161 | - */ |
|
| 162 | - public function buildBodyCells ($aRowData, $aHTMLTableColumns) { |
|
| 163 | - $aRows = array(); |
|
| 164 | - foreach ( (array)$aRowData as $iRow => $oRowData ) { |
|
| 165 | - $sCells = ""; |
|
| 166 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 167 | - $mCellValue = $oRowData[$aColumn["field"]]; |
|
| 168 | - if (!empty($aColumn["callback"]) && function_exists($aColumn["callback"])) { |
|
| 169 | - $mCellValue = call_user_func($aColumn["callback"], $oRowData, $aColumn, $iColumn, $iRow); |
|
| 170 | - } |
|
| 171 | - if ( isset($aColumn["field"]) && isset($oRowData[$aColumn["field"]]) ) { |
|
| 172 | - $sClassname = $aColumn["field"]; |
|
| 173 | - } else { |
|
| 174 | - $sClassname = "col_".$iColumn; |
|
| 175 | - } |
|
| 176 | - $sCells .= "<".$this->tags->cell." class=\"".$sClassname."\">". |
|
| 177 | - $mCellValue. |
|
| 178 | - "</".$this->tags->cell.">"; |
|
| 179 | - } |
|
| 156 | + /** |
|
| 157 | + * generate table body HTML |
|
| 158 | + * @param array $aRowData |
|
| 159 | + * @param mixed $aHTMLTableColumns |
|
| 160 | + * @return array |
|
| 161 | + */ |
|
| 162 | + public function buildBodyCells ($aRowData, $aHTMLTableColumns) { |
|
| 163 | + $aRows = array(); |
|
| 164 | + foreach ( (array)$aRowData as $iRow => $oRowData ) { |
|
| 165 | + $sCells = ""; |
|
| 166 | + foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 167 | + $mCellValue = $oRowData[$aColumn["field"]]; |
|
| 168 | + if (!empty($aColumn["callback"]) && function_exists($aColumn["callback"])) { |
|
| 169 | + $mCellValue = call_user_func($aColumn["callback"], $oRowData, $aColumn, $iColumn, $iRow); |
|
| 170 | + } |
|
| 171 | + if ( isset($aColumn["field"]) && isset($oRowData[$aColumn["field"]]) ) { |
|
| 172 | + $sClassname = $aColumn["field"]; |
|
| 173 | + } else { |
|
| 174 | + $sClassname = "col_".$iColumn; |
|
| 175 | + } |
|
| 176 | + $sCells .= "<".$this->tags->cell." class=\"".$sClassname."\">". |
|
| 177 | + $mCellValue. |
|
| 178 | + "</".$this->tags->cell.">"; |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | - $aRows[] = $sCells; |
|
| 182 | - } |
|
| 181 | + $aRows[] = $sCells; |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | - foreach ($aRows as $iRow => $sRow) { |
|
| 185 | - $this->getTemplate()->set('d', 'ROWID', "row_".$aRowData[$iRow]["productID"]); |
|
| 186 | - $this->getTemplate()->set('d', 'BODYCELLS', $sRow); |
|
| 187 | - if (($iRow % 2) == 0) { |
|
| 188 | - $this->getTemplate()->set('d', 'CSS_CLASS', 'even'); |
|
| 189 | - } else { |
|
| 190 | - $this->getTemplate()->set('d', 'CSS_CLASS', 'odd'); |
|
| 191 | - } |
|
| 192 | - $this->getTemplate()->next(); |
|
| 184 | + foreach ($aRows as $iRow => $sRow) { |
|
| 185 | + $this->getTemplate()->set('d', 'ROWID', "row_".$aRowData[$iRow]["productID"]); |
|
| 186 | + $this->getTemplate()->set('d', 'BODYCELLS', $sRow); |
|
| 187 | + if (($iRow % 2) == 0) { |
|
| 188 | + $this->getTemplate()->set('d', 'CSS_CLASS', 'even'); |
|
| 189 | + } else { |
|
| 190 | + $this->getTemplate()->set('d', 'CSS_CLASS', 'odd'); |
|
| 191 | + } |
|
| 192 | + $this->getTemplate()->next(); |
|
| 193 | 193 | |
| 194 | - } |
|
| 195 | - } |
|
| 194 | + } |
|
| 195 | + } |
|
| 196 | 196 | |
| 197 | - /** |
|
| 198 | - * generate mini table mark-up template |
|
| 199 | - * @return string |
|
| 200 | - */ |
|
| 201 | - public function buildMarkupTemplate () { |
|
| 202 | - $aHTML = array( |
|
| 203 | - "<".$this->tags->container.">", |
|
| 204 | - "<".$this->tags->row.">", |
|
| 205 | - "{HEADERCELLS}", |
|
| 206 | - "</".$this->tags->row.">", |
|
| 207 | - "<!-- BEGIN:BLOCK -->", |
|
| 208 | - "<".$this->tags->row.">", |
|
| 209 | - "{BODYCELLS}", |
|
| 210 | - "</".$this->tags->row.">", |
|
| 211 | - "<!-- END:BLOCK -->", |
|
| 212 | - "<".$this->tags->row.">", |
|
| 213 | - "{FOOTERCELLS}", |
|
| 214 | - "</".$this->tags->row.">", |
|
| 215 | - "</".$this->tags->container.">" |
|
| 216 | - ); |
|
| 217 | - $sHTML = implode("", $aHTML); |
|
| 218 | - return $sHTML; |
|
| 219 | - } |
|
| 197 | + /** |
|
| 198 | + * generate mini table mark-up template |
|
| 199 | + * @return string |
|
| 200 | + */ |
|
| 201 | + public function buildMarkupTemplate () { |
|
| 202 | + $aHTML = array( |
|
| 203 | + "<".$this->tags->container.">", |
|
| 204 | + "<".$this->tags->row.">", |
|
| 205 | + "{HEADERCELLS}", |
|
| 206 | + "</".$this->tags->row.">", |
|
| 207 | + "<!-- BEGIN:BLOCK -->", |
|
| 208 | + "<".$this->tags->row.">", |
|
| 209 | + "{BODYCELLS}", |
|
| 210 | + "</".$this->tags->row.">", |
|
| 211 | + "<!-- END:BLOCK -->", |
|
| 212 | + "<".$this->tags->row.">", |
|
| 213 | + "{FOOTERCELLS}", |
|
| 214 | + "</".$this->tags->row.">", |
|
| 215 | + "</".$this->tags->container.">" |
|
| 216 | + ); |
|
| 217 | + $sHTML = implode("", $aHTML); |
|
| 218 | + return $sHTML; |
|
| 219 | + } |
|
| 220 | 220 | |
| 221 | - /** |
|
| 222 | - * generate table mark-up |
|
| 223 | - * @return string |
|
| 224 | - */ |
|
| 225 | - public function buildMarkup () { |
|
| 226 | - $sHTML = ""; |
|
| 221 | + /** |
|
| 222 | + * generate table mark-up |
|
| 223 | + * @return string |
|
| 224 | + */ |
|
| 225 | + public function buildMarkup () { |
|
| 226 | + $sHTML = ""; |
|
| 227 | 227 | |
| 228 | - $sTableID = $this->getOptions("formID"); |
|
| 229 | - if (!$sTableID) { |
|
| 230 | - $sTableID = "table" . md5(microtime()); |
|
| 231 | - $this->options["formID"] = $sTableID; |
|
| 232 | - } |
|
| 228 | + $sTableID = $this->getOptions("formID"); |
|
| 229 | + if (!$sTableID) { |
|
| 230 | + $sTableID = "table" . md5(microtime()); |
|
| 231 | + $this->options["formID"] = $sTableID; |
|
| 232 | + } |
|
| 233 | 233 | |
| 234 | - $this->getTemplate()->reset(); |
|
| 235 | - $this->getTemplate()->set('s', 'TABLEID', $sTableID ); |
|
| 236 | - $this->buildHeaderCells( $this->getOptions("columns") ); |
|
| 237 | - $this->buildFooterCells( $this->getOptions("footer") ); |
|
| 238 | - $this->buildBodyCells( $this->getData(), $this->getOptions("columns") ); |
|
| 239 | - $sTemplate = $this->getOptions("template"); |
|
| 240 | - if ($sTemplate == "") { |
|
| 241 | - $sTemplate = $this->buildMarkupTemplate(); |
|
| 242 | - } |
|
| 243 | - $sHTML = $this->getTemplate()->generate( $sTemplate, true ); |
|
| 244 | - return $sHTML; |
|
| 245 | - } |
|
| 234 | + $this->getTemplate()->reset(); |
|
| 235 | + $this->getTemplate()->set('s', 'TABLEID', $sTableID ); |
|
| 236 | + $this->buildHeaderCells( $this->getOptions("columns") ); |
|
| 237 | + $this->buildFooterCells( $this->getOptions("footer") ); |
|
| 238 | + $this->buildBodyCells( $this->getData(), $this->getOptions("columns") ); |
|
| 239 | + $sTemplate = $this->getOptions("template"); |
|
| 240 | + if ($sTemplate == "") { |
|
| 241 | + $sTemplate = $this->buildMarkupTemplate(); |
|
| 242 | + } |
|
| 243 | + $sHTML = $this->getTemplate()->generate( $sTemplate, true ); |
|
| 244 | + return $sHTML; |
|
| 245 | + } |
|
| 246 | 246 | |
| 247 | - /** |
|
| 248 | - * generate table JSON data |
|
| 249 | - * @return string |
|
| 250 | - */ |
|
| 251 | - public function buildData () { |
|
| 252 | - $sJSON = "[]"; |
|
| 253 | - if (!empty($this->data)) { |
|
| 254 | - $sJSON = json_encode($this->data); |
|
| 255 | - } |
|
| 256 | - return $sJSON; |
|
| 257 | - } |
|
| 247 | + /** |
|
| 248 | + * generate table JSON data |
|
| 249 | + * @return string |
|
| 250 | + */ |
|
| 251 | + public function buildData () { |
|
| 252 | + $sJSON = "[]"; |
|
| 253 | + if (!empty($this->data)) { |
|
| 254 | + $sJSON = json_encode($this->data); |
|
| 255 | + } |
|
| 256 | + return $sJSON; |
|
| 257 | + } |
|
| 258 | 258 | |
| 259 | - /** |
|
| 260 | - * return template object |
|
| 261 | - * @return Template |
|
| 262 | - */ |
|
| 263 | - public function getTemplate() { |
|
| 264 | - if ($this->template == null) { |
|
| 265 | - $this->setTemplate(); |
|
| 266 | - } |
|
| 267 | - return $this->template; |
|
| 268 | - } |
|
| 259 | + /** |
|
| 260 | + * return template object |
|
| 261 | + * @return Template |
|
| 262 | + */ |
|
| 263 | + public function getTemplate() { |
|
| 264 | + if ($this->template == null) { |
|
| 265 | + $this->setTemplate(); |
|
| 266 | + } |
|
| 267 | + return $this->template; |
|
| 268 | + } |
|
| 269 | 269 | |
| 270 | - /** |
|
| 271 | - * generate template object |
|
| 272 | - * @param Template $template |
|
| 273 | - * @return ProductTable |
|
| 274 | - */ |
|
| 275 | - public function setTemplate( $template = null ) { |
|
| 276 | - if ($template == null) { |
|
| 277 | - $this->template = new Template; |
|
| 278 | - } else { |
|
| 279 | - $this->template = $template; |
|
| 280 | - } |
|
| 281 | - return ($this); |
|
| 282 | - } |
|
| 270 | + /** |
|
| 271 | + * generate template object |
|
| 272 | + * @param Template $template |
|
| 273 | + * @return ProductTable |
|
| 274 | + */ |
|
| 275 | + public function setTemplate( $template = null ) { |
|
| 276 | + if ($template == null) { |
|
| 277 | + $this->template = new Template; |
|
| 278 | + } else { |
|
| 279 | + $this->template = $template; |
|
| 280 | + } |
|
| 281 | + return ($this); |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | - /** |
|
| 285 | - * return table data |
|
| 286 | - * @return mixed |
|
| 287 | - */ |
|
| 288 | - public function getData() { |
|
| 289 | - return $this->data; |
|
| 290 | - } |
|
| 284 | + /** |
|
| 285 | + * return table data |
|
| 286 | + * @return mixed |
|
| 287 | + */ |
|
| 288 | + public function getData() { |
|
| 289 | + return $this->data; |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | - /** |
|
| 293 | - * set new table data |
|
| 294 | - * @param mixed $data |
|
| 295 | - * @return ProductTable |
|
| 296 | - */ |
|
| 297 | - public function setData( $data = null) { |
|
| 298 | - if ( is_array($data) ) { |
|
| 299 | - $this->data = $data; |
|
| 300 | - } |
|
| 301 | - return $this; |
|
| 302 | - } |
|
| 292 | + /** |
|
| 293 | + * set new table data |
|
| 294 | + * @param mixed $data |
|
| 295 | + * @return ProductTable |
|
| 296 | + */ |
|
| 297 | + public function setData( $data = null) { |
|
| 298 | + if ( is_array($data) ) { |
|
| 299 | + $this->data = $data; |
|
| 300 | + } |
|
| 301 | + return $this; |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | - /** |
|
| 305 | - * return option by key or complete option set |
|
| 306 | - * @param string $key |
|
| 307 | - * @return mixed |
|
| 308 | - */ |
|
| 309 | - public function getOptions( $key = "" ) { |
|
| 310 | - if ( !empty($key) ) { |
|
| 311 | - if ( isset($this->options[$key]) ) { |
|
| 312 | - return $this->options[$key]; |
|
| 313 | - } else { |
|
| 314 | - return false; |
|
| 315 | - } |
|
| 316 | - } |
|
| 317 | - return $this->options; |
|
| 318 | - } |
|
| 304 | + /** |
|
| 305 | + * return option by key or complete option set |
|
| 306 | + * @param string $key |
|
| 307 | + * @return mixed |
|
| 308 | + */ |
|
| 309 | + public function getOptions( $key = "" ) { |
|
| 310 | + if ( !empty($key) ) { |
|
| 311 | + if ( isset($this->options[$key]) ) { |
|
| 312 | + return $this->options[$key]; |
|
| 313 | + } else { |
|
| 314 | + return false; |
|
| 315 | + } |
|
| 316 | + } |
|
| 317 | + return $this->options; |
|
| 318 | + } |
|
| 319 | 319 | |
| 320 | - /** |
|
| 321 | - * @param object|array $options |
|
| 322 | - * @return ProductTable |
|
| 323 | - */ |
|
| 324 | - public function setOptions($options) { |
|
| 325 | - if ( is_array($options) ) { |
|
| 326 | - $this->options = $options; |
|
| 327 | - } else if ( is_object($options) ) { |
|
| 328 | - $this->options = (array)$options; |
|
| 329 | - } else { |
|
| 330 | - throw new \Exception("invalid table options"); |
|
| 331 | - } |
|
| 332 | - if ( isset($this->options["data"]) ) { |
|
| 333 | - $this->setData($this->getOptions("data")); |
|
| 334 | - unset( $this->options->data ); |
|
| 335 | - } |
|
| 336 | - return $this; |
|
| 337 | - } |
|
| 320 | + /** |
|
| 321 | + * @param object|array $options |
|
| 322 | + * @return ProductTable |
|
| 323 | + */ |
|
| 324 | + public function setOptions($options) { |
|
| 325 | + if ( is_array($options) ) { |
|
| 326 | + $this->options = $options; |
|
| 327 | + } else if ( is_object($options) ) { |
|
| 328 | + $this->options = (array)$options; |
|
| 329 | + } else { |
|
| 330 | + throw new \Exception("invalid table options"); |
|
| 331 | + } |
|
| 332 | + if ( isset($this->options["data"]) ) { |
|
| 333 | + $this->setData($this->getOptions("data")); |
|
| 334 | + unset( $this->options->data ); |
|
| 335 | + } |
|
| 336 | + return $this; |
|
| 337 | + } |
|
| 338 | 338 | |
| 339 | 339 | |
| 340 | 340 | } |
| 341 | 341 | \ No newline at end of file |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | protected $invokableClasses = [ |
| 35 | 35 | |
| 36 | - // panels |
|
| 37 | - // |
|
| 36 | + // panels |
|
| 37 | + // |
|
| 38 | 38 | 'element' => 'UIComponents\View\Helper\Components\Element', |
| 39 | 39 | 'block' => 'UIComponents\View\Helper\Components\Block', |
| 40 | 40 | //'well' => 'UIComponents\View\Helper\Components\Well', |
@@ -43,33 +43,33 @@ discard block |
||
| 43 | 43 | 'widget' => 'UIComponents\View\Helper\Components\Widget', |
| 44 | 44 | 'dashboard' => 'UIComponents\View\Helper\Components\Dashboard', |
| 45 | 45 | |
| 46 | - // page components |
|
| 47 | - // |
|
| 46 | + // page components |
|
| 47 | + // |
|
| 48 | 48 | 'nav' => 'UIComponents\View\Helper\Components\Navbar', // set 'alias to' or combine with 'Navbars' ! |
| 49 | 49 | 'topbar' => 'UIComponents\View\Helper\Components\Navbar', // set 'alias to' or combine with 'Navbars' ! |
| 50 | 50 | 'breadcrumbs' => 'UIComponents\View\Helper\Components\Breadcrumbs', |
| 51 | 51 | 'languagemenu' => 'UIComponents\View\Helper\Components\Languagemenu', |
| 52 | - 'toolbar' => 'UIComponents\View\Helper\Components\Toolbar', |
|
| 52 | + 'toolbar' => 'UIComponents\View\Helper\Components\Toolbar', |
|
| 53 | 53 | |
| 54 | 54 | // controls |
| 55 | 55 | // |
| 56 | 56 | 'button' => 'UIComponents\View\Helper\Components\Button', // default, drop-down/up, splitted |
| 57 | 57 | 'buttongroup' => 'UIComponents\View\Helper\Components\Buttongroup', |
| 58 | - //'inputgroup' => 'UIComponents\View\Helper\Components\Inputgroup', |
|
| 58 | + //'inputgroup' => 'UIComponents\View\Helper\Components\Inputgroup', |
|
| 59 | 59 | //'progressbar' => 'UIComponents\View\Helper\Components\Progressbar', |
| 60 | 60 | |
| 61 | - // forms |
|
| 62 | - // |
|
| 61 | + // forms |
|
| 62 | + // |
|
| 63 | 63 | 'formgroup' => 'UIComponents\View\Helper\Components\Formgroup', |
| 64 | 64 | |
| 65 | - // lists/tables |
|
| 66 | - // |
|
| 65 | + // lists/tables |
|
| 66 | + // |
|
| 67 | 67 | //'listgroup' => 'UIComponents\View\Helper\Components\Listgroup', |
| 68 | 68 | 'table' => 'UIComponents\View\Helper\Components\Listgroup', |
| 69 | - //'pagination' => 'UIComponents\View\Helper\Components\Pagination', |
|
| 69 | + //'pagination' => 'UIComponents\View\Helper\Components\Pagination', |
|
| 70 | 70 | |
| 71 | - // widgets |
|
| 72 | - // |
|
| 71 | + // widgets |
|
| 72 | + // |
|
| 73 | 73 | //'label' => 'UIComponents\View\Helper\Components\Label', |
| 74 | 74 | //'badge' => 'UIComponents\View\Helper\Components\Badge', |
| 75 | 75 | //'pageheader' => 'UIComponents\View\Helper\Components\Pageheader', |
@@ -235,29 +235,29 @@ |
||
| 235 | 235 | */ |
| 236 | 236 | protected function inject(\Zend\View\Helper\AbstractHelper $helper) |
| 237 | 237 | { |
| 238 | - if ( |
|
| 239 | - ($helper instanceof \UIComponents\View\Helper\AbstractHelper) || |
|
| 240 | - ($helper instanceof \UIComponents\View\Helper\Navigation\Menu) |
|
| 241 | - ) { |
|
| 242 | - if ($this->getInjectContainer() && !$helper->hasContainer()) { |
|
| 243 | - $helper->setContainer($this->getContainer()); |
|
| 244 | - } |
|
| 245 | - |
|
| 246 | - if ($this->getInjectAcl()) { |
|
| 247 | - if (!$helper->hasAcl()) { |
|
| 248 | - $helper->setAcl($this->getAcl()); |
|
| 249 | - } |
|
| 250 | - if (!$helper->hasRole()) { |
|
| 251 | - $helper->setRole($this->getRole()); |
|
| 252 | - } |
|
| 253 | - } |
|
| 254 | - if ($this->getInjectTranslator() && !$helper->hasTranslator()) { |
|
| 255 | - $helper->setTranslator( |
|
| 256 | - $this->getTranslator(), |
|
| 257 | - $this->getTranslatorTextDomain() |
|
| 258 | - ); |
|
| 259 | - } |
|
| 260 | - } |
|
| 238 | + if ( |
|
| 239 | + ($helper instanceof \UIComponents\View\Helper\AbstractHelper) || |
|
| 240 | + ($helper instanceof \UIComponents\View\Helper\Navigation\Menu) |
|
| 241 | + ) { |
|
| 242 | + if ($this->getInjectContainer() && !$helper->hasContainer()) { |
|
| 243 | + $helper->setContainer($this->getContainer()); |
|
| 244 | + } |
|
| 245 | + |
|
| 246 | + if ($this->getInjectAcl()) { |
|
| 247 | + if (!$helper->hasAcl()) { |
|
| 248 | + $helper->setAcl($this->getAcl()); |
|
| 249 | + } |
|
| 250 | + if (!$helper->hasRole()) { |
|
| 251 | + $helper->setRole($this->getRole()); |
|
| 252 | + } |
|
| 253 | + } |
|
| 254 | + if ($this->getInjectTranslator() && !$helper->hasTranslator()) { |
|
| 255 | + $helper->setTranslator( |
|
| 256 | + $this->getTranslator(), |
|
| 257 | + $this->getTranslatorTextDomain() |
|
| 258 | + ); |
|
| 259 | + } |
|
| 260 | + } |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
@@ -26,15 +26,15 @@ |
||
| 26 | 26 | class UsersController extends BaseActionController |
| 27 | 27 | { |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @var array|\Admin\Model\UserTable |
|
| 31 | - */ |
|
| 32 | - protected $userTable; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * @var array|\Admin\Model\AclroleTable |
|
| 36 | - */ |
|
| 37 | - protected $AclroleTable; |
|
| 29 | + /** |
|
| 30 | + * @var array|\Admin\Model\UserTable |
|
| 31 | + */ |
|
| 32 | + protected $userTable; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * @var array|\Admin\Model\AclroleTable |
|
| 36 | + */ |
|
| 37 | + protected $AclroleTable; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * initialize titles and toolbar items |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | class Menu extends \Zend\View\Helper\Navigation\Menu |
| 31 | 31 | { |
| 32 | - use ComponentClassnamesTrait; |
|
| 33 | - use ComponentAttributesTrait; |
|
| 32 | + use ComponentClassnamesTrait; |
|
| 33 | + use ComponentAttributesTrait; |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * default CSS class to use for li elements |
@@ -353,10 +353,10 @@ discard block |
||
| 353 | 353 | */ |
| 354 | 354 | public function findActive($container = null, $minDepth = null, $maxDepth = -1) |
| 355 | 355 | { |
| 356 | - if ( null == $container ) { |
|
| 357 | - $container = $this->getContainer(); |
|
| 358 | - } |
|
| 359 | - return parent::findActive($container, $minDepth, $maxDepth); |
|
| 356 | + if ( null == $container ) { |
|
| 357 | + $container = $this->getContainer(); |
|
| 358 | + } |
|
| 359 | + return parent::findActive($container, $minDepth, $maxDepth); |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | /** |