Code Duplication    Length = 42-42 lines in 2 locations

blocks/apcal_thedays_schedule.php 1 location

@@ 88-129 (lines=42) @@
85
     * @param $options
86
     * @return string
87
     */
88
    function apcal_thedays_schedule_edit($options)
89
    {
90
        global $xoopsDB, $xoopsConfig;
91
92
        $moduleDirName = empty($options[0]) ? basename(dirname(__DIR__)) : $options[0];
93
        $now_cid       = empty($options[1]) ? 0 : (int)$options[1];
94
95
        // setting physical & virtual paths
96
        $mod_path = XOOPS_ROOT_PATH . "/modules/$moduleDirName";
97
        $mod_url  = XOOPS_URL . "/modules/$moduleDirName";
98
99
        // defining class of APCal
100
        require_once "$mod_path/class/APCal.php";
101
        require_once "$mod_path/class/APCal_xoops.php";
102
103
        // creating an instance of APCal
104
        $cal                = new APCal_xoops(date('Y-n-j'), $xoopsConfig['language'], true);
105
        $cal->use_server_TZ = true;
106
107
        // setting properties of APCal
108
        $cal->conn = $GLOBALS['xoopsDB']->conn;
109
        include "$mod_path/include/read_configs.php";
110
        $cal->base_url    = $mod_url;
111
        $cal->base_path   = $mod_path;
112
        $cal->images_url  = "$mod_url/assets/images/$skin_folder";
113
        $cal->images_path = "$mod_path/assets/images/$skin_folder";
114
115
        $ret = "<input type='hidden' name='options[0]' value='$moduleDirName' />\n";
116
117
        // ¥«¥Æ¥´¥ê¡¼ÁªÂò¥Ü¥Ã¥¯¥¹¤ÎÀ¸À®
118
        $ret .= _MB_APCAL_CATSEL . ':';
119
        $ret .= "<select name='options[1]'>\n<option value='0'>" . _ALL . "</option>\n";
120
        foreach ($cal->categories as $cid => $cat) {
121
            $selected       = $now_cid == $cid ? 'selected' : '';
122
            $depth_desc     = str_repeat('-', (int)$cat->cat_depth);
123
            $cat_title4show = $cal->text_sanitizer_for_show($cat->cat_title);
124
            $ret            .= "\t<option value='$cid' $selected>$depth_desc $cat_title4show</option>\n";
125
        }
126
        $ret .= "</select>\n";
127
128
        return $ret;
129
    }
130
}
131

blocks/apcal_todays_schedule.php 1 location

@@ 70-111 (lines=42) @@
67
     * @param $options
68
     * @return string
69
     */
70
    function apcal_todays_schedule_edit($options)
71
    {
72
        global $xoopsDB, $xoopsConfig;
73
74
        $moduleDirName = empty($options[0]) ? basename(dirname(__DIR__)) : $options[0];
75
        $now_cid       = empty($options[1]) ? 0 : (int)$options[1];
76
77
        // setting physical & virtual paths
78
        $mod_path = XOOPS_ROOT_PATH . "/modules/$moduleDirName";
79
        $mod_url  = XOOPS_URL . "/modules/$moduleDirName";
80
81
        // defining class of APCal
82
        require_once "$mod_path/class/APCal.php";
83
        require_once "$mod_path/class/APCal_xoops.php";
84
85
        // creating an instance of APCal
86
        $cal                = new APCal_xoops(date('Y-n-j'), $xoopsConfig['language'], true);
87
        $cal->use_server_TZ = true;
88
89
        // setting properties of APCal
90
        $cal->conn = $GLOBALS['xoopsDB']->conn;
91
        include "$mod_path/include/read_configs.php";
92
        $cal->base_url    = $mod_url;
93
        $cal->base_path   = $mod_path;
94
        $cal->images_url  = "$mod_url/assets/images/$skin_folder";
95
        $cal->images_path = "$mod_path/assets/images/$skin_folder";
96
97
        $ret = "<input type='hidden' name='options[0]' value='$moduleDirName' />\n";
98
99
        // ¥«¥Æ¥´¥ê¡¼ÁªÂò¥Ü¥Ã¥¯¥¹¤ÎÀ¸À®
100
        $ret .= _MB_APCAL_CATSEL . ':';
101
        $ret .= "<select name='options[1]'>\n<option value='0'>" . _ALL . "</option>\n";
102
        foreach ($cal->categories as $cid => $cat) {
103
            $selected       = $now_cid == $cid ? 'selected' : '';
104
            $depth_desc     = str_repeat('-', (int)$cat->cat_depth);
105
            $cat_title4show = $cal->text_sanitizer_for_show($cat->cat_title);
106
            $ret            .= "\t<option value='$cid' $selected>$depth_desc $cat_title4show</option>\n";
107
        }
108
        $ret .= "</select>\n";
109
110
        return $ret;
111
    }
112
}
113