Esempio n. 1
0
/**
 * @brief Display resources for unit with id=$id
 * @global type $tool_content
 * @global type $max_resource_id
 * @param type $unit_id
 */
function show_resourcesWeeks($unit_id)
{
    global $tool_content, $max_resource_id, $langAvailableUnitResources;
    $req = Database::get()->queryArray("SELECT * FROM course_weekly_view_activities WHERE course_weekly_view_id = ?d AND `order` >= 0 ORDER BY `order`", $unit_id);
    if (count($req) > 0) {
        $max_resource_id = Database::get()->querySingle("SELECT id FROM course_weekly_view_activities\n                                WHERE course_weekly_view_id = ?d ORDER BY `order` DESC LIMIT 1", $unit_id)->id;
        $tool_content .= "<div class='table-responsive'>";
        $tool_content .= "<table class='table-default'>";
        $tool_content .= "<th colspan='2'>{$langAvailableUnitResources}</th><th>" . icon('fa-gears') . "</th>";
        foreach ($req as $info) {
            $info->comments = standard_text_escape($info->comments);
            show_resourceWeek($info);
        }
        $tool_content .= "</table>";
        $tool_content .= "</div>";
    }
}
Esempio n. 2
0
/**
 * @brief Display resources for unit with id=$id
 * @global type $tool_content
 * @global type $max_resource_id
 * @param type $unit_id
 */
function show_resourcesWeeks($unit_id) {
    global $tool_content, $max_resource_id, $langAvailableUnitResources,
           $head_content, $langDownload, $langPrint, $langCancel;
    
    $req = Database::get()->queryArray("SELECT * FROM course_weekly_view_activities WHERE course_weekly_view_id = ?d AND `order` >= 0 ORDER BY `order`", $unit_id);
    if (count($req) > 0) {
        $head_content .= "<script>
        $(function(){
            $('.fileModal').click(function (e)
            {
                e.preventDefault();
                var fileURL = $(this).attr('href');
                var downloadURL = $(this).prev('input').val();
                var fileTitle = $(this).attr('title');
                bootbox.dialog({
                    size: 'large',
                    title: fileTitle,
                    message: '<div class=\"row\">'+
                                '<div class=\"col-sm-12\">'+
                                    '<div class=\"iframe-container\"><iframe id=\"fileFrame\" src=\"'+fileURL+'\"></iframe></div>'+
                                '</div>'+
                            '</div>',                          
                    buttons: {
                        download: {
                            label: '<i class=\"fa fa-download\"></i> $langDownload',
                            className: 'btn-success',
                            callback: function (d) {                      
                                window.location = downloadURL;                                                            
                            }
                        },                        
                        print: {
                            label: '<i class=\"fa fa-print\"></i> $langPrint',
                            className: 'btn-primary',
                            callback: function (d) {
                                var iframe = document.getElementById('fileFrame');
                                iframe.contentWindow.print();                                                               
                            }
                        },
                        cancel: {
                            label: '$langCancel',
                            className: 'btn-default'
                        }                        
                    }
                });                    
            });
        });
        </script>";          
        $max_resource_id = Database::get()->querySingle("SELECT id FROM course_weekly_view_activities
                                WHERE course_weekly_view_id = ?d ORDER BY `order` DESC LIMIT 1", $unit_id)->id;                     
        $tool_content .= "<div class='table-responsive'>";
        $tool_content .= "<table class='table-default'>";
        $tool_content .= "<th colspan='2'>$langAvailableUnitResources</th><th>".icon('fa-gears')."</th>";
        foreach ($req as $info) {
            $info->comments = standard_text_escape($info->comments);
            show_resourceWeek($info);
        }
        $tool_content .= "</table>";
        $tool_content .= "</div>";
    }
}