Code Duplication    Length = 4-38 lines in 2 locations

main/exercice/exercise.php 1 location

@@ 1044-1047 (lines=4) @@
1041
                $nbrActiveTests = $nbrActiveTests + 1;
1042
                $actions .= '      <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=disable&page='.$page.'&file='.$path.'">'.
1043
                    Display::return_icon('visible.png', get_lang('Deactivate'), '', ICON_SIZE_SMALL).'</a>';
1044
            } else { // else if not active
1045
                $actions .='    <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=enable&page='.$page.'&file='.$path.'">'.
1046
                    Display::return_icon('invisible.png', get_lang('Activate'), '', ICON_SIZE_SMALL).'</a>';
1047
            }
1048
            $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;">'.
1049
                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
1050
            $item .= Display::tag('td', $actions);

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

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