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

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