Code Duplication    Length = 16-30 lines in 5 locations

class/files/user/UserSubmit.php 1 location

@@ 125-154 (lines=30) @@
122
     *
123
     * @return string
124
     */
125
    public function getUserSubmitForm($moduleDirname, $tableName, $tableSoleName, $language)
126
    {
127
        $stuModuleDirname = strtoupper($moduleDirname);
128
        $stuTableSoleName = strtoupper($tableSoleName);
129
        $ucfTableName = ucfirst($tableName);
130
        $ret = <<<EOT
131
    case 'form':
132
    default:
133
        //navigation
134
        \$navigation = {$language}SUBMIT_PROPOSER;
135
        \$GLOBALS['xoopsTpl']->assign('navigation', \$navigation);
136
        // reference
137
        // title of page
138
        \$title = {$language}SUBMIT_PROPOSER . '&nbsp;-&nbsp;';
139
        \$title .= \$GLOBALS['xoopsModule']->name();
140
        \$GLOBALS['xoopsTpl']->assign('xoops_pagetitle', \$title);
141
        //description
142
        \$GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags({$language}SUBMIT_PROPOSER));
143
        // Description
144
        \$GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags({$language}SUBMIT));
145
146
        // Create
147
        \${$tableName}Obj =& \${$tableName}Handler->create();
148
        \$form = \${$tableName}Obj->getForm{$ucfTableName}();
149
        \$xoopsTpl->assign('form', \$form->render());
150
		break;\n
151
EOT;
152
153
        return $ret;
154
    }
155
156
    /*
157
    *  @public function getUserSubmitSave

class/files/admin/AdminPages.php 1 location

@@ 175-193 (lines=19) @@
172
    *  @param string $language
173
    *  @return string
174
    */
175
    private function getAdminPagesNew($moduleDirname, $tableName, $language)
176
    {
177
        $stuTableName = strtoupper($tableName);
178
        $ucfTableName = ucfirst($tableName);
179
180
        $ret = <<<EOT
181
    case 'new':
182
        \$templateMain = '{$moduleDirname}_admin_{$tableName}.tpl';
183
        \$adminMenu->addItemButton({$language}{$stuTableName}_LIST, '{$tableName}.php', 'list');
184
        \$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php'));
185
        \$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton());
186
        // Get Form
187
        \${$tableName}Obj =& \${$tableName}Handler->create();
188
        \$form = \${$tableName}Obj->getForm{$ucfTableName}();
189
        \$GLOBALS['xoopsTpl']->assign('form', \$form->render());
190
    break;\n
191
EOT;
192
193
        return $ret;
194
    }
195
196
    /*

class/files/admin/AdminPhpCode.php 1 location

@@ 465-483 (lines=19) @@
462
    *  @param string $fieldMain
463
    *  @return string
464
    */
465
    public function getAdminPhpCodeUpdate($moduleDirname, $tableName, $language, $fieldId, $fieldMain)
466
    {
467
        $upModuleName = strtoupper($moduleDirname);
468
        $ret = <<<EOT
469
    case 'update':
470
        if (isset(\${$fieldId})) {
471
            \${$tableName}Obj =& \${$tableName}Handler->get(\${$fieldId});
472
        }
473
        \${$tableName}Obj->setVar("\${$tableName}_display", \$_POST["\${$tableName}_display"]);
474
475
        if (\${$tableName}Handler->insert(\${$tableName}Obj)) {
476
            redirect_header("\${$tableName}.php", 3, _AM_{$upModuleName}_FORMOK);
477
        }
478
        echo \${$tableName}Obj->getHtmlErrors();
479
    break;\n
480
EOT;
481
482
        return $ret;
483
    }
484
485
    /**
486
     *  @public function getAdminPhpCodeGetDisplayTpl

class/files/admin/AdminXoopsCode.php 1 location

@@ 343-361 (lines=19) @@
340
    *  @param string $fieldMain
341
    *  @return string
342
    */
343
    public function getAdminXoopsCodeUpdate($moduleDirname, $tableName, $language, $fieldId, $fieldMain)
344
    {
345
        $upModuleName = strtoupper($moduleDirname);
346
        $ret = <<<EOT
347
    case 'update':
348
        if (isset(\${$fieldId})) {
349
            \${$tableName}Obj =& \${$tableName}Handler->get(\${$fieldId});
350
        }
351
        \${$tableName}Obj->setVar("\${$tableName}_display", \$_POST["\${$tableName}_display"]);
352
353
        if (\${$tableName}Handler->insert(\${$tableName}Obj)) {
354
            redirect_header("\${$tableName}.php", 3, _AM_{$upModuleName}_FORMOK);
355
        }
356
        echo \${$tableName}Obj->getHtmlErrors();
357
    break;\n
358
EOT;
359
360
        return $ret;
361
    }    
362
}
363

class/files/user/UserXoopsVersion.php 1 location

@@ 549-564 (lines=16) @@
546
     *
547
     * @return string
548
     */
549
    private function getXoopsVersionTypeBlocks($moduleDirname, $tableName, $language, $type)
550
    {
551
        $stuTableName = strtoupper($tableName);
552
        $ret = <<<EOT
553
\$modversion['blocks'][] = array(
554
    'file' => '{$tableName}.php',
555
    'name' => {$language}{$stuTableName}_BLOCK,
556
    'description' => {$language}{$stuTableName}_BLOCK_DESC,
557
    'show_func' => 'b_{$moduleDirname}_{$tableName}_show',
558
    'edit_func' => 'b_{$moduleDirname}_{$tableName}_edit',
559
    'options' => '{$type}|5|25|0',
560
    'template' => '{$moduleDirname}_block_{$tableName}.tpl');\n\n
561
EOT;
562
563
        return $ret;
564
    }
565
566
    /*
567
    *  @private function getXoopsVersionConfig