Example #1
0
    // global stuff
    $html->set_variable('disable_footprints', $config['footprints']['disable'], 'boolean');
    $html->set_variable('disable_manufacturers', $config['manufacturers']['disable'], 'boolean');
    $html->set_variable('disable_auto_datasheets', $config['auto_datasheets']['disable'], 'boolean');
    $html->set_variable('use_modal_popup', $config['popup']['modal'], 'boolean');
    $html->set_variable('popup_width', $config['popup']['width'], 'integer');
    $html->set_variable('popup_height', $config['popup']['height'], 'integer');
    // device stuff
    $html->set_variable('device_id', $device->get_id(), 'integer');
    $html->set_variable('device_name', $device->get_name(), 'string');
    $parent_device_list = $root_device->build_html_tree($device->get_parent_id(), true, true);
    $html->set_variable('parent_device_list', $parent_device_list, 'string');
    // export stuff
    $html->set_variable('export_multiplier', $export_multiplier_original, 'integer');
    $html->set_variable('order_quantity', $device->get_order_quantity(), 'integer');
    $html->set_variable('order_only_missing_parts', $device->get_order_only_missing_parts(), 'boolean');
    $html->set_variable('export_only_missing', $export_only_missing, 'boolean');
    $html->set_loop('export_formats', build_export_formats_loop('deviceparts', $export_format_id));
    if (isset($export_string)) {
        $html->set_variable('export_result', str_replace("\n", '<br>', str_replace("\n  ", '<br>&nbsp;&nbsp;', str_replace("\n    ", '<br>&nbsp;&nbsp;&nbsp;&nbsp;', htmlspecialchars($export_string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8')))), 'string');
    }
    // import stuff
    $html->set_variable('import_rowcount', isset($import_data) ? count($import_data) : 0, 'integer');
    $html->set_variable('import_file_content', $import_file_content, 'string');
    $html->set_variable('import_format', $import_format, 'string');
    $html->set_variable('import_separator', $import_separator, 'string');
    //$html->set_variable('import_data_is_valid',     (isset($import_data_is_valid) && ($import_data_is_valid)), 'boolean');
}
/********************************************************************************
 *
 *   Generate HTML Output
Example #2
0
if (!$fatal_error) {
    try {
        $order_devices = Device::get_order_devices($database, $current_user, $log);
        $order_devices_loop = array();
        $row_odd = true;
        foreach ($order_devices as $device) {
            $too_less_parts = 0;
            foreach ($device->get_parts() as $devicepart) {
                $needed = $devicepart->get_mount_quantity() * $device->get_order_quantity();
                $instock = $devicepart->get_part()->get_instock();
                $mininstock = $devicepart->get_part()->get_mininstock();
                if ($instock - $needed < $mininstock) {
                    $too_less_parts++;
                }
            }
            $order_devices_loop[] = array('row_odd' => $row_odd, 'id' => $device->get_id(), 'name' => $device->get_name(), 'full_path' => $device->get_full_path(), 'order_quantity' => $device->get_order_quantity(), 'only_missing_parts' => $device->get_order_only_missing_parts(), 'parts_count' => $device->get_parts_count(), 'parts_count_to_order' => $too_less_parts);
            $row_odd = !$row_odd;
        }
        $html->set_loop('order_devices_loop', $order_devices_loop);
    } catch (Exception $e) {
        $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
        $fatal_error = true;
    }
}
/********************************************************************************
 *
 *   Set the rest of the HTML variables
 *
 *********************************************************************************/
$html->use_javascript(array('popup', 'validatenumber'));
if (!$fatal_error) {