@@ -111,12 +111,13 @@ public function getXcSetVarObj($tableName, $fieldName, $var, $t = '')
111111
112112 /**
113113 * @public function getXcGetVar
114- * @param $varLeft
115- * @param $handle
116- * @param $var
117- * @param $isParam
118- * @param $t
114+ * @param string $varLeft
115+ * @param string $handle
116+ * @param string $var
117+ * @param bool $isParam
118+ * @param string $t
119119 *
120+ * @param string $format
120121 * @return string
121122 */
122123 public function getXcGetVar ($ varLeft = '' , $ handle = '' , $ var = '' , $ isParam = false , $ t = '' , $ format = '' )
@@ -1674,4 +1675,82 @@ public function getXcXoopsHandler($left, $t = '', $n = "\n")
16741675 {
16751676 return "{$ t }\${$ left }Handler = xoops_getHandler(' {$ left }'); {$ n }" ;
16761677 }
1678+
1679+
1680+ /*************************************************************/
1681+ /** common components for user and admin pages */
1682+ /*************************************************************/
1683+
1684+ /**
1685+ * @public function getXcCommonPagesEdit
1686+ * @param $tableName
1687+ * @param $ccFieldId
1688+ * @param string $t
1689+ * @return string
1690+ */
1691+ public function getXcCommonPagesEdit ($ tableName , $ ccFieldId , $ t = '' )
1692+ {
1693+ $ pc = Tdmcreate \Files \CreatePhpCode::getInstance ();
1694+ $ xc = Tdmcreate \Files \CreateXoopsCode::getInstance ();
1695+
1696+ $ ret = $ pc ->getPhpCodeCommentLine ('Get Form ' , null , "\t\t" );
1697+ $ ret .= $ xc ->getXcHandlerGet ($ tableName , $ ccFieldId , 'Obj ' , $ tableName . 'Handler ' , false , $ t );
1698+ $ ret .= $ xc ->getXcGetForm ('form ' , $ tableName , 'Obj ' , $ t );
1699+ $ ret .= $ xc ->getXcXoopsTplAssign ('form ' , '$form->render() ' , true , $ t );
1700+
1701+ return $ ret ;
1702+ }
1703+
1704+ /**
1705+ * @public function getXcCommonPagesNew
1706+ * @param $tableName
1707+ * @param string $t
1708+ * @return string
1709+ */
1710+ public function getXcCommonPagesNew ($ tableName , $ t = '' )
1711+ {
1712+ $ pc = Tdmcreate \Files \CreatePhpCode::getInstance ();
1713+ $ xc = Tdmcreate \Files \CreateXoopsCode::getInstance ();
1714+
1715+ $ ret = $ pc ->getPhpCodeCommentLine ('Form Create ' , null , $ t );
1716+ $ ret .= $ xc ->getXcHandlerCreateObj ($ tableName , $ t );
1717+ $ ret .= $ xc ->getXcGetForm ('form ' , $ tableName , 'Obj ' , $ t );
1718+ $ ret .= $ xc ->getXcXoopsTplAssign ('form ' , '$form->render() ' , true , $ t );
1719+
1720+ return $ ret ;
1721+ }
1722+
1723+ /**
1724+ * @public function getXcCommonPagesDelete
1725+ * @param $language
1726+ * @param $tableName
1727+ * @param $fieldId
1728+ * @param $fieldMain
1729+ * @param string $t
1730+ * @return string
1731+ */
1732+ public function getXcCommonPagesDelete ($ language , $ tableName , $ fieldId , $ fieldMain , $ t = '' )
1733+ {
1734+ $ pc = Tdmcreate \Files \CreatePhpCode::getInstance ();
1735+ $ xc = Tdmcreate \Files \CreateXoopsCode::getInstance ();
1736+ $ cf = Tdmcreate \Files \CreateFile::getInstance ();
1737+ $ ccFieldId = $ cf ->getCamelCase ($ fieldId , false , true );
1738+ $ ret = $ xc ->getXcHandlerGet ($ tableName , $ ccFieldId , 'Obj ' , $ tableName . 'Handler ' , '' , $ t );
1739+ $ reqOk = "_REQUEST['ok'] " ;
1740+ $ isset = $ pc ->getPhpCodeIsset ($ reqOk );
1741+ $ xoopsSecurityCheck = $ xc ->getXcXoopsSecurityCheck ();
1742+ $ xoopsSecurityErrors = $ xc ->getXcXoopsSecurityErrors ();
1743+ $ implode = $ pc ->getPhpCodeImplode (', ' , $ xoopsSecurityErrors );
1744+ $ redirectHeaderErrors = $ xc ->getXcRedirectHeader ($ tableName , '' , '3 ' , $ implode , true , $ t . "\t\t" );
1745+ $ delete = $ xc ->getXcHandlerDelete ($ tableName , $ tableName , 'Obj ' , 'Handler ' );
1746+ $ condition = $ pc ->getPhpCodeConditions ('! ' . $ xoopsSecurityCheck , '' , '' , $ redirectHeaderErrors , false , $ t . "\t" );
1747+ $ redirectHeaderLanguage = $ xc ->getXcRedirectHeader ($ tableName , '' , '3 ' , "{$ language }FORM_DELETE_OK " , true , $ t . "\t\t" );
1748+ $ htmlErrors = $ xc ->getXcHtmlErrors ($ tableName , true );
1749+ $ internalElse = $ xc ->getXcXoopsTplAssign ('error ' , $ htmlErrors , true , $ t . "\t\t" );
1750+ $ condition .= $ pc ->getPhpCodeConditions ($ delete , '' , '' , $ redirectHeaderLanguage , $ internalElse , $ t . "\t" );
1751+ $ mainElse = $ xc ->getXcXoopsConfirm ($ tableName , $ language , $ fieldId , $ fieldMain , 'delete ' , $ t . "\t" );
1752+ $ ret .= $ pc ->getPhpCodeConditions ($ isset , ' && ' , "1 == \${$ reqOk }" , $ condition , $ mainElse , $ t );
1753+
1754+ return $ ret ;
1755+ }
16771756}
0 commit comments