Code Duplication    Length = 17-17 lines in 2 locations

admin/index.php 1 location

@@ 30-46 (lines=17) @@
27
$partners_handler = &xoops_getModuleHandler( 'partners' );
28
$category_handler = &xoops_getModuleHandler( 'category' );
29
$objects = $category_handler->getObj();
30
if ( $objects['count'] > 0 ) {
31
    foreach( $objects['list'] as $object ) {
32
        $category = array();
33
        $category['id'] = $object->getVar( 'cat_id' );
34
        $category['name'] = $object->getVar( 'cat_title' );
35
        $category['desc'] = $object->getVar( 'cat_description' );
36
    
37
        $contentsObj = $partners_handler->getByCategory( $object->getVar( 'cat_id' ) );
38
        if ( $contentsObj['count'] ) {
39
            foreach( $contentsObj['list'] as $content ) {
40
                $category['partners'][] = $content->toArray();
41
            }
42
        }
43
        $tpl->append_by_ref( 'categories', $category );
44
        unset( $category );
45
    }
46
}
47
// Call template file
48
echo $tpl->fetch(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/templates/admin/xoopspartners_index.html');
49
// Display Xoops footer

index.php 1 location

@@ 38-54 (lines=17) @@
35
    $xoopsTpl->assign('module_name', $xoopsModule->getVar('name', 's'));
36
    
37
    $objects = $category_handler->getObj();
38
    if ( $objects['count'] > 0 ) {
39
        foreach( $objects['list'] as $object ) {
40
            $category = array();
41
            $category['id']   = $object->getVar( 'cat_id' );
42
            $category['name'] = $object->getVar( 'cat_title' );
43
            $category['desc'] = $object->getVar( 'cat_description' );
44
45
            $contentsObj = $partners_handler->getActive( $object->getVar( 'cat_id' ) );
46
            if ( $contentsObj['count'] ) {
47
                foreach( $contentsObj['list'] as $content ) {
48
                    $category['partners'][] = $content->toArray();
49
                }
50
            }
51
            $xoopsTpl->append_by_ref( 'categories', $category );
52
            unset( $category );
53
        }
54
    }
55
56
} else {
57
    // Define template file