Abschreibung Immobilie
Projektjahr
2024
Projektstatus
Abgeschlossen
Leistungen
Team
Die bestehende Lösung zur Erfassung und Abrechnung von Gutachten besaß einige Probleme und nicht umgesetzte Anforderung des Kunden. Die Benutzerführung, sowie der Checkout-Prozess entsprach nicht dem aktuellen Stand der Technik und die generelle Erweiterbarkeit war nicht gegeben.
Web-Entwicklung
<?php
/*
Plugin Name: Calculation and Document Plugin
Description: A plugin to perform calculations and generate documents.
Version: 1.0
Author: Your Name
*/
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
}
class CalculationDocumentPlugin {
public function __construct() {
// Enqueue scripts and styles
add_action('wp_enqueue_scripts', [$this, 'enqueue_scripts']);
}
public function generate_document($number1, $number2, $doc_title, $doc_content) {
// Perform calculation
$result = $number1 + $number2;
// Generate document content
$document = "<h1>{$doc_title}</h1>\n<p>{$doc_content}</p>\n<p>Calculation Result: {$result}</p>";
// Output or offer to download the document
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="calculation_document.html"');
echo $document;
exit;
}
public function enqueue_scripts() {
wp_enqueue_style('cd-styles', plugin_dir_url(__FILE__) . 'css/styles.css');
}
}
// Initialize the plugin
new CalculationDocumentPlugin();
?>
jQuery(document).ready(function ($) {
let currentSlide = 0;
const slides = $(".slide");
const totalSlides = slides.length;
// Initially hide all slides except the first one
slides.hide();
$(slides[currentSlide]).show();
// Event listener for next button
$("#next-button").on("click", function () {
$(slides[currentSlide]).hide();
currentSlide = (currentSlide + 1) % totalSlides;
$(slides[currentSlide]).show();
});
// Event listener for previous button
$("#prev-button").on("click", function () {
$(slides[currentSlide]).hide();
currentSlide = (currentSlide - 1 + totalSlides) % totalSlides;
$(slides[currentSlide]).show();
});
});
<?php
// Schedule a custom cron job
function schedule_cron_job() {
if (!wp_next_scheduled('batch_processing_event')) {
wp_schedule_event(time(), 'hourly', 'batch_processing_event');
}
}
// Unschedule the cron job
function unschedule_cron_job() {
$timestamp = wp_next_scheduled('batch_processing_event');
if ($timestamp) {
wp_unschedule_event($timestamp, 'batch_processing_event');
}
}
// Add admin menu for manual processing
function add_admin_menu() {
add_menu_page(
'Batch Processing', // Page title
'Batch Processing', // Menu title
'manage_options', // Capability
'batch-processing', // Menu slug
'render_admin_page', // Callback function
'dashicons-update', // Icon
25 // Position
);
}
// Render admin page
function render_admin_page() {
?>
<div class="wrap">
<h1>Batch Processing</h1>
<p>Click the button below to start batch processing manually.</p>
<form method="post">
<input type="submit" name="run_batch" value="Run Batch" class="button-primary" />
</form>
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['run_batch'])) {
process_batch();
echo '<p>Batch processing completed.</p>';
}
?>
</div>
<?php
}
// Process batch task
function process_batch() {
// Example: Fetch items to process
$items = get_items_for_processing();
// Loop through items and perform the task
foreach ($items as $item) {
// Process item (pseudo-processing)
process_item($item);
// Send email notification (example)
wp_mail(
$item['email'], // Recipient email
'Processing Completed', // Subject
'Your item has been processed successfully!' // Message
);
}
}
// Get items for processing (example implementation)
function get_items_for_processing() {
// Simulate fetching items from the database
return [
['id' => 1, 'email' => 'user1@example.com'],
['id' => 2, 'email' => 'user2@example.com']
];
}
// Process individual item (example implementation)
function process_item($item) {
// Simulate item processing
error_log('Processing item ID: ' . $item['id']);
}
// Hooks
add_action('admin_menu', 'add_admin_menu');
add_action('batch_processing_event', 'process_batch');
register_activation_hook(__FILE__, 'schedule_cron_job');
register_deactivation_hook(__FILE__, 'unschedule_cron_job');
?>
<?php
/*
Plugin Name: Backend Dashboard Plugin
Description: A plugin to create a custom backend dashboard in WordPress.
Version: 1.0
Author: Your Name
*/
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
}
class BackendDashboardPlugin {
public function __construct() {
// Add admin menu
add_action('admin_menu', [$this, 'add_admin_menu']);
}
// Add custom menu to the WordPress admin dashboard
public function add_admin_menu() {
add_menu_page(
'Custom Dashboard', // Page title
'Dashboard', // Menu title
'manage_options', // Capability
'custom-dashboard', // Menu slug
[$this, 'render_dashboard'], // Callback function
'dashicons-admin-generic', // Icon
20 // Position
);
}
// Render the dashboard page
public function render_dashboard() {
?>
<div class="wrap">
<h1>Custom Dashboard</h1>
<p>Welcome to the custom backend dashboard.</p>
<form method="post" action="">
<label for="input-data">Enter some data:</label>
<input type="text" name="input_data" id="input-data" />
<input type="submit" name="save_data" value="Save" />
</form>
<?php
// Handle form submission
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['save_data'])) {
$input_data = sanitize_text_field($_POST['input_data']);
update_option('custom_dashboard_data', $input_data);
echo '<p>Data saved: ' . esc_html($input_data) . '</p>';
}
?>
</div>
<?php
}
}
// Initialize the plugin
new BackendDashboardPlugin();
?>
Der dargestellte Code dient nur zur Veranschaulichung und wird in dieser Form nicht im Projekt verwendet.
Hard Facts
Du willst das Projekt Abschreibung Immobilie besser einschätzen können?
Hier sind einige Daten & Fakten, die dir dabei helfen.
Das könnte dich auch interessieren