3131 */
3232class AdminBroken extends Files \CreateFile
3333{
34+ /**
35+ * @var mixed
36+ */
37+ private $ axc = null ;
38+
39+ /**
40+ * @var mixed
41+ */
42+ private $ xc = null ;
43+
44+ /**
45+ * @var mixed
46+ */
47+ private $ pc = null ;
48+
3449 /**
3550 * @public function constructor
3651 * @param null
3752 */
3853 public function __construct ()
3954 {
4055 parent ::__construct ();
56+ $ this ->xc = Modulebuilder \Files \CreateXoopsCode::getInstance ();
57+ $ this ->pc = Modulebuilder \Files \CreatePhpCode::getInstance ();
58+ $ this ->axc = Modulebuilder \Files \Admin \AdminXoopsCode::getInstance ();
4159 }
4260
4361 /**
@@ -78,19 +96,16 @@ public function write($module, $tables, $filename)
7896 */
7997 private function getAdminBrokenHeader ($ moduleDirname , $ tableName , $ t = '' )
8098 {
81- $ pc = Modulebuilder \Files \CreatePhpCode::getInstance ();
82- $ xc = Modulebuilder \Files \CreateXoopsCode::getInstance ();
83- $ axc = Modulebuilder \Files \Admin \AdminXoopsCode::getInstance ();
84- $ ret = $ pc ->getPhpCodeUseNamespace (['Xmf ' , 'Request ' ], '' , '' );
85- $ ret .= $ pc ->getPhpCodeUseNamespace (['XoopsModules ' , $ moduleDirname ], '' , '' );
86- $ ret .= $ pc ->getPhpCodeUseNamespace (['XoopsModules ' , $ moduleDirname , 'Constants ' ]);
99+ $ ret = $ this ->pc ->getPhpCodeUseNamespace (['Xmf ' , 'Request ' ], '' , '' );
100+ $ ret .= $ this ->pc ->getPhpCodeUseNamespace (['XoopsModules ' , $ moduleDirname ], '' , '' );
101+ $ ret .= $ this ->pc ->getPhpCodeUseNamespace (['XoopsModules ' , $ moduleDirname , 'Constants ' ]);
87102 $ ret .= $ this ->getInclude ();
88- $ ret .= $ pc ->getPhpCodeBlankLine ();
89- $ ret .= $ pc ->getPhpCodeCommentLine ('Define Stylesheet ' , '' , $ t );
90- $ ret .= $ xc ->getXcXoThemeAddStylesheet ('style ' , $ t );
91- $ ret .= $ axc ->getAdminTemplateMain ($ moduleDirname , $ tableName , $ t );
92- $ navigation = $ axc ->getAdminDisplayNavigation ($ tableName );
93- $ ret .= $ xc ->getXcXoopsTplAssign ('navigation ' , $ navigation , true , $ t );
103+ $ ret .= $ this -> pc ->getPhpCodeBlankLine ();
104+ $ ret .= $ this -> pc ->getPhpCodeCommentLine ('Define Stylesheet ' , '' , $ t );
105+ $ ret .= $ this -> xc ->getXcXoThemeAddStylesheet ('style ' , $ t );
106+ $ ret .= $ this -> axc ->getAdminTemplateMain ($ moduleDirname , $ tableName , $ t );
107+ $ navigation = $ this -> axc ->getAdminDisplayNavigation ($ tableName );
108+ $ ret .= $ this -> xc ->getXcXoopsTplAssign ('navigation ' , $ navigation , true , $ t );
94109
95110 return $ ret ;
96111 }
@@ -104,20 +119,17 @@ private function getAdminBrokenHeader($moduleDirname, $tableName, $t = '')
104119 */
105120 private function getAdminBrokenList ($ tables , $ language , $ t = '' )
106121 {
107- $ pc = Modulebuilder \Files \CreatePhpCode::getInstance ();
108- $ xc = Modulebuilder \Files \CreateXoopsCode::getInstance ();
109-
110122 $ ret = '' ;
111123 foreach (array_keys ($ tables ) as $ i ) {
112124 if (1 === (int )$ tables [$ i ]->getVar ('table_broken ' )) {
113125 $ tableName = $ tables [$ i ]->getVar ('table_name ' );
114126 $ tableSoleName = $ tables [$ i ]->getVar ('table_solename ' );
115127 $ ucfTableName = ucfirst ($ tableName );
116- $ ret .= $ pc ->getPhpCodeBlankLine ();
117- $ ret .= $ pc ->getPhpCodeCommentLine ('Check table ' , $ tableName , $ t );
118- $ ret .= $ xc ->getXcXoopsRequest ('start ' , 'start ' . $ ucfTableName , '0 ' , 'Int ' , false , $ t );
119- $ adminpager = $ xc ->getXcGetConfig ('adminpager ' );
120- $ ret .= $ xc ->getXcXoopsRequest ('limit ' , 'limit ' . $ ucfTableName , $ adminpager , 'Int ' , false , $ t );
128+ $ ret .= $ this -> pc ->getPhpCodeBlankLine ();
129+ $ ret .= $ this -> pc ->getPhpCodeCommentLine ('Check table ' , $ tableName , $ t );
130+ $ ret .= $ this -> xc ->getXcXoopsRequest ('start ' , 'start ' . $ ucfTableName , '0 ' , 'Int ' , false , $ t );
131+ $ adminpager = $ this -> xc ->getXcGetConfig ('adminpager ' );
132+ $ ret .= $ this -> xc ->getXcXoopsRequest ('limit ' , 'limit ' . $ ucfTableName , $ adminpager , 'Int ' , false , $ t );
121133 $ critName = 'cr ' . $ ucfTableName ;
122134
123135 $ fields = $ this ->getTableFields ($ tables [$ i ]->getVar ('table_mid ' ), $ tables [$ i ]->getVar ('table_id ' ));
@@ -137,34 +149,34 @@ private function getAdminBrokenList($tables, $language, $t = '')
137149 }
138150 }
139151
140- $ ret .= $ xc ->getXcCriteriaCompo ($ critName , $ t );
141- $ constant = $ xc ->getXcGetConstants ('STATUS_BROKEN ' );
142- $ crit = $ xc ->getXcCriteria ('' , "' {$ fieldSatus }' " , $ constant , '' , true );
143- $ ret .= $ xc ->getXcCriteriaAdd ($ critName , $ crit , $ t , "\n" );
144- $ ret .= $ xc ->getXcHandlerCountClear ($ tableName . 'Count ' , $ tableName , '$ ' . $ critName , $ t );
145- $ ret .= $ xc ->getXcXoopsTplAssign ($ tableName . '_count ' , "\${$ tableName }Count " , true , $ t );
146- $ sprintf = $ pc ->getPhpCodeSprintf ($ language . 'BROKEN_RESULT ' , "' {$ ucfTableName }' " );
147- $ ret .= $ xc ->getXcXoopsTplAssign ($ tableName . '_result ' , $ sprintf , true , $ t );
148-
149- $ ret .= $ xc ->getXcCriteriaSetStart ($ critName ,'$start ' , $ t );
150- $ ret .= $ xc ->getXcCriteriaSetLimit ($ critName ,'$limit ' , $ t );
151- $ contIf = $ xc ->getXcHandlerAllClear ("{$ tableName }All " , $ tableName , "\${$ critName }" , $ t . "\t" );
152- $ foreach = $ xc ->getXcEqualsOperator ("\${$ tableSoleName }['table'] " , "' {$ ucfTableName }' " , '' , $ t . "\t\t" );
153- $ foreach .= $ xc ->getXcEqualsOperator ("\${$ tableSoleName }['key'] " , "' {$ fieldId }' " , '' , $ t . "\t\t" );
154- $ foreach .= $ xc ->getXcGetVar ("{$ tableSoleName }['keyval'] " , "{$ tableName }All[ \$i] " , "{$ fieldId }" , false , $ t . "\t\t" );
155- $ foreach .= $ xc ->getXcGetVar ("{$ tableSoleName }['main'] " , "{$ tableName }All[ \$i] " , "{$ fieldMain }" , false , $ t . "\t\t" );
156- $ foreach .= $ xc ->getXcXoopsTplAppend ("{$ tableName }_list " , "\${$ tableSoleName }" , $ t . "\t\t" );
157- $ contIf .= $ pc ->getPhpCodeForeach ("{$ tableName }All " , true , false , 'i ' , $ foreach , $ t . "\t" );
158- $ contIf .= $ xc ->getXcPageNav ($ tableName , $ t . "\t" , 'start ' . $ ucfTableName , "'op=list&limit {$ ucfTableName }=' . \$limit " );
159- $ sprintf = $ pc ->getPhpCodeSprintf ($ language . 'BROKEN_NODATA ' , "' {$ ucfTableName }' " );
160- $ contElse = $ xc ->getXcXoopsTplAssign ('nodata ' . $ ucfTableName , $ sprintf , true , $ t . "\t" );
161-
162- $ ret .= $ pc ->getPhpCodeConditions ("\${$ tableName }Count " , ' > ' , '0 ' , $ contIf , $ contElse , $ t );
163- $ ret .= $ pc ->getPhpCodeUnset ($ critName , $ t );
152+ $ ret .= $ this -> xc ->getXcCriteriaCompo ($ critName , $ t );
153+ $ constant = $ this -> xc ->getXcGetConstants ('STATUS_BROKEN ' );
154+ $ crit = $ this -> xc ->getXcCriteria ('' , "' {$ fieldSatus }' " , $ constant , '' , true );
155+ $ ret .= $ this -> xc ->getXcCriteriaAdd ($ critName , $ crit , $ t , "\n" );
156+ $ ret .= $ this -> xc ->getXcHandlerCountClear ($ tableName . 'Count ' , $ tableName , '$ ' . $ critName , $ t );
157+ $ ret .= $ this -> xc ->getXcXoopsTplAssign ($ tableName . '_count ' , "\${$ tableName }Count " , true , $ t );
158+ $ sprintf = $ this -> pc ->getPhpCodeSprintf ($ language . 'BROKEN_RESULT ' , "' {$ ucfTableName }' " );
159+ $ ret .= $ this -> xc ->getXcXoopsTplAssign ($ tableName . '_result ' , $ sprintf , true , $ t );
160+
161+ $ ret .= $ this -> xc ->getXcCriteriaSetStart ($ critName ,'$start ' , $ t );
162+ $ ret .= $ this -> xc ->getXcCriteriaSetLimit ($ critName ,'$limit ' , $ t );
163+ $ contIf = $ this -> xc ->getXcHandlerAllClear ("{$ tableName }All " , $ tableName , "\${$ critName }" , $ t . "\t" );
164+ $ foreach = $ this -> xc ->getXcEqualsOperator ("\${$ tableSoleName }['table'] " , "' {$ ucfTableName }' " , '' , $ t . "\t\t" );
165+ $ foreach .= $ this -> xc ->getXcEqualsOperator ("\${$ tableSoleName }['key'] " , "' {$ fieldId }' " , '' , $ t . "\t\t" );
166+ $ foreach .= $ this -> xc ->getXcGetVar ("{$ tableSoleName }['keyval'] " , "{$ tableName }All[ \$i] " , "{$ fieldId }" , false , $ t . "\t\t" );
167+ $ foreach .= $ this -> xc ->getXcGetVar ("{$ tableSoleName }['main'] " , "{$ tableName }All[ \$i] " , "{$ fieldMain }" , false , $ t . "\t\t" );
168+ $ foreach .= $ this -> xc ->getXcXoopsTplAppend ("{$ tableName }_list " , "\${$ tableSoleName }" , $ t . "\t\t" );
169+ $ contIf .= $ this -> pc ->getPhpCodeForeach ("{$ tableName }All " , true , false , 'i ' , $ foreach , $ t . "\t" );
170+ $ contIf .= $ this -> xc ->getXcPageNav ($ tableName , $ t . "\t" , 'start ' . $ ucfTableName , "'op=list&limit {$ ucfTableName }=' . \$limit " );
171+ $ sprintf = $ this -> pc ->getPhpCodeSprintf ($ language . 'BROKEN_NODATA ' , "' {$ ucfTableName }' " );
172+ $ contElse = $ this -> xc ->getXcXoopsTplAssign ('nodata ' . $ ucfTableName , $ sprintf , true , $ t . "\t" );
173+
174+ $ ret .= $ this -> pc ->getPhpCodeConditions ("\${$ tableName }Count " , ' > ' , '0 ' , $ contIf , $ contElse , $ t );
175+ $ ret .= $ this -> pc ->getPhpCodeUnset ($ critName , $ t );
164176 }
165177 }
166178
167- $ ret .= $ pc ->getPhpCodeBlankLine ();
179+ $ ret .= $ this -> pc ->getPhpCodeBlankLine ();
168180
169181 return $ ret ;
170182 }
0 commit comments