Example #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_resources($unit_id) {
    global $tool_content, $max_resource_id, $langAvailableUnitResources,
           $is_editor, $head_content, $langDownload, $langPrint, $langCancel;

    $req = Database::get()->queryArray("SELECT * FROM unit_resources WHERE unit_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 unit_resources
                                WHERE unit_id = ?d ORDER BY `order` DESC LIMIT 1", $unit_id)->id;
        $tool_content .= "<div class='table-responsive'>";
        $tool_content .= "<table class='table-default'>";
        foreach ($req as $info) {
            $info->comments = standard_text_escape($info->comments);
            show_resource($info);
        }
        $tool_content .= "</table>";
        $tool_content .= "</div>";
    }
}
Example #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_resources($unit_id)
{
    global $tool_content, $max_resource_id, $langAvailableUnitResources;
    $req = Database::get()->queryArray("SELECT * FROM unit_resources WHERE unit_id = ?d AND `order` >= 0 ORDER BY `order`", $unit_id);
    if (count($req) > 0) {
        $max_resource_id = Database::get()->querySingle("SELECT id FROM unit_resources\n                                WHERE unit_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_resource($info);
        }
        $tool_content .= "</table>";
        $tool_content .= "</div>";
    }
}
					<td width="25"  class="box-pl" align="center">%</td>
					<td width="80"  class="box-pl" align="center"><?php 
    echo $GLOBALS['language']['status']['res_free'];
    ?>
</td>
					<td width="80"  class="box-pl" align="center"><?php 
    echo $GLOBALS['language']['status']['res_used'];
    ?>
</td>
					<td width="80"  class="box-pl" align="center"><?php 
    echo $GLOBALS['language']['status']['res_size'];
    ?>
</td>
				</tr>
				<?php 
    show_resource($mem_info, 0);
}
$net_info = $system->get_resource_network();
if (sizeof($net_info) != 0) {
    ?>
				<tr><td colspan="6" class="box-subheadspace">&nbsp;</td></tr>
				<tr><td colspan="6" class="box-subheadline"><?php 
    echo $GLOBALS['language']['status']['res_network'];
    ?>
</td></tr>
				<tr>
					<td width="*"   class="box-pl" align="center" colspan=2><?php 
    echo $GLOBALS['language']['status']['res_devname'];
    ?>
</td>
					<td width="105" class="box-pl" align="center" colspan=2><?php