| @@ 433-454 (lines=22) @@ | ||
| 430 | * @param string $fieldMain |
|
| 431 | * @return string |
|
| 432 | */ |
|
| 433 | public function getAdminPhpCodeDelete($tableName, $language, $fieldId, $fieldMain) |
|
| 434 | { |
|
| 435 | $ret = <<<EOT |
|
| 436 | case 'delete': |
|
| 437 | \${$tableName}Obj =& \${$tableName}Handler->get(\${$fieldId}); |
|
| 438 | if (isset(\$_REQUEST['ok']) && 1 == \$_REQUEST['ok']) { |
|
| 439 | if ( !\$GLOBALS['xoopsSecurity']->check() ) { |
|
| 440 | redirect_header('{$tableName}.php', 3, implode(', ', \$GLOBALS['xoopsSecurity']->getErrors())); |
|
| 441 | } |
|
| 442 | if (\${$tableName}Handler->delete(\${$tableName}Obj)) { |
|
| 443 | redirect_header('{$tableName}.php', 3, {$language}FORMDELOK); |
|
| 444 | } else { |
|
| 445 | echo \${$tableName}Obj->getHtmlErrors(); |
|
| 446 | } |
|
| 447 | } else { |
|
| 448 | xoops_confirm(array('ok' => 1, '{$fieldId}' => \${$fieldId}, 'op' => 'delete'), \$_SERVER['REQUEST_URI'], sprintf({$language}FORMSUREDEL, \${$tableName}Obj->getVar('{$fieldMain}'))); |
|
| 449 | } |
|
| 450 | break;\n |
|
| 451 | EOT; |
|
| 452 | ||
| 453 | return $ret; |
|
| 454 | } |
|
| 455 | ||
| 456 | /* |
|
| 457 | * @public function getAdminPhpCodeUpdate |
|
| @@ 933-964 (lines=32) @@ | ||
| 930 | * @param string $fieldMain |
|
| 931 | * @return string |
|
| 932 | */ |
|
| 933 | public function getXoopsCodeCaseDelete($language, $tableName, $fieldId, $fieldMain) |
|
| 934 | { |
|
| 935 | $ret = <<<EOT |
|
| 936 | \${$tableName}Obj =& \${$tableName}Handler->get(\${$fieldId}); |
|
| 937 | if (isset(\$_REQUEST['ok']) && 1 == \$_REQUEST['ok']) { |
|
| 938 | if ( !\$GLOBALS['xoopsSecurity']->check() ) { |
|
| 939 | redirect_header('{$tableName}.php', 3, implode(', ', \$GLOBALS['xoopsSecurity']->getErrors())); |
|
| 940 | } |
|
| 941 | if (\${$tableName}Handler->delete(\${$tableName}Obj)) { |
|
| 942 | redirect_header('{$tableName}.php', 3, {$language}FORM_DELETE_OK); |
|
| 943 | } else { |
|
| 944 | echo \${$tableName}Obj->getHtmlErrors(); |
|
| 945 | } |
|
| 946 | } else { |
|
| 947 | xoops_confirm(array('ok' => 1, '{$fieldId}' => \${$fieldId}, 'op' => 'delete'), \$_SERVER['REQUEST_URI'], sprintf({$language}FORM_SURE_DELETE, \${$tableName}Obj->getVar('{$fieldMain}'))); |
|
| 948 | }\n |
|
| 949 | EOT; |
|
| 950 | /*$isset = $this->phpcode->getPhpCodeIsset($fieldId); |
|
| 951 | $if1 = $this->phpcode->getPhpCodeConditions($isset, '', '', "\${$tableName}Obj =& ".$get); |
|
| 952 | $get = $this->getXoopsCodeHandler($tableName, $fieldId, true); |
|
| 953 | $if2 = $this->phpcode->getPhpCodeConditions($isset, '', '', "\${$tableName}Obj =& ".$get); |
|
| 954 | $ret = $this->phpcode->getPhpCodeConditions($isset, '', '', "\${$tableName}Obj =& ".$get); |
|
| 955 | //$ret .= $this->getXoopsCodeSetVar($tableName, $fieldName, "\$_POST['{$fieldName}']"); |
|
| 956 | $handlerInsert = $this->$this->getXoopsCodeHandler($tableName, $tableName, false, true, false, 'Obj'); |
|
| 957 | $redirect = $this->getXoopsCodeRedirectHeader($tableName, '', 2, "{$language}FORM_DELETE_OK"); |
|
| 958 | ||
| 959 | $else = $this->getXoopsCodeTplAssign('error', "\${$tableName}Obj->getHtmlErrors()"); |
|
| 960 | ||
| 961 | $ret .= $this->phpcode->getPhpCodeConditions($handlerInsert, '', '', $redirect, $else);*/ |
|
| 962 | ||
| 963 | return $this->phpcode->getPhpCodeCaseSwitch('delete', $ret); |
|
| 964 | } |
|
| 965 | ||
| 966 | /* |
|
| 967 | * @public function getXoopsCodeUpdate |
|