Code Duplication    Length = 44-44 lines in 2 locations

system/Inji/Model.php 2 locations

@@ 245-288 (lines=44) @@
242
                    return \App::$cur->{$colInfo['colParams']['value']['module']}->{$colInfo['colParams']['value']['method']}($item, $colName, $colInfo['colParams']);
243
                }
244
                break;
245
            case 'map':
246
                if ($item->$colName && json_decode($item->$colName, true)) {
247
                    $addres = json_decode($item->$colName, true);
248
                    $name = $addres['address'] ? $addres['address'] : 'lat:' . $addres['lat'] . ': lng:' . $addres['lng'];
249
                    \App::$cur->libs->loadLib('yandexMap');
250
                    ob_start();
251
                    $uid = Tools::randomString();
252
                    ?>
253
                    <div id='map<?= $uid; ?>_container' style="display:none;">
254
                        <script>/*
255
                             <div id='map<?= $uid; ?>' style="width: 100%; height: 500px"></div>
256
                             <script>
257
                             var myMap<?= $uid; ?>;
258
                             var myMap<?= $uid; ?>CurPin;
259
                             inji.onLoad(function () {
260
                             ymaps.ready(init<?= $uid; ?>);
261
                             function init<?= $uid; ?>() {
262
                             var myPlacemark;
263
                             myMap<?= $uid; ?> = new ymaps.Map("map<?= $uid; ?>", {
264
                             center: ["<?= $addres['lat'] ?>", "<?= $addres['lng']; ?>"],
265
                             zoom: 13
266
                             });
267
                             myCoords = ["<?= $addres['lat'] ?>", "<?= $addres['lng']; ?>"];
268
                             myMap<?= $uid; ?>CurPin = new ymaps.Placemark(myCoords,
269
                             {iconContent: "<?= $addres['address']; ?>"},
270
                             {preset: 'islands#greenStretchyIcon'}
271
                             );
272
                             myMap<?= $uid; ?>.geoObjects.add(myMap<?= $uid; ?>CurPin, 0);
273
                             }
274
                             window['init<?= $uid; ?>'] = init<?= $uid; ?>;
275
                             });
276
                             */</script>
277
                    </div>
278
                    <?php
279
                    $content = ob_get_contents();
280
                    ob_end_clean();
281
                    $onclick = 'inji.Ui.modals.show("' . addcslashes($addres['address'], '"') . '", $("#map' . $uid . '_container script").html().replace(/^\/\*/g, "").replace(/\*\/$/g, "")+"</script>","mapmodal' . $uid . '","modal-lg");';
282
                    $onclick .= 'return false;';
283
                    $value = "<a href ='#' onclick='{$onclick}' >{$name}</a>";
284
                    $value .= $content;
285
                } else {
286
                    $value = 'Местоположение не заданно';
287
                }
288
289
                break;
290
            case 'dynamicType':
291
                switch ($colInfo['colParams']['typeSource']) {
@@ 317-360 (lines=44) @@
314
                            }
315
                        } else {
316
                            switch ($type) {
317
                                case 'map':
318
                                    if ($item->$colName && json_decode($item->$colName, true)) {
319
                                        $addres = json_decode($item->$colName, true);
320
                                        $name = $addres['address'] ? $addres['address'] : 'lat:' . $addres['lat'] . ': lng:' . $addres['lng'];
321
                                        \App::$cur->libs->loadLib('yandexMap');
322
                                        ob_start();
323
                                        $uid = Tools::randomString();
324
                                        ?>
325
                                        <div id='map<?= $uid; ?>_container' style="display:none;">
326
                                            <script>/*
327
                                                 <div id='map<?= $uid; ?>' style="width: 100%; height: 500px"></div>
328
                                                 <script>
329
                                                 var myMap<?= $uid; ?>;
330
                                                 var myMap<?= $uid; ?>CurPin;
331
                                                 inji.onLoad(function () {
332
                                                 ymaps.ready(init<?= $uid; ?>);
333
                                                 function init<?= $uid; ?>() {
334
                                                 var myPlacemark;
335
                                                 myMap<?= $uid; ?> = new ymaps.Map("map<?= $uid; ?>", {
336
                                                 center: ["<?= $addres['lat'] ?>", "<?= $addres['lng']; ?>"],
337
                                                 zoom: 13
338
                                                 });
339
                                                 myCoords = ["<?= $addres['lat'] ?>", "<?= $addres['lng']; ?>"];
340
                                                 myMap<?= $uid; ?>CurPin = new ymaps.Placemark(myCoords,
341
                                                 {iconContent: "<?= $addres['address']; ?>"},
342
                                                 {preset: 'islands#greenStretchyIcon'}
343
                                                 );
344
                                                 myMap<?= $uid; ?>.geoObjects.add(myMap<?= $uid; ?>CurPin, 0);
345
                                                 }
346
                                                 window['init<?= $uid; ?>'] = init<?= $uid; ?>;
347
                                                 });
348
                                                 */</script>
349
                                        </div>
350
                                        <?php
351
                                        $content = ob_get_contents();
352
                                        ob_end_clean();
353
                                        $onclick = 'inji.Ui.modals.show("' . addcslashes($addres['address'], '"') . '", $("#map' . $uid . '_container script").html().replace(/^\/\*/g, "").replace(/\*\/$/g, "")+"</script>","mapmodal' . $uid . '","modal-lg");';
354
                                        $onclick .= 'return false;';
355
                                        $value = "<a href ='#' onclick='{$onclick}' >{$name}</a>";
356
                                        $value .= $content;
357
                                    } else {
358
                                        $value = 'Местоположение не заданно';
359
                                    }
360
361
                                    break;
362
                                default:
363
                                    $value = $item->$colName;