| @@ 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 |
|
| @@ 451-472 (lines=22) @@ | ||
| 448 | * @param string $fieldMain |
|
| 449 | * @return string |
|
| 450 | */ |
|
| 451 | public function getAdminXoopsCodeDelete($tableName, $language, $fieldId, $fieldMain) |
|
| 452 | { |
|
| 453 | $ret = <<<EOT |
|
| 454 | case 'delete': |
|
| 455 | \${$tableName}Obj =& \${$tableName}Handler->get(\${$fieldId}); |
|
| 456 | if (isset(\$_REQUEST['ok']) && 1 == \$_REQUEST['ok']) { |
|
| 457 | if ( !\$GLOBALS['xoopsSecurity']->check() ) { |
|
| 458 | redirect_header('{$tableName}.php', 3, implode(', ', \$GLOBALS['xoopsSecurity']->getErrors())); |
|
| 459 | } |
|
| 460 | if (\${$tableName}Handler->delete(\${$tableName}Obj)) { |
|
| 461 | redirect_header('{$tableName}.php', 3, {$language}FORMDELOK); |
|
| 462 | } else { |
|
| 463 | echo \${$tableName}Obj->getHtmlErrors(); |
|
| 464 | } |
|
| 465 | } else { |
|
| 466 | xoops_confirm(array('ok' => 1, '{$fieldId}' => \${$fieldId}, 'op' => 'delete'), \$_SERVER['REQUEST_URI'], sprintf({$language}FORMSUREDEL, \${$tableName}Obj->getVar('{$fieldMain}'))); |
|
| 467 | } |
|
| 468 | break;\n |
|
| 469 | EOT; |
|
| 470 | ||
| 471 | return $ret; |
|
| 472 | } |
|
| 473 | ||
| 474 | /* |
|
| 475 | * @public function getAdminXoopsCodeUpdate |
|
| @@ 925-956 (lines=32) @@ | ||
| 922 | * @param string $fieldMain |
|
| 923 | * @return string |
|
| 924 | */ |
|
| 925 | public function getXoopsCodeCaseDelete($language, $tableName, $fieldId, $fieldMain) |
|
| 926 | { |
|
| 927 | $ret = <<<EOT |
|
| 928 | \${$tableName}Obj =& \${$tableName}Handler->get(\${$fieldId}); |
|
| 929 | if (isset(\$_REQUEST['ok']) && 1 == \$_REQUEST['ok']) { |
|
| 930 | if ( !\$GLOBALS['xoopsSecurity']->check() ) { |
|
| 931 | redirect_header('{$tableName}.php', 3, implode(', ', \$GLOBALS['xoopsSecurity']->getErrors())); |
|
| 932 | } |
|
| 933 | if (\${$tableName}Handler->delete(\${$tableName}Obj)) { |
|
| 934 | redirect_header('{$tableName}.php', 3, {$language}FORM_DELETE_OK); |
|
| 935 | } else { |
|
| 936 | echo \${$tableName}Obj->getHtmlErrors(); |
|
| 937 | } |
|
| 938 | } else { |
|
| 939 | xoops_confirm(array('ok' => 1, '{$fieldId}' => \${$fieldId}, 'op' => 'delete'), \$_SERVER['REQUEST_URI'], sprintf({$language}FORM_SURE_DELETE, \${$tableName}Obj->getVar('{$fieldMain}'))); |
|
| 940 | }\n |
|
| 941 | EOT; |
|
| 942 | /*$isset = $this->phpcode->getPhpCodeIsset($fieldId); |
|
| 943 | $if1 = $this->phpcode->getPhpCodeConditions($isset, '', '', "\${$tableName}Obj =& ".$get); |
|
| 944 | $get = $this->getXoopsCodeHandler($tableName, $fieldId, true); |
|
| 945 | $if2 = $this->phpcode->getPhpCodeConditions($isset, '', '', "\${$tableName}Obj =& ".$get); |
|
| 946 | $ret = $this->phpcode->getPhpCodeConditions($isset, '', '', "\${$tableName}Obj =& ".$get); |
|
| 947 | //$ret .= $this->getXoopsCodeSetVar($tableName, $fieldName, "\$_POST['{$fieldName}']"); |
|
| 948 | $handlerInsert = $this->$this->getXoopsCodeHandler($tableName, $tableName, false, true, false, 'Obj'); |
|
| 949 | $redirect = $this->getXoopsCodeRedirectHeader($tableName, '', 2, "{$language}FORM_DELETE_OK"); |
|
| 950 | ||
| 951 | $else = $this->getXoopsCodeTplAssign('error', "\${$tableName}Obj->getHtmlErrors()"); |
|
| 952 | ||
| 953 | $ret .= $this->phpcode->getPhpCodeConditions($handlerInsert, '', '', $redirect, $else);*/ |
|
| 954 | ||
| 955 | return $this->phpcode->getPhpCodeCaseSwitch('delete', $ret); |
|
| 956 | } |
|
| 957 | ||
| 958 | /* |
|
| 959 | * @public function getXoopsCodeUpdate |
|