Code Duplication    Length = 27-27 lines in 2 locations

class/Utility.php 1 location

@@ 149-175 (lines=27) @@
146
     * @param        $cat
147
     * @return array
148
     */
149
    public static function getCheckeCategories($name = 'cat', $cat)
150
    {
151
        global $xoopsUser;
152
        // Category selectbox
153
        //<option style="background-color:#00FFFF;">VARCHAR</option>
154
155
         $catHandler   = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_CAT);
156
        $catsList   = $catHandler->getAllCat($xoopsUser);
157
158
        $t = [];
159
        foreach ($catsList as $catList) {
160
            $cat_id    = $catList->getVar('cat_id');
161
            $name      = $catList->getVar('cat_name');
162
            $cat_color = $catList->getVar('cat_color');
163
            $checked   = in_array($cat_id, $cat) ? 'checked' : '';
164
            $cat       = ''
165
                         . "<div style='float:left; margin-left:5px;'>"
166
                         . "<input type='checkbox' name='{$name}[{$cat_id}]' value='1' {$checked}>"
167
                         . "<div style='absolute:left;height:12px; width:6px; background-color:#{$cat_color}; border:1px solid black; float:left; margin-right:5px;' ></div>"
168
                         . " {$name}"
169
                         . '</div>';
170
171
            $t[] = $cat;
172
        }
173
174
        return $t;
175
    }
176
177
    /*******************************************************************
178
     *

include/functions0.php 1 location

@@ 136-162 (lines=27) @@
133
 * @param        $cat
134
 * @return array
135
 */
136
function getCheckeCategories($name = 'cat', $cat)
137
{
138
    global $xoopsUser;
139
    // Category selectbox
140
    //<option style="background-color:#00FFFF;">VARCHAR</option>
141
142
     $catHandler   = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_CAT);
143
    $catsList   = $catHandler->getAllCat($xoopsUser);
144
145
    $t = [];
146
    foreach ($catsList as $catList) {
147
        $cat_id    = $catList->getVar('cat_id');
148
        $name      = $catList->getVar('cat_name');
149
        $cat_color = $catList->getVar('cat_color');
150
        $checked   = in_array($cat_id, $cat) ? 'checked' : '';
151
        $cat       = ''
152
                     . "<div style='float:left; margin-left:5px;'>"
153
                     . "<input type='checkbox' name='{$name}[{$cat_id}]' value='1' {$checked}>"
154
                     . "<div style='absolute:left;height:12px; width:6px; background-color:#{$cat_color}; border:1px solid black; float:left; margin-right:5px;' ></div>"
155
                     . " {$name}"
156
                     . '</div>';
157
158
        $t[] = $cat;
159
    }
160
161
    return $t;
162
}
163
164
/*******************************************************************
165
 *