@@ -276,9 +276,10 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm)
276276 $ action = $ xc ->getXcEqualsOperator ('$action ' , "\$_SERVER['REQUEST_URI'] " , null , "\t\t\t" );
277277 $ ucfModuleDirname = ucfirst ($ moduleDirname );
278278 $ getForm = $ xc ->getXcGetInstance ('helper ' , "\XoopsModules \\{$ ucfModuleDirname }\Helper " , "\t\t" );
279- $ getForm .= $ pc ->getPhpCodeConditions ('false ' , ' === ' , '$action ' , $ action , false , "\t\t" );
279+ $ getForm .= $ pc ->getPhpCodeConditions ('$action ' , ' === ' , 'false ' , $ action , false , "\t\t" );
280280 $ xUser = $ pc ->getPhpCodeGlobals ('xoopsUser ' );
281281 $ xModule = $ pc ->getPhpCodeGlobals ('xoopsModule ' );
282+ $ getForm .= $ xc ->getXcEqualsOperator ('$isAdmin ' , $ xUser . '->isAdmin( ' . $ xModule . '->mid()) ' , null , "\t\t" );
282283 $ permString = 'upload_groups ' ;
283284 if (1 != $ tableCategory/* && (1 == $tablePermissions)*/ ) {
284285 $ getForm .= $ pc ->getPhpCodeCommentLine ('Permissions for ' , 'uploader ' , "\t\t" );
@@ -288,7 +289,7 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm)
288289 $ ternaryOperator = $ pc ->getPhpCodeTernaryOperator ('permissionUpload ' , $ checkRight , 'true ' , 'false ' , "\t\t\t" );
289290 $ permissionUpload = $ xc ->getXcEqualsOperator ('$permissionUpload ' , 'true ' , null , "\t\t\t\t" );
290291 $ ternOperator = $ pc ->getPhpCodeRemoveCarriageReturn ($ ternaryOperator , '' , "\r" );
291- $ if = $ pc ->getPhpCodeConditions ('! ' . $ xUser . ' -> isAdmin( ' . $ xModule . ' ->mid()) ' , '' , '' , "\t" . $ ternaryOperator , $ permissionUpload , "\t\t\t" );
292+ $ if = $ pc ->getPhpCodeConditions ('$ isAdmin ' , '' , '' , "\t" . $ ternaryOperator , $ permissionUpload , "\t\t\t" );
292293 $ getForm .= $ pc ->getPhpCodeConditions ($ xUser , '' , '' , $ if , $ ternOperator , "\t\t" );
293294 }
294295 $ getForm .= $ pc ->getPhpCodeCommentLine ('Title ' , '' , "\t\t" );
@@ -390,44 +391,57 @@ private function getValuesInObject($moduleDirname, $table, $fields)
390391 $ utility = 0 ;
391392 $ header = '' ;
392393 $ configMaxchar = 0 ;
394+ $ lenMaxName = 0 ;
395+ foreach (array_keys ($ fields ) as $ f ) {
396+ $ fieldName = $ fields [$ f ]->getVar ('field_name ' );
397+ $ rpFieldName = $ this ->getRightString ($ fieldName );
398+ $ len = strlen ($ rpFieldName );
399+ if (3 == $ fields [$ f ]->getVar ('field_element ' ) || 4 == $ fields [$ f ]->getVar ('field_element ' )) {
400+ $ len = $ len + strlen ('_short ' );
401+ }
402+ $ lenMaxName = max ($ len , $ lenMaxName );
403+ }
393404 foreach (array_keys ($ fields ) as $ f ) {
394405 $ fieldName = $ fields [$ f ]->getVar ('field_name ' );
395406 $ fieldElement = $ fields [$ f ]->getVar ('field_element ' );
396407 $ rpFieldName = $ this ->getRightString ($ fieldName );
408+ $ spacer = str_repeat (' ' , $ lenMaxName - strlen ($ rpFieldName ));
397409 switch ($ fieldElement ) {
398410 case 3 :
399- $ getValues .= $ pc ->getPhpCodeStripTags ("ret[' {$ rpFieldName }'] " , "\$this->getVar(' {$ fieldName }', 'e') " , false , "\t\t" );
411+ $ getValues .= $ pc ->getPhpCodeStripTags ("ret[' {$ rpFieldName }'] { $ spacer } " , "\$this->getVar(' {$ fieldName }', 'e') " , false , "\t\t" );
400412 if ($ configMaxchar == 0 ) {
401413 $ getValues .= $ xc ->getXcEqualsOperator ('$editorMaxchar ' , $ xc ->getXcGetConfig ('editor_maxchar ' ), false , "\t\t" );
402414 $ configMaxchar = 1 ;
403415 }
404416 $ truncate = "\$utility::truncateHtml( \$ret[' {$ rpFieldName }'], \$editorMaxchar) " ;
405- $ getValues .= $ xc ->getXcEqualsOperator ("\$ret[' {$ rpFieldName }_short'] " , $ truncate , false , "\t\t" );
417+ $ spacer = str_repeat (' ' , $ lenMaxName - strlen ($ rpFieldName ) - strlen ('_short ' ));
418+ $ getValues .= $ xc ->getXcEqualsOperator ("\$ret[' {$ rpFieldName }_short'] {$ spacer }" , $ truncate , false , "\t\t" );
406419 $ helper = 1 ;
407420 $ utility = 1 ;
408421 break ;
409422 case 4 :
410- $ getValues .= $ xc ->getXcGetVar ("ret[' {$ rpFieldName }'] " , 'this ' , $ fieldName , false , "\t\t" , ", 'e' " );
423+ $ getValues .= $ xc ->getXcGetVar ("ret[' {$ rpFieldName }'] { $ spacer } " , 'this ' , $ fieldName , false , "\t\t" , ", 'e' " );
411424 if ($ configMaxchar == 0 ) {
412425 $ getValues .= $ xc ->getXcEqualsOperator ('$editorMaxchar ' , $ xc ->getXcGetConfig ('editor_maxchar ' ), false , "\t\t" );
413426 $ configMaxchar = 1 ;
414427 }
415428 $ truncate = "\$utility::truncateHtml( \$ret[' {$ rpFieldName }'], \$editorMaxchar) " ;
416- $ getValues .= $ xc ->getXcEqualsOperator ("\$ret[' {$ rpFieldName }_short'] " , $ truncate , false , "\t\t" );
429+ $ spacer = str_repeat (' ' , $ lenMaxName - strlen ($ rpFieldName ) - strlen ('_short ' ));
430+ $ getValues .= $ xc ->getXcEqualsOperator ("\$ret[' {$ rpFieldName }_short'] {$ spacer }" , $ truncate , false , "\t\t" );
417431 $ helper = 1 ;
418432 $ utility = 1 ;
419433 break ;
420434 case 6 :
421- $ getValues .= $ xc ->getXcEqualsOperator ("\$ret[' {$ rpFieldName }'] " , "(int) \$this->getVar(' {$ fieldName }') > 0 ? _YES : _NO " , false , "\t\t" );
435+ $ getValues .= $ xc ->getXcEqualsOperator ("\$ret[' {$ rpFieldName }'] { $ spacer } " , "(int) \$this->getVar(' {$ fieldName }') > 0 ? _YES : _NO " , false , "\t\t" );
422436 break ;
423437 case 8 :
424- $ getValues .= $ xc ->getXcXoopsUserUnameFromId ("ret[' {$ rpFieldName }'] " , "\$this->getVar(' {$ fieldName }') " , "\t\t" );
438+ $ getValues .= $ xc ->getXcXoopsUserUnameFromId ("ret[' {$ rpFieldName }'] { $ spacer } " , "\$this->getVar(' {$ fieldName }') " , "\t\t" );
425439 break ;
426440 case 15 :
427- $ getValues .= $ xc ->getXcFormatTimeStamp ("ret[' {$ rpFieldName }'] " , "\$this->getVar(' {$ fieldName }') " , 's ' , "\t\t" );
441+ $ getValues .= $ xc ->getXcFormatTimeStamp ("ret[' {$ rpFieldName }'] { $ spacer } " , "\$this->getVar(' {$ fieldName }') " , 's ' , "\t\t" );
428442 break ;
429443 case 21 :
430- $ getValues .= $ xc ->getXcFormatTimeStamp ("ret[' {$ rpFieldName }'] " , "\$this->getVar(' {$ fieldName }') " , 'm ' , "\t\t" );
444+ $ getValues .= $ xc ->getXcFormatTimeStamp ("ret[' {$ rpFieldName }'] { $ spacer } " , "\$this->getVar(' {$ fieldName }') " , 'm ' , "\t\t" );
431445 break ;
432446 default :
433447 $ fieldElements = $ tc ->getHandler ('Fieldelements ' )->get ($ fieldElement );
@@ -448,10 +462,10 @@ private function getValuesInObject($moduleDirname, $table, $fields)
448462 $ getTopicTable = "\${$ topicTableName }Handler->get( \$this->getVar(' {$ fieldName }')) " ;
449463 $ getValues .= $ xc ->getXcEqualsOperator ("\${$ topicTableName }Obj " , $ getTopicTable , null , "\t\t" );
450464 $ fMainTopic = "\${$ topicTableName }Obj->getVar(' {$ fieldMainTopic }') " ;
451- $ getValues .= $ xc ->getXcEqualsOperator ("\$ret[' {$ rpFieldName }'] " , $ fMainTopic , null , "\t\t" );
465+ $ getValues .= $ xc ->getXcEqualsOperator ("\$ret[' {$ rpFieldName }'] { $ spacer } " , $ fMainTopic , null , "\t\t" );
452466 $ helper = 1 ;
453467 } else {
454- $ getValues .= $ xc ->getXcGetVar ("ret[' {$ rpFieldName }'] " , 'this ' , $ fieldName , false , "\t\t" );
468+ $ getValues .= $ xc ->getXcGetVar ("ret[' {$ rpFieldName }'] { $ spacer } " , 'this ' , $ fieldName , false , "\t\t" );
455469 }
456470 break ;
457471 }
@@ -522,7 +536,7 @@ private function getOptionsCheck($table)
522536 $ rpFieldName = $ this ->getRightString ($ fieldName );
523537 if (5 == $ fieldElementId ) {
524538 $ arrayPush = $ pc ->getPhpCodeArrayType ('ret ' , 'push ' , "' {$ rpFieldName }' " , null , false , "\t\t\t" );
525- $ getOptions .= $ pc ->getPhpCodeConditions (1 , ' == ' , "\$this->getVar(' {$ fieldName }') " , $ arrayPush , false , "\t\t" );
539+ $ getOptions .= $ pc ->getPhpCodeConditions ("\$this->getVar(' {$ fieldName }') " , ' == ' , ' 1 ' , $ arrayPush , false , "\t\t" );
526540 }
527541 }
528542
0 commit comments