Code Duplication    Length = 4-38 lines in 2 locations

main/exercice/exercise.php 1 location

@@ 1046-1049 (lines=4) @@
1043
                $nbrActiveTests = $nbrActiveTests + 1;
1044
                $actions .= '      <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=disable&page='.$page.'&file='.$path.'">'.
1045
                    Display::return_icon('visible.png', get_lang('Deactivate'), '', ICON_SIZE_SMALL).'</a>';
1046
            } else { // else if not active
1047
                $actions .='    <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=enable&page='.$page.'&file='.$path.'">'.
1048
                    Display::return_icon('invisible.png', get_lang('Activate'), '', ICON_SIZE_SMALL).'</a>';
1049
            }
1050
            $actions .= '<a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=delete&file='.$path.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('AreYouSureToDeleteJS'), ENT_QUOTES, $charset).' '.$title."?").'\')) return false;">'.
1051
                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
1052
            $item .= Display::tag('td', $actions);

main/inc/lib/document.lib.php 1 location

@@ 3510-3547 (lines=38) @@
3507
            });
3508
3509
            </script>";
3510
        } else {
3511
            //For LPs
3512
            $url = api_get_path(WEB_AJAX_PATH).'lp.ajax.php?a=get_documents&lp_id='.$lp_id.'&'.api_get_cidreq();
3513
            $return .= "<script>
3514
3515
            function testResources(id, img) {
3516
                var numericId = id.split('_')[1];
3517
                var parentId = 'doc_id_'+numericId;
3518
                var tempId = 'temp_'+numericId;
3519
                var image = $('#'+img);
3520
3521
                if (image.hasClass('open')) {
3522
                    image.removeClass('open');
3523
                    image.attr('src', '" . Display::returnIconPath('nolines_plus.gif')."');
3524
                    $('#'+id).show();
3525
                    $('#'+tempId).hide();
3526
                } else {
3527
                    image.addClass('open');
3528
                    image.attr('src', '" . Display::returnIconPath('nolines_minus.gif') . "');
3529
                    $('#'+id).hide();
3530
                    $('#'+tempId).show();
3531
3532
                    var tempDiv = $('#'+parentId).find('#'+tempId);
3533
                    if (tempDiv.length == 0) {
3534
                        $.ajax({
3535
                            type: 'GET',
3536
                            async: false,
3537
                            url:  '".$url."',
3538
                            data: 'folder_id='+numericId,
3539
                            success: function(data) {
3540
                                tempDiv = $('#doc_id_'+numericId).append('<div id='+tempId+'>'+data+'</div>');
3541
                            }
3542
                        });
3543
                    }
3544
                }
3545
            }
3546
            </script>";
3547
        }
3548
3549
        if (!$user_in_course) {
3550
            $return = '';