Code Duplication    Length = 16-30 lines in 4 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/AdminXoopsCode.php 1 location

@@ 451-469 (lines=19) @@
448
    *  @param string $fieldMain
449
    *  @return string
450
    */
451
    public function getAdminXoopsCodeUpdate($moduleDirname, $tableName, $language, $fieldId, $fieldMain)
452
    {
453
        $upModuleName = strtoupper($moduleDirname);
454
        $ret = <<<EOT
455
    case 'update':
456
        if (isset(\${$fieldId})) {
457
            \${$tableName}Obj =& \${$tableName}Handler->get(\${$fieldId});
458
        }
459
        \${$tableName}Obj->setVar("\${$tableName}_display", \$_POST["\${$tableName}_display"]);
460
461
        if (\${$tableName}Handler->insert(\${$tableName}Obj)) {
462
            redirect_header("\${$tableName}.php", 3, _AM_{$upModuleName}_FORMOK);
463
        }
464
        echo \${$tableName}Obj->getHtmlErrors();
465
    break;\n
466
EOT;
467
468
        return $ret;
469
    }
470
}
471