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/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/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

class/files/admin/AdminPages.php 1 location

@@ 194-212 (lines=19) @@
191
    *  @param string $language
192
    *  @return string
193
    */
194
    private function getAdminPagesNew($moduleDirname, $tableName, $language)
195
    {
196
        $stuTableName = strtoupper($tableName);
197
        $ucfTableName = ucfirst($tableName);
198
199
        $ret = <<<EOT
200
    case 'new':
201
        \$templateMain = '{$moduleDirname}_admin_{$tableName}.tpl';
202
        \$adminMenu->addItemButton({$language}{$stuTableName}_LIST, '{$tableName}.php', 'list');
203
        \$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php'));
204
        \$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton());
205
        // Get Form
206
        \${$tableName}Obj =& \${$tableName}Handler->create();
207
        \$form = \${$tableName}Obj->getForm{$ucfTableName}();
208
        \$GLOBALS['xoopsTpl']->assign('form', \$form->render());
209
    break;\n
210
EOT;
211
212
        return $ret;
213
    }
214
215
    /*

class/files/admin/AdminXoopsCode.php 1 location

@@ 483-501 (lines=19) @@
480
    *  @param string $fieldMain
481
    *  @return string
482
    */
483
    public function getAdminXoopsCodeUpdate($moduleDirname, $tableName, $language, $fieldId, $fieldMain)
484
    {
485
        $upModuleName = strtoupper($moduleDirname);
486
        $ret = <<<EOT
487
    case 'update':
488
        if (isset(\${$fieldId})) {
489
            \${$tableName}Obj =& \${$tableName}Handler->get(\${$fieldId});
490
        }
491
        \${$tableName}Obj->setVar("\${$tableName}_display", \$_POST["\${$tableName}_display"]);
492
493
        if (\${$tableName}Handler->insert(\${$tableName}Obj)) {
494
            redirect_header("\${$tableName}.php", 3, _AM_{$upModuleName}_FORMOK);
495
        }
496
        echo \${$tableName}Obj->getHtmlErrors();
497
    break;\n
498
EOT;
499
500
        return $ret;
501
    }
502
}
503