Code Duplication    Length = 44-44 lines in 2 locations

system/Inji/Model.php 2 locations

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