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

@@ 3534-3571 (lines=38) @@
3531
            });
3532
3533
            </script>";
3534
        } else {
3535
            //For LPs
3536
            $url = api_get_path(WEB_AJAX_PATH).'lp.ajax.php?a=get_documents&lp_id='.$lp_id.'&'.api_get_cidreq();
3537
            $return .= "<script>
3538
3539
            function testResources(id, img) {
3540
                var numericId = id.split('_')[1];
3541
                var parentId = 'doc_id_'+numericId;
3542
                var tempId = 'temp_'+numericId;
3543
                var image = $('#'+img);
3544
3545
                if (image.hasClass('open')) {
3546
                    image.removeClass('open');
3547
                    image.attr('src', '" . Display::returnIconPath('nolines_plus.gif')."');
3548
                    $('#'+id).show();
3549
                    $('#'+tempId).hide();
3550
                } else {
3551
                    image.addClass('open');
3552
                    image.attr('src', '" . Display::returnIconPath('nolines_minus.gif') . "');
3553
                    $('#'+id).hide();
3554
                    $('#'+tempId).show();
3555
3556
                    var tempDiv = $('#'+parentId).find('#'+tempId);
3557
                    if (tempDiv.length == 0) {
3558
                        $.ajax({
3559
                            type: 'GET',
3560
                            async: false,
3561
                            url:  '".$url."',
3562
                            data: 'folder_id='+numericId,
3563
                            success: function(data) {
3564
                                tempDiv = $('#doc_id_'+numericId).append('<div id='+tempId+'>'+data+'</div>');
3565
                            }
3566
                        });
3567
                    }
3568
                }
3569
            }
3570
            </script>";
3571
        }
3572
3573
        if (!$user_in_course) {
3574
            $return = '';