Code Duplication    Length = 19-19 lines in 2 locations

blocks/headline.php 1 location

@@ 41-59 (lines=19) @@
38
    $hlman    = xoops_getModuleHandler('headline', 'xoopsheadline');
39
    $criteria = new CriteriaCompo();
40
    $criteria->add(new Criteria('headline_asblock', 1, '='));
41
    switch ($moduleConfig['sortby']) {
42
        case 1:
43
            $criteria->setSort('headline_name');
44
            $criteria->setOrder('DESC');
45
            break;
46
        case 2:
47
            $criteria->setSort('headline_name');
48
            $criteria->setOrder('ASC');
49
            break;
50
        case 3:
51
            $criteria->setSort('headline_weight');
52
            $criteria->setOrder('DESC');
53
            break;
54
        case 4:
55
        default:
56
            $criteria->setSort('headline_weight');
57
            $criteria->setOrder('ASC');
58
            break;
59
    }
60
    $headlines = $hlman->getObjects($criteria);
61
    $count     = count($headlines);
62
    for ($i = 0; $i < $count; $i++) {

index.php 1 location

@@ 32-50 (lines=19) @@
29
$criteria = new CriteriaCompo();
30
$criteria->add(new Criteria('headline_display', 1, '='));
31
$criteria->add(new Criteria('headline_xml', '', '!='));
32
switch ((int)$xoopsModuleConfig['sortby']) {
33
    case 1:
34
        $criteria->setSort('headline_name');
35
        $criteria->setOrder('DESC');
36
        break;
37
    case 2:
38
        $criteria->setSort('headline_name');
39
        $criteria->setOrder('ASC');
40
        break;
41
    case 3:
42
        $criteria->setSort('headline_weight');
43
        $criteria->setOrder('DESC');
44
        break;
45
    case 4:
46
    default:
47
        $criteria->setSort('headline_weight');
48
        $criteria->setOrder('ASC');
49
        break;
50
}
51
$headlines = $hlman->getObjects($criteria);
52
53
global $xoopsModule;