@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | /** |
| 70 | 70 | * @param $module |
| 71 | 71 | * @param $tables |
| 72 | - * @param $filename |
|
| 72 | + * @param string $filename |
|
| 73 | 73 | */ |
| 74 | 74 | public function write($module, $tables, $filename) |
| 75 | 75 | { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @param null |
| 147 | 147 | */ |
| 148 | 148 | /** |
| 149 | - * @return bool|string |
|
| 149 | + * @return null|string |
|
| 150 | 150 | */ |
| 151 | 151 | public function render() |
| 152 | 152 | { |
@@ -74,6 +74,11 @@ discard block |
||
| 74 | 74 | * @param boolean $ref |
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * @param string $left |
|
| 80 | + * @param string $right |
|
| 81 | + */ |
|
| 77 | 82 | public function getXoopsCodeEqualsOperator($left, $right, $ref = false) |
| 78 | 83 | { |
| 79 | 84 | if (false === $ref) { |
@@ -249,6 +254,10 @@ discard block |
||
| 249 | 254 | * @param $name |
| 250 | 255 | * @return string |
| 251 | 256 | */ |
| 257 | + |
|
| 258 | + /** |
|
| 259 | + * @param string $name |
|
| 260 | + */ |
|
| 252 | 261 | public function getXoopsCodeGetConfig($moduleDirname, $name) |
| 253 | 262 | { |
| 254 | 263 | return "\${$moduleDirname}->getConfig('{$name}')"; |
@@ -612,7 +621,7 @@ discard block |
||
| 612 | 621 | /** |
| 613 | 622 | * @public function getXoopsCodeTplAssign |
| 614 | 623 | * |
| 615 | - * @param $tplString |
|
| 624 | + * @param string $tplString |
|
| 616 | 625 | * @param $phpRender |
| 617 | 626 | * |
| 618 | 627 | * @return string |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | private $tdmcfile = null; |
| 34 | 34 | |
| 35 | - /* |
|
| 35 | + /* |
|
| 36 | 36 | * @var mixed |
| 37 | 37 | */ |
| 38 | 38 | private $phpcode = null; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public function __construct() |
| 48 | 48 | { |
| 49 | 49 | $this->tdmcfile = TDMCreateFile::getInstance(); |
| 50 | - $this->phpcode = TDMCreatePhpCode::getInstance(); |
|
| 50 | + $this->phpcode = TDMCreatePhpCode::getInstance(); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /* |
@@ -745,11 +745,11 @@ discard block |
||
| 745 | 745 | return $ret; |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | - /** |
|
| 748 | + /** |
|
| 749 | 749 | * @public function getXoopsCodeGetValues |
| 750 | 750 | * |
| 751 | 751 | * @param $tableName |
| 752 | - * @param $tableSoleName |
|
| 752 | + * @param $tableSoleName |
|
| 753 | 753 | * |
| 754 | 754 | * @return string |
| 755 | 755 | */ |
@@ -867,7 +867,7 @@ discard block |
||
| 867 | 867 | public function getXoopsCodeXoopsConfirm($tableName, $language, $fieldId, $fieldMain, $options = 'delete') |
| 868 | 868 | { |
| 869 | 869 | $stuOptions = strtoupper($options); |
| 870 | - $ccFieldId = $this->tdmcfile->getCamelCase($fieldId, false, true); |
|
| 870 | + $ccFieldId = $this->tdmcfile->getCamelCase($fieldId, false, true); |
|
| 871 | 871 | $ret = "xoops_confirm(array('ok' => 1, '{$fieldId}' => \${$ccFieldId}, 'op' => {$options}), \$_SERVER['REQUEST_URI'], sprintf({$language}FORM_SURE_{$stuOptions}, \${$tableName}Obj->getVar('{$fieldMain}')));\n"; |
| 872 | 872 | |
| 873 | 873 | return $ret; |
@@ -927,7 +927,7 @@ discard block |
||
| 927 | 927 | { |
| 928 | 928 | $ucfTableName = ucfirst($tableName); |
| 929 | 929 | |
| 930 | - return "\${$left} =& \${$tableName}{$obj}->getForm{$ucfTableName}();\n"; |
|
| 930 | + return "\${$left} =& \${$tableName}{$obj}->getForm{$ucfTableName}();\n"; |
|
| 931 | 931 | } |
| 932 | 932 | |
| 933 | 933 | /** |
@@ -944,7 +944,7 @@ discard block |
||
| 944 | 944 | public function getXoopsCodeGet($tableName, $var, $obj = '', $isHandler = false, $isParam = false) |
| 945 | 945 | { |
| 946 | 946 | $handler = $isHandler === false ? '' : 'Handler'; |
| 947 | - if ($isParam) { |
|
| 947 | + if ($isParam) { |
|
| 948 | 948 | $ret = "\${$tableName}{$handler}->get(\${$var})"; |
| 949 | 949 | } else { |
| 950 | 950 | $ret = "\${$tableName}{$obj} =& \${$tableName}{$handler}->get(\${$var});\n"; |
@@ -959,14 +959,14 @@ discard block |
||
| 959 | 959 | * @param $tableName |
| 960 | 960 | * @param $var |
| 961 | 961 | * @param $obj |
| 962 | - * @param $isHandler |
|
| 962 | + * @param $isHandler |
|
| 963 | 963 | * |
| 964 | 964 | * @return string |
| 965 | 965 | */ |
| 966 | 966 | public function getXoopsCodeInsert($tableName, $var, $obj = '', $isHandler = false) |
| 967 | 967 | { |
| 968 | 968 | $handler = $isHandler === false ? '' : 'Handler'; |
| 969 | - if ($obj != '') { |
|
| 969 | + if ($obj != '') { |
|
| 970 | 970 | $ret = "\${$tableName}{$handler}->insert(\${$var}{$obj})"; |
| 971 | 971 | } else { |
| 972 | 972 | $ret = "\${$tableName}{$handler}->insert(\${$var})"; |
@@ -988,11 +988,11 @@ discard block |
||
| 988 | 988 | public function getXoopsCodeDelete($tableName, $var, $obj = '', $isHandler = false) |
| 989 | 989 | { |
| 990 | 990 | $handler = $isHandler === false ? '' : 'Handler'; |
| 991 | - if ($obj != '') { |
|
| 992 | - $ret = "\${$tableName}{$handler}->delete(\${$var}{$obj})"; |
|
| 993 | - } else { |
|
| 994 | - $ret = "\${$tableName}{$handler}->delete(\${$var})"; |
|
| 995 | - } |
|
| 991 | + if ($obj != '') { |
|
| 992 | + $ret = "\${$tableName}{$handler}->delete(\${$var}{$obj})"; |
|
| 993 | + } else { |
|
| 994 | + $ret = "\${$tableName}{$handler}->delete(\${$var})"; |
|
| 995 | + } |
|
| 996 | 996 | |
| 997 | 997 | return $ret; |
| 998 | 998 | } |
@@ -1029,7 +1029,7 @@ discard block |
||
| 1029 | 1029 | public function getXoopsCodeCaseDelete($language, $tableName, $fieldId, $fieldMain) |
| 1030 | 1030 | { |
| 1031 | 1031 | $ccFieldId = $this->tdmcfile->getCamelCase($fieldId, false, true); |
| 1032 | - $ret = $this->getXoopsCodeGet($tableName, $ccFieldId, 'Obj', true); |
|
| 1032 | + $ret = $this->getXoopsCodeGet($tableName, $ccFieldId, 'Obj', true); |
|
| 1033 | 1033 | |
| 1034 | 1034 | $reqOk = "\$_REQUEST['ok']"; |
| 1035 | 1035 | $isset = $this->phpcode->getPhpCodeIsset($reqOk); |
@@ -1104,8 +1104,8 @@ discard block |
||
| 1104 | 1104 | public function getXoopsCodeUpdate($language, $tableName, $fieldId, $fieldName) |
| 1105 | 1105 | { |
| 1106 | 1106 | $ccFieldId = $this->tdmcfile->getCamelCase($fieldId, false, true); |
| 1107 | - $get = $this->getXoopsCodeGet($tableName, $ccFieldId, 'Obj', true); |
|
| 1108 | - $isset = $this->phpcode->getPhpCodeIsset($ccFieldId); |
|
| 1107 | + $get = $this->getXoopsCodeGet($tableName, $ccFieldId, 'Obj', true); |
|
| 1108 | + $isset = $this->phpcode->getPhpCodeIsset($ccFieldId); |
|
| 1109 | 1109 | $get = $this->getXoopsCodeHandler($tableName, $fieldId, true); |
| 1110 | 1110 | $ret = $this->phpcode->getPhpCodeConditions($isset, '', '', $get); |
| 1111 | 1111 | $ret .= $this->getXoopsCodeSetVar($tableName, $fieldName, "\$_POST['{$fieldName}']"); |
@@ -1188,7 +1188,7 @@ discard block |
||
| 1188 | 1188 | return $ret; |
| 1189 | 1189 | } |
| 1190 | 1190 | |
| 1191 | - /* |
|
| 1191 | + /* |
|
| 1192 | 1192 | * @public function getXoopsCodePageNav |
| 1193 | 1193 | * @param $tableName |
| 1194 | 1194 | * |
@@ -1198,8 +1198,8 @@ discard block |
||
| 1198 | 1198 | { |
| 1199 | 1199 | $condition = $this->phpcode->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/pagenav', true); |
| 1200 | 1200 | $condition .= "\$pagenav = new XoopsPageNav(\${$tableName}Count, \$limit, \$start, 'start', 'op=list&limit=' . \$limit);\n"; |
| 1201 | - $condition .= $this->getXoopsCodeTplAssign('pagenav', "\$pagenav->renderNav(4)"); |
|
| 1202 | - $ret = $this->phpcode->getPhpCodeConditions("\${$tableName}Count", ' > ', "\$limit", $condition, false, "\t\t"); |
|
| 1201 | + $condition .= $this->getXoopsCodeTplAssign('pagenav', "\$pagenav->renderNav(4)"); |
|
| 1202 | + $ret = $this->phpcode->getPhpCodeConditions("\${$tableName}Count", ' > ', "\$limit", $condition, false, "\t\t"); |
|
| 1203 | 1203 | |
| 1204 | 1204 | return $ret; |
| 1205 | 1205 | } |
@@ -158,13 +158,13 @@ discard block |
||
| 158 | 158 | $ret .= $this->t2.$this->xoopscode->getXoopsCodeTplAssign("{$moduleDirname}_upload_url", "{$stuModuleDirname}_UPLOAD_URL"); |
| 159 | 159 | |
| 160 | 160 | $ret .= $this->t2.$this->getCommentLine('Table view'); |
| 161 | - $contentForeach = $this->xoopscode->getXoopsCodeGetValues($tableName, $tableSoleName); |
|
| 162 | - $contentForeach .= $this->xoopscode->getXoopsCodeXoopsTplAppend("{$tableName}_list", "\${$tableSoleName}"); |
|
| 163 | - $contentForeach .= $this->phpcode->getPhpCodeUnset($tableSoleName); |
|
| 164 | - $condIf = $this->phpcode->getPhpCodeForeach("{$tableName}All", true, false, 'i', $contentForeach); |
|
| 165 | - $condIf .= $this->xoopscode->getXoopsCodePageNav($tableName); |
|
| 166 | - $condElse = $this->xoopscode->getXoopsCodeTplAssign('error', "{$language}THEREARENT_{$stuTableName}"); |
|
| 167 | - $ret .= $this->phpcode->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $condIf, $condElse, "\t\t"); |
|
| 161 | + $contentForeach = $this->xoopscode->getXoopsCodeGetValues($tableName, $tableSoleName); |
|
| 162 | + $contentForeach .= $this->xoopscode->getXoopsCodeXoopsTplAppend("{$tableName}_list", "\${$tableSoleName}"); |
|
| 163 | + $contentForeach .= $this->phpcode->getPhpCodeUnset($tableSoleName); |
|
| 164 | + $condIf = $this->phpcode->getPhpCodeForeach("{$tableName}All", true, false, 'i', $contentForeach); |
|
| 165 | + $condIf .= $this->xoopscode->getXoopsCodePageNav($tableName); |
|
| 166 | + $condElse = $this->xoopscode->getXoopsCodeTplAssign('error', "{$language}THEREARENT_{$stuTableName}"); |
|
| 167 | + $ret .= $this->phpcode->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $condIf, $condElse, "\t\t"); |
|
| 168 | 168 | |
| 169 | 169 | return $ret; |
| 170 | 170 | } |
@@ -191,10 +191,10 @@ discard block |
||
| 191 | 191 | $ret .= $this->t2.$this->adminxoopscode->getAdminItemButton($language, $tableName, $stuTableSoleName, '', 'list'); |
| 192 | 192 | $ret .= $this->t2.$this->xoopscode->getXoopsCodeTplAssign('buttons', '$adminMenu->renderButton()'); |
| 193 | 193 | } |
| 194 | - $ret .= $this->t2.$this->getCommentLine('Get Form'); |
|
| 195 | - $ret .= $this->t2.$this->xoopscode->getXoopsCodeObjHandlerCreate($tableName); |
|
| 196 | - $ret .= $this->t2.$this->xoopscode->getXoopsCodeGetForm('form', $tableName, 'Obj'); |
|
| 197 | - $ret .= $this->t2.$this->xoopscode->getXoopsCodeTplAssign('form', '$form->render()'); |
|
| 194 | + $ret .= $this->t2.$this->getCommentLine('Get Form'); |
|
| 195 | + $ret .= $this->t2.$this->xoopscode->getXoopsCodeObjHandlerCreate($tableName); |
|
| 196 | + $ret .= $this->t2.$this->xoopscode->getXoopsCodeGetForm('form', $tableName, 'Obj'); |
|
| 197 | + $ret .= $this->t2.$this->xoopscode->getXoopsCodeTplAssign('form', '$form->render()'); |
|
| 198 | 198 | |
| 199 | 199 | return $ret; |
| 200 | 200 | } |
@@ -265,14 +265,14 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | - $ret .= $this->t2.$this->getCommentLine('Insert Data'); |
|
| 269 | - $insert = $this->xoopscode->getXoopsCodeInsert($tableName, $tableName); |
|
| 268 | + $ret .= $this->t2.$this->getCommentLine('Insert Data'); |
|
| 269 | + $insert = $this->xoopscode->getXoopsCodeInsert($tableName, $tableName); |
|
| 270 | 270 | $confirmOk = $this->xoopscode->getXoopsCodeRedirectHeader($tableName, '?op=list', '2', "{$language}FORM_OK"); |
| 271 | 271 | $ret .= $this->phpcode->getPhpCodeConditions($insert, '', '', $confirmOk, false, "\t"); |
| 272 | - $ret .= $this->t2.$this->getCommentLine('Get Form'); |
|
| 273 | - $ret .= $this->t2.$this->xoopscode->getXoopsCodeTplAssign('error', "\${$tableName}Obj->getHtmlErrors()"); |
|
| 274 | - $ret .= $this->t2.$this->xoopscode->getXoopsCodeGetForm('form', $tableName, 'Obj'); |
|
| 275 | - $ret .= $this->t2.$this->xoopscode->getXoopsCodeTplAssign('form', '$form->render()'); |
|
| 272 | + $ret .= $this->t2.$this->getCommentLine('Get Form'); |
|
| 273 | + $ret .= $this->t2.$this->xoopscode->getXoopsCodeTplAssign('error', "\${$tableName}Obj->getHtmlErrors()"); |
|
| 274 | + $ret .= $this->t2.$this->xoopscode->getXoopsCodeGetForm('form', $tableName, 'Obj'); |
|
| 275 | + $ret .= $this->t2.$this->xoopscode->getXoopsCodeTplAssign('form', '$form->render()'); |
|
| 276 | 276 | |
| 277 | 277 | return $ret; |
| 278 | 278 | } |
@@ -307,10 +307,10 @@ discard block |
||
| 307 | 307 | $ret .= $this->t2.$this->adminxoopscode->getAdminItemButton($language, $tableName, $stuTableSoleName, '', 'list'); |
| 308 | 308 | $ret .= $this->t2.$this->xoopscode->getXoopsCodeTplAssign('buttons', '$adminMenu->renderButton()'); |
| 309 | 309 | } |
| 310 | - $ret .= $this->t2.$this->getCommentLine('Get Form'); |
|
| 311 | - $ret .= $this->t2.$this->xoopscode->getXoopsCodeGet($tableName, $ccFieldId, 'Obj', true); |
|
| 312 | - $ret .= $this->t2.$this->xoopscode->getXoopsCodeGetForm('form', $tableName, 'Obj'); |
|
| 313 | - $ret .= $this->t2.$this->xoopscode->getXoopsCodeTplAssign('form', '$form->render()'); |
|
| 310 | + $ret .= $this->t2.$this->getCommentLine('Get Form'); |
|
| 311 | + $ret .= $this->t2.$this->xoopscode->getXoopsCodeGet($tableName, $ccFieldId, 'Obj', true); |
|
| 312 | + $ret .= $this->t2.$this->xoopscode->getXoopsCodeGetForm('form', $tableName, 'Obj'); |
|
| 313 | + $ret .= $this->t2.$this->xoopscode->getXoopsCodeTplAssign('form', '$form->render()'); |
|
| 314 | 314 | |
| 315 | 315 | return $ret; |
| 316 | 316 | } |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | */ |
| 339 | 339 | private function getAdminPagesUpdate($language, $tableName, $fieldId, $fieldName) |
| 340 | 340 | { |
| 341 | - return $this->xoopscode->getXoopsCodeUpdate($language, $tableName, $fieldId, $fieldName); |
|
| 341 | + return $this->xoopscode->getXoopsCodeUpdate($language, $tableName, $fieldId, $fieldName); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /* |
@@ -383,7 +383,7 @@ |
||
| 383 | 383 | 'new' => array($new), |
| 384 | 384 | 'save' => array($save), |
| 385 | 385 | 'edit' => array($edit), |
| 386 | - 'delete' => array($delete) ); |
|
| 386 | + 'delete' => array($delete)); |
|
| 387 | 387 | $content .= $this->getAdminPagesSwitch($cases); |
| 388 | 388 | $content .= $this->getInclude('footer'); |
| 389 | 389 | // |