Code Duplication    Length = 4-38 lines in 2 locations

main/exercise/exercise.php 1 location

@@ 1099-1102 (lines=4) @@
1096
                $nbrActiveTests = $nbrActiveTests + 1;
1097
                $actions .= '      <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=disable&page='.$page.'&file='.$path.'">'.
1098
                    Display::return_icon('visible.png', get_lang('Deactivate'), '', ICON_SIZE_SMALL).'</a>';
1099
            } else { // else if not active
1100
                $actions .='    <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=enable&page='.$page.'&file='.$path.'">'.
1101
                    Display::return_icon('invisible.png', get_lang('Activate'), '', ICON_SIZE_SMALL).'</a>';
1102
            }
1103
            $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;">'.
1104
                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
1105
            $item .= Display::tag('td', $actions);

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

@@ 3593-3630 (lines=38) @@
3590
            });
3591
3592
            </script>";
3593
        } else {
3594
            //For LPs
3595
            $url = api_get_path(WEB_AJAX_PATH).'lp.ajax.php?a=get_documents&lp_id='.$lp_id.'&'.api_get_cidreq();
3596
            $return .= "<script>
3597
3598
            function testResources(id, img) {
3599
                var numericId = id.split('_')[1];
3600
                var parentId = 'doc_id_'+numericId;
3601
                var tempId = 'temp_'+numericId;
3602
                var image = $('#'+img);
3603
3604
                if (image.hasClass('open')) {
3605
                    image.removeClass('open');
3606
                    image.attr('src', '" . Display::returnIconPath('nolines_plus.gif')."');
3607
                    $('#'+id).show();
3608
                    $('#'+tempId).hide();
3609
                } else {
3610
                    image.addClass('open');
3611
                    image.attr('src', '" . Display::returnIconPath('nolines_minus.gif') . "');
3612
                    $('#'+id).hide();
3613
                    $('#'+tempId).show();
3614
3615
                    var tempDiv = $('#'+parentId).find('#'+tempId);
3616
                    if (tempDiv.length == 0) {
3617
                        $.ajax({
3618
                            type: 'GET',
3619
                            async: false,
3620
                            url:  '".$url."',
3621
                            data: 'folder_id='+numericId,
3622
                            success: function(data) {
3623
                                tempDiv = $('#doc_id_'+numericId).append('<div id='+tempId+'>'+data+'</div>');
3624
                            }
3625
                        });
3626
                    }
3627
                }
3628
            }
3629
            </script>";
3630
        }
3631
3632
        if (!$user_in_course) {
3633
            $return = '';