$current_user = new User($database, $current_user, $log, 1); // admin } catch (Exception $e) { $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red'); $fatal_error = true; } /******************************************************************************** * * Generate Table * *********************************************************************************/ if (!$fatal_error) { try { $parts = Part::get_noprice_parts($database, $current_user, $log); $table_loop = Part::build_template_table_array($parts, 'noprice_parts'); $html->set_loop('table', $table_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')); if (!$fatal_error) { // global stuff $html->set_variable('disable_footprints', $config['footprints']['disable'], 'boolean'); $html->set_variable('disable_manufacturers', $config['manufacturers']['disable'], 'boolean');
header('Location: show_device_parts.php?device_id=' . $device_id . '&export_multiplier=' . $export_multiplier_original); } /******************************************************************************** * * Generate Subdevices Table * *********************************************************************************/ if (!$fatal_error) { try { $subdevices_loop = array(); $row_odd = true; foreach ($subdevices as $subdevice) { $subdevices_loop[] = array('row_odd' => $row_odd, 'id' => $subdevice->get_id(), 'name' => $subdevice->get_name(), 'parts_count' => $subdevice->get_parts_count(), 'parts_sum_count' => $subdevice->get_parts_sum_count(), 'sum_price' => $subdevice->get_total_price(true, false)); $row_odd = !$row_odd; } $html->set_loop('subdevices', $subdevices_loop); } catch (Exception $e) { $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red'); $fatal_error = true; } } /******************************************************************************** * * Generate DeviceParts Table * *********************************************************************************/ if (!$fatal_error) { try { $device_parts = $device->get_parts(); // don't forget: $device_parts contains "DevicePart"-objects, not "Part"-objects!! $device_parts_loop = DevicePart::build_template_table_array($device_parts, 'device_parts');
$messages[] = array('text' => 'Das neue Administratorpasswort wurde erfolgreich gespeichert.', 'strong' => true, 'color' => 'darkgreen'); } catch (Exception $e) { $messages[] = array('text' => 'Die neuen Werte konnten nicht gespeichert werden!', 'strong' => true, 'color' => 'red'); $messages[] = array('text' => 'Fehlermeldung: ' . nl2br($e->getMessage()), 'color' => 'red'); } break; } } /******************************************************************************** * * Set all HTML variables * *********************************************************************************/ $html->use_javascript(array('validatenumber', 'popup')); // http charset / theme $html->set_loop('http_charset_loop', array_to_template_loop($config['http_charsets'], $config['html']['http_charset'])); $html->set_loop('theme_loop', build_theme_loop(), $config['html']['theme']); $html->set_loop('custom_css_loop', build_custom_css_loop(), $config['html']['custom_css']); // locale settings $html->set_loop('timezone_loop', array_to_template_loop($config['timezones'], $config['timezone'])); $html->set_loop('language_loop', array_to_template_loop($config['languages'], $config['language'])); // checkboxes $html->set_variable('disable_updatelist', $config['startup']['disable_update_list'], 'boolean'); $html->set_variable('disable_help', $config['menu']['disable_help'], 'boolean'); $html->set_variable('disable_config', $config['menu']['disable_config'], 'boolean'); $html->set_variable('enable_debug_link', $config['menu']['enable_debug'], 'boolean'); $html->set_variable('disable_devices', $config['devices']['disable'], 'boolean'); $html->set_variable('disable_footprints', $config['footprints']['disable'], 'boolean'); $html->set_variable('disable_manufacturers', $config['manufacturers']['disable'], 'boolean'); $html->set_variable('disable_labels', $config['menu']['disable_labels'], 'boolean'); $html->set_variable('disable_calculator', $config['menu']['disable_calculator'], 'boolean');
*********************************************************************************/ $html->use_javascript(array('popup')); $html->set_variable('keyword', $keyword, 'string'); $html->set_variable('hits_count', isset($hits_count) ? $hits_count : 0, 'integer'); $html->set_variable('search_name', $search_name, 'boolean'); $html->set_variable('search_category', $search_category, 'boolean'); $html->set_variable('search_description', $search_description, 'boolean'); $html->set_variable('search_comment', $search_comment, 'boolean'); $html->set_variable('search_supplier', $search_supplier, 'boolean'); $html->set_variable('search_supplierpartnr', $search_supplierpartnr, 'boolean'); $html->set_variable('search_storelocation', $search_storelocation, 'boolean'); $html->set_variable('search_footprint', $search_footprint, 'boolean'); $html->set_variable('search_manufacturer', $search_manufacturer, 'boolean'); if (!$fatal_error) { // export formats $html->set_loop('export_formats', build_export_formats_loop('searchparts')); // 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'); } /******************************************************************************** * * Generate HTML Output * *********************************************************************************/ $html->print_header($messages); if (!$fatal_error) {
$messages[] = array('text' => nl2br($message['text']), 'color' => $message['error'] == true ? 'red' : 'black'); } } catch (Exception $e) { $messages[] = array('text' => 'Es trat ein Fehler auf!', 'strong' => true, 'color' => 'red'); $messages[] = array('text' => 'Fehlermeldung: ' . nl2br($e->getMessage()), 'color' => 'red'); } $messages[count($messages) - 1]['text'] .= nl2br("\n"); break; } /******************************************************************************** * * Set all HTML variables * *********************************************************************************/ $html->set_variable('is_online_demo', $config['is_online_demo'], 'boolean'); $html->set_loop('db_type_loop', array_to_template_loop($config['db_types'], $config['db']['type'])); $html->set_loop('db_charset_loop', array_to_template_loop($config['db_charsets'], $config['db']['charset'])); $html->set_variable('db_host', $config['db']['host'], 'string'); $html->set_variable('db_name', $config['db']['name'], 'string'); $html->set_variable('db_user', $config['db']['user'], 'string'); $html->set_variable('automatic_updates_enabled', $config['db']['auto_update'], 'boolean'); $html->set_variable('refresh_navigation_frame', isset($database_update_executed) && $database_update_executed, 'boolean'); if (!$fatal_error) { try { $current = $database->get_current_version(); $latest = $database->get_latest_version(); $html->set_variable('current_version', $current, 'integer'); $html->set_variable('latest_version', $latest, 'integer'); $html->set_variable('update_required', $latest > $current, 'boolean'); $html->set_variable('last_update_failed', $config['db']['update_error']['version'] == $current, 'boolean'); if ($current > 0 && $current < 13 && $latest >= 13) {
} $footprint = $broken_filename_footprints[$i]; $proposed_filenames_loop = array(); $proposed_filenames = get_proposed_filenames($footprint->get_filename(), $available_proposed_files); if (count($proposed_filenames) > 0 && pathinfo($proposed_filenames[0], PATHINFO_FILENAME) == pathinfo($footprint->get_filename(), PATHINFO_FILENAME)) { $exact_match = true; } else { $exact_match = false; } foreach ($proposed_filenames as $index => $filename) { $filename = str_replace(BASE . '/', '', $filename); $proposed_filenames_loop[] = array('selected' => $index == 0 && $exact_match, 'proposed_filename' => $filename); } $broken_filename_loop[] = array('index' => $i, 'checked' => $exact_match, 'broken_id' => $footprint->get_id(), 'broken_full_path' => $footprint->get_full_path(), 'broken_filename' => str_replace(BASE . '/', '', $footprint->get_filename()), 'proposed_filenames_count' => count($proposed_filenames_loop), 'proposed_filenames' => $proposed_filenames_loop); } $html->set_loop('broken_filename_footprints', $broken_filename_loop); } $html->set_variable('broken_footprints_count', count($broken_filename_loop), 'integer'); $html->set_variable('broken_footprints_count_total', count($broken_filename_footprints), 'integer'); } catch (Exception $e) { $messages[] = array('text' => 'Es konnten nicht alle Footprints mit defektem Dateinamen aufgelistet werden!', 'strong' => true, 'color' => 'red'); $messages[] = array('text' => 'Fehlermeldung: ' . nl2br($e->getMessage()), 'color' => 'red'); } } /******************************************************************************** * * Set the rest of the HTML variables * *********************************************************************************/ $html->set_variable('add_more', $add_more, 'boolean'); if (!$fatal_error) {
$categories = array(); foreach ($directories as $directory) { $categories[] = rtrim($directory, "\\/"); $categories = array_merge($categories, find_all_directories($directory, true)); } sort($categories); foreach ($categories as $category) { $pictures_loop = array(); $pictures = find_all_files($category . '/', false, '.png'); foreach ($pictures as $filename) { $pictures_loop[] = array('title' => str_replace('.png', '', basename($filename)), 'filename' => str_replace(BASE, BASE_RELATIVE, $filename)); } if (count($pictures_loop) > 0) { $categories_loop[] = array('category_name' => str_replace(BASE, '', $category), 'pictures_loop' => $pictures_loop); } } $html->set_loop('categories_loop', $categories_loop); } /******************************************************************************** * * Generate HTML Output * *********************************************************************************/ $html->print_header($messages); if (!$fatal_error) { $html->print_template('footprints'); } $html->print_footer(); ?>
break; } $link = 'FEHLER - Kein Link im Atom-Feed gefunden!'; foreach ($entry->link as $link_entry) { $attributes = $link_entry->attributes(); if (isset($attributes['rel']) && $attributes['rel'] == 'alternate' && isset($attributes['href'])) { $link = 'https://github.com' . $attributes['href']; } } $rss_loop[] = array('title' => $entry->title, 'datetime' => $entry->updated, 'link' => $link); $item_index++; } } catch (Exception $e) { $rss_loop = array(array('title' => $e->getMessage())); } $html->set_loop('rss_feed_loop', $rss_loop); } /******************************************************************************** * * Set the rest of the HTML variables * *********************************************************************************/ $html->set_loop('authors', $authors); if (!$fatal_error) { $html->set_variable('banner', $config['startup']['custom_banner'], 'string'); try { $system_version = $system->get_installed_version(); $html->set_variable('system_version', $system_version->as_string(false, true, true, false), 'string'); $html->set_variable('system_version_full', $system_version->as_string(false, false, false, true), 'string'); $html->set_variable('git_branch', get_git_branch_name(), 'string'); $html->set_variable('git_commit', get_git_commit_hash(10), 'string');
foreach ($orderdetails->get_pricedetails() as $pricedetails) { $pricedetails_loop[] = array('row_odd' => !$row_odd, 'orderdetails_id' => $orderdetails->get_id(), 'pricedetails_id' => $pricedetails->get_id(), 'min_discount_quantity' => $pricedetails->get_min_discount_quantity(), 'price' => $pricedetails->get_price(false, $pricedetails->get_price_related_quantity()), 'price_related_quantity' => $pricedetails->get_price_related_quantity()); } if (count($pricedetails_loop) > 0) { $next_min_discount_quantity = $pricedetails_loop[count($pricedetails_loop) - 1]['min_discount_quantity'] * 10; } else { $next_min_discount_quantity = 1; } $pricedetails_loop[] = array('orderdetails_id' => $orderdetails->get_id(), 'pricedetails_id' => 'new', 'min_discount_quantity' => $next_min_discount_quantity, 'price' => 0, 'price_related_quantity' => 1); $orderdetails_loop[] = array('row_odd' => $row_odd, 'orderdetails_id' => $orderdetails->get_id(), 'supplier_list' => $supplier_list, 'supplierpartnr' => $orderdetails->get_supplierpartnr(), 'obsolete' => $orderdetails->get_obsolete(), 'pricedetails' => $pricedetails_loop); $row_odd = !$row_odd; } // add one additional row -> with this row you can add more orderdetails $supplier_list = $root_supplier->build_html_tree(0, true, false); $orderdetails_loop[] = array('row_odd' => $row_odd, 'orderdetails_id' => 'new', 'supplier_list' => $supplier_list, 'supplierpartnr' => '', 'obsolete' => false); $html->set_loop('orderdetails', $orderdetails_loop); // build attachements loop $master_picture_id = is_object($part->get_master_picture_attachement()) ? $part->get_master_picture_attachement()->get_id() : NULL; $attachements_loop = array(); $all_attachements = $part->get_attachements(); $row_odd = true; foreach ($all_attachements as $attachement) { $attachement_types_list = $root_attachement_type->build_html_tree($attachement->get_type()->get_id(), true, false); $attachements_loop[] = array('row_odd' => $row_odd, 'id' => $attachement->get_id(), 'attachement_types_list' => $attachement_types_list, 'name' => $attachement->get_name(), 'show_in_table' => $attachement->get_show_in_table(), 'is_picture' => $attachement->is_picture(), 'is_master_picture' => $attachement->get_id() == $master_picture_id, 'filename' => str_replace(BASE, BASE_RELATIVE, $attachement->get_filename()), 'filename_base_relative' => str_replace(BASE . '/', '', $attachement->get_filename()), 'picture_filename' => $attachement->is_picture() ? str_replace(BASE, BASE_RELATIVE, $attachement->get_filename()) : ''); $row_odd = !$row_odd; } // add one additional row -> with this row you can add more files $attachement_types_list = $root_attachement_type->build_html_tree(0, true, false); $attachements_loop[] = array('row_odd' => $row_odd, 'id' => 'new', 'attachement_types_list' => $attachement_types_list, 'name' => '', 'is_picture' => true, 'show_in_table' => false, 'is_master_picture' => false, 'filename' => '', 'filename_base_relative' => '', 'picture_filename' => ''); $html->set_loop('attachements_loop', $attachements_loop); }
} } if (isset($reload_site) && $reload_site && !$config['debug']['request_debugging_enable']) { // reload the site to avoid multiple actions by manual refreshing header('Location: show_order_parts.php?selected_supplier_id=' . $selected_supplier_id); } /******************************************************************************** * * Generate Supplier Dropdown-List * *********************************************************************************/ if (!$fatal_error) { try { $suppliers = Supplier::get_order_suppliers($database, $current_user, $log); $supplier_loop = get_suppliers_template_loop($suppliers, $selected_supplier_id); $html->set_loop('suppliers', $supplier_loop); $html->set_variable('selected_supplier_id', $selected_supplier_id, 'integer'); } catch (Exception $e) { $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red'); $fatal_error = true; } } /******************************************************************************** * * Generate "Parts to order"-Table * *********************************************************************************/ if (!$fatal_error) { try { if ($selected_supplier_id > 0) { $parts = Part::get_order_parts($database, $current_user, $log, array($selected_supplier_id));
$fatal_error = true; } /******************************************************************************** * * Decide which installation step should be displayed next * and set the rest of the HTML variables * *********************************************************************************/ if (!$fatal_error) { // global variables $html->set_variable('system_version', $system_version->as_string(false, true, true, false), 'string'); $html->set_variable('system_version_full', $system_version->as_string(false, false, false, true), 'string'); if (!$config['installation_complete']['locales']) { // step "set_locales" $tmpl_site_to_show = 'set_locales'; $html->set_loop('timezone_loop', array_to_template_loop($config['timezones'], $config['timezone'])); $html->set_loop('language_loop', array_to_template_loop($config['languages'], $config['language'])); } elseif (!$config['installation_complete']['admin_password']) { $tmpl_site_to_show = 'set_admin_password'; } elseif (!$config['installation_complete']['database']) { // step "set_db_settings" $tmpl_site_to_show = 'set_db_settings'; $html->set_loop('db_type_loop', array_to_template_loop($config['db_types'], $config['db']['type'])); $html->set_loop('db_charset_loop', array_to_template_loop($config['db_charsets'], $config['db']['charset'])); $html->set_variable('db_host', $config['db']['host'], 'string'); $html->set_variable('db_name', $config['db']['name'], 'string'); $html->set_variable('db_user', $config['db']['user'], 'string'); } elseif (!$config['installation_complete']['db_backup_path']) { // step "set_db_backup_path" $tmpl_site_to_show = 'set_db_backup_path'; $html->set_variable('db_backup_name', $config['db']['backup']['name'], 'string');
} } /******************************************************************************** * * Set all HTML variables * *********************************************************************************/ $html->set_variable('current_system_version', $config['system']['version'], 'string'); if (file_exists($release_package_filename)) { $html->set_variable('release_archive_link', str_replace(BASE, BASE_RELATIVE, $release_package_filename), 'string'); $html->set_variable('release_archive_basename', basename($release_package_filename), 'string'); } $html->set_variable('packing_checklist_link', BASE_RELATIVE . '/development/package_output/readme.txt', 'string'); if (isset($doxygen_output_loop)) { //$html->set_variable('exec_successful', $doxygen_successful, 'boolean'); $html->set_loop('exec_output', $doxygen_output_loop); } if (isset($tab2spaces_output_loop)) { //$html->set_variable('exec_successful', $tab2spaces_successful, 'boolean'); $html->set_loop('exec_output', $tab2spaces_output_loop); } if (isset($release_packing_output_loop)) { //$html->set_variable('exec_successful', $release_packing_successful, 'boolean'); $html->set_loop('exec_output', $release_packing_output_loop); } /******************************************************************************** * * Generate HTML Output * *********************************************************************************/ $html->print_header($messages);
$new_parts_loop = Part::build_template_table_array($new_parts, 'imported_parts'); } } catch (Exception $e) { $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red'); } } /******************************************************************************** * * Generate HTML Output * *********************************************************************************/ $html->print_header($messages); if (!$fatal_error) { $html->print_template('upload'); if (isset($import_data)) { $html->set_loop('table', $table_loop); $html->set_variable('table_rowcount', count($import_data), 'integer'); $html->print_template('check_data'); } if (strlen($file_content) > 0) { $html->print_template('file_content'); } if (isset($new_parts_loop)) { $html->set_loop('table', $new_parts_loop); $html->print_template('new_parts'); } if ($action == 'default') { $html->print_template('file_examples'); } } $html->print_footer();