本文整理汇总了PHP中HTML::set_variable方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::set_variable方法的具体用法?PHP HTML::set_variable怎么用?PHP HTML::set_variable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::set_variable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: catch
}
} catch (Exception $e) {
$messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
$fatal_error = true;
}
/********************************************************************************
*
* Execute actions
*
*********************************************************************************/
if (!$fatal_error) {
switch ($action) {
case 'add':
try {
$new_category = Category::add($database, $current_user, $log, $new_name, $new_parent_id, $new_disable_footprints, $new_disable_manufacturers, $new_disable_autodatasheets);
$html->set_variable('refresh_navigation_frame', true, 'boolean');
if (!$add_more) {
$selected_category = $new_category;
$selected_id = $selected_category->get_id();
}
} catch (Exception $e) {
$messages[] = array('text' => 'Die neue Kategorie konnte nicht angelegt werden!', 'strong' => true, 'color' => 'red');
$messages[] = array('text' => 'Fehlermeldung: ' . nl2br($e->getMessage()), 'color' => 'red');
}
break;
case 'delete':
try {
if (!is_object($selected_category)) {
throw new Exception('Es ist keine Kategorie markiert oder es trat ein Fehler auf!');
}
$parts = $selected_category->get_parts();
示例2: System
$system = new System($database, $log);
$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;
}
/********************************************************************************
*
* Database Update (if required and automatic updates are enabled)
*
*********************************************************************************/
if (!$fatal_error && $database->is_update_required()) {
if ($database->get_current_version() < 13 && $database->get_latest_version() >= 13) {
$config['db']['auto_update'] = false;
$html->set_variable('auto_disabled_autoupdate', true, 'boolean');
}
$html->set_variable('database_update', true, 'boolean');
$html->set_variable('disabled_autoupdate', !$config['db']['auto_update'], 'boolean');
$html->set_variable('db_version_current', $database->get_current_version(), 'integer');
$html->set_variable('db_version_latest', $database->get_latest_version(), 'integer');
if ($config['db']['auto_update'] == true) {
$update_log = $database->update();
$html->set_variable('database_update_log', nl2br($update_log));
}
}
/********************************************************************************
*
* Show a warning if there are empty tables
* (categories, storelocations, footprints, suppliers)
*
示例3: Category
$root_category = new Category($database, $current_user, $log, 0);
$root_device = new Device($database, $current_user, $log, 0);
} catch (Exception $e) {
$messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
$fatal_error = true;
}
/********************************************************************************
*
* Build Navigation Trees
*
*********************************************************************************/
$html->use_javascript(array('dtree', 'toggle'));
if (!$fatal_error) {
try {
$javascript = $root_category->build_javascript_tree('cat_navtree', 'show_category_parts.php', 'cid', 'content_frame');
$html->set_variable('categories_navtree', $javascript);
$javascript = $root_device->build_javascript_tree('cat_devtree', 'show_device_parts.php', 'device_id', 'content_frame', true, true, 'Übersicht', false, true);
$html->set_variable('devices_navtree', $javascript);
} catch (Exception $e) {
$messages[] = array('text' => 'Die Navigationsmenüs konnten nicht erfolgreich erstellt werden!', 'strong' => true, 'color' => 'red');
$messages[] = array('text' => 'Fehlermeldung: ' . nl2br($e->getMessage()), 'color' => 'red');
}
}
/********************************************************************************
*
* Set the rest of the HTML variables
*
*********************************************************************************/
$html->set_variable('disable_footprints', $config['footprints']['disable'], 'boolean');
$html->set_variable('disable_manufacturers', $config['manufacturers']['disable'], 'boolean');
$html->set_variable('disable_devices', $config['devices']['disable'], 'boolean');
示例4: Exception
throw new Exception('Es ist kein Lieferant markiert oder es trat ein Fehler auf!');
}
$selected_supplier->set_attributes(array('name' => $new_name, 'parent_id' => $new_parent_id, 'address' => $new_address, 'phone_number' => $new_phone_number, 'fax_number' => $new_fax_number, 'email_address' => $new_email_address, 'website' => $new_website, 'auto_product_url' => $new_auto_product_url));
} 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 the rest of the HTML variables
*
*********************************************************************************/
$html->set_variable('add_more', $add_more, 'boolean');
if (!$fatal_error) {
try {
if (is_object($selected_supplier)) {
$parent_id = $selected_supplier->get_parent_id();
$html->set_variable('id', $selected_supplier->get_id(), 'integer');
$html->set_variable('name', $selected_supplier->get_name(), 'string');
$html->set_variable('address', $selected_supplier->get_address(), 'string');
$html->set_variable('phone_number', $selected_supplier->get_phone_number(), 'string');
$html->set_variable('fax_number', $selected_supplier->get_fax_number(), 'string');
$html->set_variable('email_address', $selected_supplier->get_email_address(), 'string');
$html->set_variable('website', $selected_supplier->get_website(), 'string');
$html->set_variable('auto_product_url', $selected_supplier->get_auto_product_url(NULL), 'string');
} elseif ($action == 'add') {
$parent_id = $new_parent_id;
} else {
示例5: catch
$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');
$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) {
$html->print_template('show_noprice_parts');
}
示例6: Exception
throw new Exception('Datei konnte nicht hochgeladen werden!');
}
$file_content = file_get_contents($_FILES['uploaded_file']['tmp_name']);
$import_data = import_text_to_array($file_content, $file_format, $separator);
$table_loop = build_parts_import_template_loop($database, $current_user, $log, $import_data);
} catch (Exception $e) {
$messages[] = array('text' => 'Es gab ein Fehler!', 'strong' => true, 'color' => 'red');
$messages[] = array('text' => 'Fehlermeldung: ' . nl2br($e->getMessage()), 'color' => 'red');
}
break;
case 'check_data':
try {
$import_data = extract_import_data_from_request($table_rowcount);
$table_loop = build_parts_import_template_loop($database, $current_user, $log, $import_data);
import_parts($database, $current_user, $log, $import_data, true);
$html->set_variable('data_is_valid', true, 'boolean');
// now the "import" button will be visible
$messages[] = array('text' => 'Die Daten sind gültig!', 'strong' => true, 'color' => 'darkgreen');
} catch (Exception $e) {
$messages[] = array('text' => 'Die Daten sind nicht gültig!', 'strong' => true, 'color' => 'red');
$messages[] = array('text' => 'Fehlermeldung: ' . nl2br($e->getMessage()), 'color' => 'red');
}
break;
case 'import_data':
try {
$import_data = extract_import_data_from_request($table_rowcount);
$table_loop = build_parts_import_template_loop($database, $current_user, $log, $import_data);
$new_parts = import_parts($database, $current_user, $log, $import_data, false);
$html->set_variable('refresh_navigation_frame', true, 'boolean');
$messages[] = array('text' => 'Die Daten wurden erfolgreich importiert!', 'strong' => true, 'color' => 'darkgreen');
unset($import_data);
示例7: catch
}
} catch (Exception $e) {
$messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
$fatal_error = true;
}
/********************************************************************************
*
* Execute actions
*
*********************************************************************************/
if (!$fatal_error) {
switch ($action) {
case 'add':
try {
$new_device = Device::add($database, $current_user, $log, $new_name, $new_parent_id);
$html->set_variable('refresh_navigation_frame', true, 'boolean');
if (!$add_more) {
$selected_device = $new_device;
$selected_id = $selected_device->get_id();
}
} catch (Exception $e) {
$messages[] = array('text' => 'Die neue Baugruppe konnte nicht angelegt werden!', 'strong' => true, 'color' => 'red');
$messages[] = array('text' => 'Fehlermeldung: ' . nl2br($e->getMessage()), 'color' => 'red');
}
break;
case 'delete':
try {
if (!is_object($selected_device)) {
throw new Exception('Es ist keine Baugruppe markiert oder es trat ein Fehler auf!');
}
$parts = $selected_device->get_parts();
示例8: fopen
// enable write permissions
$filehandle = fopen(DOKUWIKI_PERMS_FILENAME, 'w');
if (!$filehandle) {
$messages[] = array('text' => 'Die Datei "' . DOKUWIKI_PERMS_FILENAME . '" kann nicht gelöscht werden! ' . 'Überprüfen Sie, ob Sie die nötigen Schreibrechte besitzen.', 'strong' => true, 'color' => 'red');
} else {
fclose($filehandle);
}
} elseif (!$enable_dokuwiki_write_perms && file_exists(DOKUWIKI_PERMS_FILENAME)) {
// disable write permissions
if (!unlink(DOKUWIKI_PERMS_FILENAME)) {
$messages[] = array('text' => 'Die Datei "' . DOKUWIKI_PERMS_FILENAME . '" kann nicht gelöscht werden! ' . 'Überprüfen Sie, ob Sie die nötigen Schreibrechte besitzen.', 'strong' => true, 'color' => 'red');
}
}
try {
save_config();
$html->set_variable('refresh_navigation_frame', true, 'boolean');
//header('Location: system_config.php'); // Reload the page that we can see if the new settings are stored successfully --> does not work correctly?!
} catch (Exception $e) {
$config = $config_old;
// reload the old config
$messages[] = array('text' => 'Die neuen Werte konnten nicht gespeichert werden!', 'strong' => true, 'color' => 'red');
$messages[] = array('text' => 'Fehlermeldung: ' . nl2br($e->getMessage()), 'color' => 'red');
}
break;
case 'change_admin_password':
try {
if ($config['is_online_demo']) {
throw new Exception('Diese Funktion steht in der Online-Demo nicht zur Verfügung!');
}
// set_admin_password() throws an exception if the old or the new passwords are not valid
set_admin_password($current_admin_password, $new_admin_password_1, $new_admin_password_2, false);
示例9: catch
// admin
} catch (Exception $e) {
$messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
$fatal_error = true;
}
/********************************************************************************
*
* Set all HTML variables
*
*********************************************************************************/
if (!$fatal_error) {
try {
$noprice_parts = Part::get_noprice_parts($database, $current_user, $log);
$count_of_parts_with_price = Part::get_count($database) - count($noprice_parts);
// :-)
$html->set_variable('parts_count_with_prices', $count_of_parts_with_price, 'integer');
$html->set_variable('parts_count_sum_value', Part::get_sum_price_instock($database, $current_user, $log, true), 'string');
$html->set_variable('parts_count', Part::get_count($database), 'integer');
$html->set_variable('parts_count_sum_instock', Part::get_sum_count_instock($database), 'integer');
$html->set_variable('categories_count', Category::get_count($database), 'integer');
$html->set_variable('footprint_count', Footprint::get_count($database), 'integer');
$html->set_variable('location_count', Storelocation::get_count($database), 'integer');
$html->set_variable('suppliers_count', Supplier::get_count($database), 'integer');
$html->set_variable('manufacturers_count', Manufacturer::get_count($database), 'integer');
$html->set_variable('devices_count', Device::get_count($database), 'integer');
$html->set_variable('attachements_count', Attachement::get_count($database), 'integer');
$html->set_variable('footprint_picture_count', count(find_all_files(BASE . '/img/footprints/', true)), 'integer');
$html->set_variable('iclogos_picture_count', count(find_all_files(BASE . '/img/iclogos/', true)), 'integer');
} catch (Exception $e) {
$messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
$fatal_error = true;
示例10: header
}
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));
} else {
示例11: catch
// try to save the config array in config.php --> fatal error if this does not work!
try {
save_config();
} catch (Exception $e) {
$messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
$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');
示例12: unlink
$remove_spaces_successful = tab2spaces($trim_exec_output, $tab2spaces_output_loop);
break;
case 'build_release_package':
$release_packing_successful = build_release_package($trim_exec_output, $release_packing_output_loop);
break;
case 'delete_release_package':
unlink($release_package_filename);
break;
}
}
/********************************************************************************
*
* 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');
示例13: Exception
throw new Exception('Es ist kein Dateityp markiert oder es trat ein Fehler auf!');
}
$selected_attachement_type->set_attributes(array('name' => $new_name, 'parent_id' => $new_parent_id));
} 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 the rest of the HTML variables
*
*********************************************************************************/
$html->set_variable('add_more', $add_more, 'boolean');
if (!$fatal_error) {
try {
if (is_object($selected_attachement_type)) {
$parent_id = $selected_attachement_type->get_parent_id();
$html->set_variable('id', $selected_attachement_type->get_id(), 'integer');
$name = $selected_attachement_type->get_name();
} elseif ($action == 'add') {
$parent_id = $new_parent_id;
$name = $new_name;
} else {
$parent_id = 0;
$name = '';
}
$html->set_variable('name', $name, 'string');
$attachement_types_list = $root_attachement_type->build_html_tree($selected_id, true, false);
示例14: foreach
foreach ($update_log as $message) {
$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');
示例15: header
*
* Check if all installation steps are done. If not, go to the installer.
*
*********************************************************************************/
if (!is_array($config['installation_complete']) || in_array(false, $config['installation_complete'], true)) {
header('Location: install.php');
// ...then go to the installation page
exit;
}
/********************************************************************************
*
* Initialize Objects
*
*********************************************************************************/
$html = new HTML($config['html']['theme'], $config['html']['custom_css'], $config['page_title']);
$html->set_variable('title', $config['page_title'], 'string');
/********************************************************************************
*
* Check if client is a mobile device
*
*********************************************************************************/
/*$mobile = false;
if (isset($_SERVER["HTTP_USER_AGENT"]))
{
$agents = array(
'Windows CE', 'Pocket', 'Mobile',
'Portable', 'Smartphone', 'SDA',
'PDA', 'Handheld', 'Symbian',
'WAP', 'Palm', 'Avantgo',
'cHTML', 'BlackBerry', 'Opera Mini',
'Nokia', 'PSP', 'J2ME'