Merge branch 'master' into fronkdev
This commit is contained in:
@@ -549,9 +549,30 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
function formatIBAN(input) {
|
||||
let iban = input.value.replace(/\s/g, '');
|
||||
|
||||
let formattedIBAN = '';
|
||||
for (let i = 0; i < iban.length; i++) {
|
||||
if (i > 0 && i % 4 === 0) {
|
||||
formattedIBAN += ' ';
|
||||
}
|
||||
formattedIBAN += iban[i];
|
||||
}
|
||||
|
||||
input.value = formattedIBAN;
|
||||
}
|
||||
|
||||
$("#bank_account_iban").on("input", function () {
|
||||
formatIBAN(this);
|
||||
});
|
||||
formatIBAN(document.getElementById('bank_account_iban'));
|
||||
|
||||
|
||||
$('#addressForm').submit(function(e) {
|
||||
$("#error").hide();
|
||||
$("#bank-error").hide();
|
||||
$("#bank_account_iban").val($("#bank_account_iban").val().replaceAll(/\s/g, ''));
|
||||
|
||||
if($('#billing_type').val() == "sepa") {
|
||||
console.log("bankdata_valid (1): " + bankdata_valid);
|
||||
|
||||
@@ -112,7 +112,13 @@
|
||||
<td><?=$address->bank_account_owner?></td>
|
||||
</tr><tr>
|
||||
<th>IBAN</th>
|
||||
<td><?=$address->bank_account_iban?></td>
|
||||
<td><?php
|
||||
$iban = $address->bank_account_iban;
|
||||
$iban = preg_replace('/\s+/', '', $iban);
|
||||
$iban = chunk_split($iban, 4, ' ');
|
||||
$iban = trim($iban);
|
||||
echo $iban;
|
||||
?></td>
|
||||
</tr><tr>
|
||||
<th>BIC</th>
|
||||
<td><?=$address->bank_account_bic?></td>
|
||||
|
||||
@@ -175,6 +175,9 @@ if ($devices->power != "0.0") {
|
||||
} else {
|
||||
$power = $devices->devicetype->power;
|
||||
}
|
||||
foreach ($devicesall as $deviceall) {
|
||||
$DevicesAll[$deviceall->id] = $deviceall->name;
|
||||
}
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@@ -205,6 +208,12 @@ if ($devices->power != "0.0") {
|
||||
<th>Geräte Hersteller</th>
|
||||
<td><?= $devices->devicetype->devicemanufactor->name ?> </td>
|
||||
</tr>
|
||||
<?php if ($devices->parent_id) : ?>
|
||||
<tr>
|
||||
<th>Parent Device</th>
|
||||
<td><a href="<?= self::getUrl("Device", "Detail", ["id" => $devices->parent_id]) ?>"><?= $DevicesAll[$devices->parent_id]?></a></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<tr>
|
||||
<th>Mac Adresse</th>
|
||||
<td><?= $devices->mac ?> </td>
|
||||
@@ -221,6 +230,7 @@ if ($devices->power != "0.0") {
|
||||
<th>Leistung</th>
|
||||
<td><?= $power ?> Watt</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Bemerkung</th>
|
||||
<td><?= nl2br($devices->comment) ?> </td>
|
||||
|
||||
@@ -22,6 +22,10 @@ if (isset($_GET['returnto']) && $_GET['returnto'] == "device-detail") {
|
||||
} else {
|
||||
$cancelUrl = self::getUrl("Device");
|
||||
}
|
||||
foreach ($devices as $Device) {
|
||||
$Devices[$Device->id] = $Device->name;
|
||||
}
|
||||
asort($Devices);
|
||||
?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
@@ -80,6 +84,17 @@ if (isset($_GET['returnto']) && $_GET['returnto'] == "device-detail") {
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="parent_id">Parent </label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="parent_id" id="parent_id">
|
||||
<option value=""> </option>
|
||||
<?php foreach ($Devices as $key => $value): ?>
|
||||
<option value="<?= $key ?>" <?= ($device->parent_id == $key) ? "selected='selected'" : "" ?>><?= ($value) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="pop_id">Pop</label>
|
||||
<div class="col-lg-10">
|
||||
|
||||
251
Layout/default/Domain/Index.php
Normal file
251
Layout/default/Domain/Index.php
Normal file
@@ -0,0 +1,251 @@
|
||||
<?php /** @noinspection PhpUndefinedClassInspection
|
||||
* @var string $mfLayoutPackage
|
||||
* @var TYPE_NAME $git_merge_ts
|
||||
*/
|
||||
|
||||
//additional css /css/views/RaspberryDisplay.css
|
||||
|
||||
$JSGlobals = ["BASE_URL" => self::getUrl("Domain"),
|
||||
"DASHBOARD_URL" => self::getUrl("Dashboard"),
|
||||
"MFAPPNAME" => MFAPPNAME_SLUG,
|
||||
"PAGE_TITLE" => "Domains",
|
||||
"PATH" => [
|
||||
["text" => MFAPPNAME_SLUG, "href" => self::getUrl("Dashboard")],
|
||||
["text" => "Domain Management", "href" => self::getUrl("Domain")],
|
||||
["text" => "Domains"]
|
||||
],
|
||||
"DOMAIN_API_URL" => self::getUrl("Domain/api"),
|
||||
];
|
||||
|
||||
$additionalJS = ["plugins/vue/vue.js",
|
||||
"plugins/axios/axios.min.js",
|
||||
"plugins/vue/tt-components/tt-page-title.js",
|
||||
"plugins/vue/tt-components/tt-table.js",
|
||||
];
|
||||
$additionalCSS = [
|
||||
'plugins/vue/tt-components/css/tt-table.css',
|
||||
];
|
||||
|
||||
include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
|
||||
<div id="app">
|
||||
<!-- start page title -->
|
||||
<tt-page-title :title="window['TT_CONFIG']['PAGE_TITLE']" :path="window['TT_CONFIG']['PATH']"></tt-page-title>
|
||||
|
||||
<tt-table :fetch-url="window['TT_CONFIG']['DOMAIN_API_URL'] + '?do=getDomains'" :table-config="domainsTableConfig"
|
||||
small ref="table">
|
||||
<template v-slot:top-buttons>
|
||||
<button type="button" class="btn btn-primary" @click="reloadDomains">
|
||||
<template v-if="reloadDomainsLoading">
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<i class="fas fa-sync-alt"></i>
|
||||
Reload Domains
|
||||
</template>
|
||||
</button>
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" v-model="checkDomainInput" placeholder="Neue Domain überprüfen">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary" @click="checkDomainAvailability">
|
||||
<template v-if="checkDomainLoading">
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<i class="fas fa-search"></i>
|
||||
</template>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Slot to show DNS records button -->
|
||||
<template v-slot:inwxroid="{ row }">
|
||||
<button type="button" class="btn btn-primary" @click="showDnsRecordsModal(row.domain)"
|
||||
:class="dnsRecordsModalLoading === row.domain ? 'disabled' : ''">
|
||||
<template v-if="dnsRecordsModalLoading === row.domain">
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
</template>
|
||||
<span v-else>DNS</span>
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<!-- Slot to show if Domain is in Plesk -->
|
||||
<template v-slot:pleskid="{ row }">
|
||||
<i v-if="row.pleskId !== null" class="fas fa-check text-success"></i>
|
||||
<i v-else class="fas fa-times text-danger"></i>
|
||||
</template>
|
||||
|
||||
<!-- Convert all Dates to human readable format -->
|
||||
<template v-slot:crdate="{ row }">{{ new Date(row.crDate * 1000).toLocaleDateString() }}</template>
|
||||
<template v-slot:exdate="{ row }">{{ new Date(row.exDate * 1000).toLocaleDateString() }}</template>
|
||||
<template v-slot:redate="{ row }">{{ new Date(row.reDate * 1000).toLocaleDateString() }}</template>
|
||||
<template v-slot:update="{ row }">{{ new Date(row.upDate * 1000).toLocaleDateString() }}</template>
|
||||
|
||||
<!-- Registrant Admin Tech Billing from domainContacts -->
|
||||
<template v-slot:registrant="{ row }">
|
||||
{{ domainContacts[row.registrant] ? domainContacts[row.registrant]["name"] : '' }}
|
||||
</template>
|
||||
<template v-slot:admin="{ row }">{{ domainContacts[row.admin] ? domainContacts[row.admin]["name"] : ''}}
|
||||
</template>
|
||||
<template v-slot:tech="{ row }">{{ domainContacts[row.tech] ? domainContacts[row.tech]["name"] : ''}}
|
||||
</template>
|
||||
<template v-slot:billing="{ row }">{{ domainContacts[row.billing] ? domainContacts[row.billing]["name"] : ''}}
|
||||
</template>
|
||||
|
||||
</tt-table>
|
||||
|
||||
<!-- Bootstrap Modal to query and show all DNS records for a domain -->
|
||||
<div class="modal show d-block" tabindex="-1" role="dialog" style="background: rgba(0, 0, 0, 0.5);" ref="dnsRecordsModal" @click="dnsRecordsModal.domain = null" @keydown.esc="dnsRecordsModal.domain = null"
|
||||
v-if="dnsRecordsModal.domain">
|
||||
<div class="modal-dialog" role="document" style="max-width: fit-content" @click.stop>
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">DNS Records for {{ dnsRecordsModal.domain ?? '' }}</h5>
|
||||
<button type="button" class="close" @click="dnsRecordsModal.domain = null">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<table class="tt-table table-striped table-bordered table-hover table-sm table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Record Class</th>
|
||||
<th>Record Type</th>
|
||||
<th>Record Host</th>
|
||||
<th>Record Value</th>
|
||||
<th>Record TTL</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="record in dnsRecordsModal.records">
|
||||
<td>{{ record.class }}</td>
|
||||
<td>{{ record.type }} {{ record.pri ? '(' + record.pri + ')' : '' }}</td>
|
||||
<td>{{ record.host }}</td>
|
||||
<td>{{ record.value }}</td>
|
||||
<td>{{ record.ttl }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-secondary" @click="dnsRecordsModal.domain = null">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
window: window,
|
||||
domainContacts: {},
|
||||
reloadDomainsLoading: false,
|
||||
dnsRecordsModalLoading: null,
|
||||
dnsRecordsModal: {
|
||||
domain: null,
|
||||
records: []
|
||||
},
|
||||
checkDomainInput: '',
|
||||
checkDomainResult: null,
|
||||
checkDomainLoading: false
|
||||
},
|
||||
mounted() {
|
||||
this.fetchDomainContacts()
|
||||
},
|
||||
computed: {
|
||||
domainsTableConfig() {
|
||||
const base = {
|
||||
headers: [
|
||||
{text: "ID", key: "inwxRoId", "filter": false},
|
||||
{text: "Domain", key: "domain"},
|
||||
{text: "Plesk", key: "pleskId", filter: false},
|
||||
{text: "Created Date", key: "crDate", filter: false},
|
||||
{text: "Expiration Date", key: "exDate", filter: false},
|
||||
{text: "Renewal Date", key: "reDate", filter: false},
|
||||
{text: "Updated Date", key: "upDate", filter: false},
|
||||
{text: "Transfer Lock", key: "transferLock"},
|
||||
{text: "Authorization Code", key: "authCode"},
|
||||
{text: "Registrant ID", key: "registrant"},
|
||||
{text: "Admin ID", key: "admin"},
|
||||
{text: "Tech ID", key: "tech"},
|
||||
{text: "Billing ID", key: "billing"},
|
||||
{text: "Name Servers", key: "ns"}
|
||||
],
|
||||
tableHeader: 'Bestellungen',
|
||||
}
|
||||
|
||||
const domainContactsSorted = Object.entries(this.domainContacts).sort(([, a], [, b]) => a.name.localeCompare(b.name))
|
||||
const domainContactsFilterOptions = domainContactsSorted.map(([, contact]) => {
|
||||
return {text: contact.name, value: contact.inwxRoId}
|
||||
})
|
||||
|
||||
// for registrant admin tech billing set filter to select with domainContacts if domainContacts is not empty
|
||||
if (Object.keys(this.domainContacts).length > 0) {
|
||||
base.headers = base.headers.map(header => {
|
||||
if (['registrant', 'admin', 'tech', 'billing'].includes(header.key)) {
|
||||
header.filter = 'select'
|
||||
header.filterOptions = domainContactsFilterOptions
|
||||
}
|
||||
return header
|
||||
})
|
||||
}
|
||||
return base
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async showDnsRecordsModal(domain) {
|
||||
this.dnsRecordsModalLoading = domain
|
||||
this.dnsRecordsModal = {
|
||||
domain: null,
|
||||
records: []
|
||||
}
|
||||
const response = await axios.get(window['TT_CONFIG']['DOMAIN_API_URL'] + '?do=getDnsRecords&domain=' + domain)
|
||||
this.dnsRecordsModal.domain = domain
|
||||
this.dnsRecordsModal.records = response.data.map(record => {
|
||||
if (typeof record.entries === 'object') {
|
||||
record.value = record.entries[0]
|
||||
} else {
|
||||
record.value = record.target || record.txt || record.ip
|
||||
}
|
||||
if (record.type === 'SOA') {
|
||||
record.value = record.mname + ' ' + record.rname + ' ' + record.serial + ' ' + record.refresh + ' ' + record.retry + ' ' + record.expire
|
||||
|
||||
}
|
||||
return record
|
||||
})
|
||||
this.dnsRecordsModalLoading = null
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dnsRecordsModal.focus()
|
||||
})
|
||||
},
|
||||
async fetchDomainContacts() {
|
||||
const response = await axios.get(window['TT_CONFIG']['DOMAIN_API_URL'] + '?do=getDomainContacts')
|
||||
this.domainContacts = response.data
|
||||
},
|
||||
async reloadDomains() {
|
||||
this.reloadDomainsLoading = true
|
||||
const response = await axios.get(window['TT_CONFIG']['DOMAIN_API_URL'] + '?do=importAllDomains')
|
||||
window.notify('success', response.data["importMessages"].join('<br>'))
|
||||
await Promise.all([
|
||||
this.fetchDomainContacts(),
|
||||
this.$refs.table.fetchData(this.$refs.table.pagination.page)
|
||||
])
|
||||
this.reloadDomainsLoading = false
|
||||
},
|
||||
//TODO: make this cleaner
|
||||
async checkDomainAvailability() {
|
||||
this.checkDomainLoading = true
|
||||
const response = await axios.get(window['TT_CONFIG']['DOMAIN_API_URL'] + '?do=checkDomain&domain=' + this.checkDomainInput)
|
||||
const priceInformation = response.data.price.domain[this.checkDomainInput]
|
||||
window.notify(response.data.status === 'free' ? 'success' : 'error',
|
||||
`Domain ist ${response.data.status === 'free' ? 'verfügbar. Registrieren um' : 'nicht frei. Transfer um'} ${priceInformation.price}${priceInformation.currency}/${priceInformation.period === '1Y' ? 'Jahr' : priceInformation.period}`)
|
||||
this.checkDomainLoading = false
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
|
||||
244
Layout/default/FiberPlanDispatcher/Form.php
Normal file
244
Layout/default/FiberPlanDispatcher/Form.php
Normal file
@@ -0,0 +1,244 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
|
||||
</li>
|
||||
<li class="breadcrumb-item"><a
|
||||
href="<?= self::getUrl("FiberPlanDispatcher") ?>">Verteiler/Schächte</a></li>
|
||||
<li class="breadcrumb-item active"><?= ($fiberplandispatchers->id) ? "bearbeiten" : "Neu" ?></li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title"><?= ($fiberplandispatchers->id) ? "Verteiler/Schacht bearbeiten" : "Neuer Verteiler/Schacht" ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
<?php
|
||||
if (!$me->permissions->isAdmin) {
|
||||
foreach ($networkaddresses as $networkaddress) {
|
||||
if ($me->address->id == $networkaddress->address_id) {
|
||||
$allowedNetworks[$networkaddress->network_id] = "ok";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<style>
|
||||
.fa-circle-plus {
|
||||
color: #00b125;
|
||||
cursor: pointer;
|
||||
font-size: 17px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.remove-sleeve {
|
||||
cursor: pointer;
|
||||
color: #ff0606;
|
||||
font-size: 17px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
</style>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<h4 class="header-title mb-2"><?= ($fiberplandispatchers->id) ? "Verteiler/Schacht bearbeiten" : "Neuer Verteiler/Schacht" ?></h4>
|
||||
<div class="col-12">
|
||||
<form class="form-horizontal" method="post"
|
||||
action="<?= self::getUrl("FiberPlanDispatcher", "save") ?>">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<input type="hidden" name="id" value="<?= $fiberplandispatchers->id ?>"/>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-4 col-form-label" for="network_id">Netzgebiet
|
||||
*</label>
|
||||
<div class="col-lg-5">
|
||||
|
||||
<select class="select2 form-control "
|
||||
name="network_id" id="network_id">
|
||||
<option value=""> </option>
|
||||
<?php foreach ($networks as $key => $network):
|
||||
if (!$me->permissions->isAdmin) {
|
||||
if (!array_key_exists($network->id, $allowedNetworks)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<option value="<?= $network->id ?>" <?= ($fiberplandispatchers->network_id == $network->id) ? "selected='selected'" : "" ?>><?= ($network->name) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-4 col-form-label" for="gps_lat">Beschreibung
|
||||
*</label>
|
||||
<div class="col-lg-4">
|
||||
<input type="text" required="required" step="any"
|
||||
class="form-control" name="description" id="description"
|
||||
value="<?= $fiberplandispatchers->description ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-4 col-form-label" for="object_type">Objekt Typ
|
||||
*</label>
|
||||
<div class="col-lg-4">
|
||||
<select class="select2 form-control" required="required"
|
||||
name="object_type" id="object_type">
|
||||
<option value="1" <?= ($fiberplandispatchers->object_type == '1') ? "selected='selected'" : "" ?>>
|
||||
Verteiler
|
||||
</option>
|
||||
<option value="2" <?= ($fiberplandispatchers->object_type == '2') ? "selected='selected'" : "" ?>>
|
||||
Schacht
|
||||
</option>
|
||||
<option value="3" <?= ($fiberplandispatchers->object_type == '3') ? "selected='selected'" : "" ?>>
|
||||
Greenfield
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-4 col-form-label" for="type">Typ</label>
|
||||
<div class="col-lg-4">
|
||||
<textarea id="type" name="type"
|
||||
class="form-control"><?= $fiberplandispatchers->type ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-4 col-form-label" for="gps_lat">GPS
|
||||
Breite/Länge</label>
|
||||
<div class="col-lg-3">
|
||||
<input type="number" step="any" class="form-control" name="gps_lat"
|
||||
id="gps_lat" placeholder="GPS Breite"
|
||||
value="<?= $fiberplandispatchers->gps_lat ?>">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3">
|
||||
<input type="number" step="any" class="form-control" name="gps_long"
|
||||
id="gps_long" placeholder="GPS Länge"
|
||||
value="<?= $fiberplandispatchers->gps_long ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-4 col-form-label" for="comment">Kommentar</label>
|
||||
<div class="col-lg-5">
|
||||
<textarea id="comment" name="comment"
|
||||
class="form-control"><?= $fiberplandispatchers->comment ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="sleeves-main" class="col-6" <?= ($fiberplandispatchers->object_type == 2) ? "" : 'style="display:none"' ?>>
|
||||
<div class="row">
|
||||
<h4>Muffe(n) <i class="fa-regular fa-circle-plus add-sleeve"></i>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="sleeves-div">
|
||||
<?php
|
||||
if ($sleeves):
|
||||
foreach ($sleeves as $sleeve) : ?>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-3 col-form-label"
|
||||
>Muffe <i data-popid="5"
|
||||
class="fa-regular fa-circle-minus remove-sleeve"></i></label>
|
||||
<div class="col-lg-4">
|
||||
<input type="text" required="required" step="any"
|
||||
class="form-control" name="sleeves[]"
|
||||
value="<?= $sleeve['name']; ?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
endforeach;
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2"></label>
|
||||
<div class="col-lg-10">
|
||||
<button type="submit" class="btn btn-primary">Speichern</button>
|
||||
<a href="<?= self::getUrl("FiberPlanDispatcher") ?>">
|
||||
<button type="button" class="btn btn-secondary">Abbrechen</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$("#network_id").select2({placeholder: ""});
|
||||
$("#object_type").select2();
|
||||
|
||||
// disable mousewheel on a input number field when in focus
|
||||
$('form').on('focus', 'input[type=number]', function (e) {
|
||||
$(this).on('wheel.disableScroll', function (e) {
|
||||
e.preventDefault()
|
||||
})
|
||||
});
|
||||
$('form').on('blur', 'input[type=number]', function (e) {
|
||||
$(this).off('wheel.disableScroll')
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$("body").on("click", ".remove-sleeve", function () {
|
||||
$(this).closest('.form-group').remove();
|
||||
});
|
||||
|
||||
$("body").on("change", "#object_type", function (){
|
||||
if ($(this).val()=="2")
|
||||
{
|
||||
$('#sleeves-main').show()
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#sleeves-main').hide()
|
||||
$('#sleeves-div').empty()
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
$("body").on("click", ".add-sleeve", function () {
|
||||
if ($('#sleeves-div').find('.form-group').length < 5) {
|
||||
$('#sleeves-div').append(`<div class="form-group row">
|
||||
<label class="col-lg-3 col-form-label"
|
||||
>Muffe <i data-popid="5" class="fa-regular fa-circle-minus remove-sleeve"></i></label>
|
||||
<div class="col-lg-4">
|
||||
<input type="text" required="required" step="any"
|
||||
class="form-control" name="sleeves[]"
|
||||
value="">
|
||||
</div>
|
||||
</div>`);
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
;
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
122
Layout/default/FiberPlanDispatcher/Index.php
Normal file
122
Layout/default/FiberPlanDispatcher/Index.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
$objecttype[1] = 'Verteiler';
|
||||
$objecttype[2] = 'Schacht';
|
||||
$objecttype[3] = 'Greenfield';
|
||||
|
||||
?>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">Verteiler und Schächte</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Verteiler und Schächte</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="float-left">
|
||||
<h4 class="header-title">Liste aller Verteiler und Schächte</h4>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<a class="btn btn-primary mb-2" href="<?= self::getUrl("FiberPlanDispatcher", "add") ?>"><i
|
||||
class="fas fa-plus"></i> Neuen Verteiler/Schacht anlegen</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination.php"); ?>
|
||||
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination-summary.php"); ?>
|
||||
|
||||
<table id="datatable" class="table table-striped table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">Netzgebiet</th>
|
||||
<th class="text-center">Beschreibung</th>
|
||||
<th class="text-center">Objektart</th>
|
||||
<th class="text-center">Type</th>
|
||||
<th class="text-center">Koordinaten</th>
|
||||
<th class="text-center">Kommentar</th>
|
||||
<th class="edit-weight"></th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<thead>
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($fiberplandispatchers as $fiberplandispatcher): ?>
|
||||
<?php
|
||||
if ($fiberplandispatcher->gps_lat) {
|
||||
$mapslink = '<a
|
||||
title="Google-Maps: ' . $fiberplandispatcher->gps_lat . ' , ' . $fiberplandispatcher->gps_long . '"
|
||||
class="mapsLink"
|
||||
href="http://maps.google.com/?q=' . $fiberplandispatcher->gps_lat . ' , ' . $fiberplandispatcher->gps_long . '"
|
||||
target="_blank">' . rtrim($fiberplandispatcher->gps_lat, 0) . ' , ' . rtrim($fiberplandispatcher->gps_long, 0) . '</a>';
|
||||
} else {
|
||||
$mapslink = 'N/A';
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?= $fiberplandispatcher->network->name ?></td>
|
||||
<td><?= $fiberplandispatcher->description ?></td>
|
||||
<td class="text-center"><?= $objecttype[$fiberplandispatcher->object_type] ?></td>
|
||||
<td class="text-left"><?= nl2br($fiberplandispatcher->type) ?></td>
|
||||
<td class="text-center"><?= $mapslink ?></td>
|
||||
<td class="text-left"><?= nl2br($fiberplandispatcher->comment) ?></td>
|
||||
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?= self::getUrl("FiberPlanDispatcher", "edit", ["id" => $fiberplandispatcher->id]) ?>"><i
|
||||
class="far fa-edit" title="Bearbeiten"></i></a>
|
||||
<a href="<?= self::getUrl("FiberPlanDispatcher", "delete", ["id" => $fiberplandispatcher->id]) ?>"
|
||||
onclick="if(!confirm('Verteiler/Schacht wirklich löschen?')) return false;"
|
||||
class="text-danger"
|
||||
title="Löschen"><i class="fas fa-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [6];
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
530
Layout/default/FiberPlanPipe/Detail.php
Normal file
530
Layout/default/FiberPlanPipe/Detail.php
Normal file
@@ -0,0 +1,530 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
|
||||
<?php
|
||||
$markers = [];
|
||||
$typeOption[1] = "Einzel";
|
||||
$typeOption[2] = "Schutzrohr";
|
||||
$typeOption[3] = "Verband";
|
||||
$starting_pointOption[1] = "Greenfield";
|
||||
$starting_pointOption[2] = "POP";
|
||||
$starting_pointOption[3] = "Building";
|
||||
$starting_pointOption[4] = "Schacht-Verteiler";
|
||||
$fiberplanpipestypes[1] = "Verteiler";
|
||||
$fiberplanpipestypes[2] = "Schacht";
|
||||
$fiberplanpipestypes[3] = "Greenfield";
|
||||
$fiberplanpipestypes[4] = "Abzweigepunkt";
|
||||
|
||||
$dimension_v1Option[1] = "MR7";
|
||||
$dimension_v1Option[2] = "MR14";
|
||||
$dimension_v1Option[3] = "MR16";
|
||||
$dimension_v1Option[4] = "MR20";
|
||||
$dimension_v1Option[5] = "PE32";
|
||||
$dimension_v1Option[6] = "PE40";
|
||||
$dimension_v1Option[7] = "PE50";
|
||||
$dimension_v1Option[8] = "KSR50";
|
||||
$dimension_v1Option[9] = "KSR80";
|
||||
$dimension_v1Option[10] = "KSR100";
|
||||
$dimension_v2Option[1] = "Anzahl";
|
||||
$dimension_v2Option[2] = "Dimenson";
|
||||
$dimension_v2Option[3] = "Farben";
|
||||
$state[10] = 'Geplant';
|
||||
$state[20] = 'Umsetzung';
|
||||
$state[30] = 'Fertiggestellt';
|
||||
foreach ($pipworkeraddresses as $pipworkeraddress):
|
||||
$Pipeworkers[$pipworkeraddress->id] = $pipworkeraddress->company;
|
||||
|
||||
endforeach;
|
||||
|
||||
foreach ($networks as $network):
|
||||
$Network[$network->id] = $network->name;
|
||||
endforeach;
|
||||
|
||||
$allNetworks[$fiberplanpipes->startpoint_network_id] = $Network[$fiberplanpipes->startpoint_network_id];
|
||||
$allNetworks[$fiberplanpipes->endpoint_network_id] = $Network[$fiberplanpipes->endpoint_network_id];
|
||||
|
||||
if ($fiberplanpipes->address_id) {
|
||||
$responsible = $Pipeworkers[$fiberplanpipes->address_id];
|
||||
} else {
|
||||
$responsible = "Person";
|
||||
}
|
||||
if ($fiberplanpipes->type == "3") {
|
||||
$name = "";
|
||||
if ($fiberplanpipes->fiberPlanPipeTemplate->pipe7x4 && $fiberplanpipes->fiberPlanPipeTemplate->pipe14x10) {
|
||||
$name = $fiberplanpipes->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipes->fiberPlanPipeTemplate->pipe7x4 . "*7x4" . "/" . $fiberplanpipes->fiberPlanPipeTemplate->pipe14x10 . "*14x10";
|
||||
} else if ($fiberplanpipes->fiberPlanPipeTemplate->pipe7x4) {
|
||||
$name = $fiberplanpipes->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipes->fiberPlanPipeTemplate->pipe7x4 . "*7x4";
|
||||
} else if ($fiberplanpipes->fiberPlanPipeTemplate->pipe14x10) {
|
||||
$name = $fiberplanpipes->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipes->fiberPlanPipeTemplate->pipe14x10 . "*14x10";
|
||||
}
|
||||
$typeDescription = $name;
|
||||
//
|
||||
} else {
|
||||
$typeDescription = $dimension_v1Option[$fiberplanpipes->type_description];
|
||||
}
|
||||
|
||||
?>
|
||||
<style>
|
||||
#map {
|
||||
height: 600px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.card-border {
|
||||
border-left: 1px solid #428bca;
|
||||
border-left-width: 5px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.fiber-rack-div {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.fiber-color {
|
||||
color: #0d6efd;
|
||||
float: right;
|
||||
margin-left: 5px;
|
||||
|
||||
}
|
||||
|
||||
.fiber-module-div {
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
margin-bottom: 5px;
|
||||
border: 1px solid #e3e3e3;
|
||||
}
|
||||
|
||||
.sp-border-rl {
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
|
||||
}
|
||||
|
||||
.sp-table-border {
|
||||
border: 1px solid #bfbfbf;
|
||||
border-radius: 10px;
|
||||
display: inline;
|
||||
|
||||
}
|
||||
|
||||
.sp-table-border > tbody {
|
||||
padding: 10px;
|
||||
|
||||
}
|
||||
|
||||
.sp-table-border > thead td {
|
||||
padding: 10px 0px 0px 0px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.sp-port-lines {
|
||||
width: 50px;
|
||||
border-top: 1px solid #000;
|
||||
border-bottom: 1px solid #000;
|
||||
|
||||
}
|
||||
|
||||
#olt-splitter td {
|
||||
height: 30px;
|
||||
width: 150px;
|
||||
border: 1px solid #bfbfbf;
|
||||
margin-top: 15px;
|
||||
display: block;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#olt-splitter-table thead {
|
||||
padding: 10px 0px 0px 0px;
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
|
||||
}
|
||||
|
||||
#olt-splitter-table thead td {
|
||||
padding-top: 12px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.sp-splitter-count {
|
||||
padding: 3px 10px 3px 10px;
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.sp-splitter-count-left {
|
||||
padding: 3px 0px 3px 10px;
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.sp-splitter-count-right {
|
||||
padding: 3px 10px 3px 0px;
|
||||
width: 50px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.sp-splitter-count-edit {
|
||||
-ms-user-select: None;
|
||||
-moz-user-select: None;
|
||||
-webkit-user-select: None;
|
||||
user-select: None;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.sp-splitter-count-show {
|
||||
width: 46px;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
padding-top: 2px;
|
||||
-ms-user-select: None;
|
||||
-moz-user-select: None;
|
||||
-webkit-user-select: None;
|
||||
user-select: None;
|
||||
}
|
||||
|
||||
.sp-white-border {
|
||||
border-color: #fff !important;
|
||||
}
|
||||
|
||||
.sp-ont-text {
|
||||
padding: 0px 5px 0px 5px;
|
||||
}
|
||||
|
||||
.fa-circle-check {
|
||||
color: #07ad2b;
|
||||
}
|
||||
|
||||
.fa-circle-xmark {
|
||||
color: #ff0000;
|
||||
}
|
||||
|
||||
.fa-rotate-right {
|
||||
color: #0d6efd;
|
||||
cursor: pointer;
|
||||
|
||||
}
|
||||
|
||||
.ont-refresh-span, .ontdetail-refresh-span {
|
||||
display: inline-block;
|
||||
width: 20px;
|
||||
margin-right: 50px;
|
||||
min-height: 1px;
|
||||
color: #0d6efd;
|
||||
}
|
||||
|
||||
.text-decoration-underline {
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.condensed-ont th {
|
||||
padding: 6px 0.85rem 6px 0.85rem !important;
|
||||
}
|
||||
|
||||
.condensed-ont td {
|
||||
padding: 6px 0.85rem 6px 0.85rem !important;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
|
||||
</li>
|
||||
<li class="breadcrumb-item"><a href="<?= self::getUrl("FiberPlanPipe") ?>">Rohrverzeichnis</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">Kabelverzeichnis Detail</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Kabel: <span
|
||||
class="font-weight-normal ml-1"><?= $fiberplanpipes->description ?></span>
|
||||
<span class="ml-2">
|
||||
<a href="<?= self::getUrl("FiberPlanPipe", "edit", ["id" => $fiberplanpipes->id, 'returnto' => "fiberplanpipe-detail"]) ?>">
|
||||
<button class="btn btn-primary">Bearbeiten</button>
|
||||
</a>
|
||||
</span></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-4 card-border">
|
||||
<div>
|
||||
<h4>Allgemeine Informationen </h4>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<table class="table table-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="w-50">Bezeichnung</th>
|
||||
<td><?= $fiberplanpipes->description ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>GisId</th>
|
||||
<td><?= $fiberplanpipes->gisid ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Länge (m)</th>
|
||||
<td>
|
||||
<?= $fiberplanpipes->length ?> Meter
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Netzgebiet (e)</th>
|
||||
<td><?= implode(', ', $allNetworks) ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Rohrtyp</th>
|
||||
<td><?= $typeOption[$fiberplanpipes->type] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Rohrbezeichnung</th>
|
||||
<td><?= $typeDescription ?> </td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-4 ">
|
||||
<div>
|
||||
<h4> </h4>
|
||||
</div>
|
||||
<table class="table table-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<td><?= $state[$fiberplanpipes->status] ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Zuständig</th>
|
||||
<td><?= $responsible ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Kontakt</th>
|
||||
<td><?= $fiberplanpipes->responsible_text ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Bemerkung</th>
|
||||
<td><?= nl2br($fiberplanpipes->comment) ?> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-3 ">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row pb-3 pt-4 ">
|
||||
|
||||
<div class="col-12 text-center card-border">
|
||||
<div>
|
||||
<h4 class="text-left mb-3">Schematische Darstellung <i data-toggle="modal"
|
||||
data-target="#pipemap"
|
||||
class="fa-duotone fa-map-location-dot font-24"
|
||||
style="--fa-primary-color: #fa0000; --fa-secondary-color: #232423;margin-left:5px;cursor:pointer"></i>
|
||||
</h4>
|
||||
|
||||
</div>
|
||||
<div class="ml-2">
|
||||
<?php
|
||||
if ($fiberplanpipeendpoints) :
|
||||
$endpointcounter = count($fiberplanpipeendpoints);
|
||||
$counter = 1;
|
||||
foreach ($fiberplanpipeendpoints as $endpoint):
|
||||
if ($endpoint->pop_id) {
|
||||
$endpointname = '<a href="' . self::getUrl("Pop", "Detail", ["id" => $endpoint->pop->id]) . '" target="_blank">' . $endpoint->pop->name . '</a>';
|
||||
$endpointtype = "Pop";
|
||||
$gps_lat = $endpoint->pop->gps_lat;
|
||||
$gps_long = $endpoint->pop->gps_long;
|
||||
} elseif ($endpoint->fiberPlanDispatcher_id) {
|
||||
$endpointname = $endpoint->fiberPlanDispatcher->description;
|
||||
$endpointtype = $fiberplanpipestypes[$endpoint->fiberPlanDispatcher->object_type];
|
||||
$gps_lat = $endpoint->fiberPlanDispatcher->gps_lat;
|
||||
$gps_long = $endpoint->fiberPlanDispatcher->gps_long;
|
||||
}
|
||||
$coordinates = "";
|
||||
if ($gps_lat) {
|
||||
$coordinates = round($gps_lat, 5) . " , " . round($gps_long, 5);
|
||||
$coordinates = '<a title="Google-Maps: ' . $coordinates . '" class="mapsLink" href="http://maps.google.com/?q=' . $coordinates . '" target="_blank">' . $coordinates . '</a>';
|
||||
}
|
||||
?>
|
||||
<table class="sp-table-border float-left border-collapse: collapse;"
|
||||
style="min-height: 150px;">
|
||||
<thead style="display: inline;">
|
||||
<tr>
|
||||
<th colspan="3"
|
||||
class="text-center font-15">
|
||||
<div class="pt-2 pl-2 pr-2"><?= $endpointtype; ?></div>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="3"
|
||||
class="text-center font-15">
|
||||
<div class="pl-2 pr-2"><?= $endpointname; ?></div>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="3"
|
||||
class="text-center font-13">
|
||||
<div class="pb-2 pl-2 pr-2"><?= $coordinates ?></div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php
|
||||
if ($gps_lat) {
|
||||
$markers[] = array(
|
||||
"gps_lat" => $gps_lat,
|
||||
"gps_long" => $gps_long,
|
||||
"name" => $endpointname,
|
||||
);
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
if ($endpointcounter > $counter) :
|
||||
?>
|
||||
<table id="olt-port-table" class="float-left" style="width: 100px">
|
||||
<thead>
|
||||
<tr>
|
||||
<td style="height:40px;"></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="olt-ports">
|
||||
<tr>
|
||||
<td data-oltport="0"
|
||||
class="font-13"><?= $fibers[$fiberplancables->fibers]['fibers']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-oltport="0" class="sp-port-lines"
|
||||
style="width: 70px; background-color: <?= $pipecolor; ?> ;height: <?= $pipeheight; ?>;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-oltport="0" class="font-13"><?= $pipesub; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
endif;
|
||||
$counter++;
|
||||
endforeach;
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="pipemap" tabindex="-1" role="dialog" aria-labelledby="pipemap"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-xl" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="pipemapLabel">Rohrverzeichnis</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="map"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Schließen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($markers) :
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
||||
var marker;
|
||||
var polylinec;
|
||||
var polyline;
|
||||
var map = L.map('map').setView([51.505, -0.09], 13);
|
||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19
|
||||
}).addTo(map);
|
||||
L.MakiMarkers.accessToken = '<?=TT_MAPBOX_TILE_API_TOKEN?>';
|
||||
$(document).ready(function () {
|
||||
var locations = [<?php
|
||||
$counter = 0;
|
||||
$lat = 0;
|
||||
$long = 0;
|
||||
foreach ($markers as $marker):
|
||||
if ($counter > 0) echo ',';
|
||||
?>
|
||||
['<?= $marker['name'] ?>', <?= $marker['gps_lat'] ?>, <?= $marker['gps_long'] ?>]
|
||||
<?php
|
||||
$lat = $lat + $marker['gps_lat'];
|
||||
$long = $long + $marker['gps_long'];
|
||||
$counter++;
|
||||
endforeach;
|
||||
$lat = $lat / $counter;
|
||||
$long = $long / $counter;
|
||||
|
||||
?>
|
||||
];
|
||||
var startlat = <?=$lat ?>;
|
||||
var startlong = <?=$long ?>;
|
||||
console.log('<?=$lat . " " . $long ?>')
|
||||
|
||||
$('#pipemap').on('show.bs.modal', function (event) {
|
||||
var button = $(event.relatedTarget);
|
||||
map.remove();
|
||||
map = L.map('map').setView([51.505, -0.09], 13);
|
||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19
|
||||
}).addTo(map);
|
||||
var icon_name = "town";
|
||||
var icon_color = "#ec98a2";
|
||||
var icon = L.MakiMarkers.icon({icon: icon_name, color: icon_color, size: "l"});
|
||||
var oldlat;
|
||||
var oldlong;
|
||||
map.setView([startlat, startlong], 14)
|
||||
for (var i = 0; i < locations.length; i++) {
|
||||
marker = new L.marker([locations[i][1], locations[i][2]]).addTo(map)
|
||||
.bindPopup(locations[i][0]);
|
||||
|
||||
if (oldlong) {
|
||||
polylinec = [
|
||||
[oldlat, oldlong],
|
||||
[locations[i][1], locations[i][2]]
|
||||
];
|
||||
polyline = L.polyline(polylinec, {color: 'red'}).addTo(map);
|
||||
polyline = null;
|
||||
console.log(polylinec);
|
||||
}
|
||||
oldlong = locations[i][2];
|
||||
oldlat = locations[i][1];
|
||||
}
|
||||
|
||||
});
|
||||
$('#pipemap').on('shown.bs.modal', function (event) {
|
||||
map.invalidateSize();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
469
Layout/default/FiberPlanPipe/Form.php
Normal file
469
Layout/default/FiberPlanPipe/Form.php
Normal file
@@ -0,0 +1,469 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
|
||||
</li>
|
||||
<li class="breadcrumb-item"><a
|
||||
href="<?= self::getUrl("FiberPlanPipe") ?>">Rohrverzeichnisse</a></li>
|
||||
<li class="breadcrumb-item active"><?= ($fiberplanpipes->id) ? "bearbeiten" : "Neu" ?></li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title"><?= ($fiberplanpipes->id) ? "Rohrverzeichnis bearbeiten" : "Neuer Rohrverzeichnis" ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
.fa-circle-plus {
|
||||
color: #00b125;
|
||||
cursor: pointer;
|
||||
font-size: 17px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.remove-endpoint {
|
||||
cursor: pointer;
|
||||
color: #ff0606;
|
||||
font-size: 17px;
|
||||
float: right;
|
||||
margin-left: 7px;
|
||||
}
|
||||
|
||||
.fa-up {
|
||||
color: #0d6efd;
|
||||
font-size: 17px;
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
if (isset($_GET['returnto']) && $_GET['returnto'] == "fiberplanpipe-detail") {
|
||||
$cancelUrl = self::getUrl("FiberPlanPipe", "Detail", ["id" => $fiberplanpipes->id]);
|
||||
} else {
|
||||
$cancelUrl = self::getUrl("FiberPlanPipe");
|
||||
}
|
||||
?>
|
||||
<!-- end page title -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-2"><?= ($fiberplanpipes->id) ? "Rohrverzeichnis bearbeiten" : "Neuer Rohrverzeichnis" ?></h4>
|
||||
|
||||
<form class="form-horizontal" method="post"
|
||||
action="<?= self::getUrl("FiberPlanPipe", "save", ["returnto" => $_GET["returnto"]]) ?>">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<input type="hidden" name="id" value="<?= $fiberplanpipes->id ?>"/>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="description">Bezeichnung * / Gis
|
||||
Id</label>
|
||||
<div class="col-lg-2">
|
||||
<input required="required" type="text" id="description" name="description"
|
||||
class="form-control"
|
||||
value="<?= $fiberplanpipes->description ?>"/>
|
||||
</div>
|
||||
<div class="col-lg-1">
|
||||
<input type="text" id="gisid" name="gisid" placeholder="Gis Id"
|
||||
class="form-control"
|
||||
value="<?= $fiberplanpipes->gisid ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="type">Type *</label>
|
||||
<div class="col-lg-3">
|
||||
<select required="required" id="type" name="type" class="select2 form-control">
|
||||
<option value=""></option>
|
||||
<option value="1" <?= ($fiberplanpipes->type == "1") ? "selected='selected'" : "" ?>>
|
||||
Einzel
|
||||
</option>
|
||||
<option value="2" <?= ($fiberplanpipes->type == "2") ? "selected='selected'" : "" ?>>
|
||||
Schutzrohr
|
||||
</option>
|
||||
<option value="3" <?= ($fiberplanpipes->type == "3") ? "selected='selected'" : "" ?>>
|
||||
Verband
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" id="dimesion-div"
|
||||
style="<?= ($fiberplanpipes->type == "3") ? "display:none" : "" ?>">
|
||||
<label class="col-lg-2 col-form-label" for="type_description">Dimension *</label>
|
||||
<div class="col-lg-3">
|
||||
<select required="required" <?= ($fiberplanpipes->type == "3") ? 'disabled="disabled"' : "" ?>
|
||||
id="type_description" name="type_description"
|
||||
class="select2 form-control">
|
||||
<option value=""></option>
|
||||
<option value="1" <?= ($fiberplanpipes->type_description == "1") ? "selected='selected'" : "" ?>>
|
||||
MR7
|
||||
</option>
|
||||
<option value="2" <?= ($fiberplanpipes->type_description == "2") ? "selected='selected'" : "" ?>>
|
||||
MR14
|
||||
</option>
|
||||
<option value="3" <?= ($fiberplanpipes->type_description == "3") ? "selected='selected'" : "" ?>>
|
||||
MR16
|
||||
</option>
|
||||
<option value="4" <?= ($fiberplanpipes->type_description == "4") ? "selected='selected'" : "" ?>>
|
||||
MR20
|
||||
</option>
|
||||
<option value="5" <?= ($fiberplanpipes->type_description == "5") ? "selected='selected'" : "" ?>>
|
||||
PE32
|
||||
</option>
|
||||
<option value="6" <?= ($fiberplanpipes->type_description == "6") ? "selected='selected'" : "" ?>>
|
||||
PE40
|
||||
</option>
|
||||
<option value="7" <?= ($fiberplanpipes->type_description == "7") ? "selected='selected'" : "" ?>>
|
||||
PE50
|
||||
</option>
|
||||
<option value="8" <?= ($fiberplanpipes->type_description == "8") ? "selected='selected'" : "" ?>>
|
||||
KSR50
|
||||
</option>
|
||||
<option value="9" <?= ($fiberplanpipes->type_description == "9") ? "selected='selected'" : "" ?>>
|
||||
KSR80
|
||||
</option>
|
||||
<option value="10" <?= ($fiberplanpipes->type_description == "10") ? "selected='selected'" : "" ?>>
|
||||
KSR100
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" id="dimension-bundle-div"
|
||||
style="<?= ($fiberplanpipes->type < "3" || !$fiberplanpipes->type) ? "display:none" : "" ?>">
|
||||
<label class="col-lg-2 col-form-label" for="fiberplanpipetemplate_id">Multirohr
|
||||
*</label>
|
||||
<div class="col-lg-3">
|
||||
<select <?= ($fiberplanpipes->type < "3" || !$fiberplanpipes->type) ? 'disabled="disabled"' : "" ?>
|
||||
required="required" id="fiberplanpipetemplate_id"
|
||||
name="fiberplanpipetemplate_id"
|
||||
class="select2 form-control">
|
||||
<option value=""></option>
|
||||
<?php foreach ($fiberplanpipetemplates as $fiberplanpipetemplate) :
|
||||
$name = "";
|
||||
if ($fiberplanpipetemplate->pipe7x4 && $fiberplanpipetemplate->pipe14x10) {
|
||||
$name = $fiberplanpipetemplate->name . " " . $fiberplanpipetemplate->pipe7x4 . "*7x4" . "/" . $fiberplanpipetemplate->pipe14x10 . "*14x10";
|
||||
} else if ($fiberplanpipetemplate->pipe7x4) {
|
||||
$name = $fiberplanpipetemplate->name . " " . $fiberplanpipetemplate->pipe7x4 . "*7x4";
|
||||
} else if ($fiberplanpipetemplate->pipe14x10) {
|
||||
$name = $fiberplanpipetemplate->name . " " . $fiberplanpipetemplate->pipe14x10 . "*14x10";
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<option <?= ($fiberplanpipetemplate->id == $fiberplanpipes->fiberPlanPipeTemplate_id) ? "selected='selected'" : "" ?>
|
||||
value="<?= $fiberplanpipetemplate->id ?>"><?= $name ?></option>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="length">Länge (m) *</label>
|
||||
<div class="col-lg-1">
|
||||
<input required="required" type="number" step="any" id="length" name="length"
|
||||
class="form-control"
|
||||
value="<?= $fiberplanpipes->length ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="endpoints">
|
||||
<?php if ($fiberplanpipeendpoints) :
|
||||
FiberPlanPipeModel::generateEndpoints($fiberplanpipeendpoints, $networks);
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="status">Status *</label>
|
||||
<div class="col-lg-2">
|
||||
<select id="status" name="status" class="select2 form-control"
|
||||
required="required">
|
||||
<option value=""></option>
|
||||
<option value="10" <?= ($fiberplanpipes->status == "10") ? "selected='selected'" : "" ?>>
|
||||
Geplant
|
||||
</option>
|
||||
<option value="20" <?= ($fiberplanpipes->status == "20") ? "selected='selected'" : "" ?>>
|
||||
Umsetzung
|
||||
</option>
|
||||
<option value="30" <?= ($fiberplanpipes->status == "30") ? "selected='selected'" : "" ?>>
|
||||
Fertiggestellt
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="responsible">Zuständig</label>
|
||||
<div class="col-lg-2">
|
||||
<select id="responsible" name="responsible" class="select2 form-control">
|
||||
<option value=""></option>
|
||||
<option value="1" <?= ($fiberplanpipes->responsible == "1") ? "selected='selected'" : "" ?>>
|
||||
Tiefbaufirma
|
||||
</option>
|
||||
<option value="2" <?= ($fiberplanpipes->responsible == "2") ? "selected='selected'" : "" ?>>
|
||||
Person
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div id="responsible-div" class="col-lg-3"
|
||||
style="<?= ($fiberplanpipes->responsible != "1") ? "display:none" : "" ?>">
|
||||
<select id="address_id" name="address_id"
|
||||
class="select2 form-control" <?= ($fiberplanpipes->responsible != "1") ? 'disabled="disabled"' : "" ?> >
|
||||
<option value=""></option>
|
||||
<?php foreach ($pipworkeraddresses as $pipworkeraddress): ?>
|
||||
<option value="<?= $pipworkeraddress->id ?>" <?= ($fiberplanpipes->address_id == $pipworkeraddress->id) ? "selected='selected'" : "" ?>><?= $pipworkeraddress->company ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div id="responsible_text-div" class="col-lg-3">
|
||||
<input id="responsible_text" name="responsible_text"
|
||||
value="<?= $fiberplanpipes->responsible_text ?>"
|
||||
placeholder="Ansprechsperson"
|
||||
class="form-control"/>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="comment">Kommentar</label>
|
||||
<div class="col-lg-3">
|
||||
<textarea id="comment" name="comment"
|
||||
class="form-control"><?= $fiberplanpipes->comment ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2"></label>
|
||||
<div class="col-lg-10">
|
||||
<button type="submit" class="btn btn-primary">Speichern</button>
|
||||
<a href="<?= $cancelUrl ?>">
|
||||
<button type="button" class="btn btn-secondary">Abbrechen</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function checkendpoints() {
|
||||
let endpointcounter = $('.endpoint-label').length;
|
||||
let endpointtext;
|
||||
$('.endpoint-label').each(function (index) {
|
||||
|
||||
|
||||
$(this).find('.move-endpoint-up').remove();
|
||||
if (index == 0) {
|
||||
endpointtext = "Startpunkt";
|
||||
$(this).find('.endpointsymbol').html('<i id="add-endpoint" class="fa-regular fa-circle-plus"></i>');
|
||||
} else if (endpointcounter == 2) {
|
||||
endpointtext = 'Standort ' + index;
|
||||
$(this).closest('.endpoint-maindiv').find('.label-text').after('<i title="nach oben verschieben" class="fa-sharp fa-solid fa-up move-endpoint-up"></i>');
|
||||
$(this).find('.endpointsymbol').html('');
|
||||
} else if (index > 0) {
|
||||
endpointtext = 'Standort ' + index;
|
||||
$(this).closest('.endpoint-maindiv').find('.label-text').after('<i title="nach oben verschieben" class="fa-sharp fa-solid fa-up move-endpoint-up"></i>');
|
||||
$(this).find('.endpointsymbol').html('<i class="fa-regular fa-circle-minus remove-endpoint"></i>');
|
||||
}
|
||||
|
||||
$(this).find('.label-text').text(endpointtext + ' *');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$("body").on("change", ".endpoint_type,.endpoint_network_id ", function () {
|
||||
|
||||
const splitid = $(this).attr('id').split('_');
|
||||
let thisid = splitid[0];
|
||||
var options;
|
||||
if ($.trim($("#" + thisid + "_endpoint_network_id").val()) != "" && $.trim($("#" + thisid + "_endpoint_type").val())) {
|
||||
|
||||
|
||||
$.getJSON("<?= self::getUrl("FiberPlanPipe", "api", ['do' => 'getBuildingInfo']) ?>&network_id=" + $.trim($("#" + thisid + "_endpoint_network_id").val()) + "&bdtype=" + $.trim($("#" + thisid + "_endpoint_type").val()), {})
|
||||
.done(function (data) {
|
||||
$.each(data, function (k, val) {
|
||||
options = options + '<option value="' + val.id + '">' + val.name + '</option>';
|
||||
});
|
||||
$("#" + thisid + "_mid-point-building").empty();
|
||||
$("#" + thisid + "_mid-point-building").append('<select id=' + thisid + '_endpoint" required="required" name="endpoint[]" class="select2 form-control">' + options + '</select>');
|
||||
$(".select2").select2({placeholder: ""});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", ".move-endpoint-up", function () {
|
||||
$(this).closest('.endpoint-maindiv').insertBefore($(this).closest('.endpoint-maindiv').prev());
|
||||
checkendpoints();
|
||||
});
|
||||
|
||||
$("body").on("click", ".remove-endpoint", function () {
|
||||
let endpointcounter;
|
||||
$(this).closest('.endpoint-maindiv').remove();
|
||||
checkendpoints();
|
||||
});
|
||||
|
||||
|
||||
$("body").on("change", "#startpoint_type,#network_id", function () {
|
||||
var options;
|
||||
if ($.trim($("#network_id").val()) != "" && $.trim($("#startpoint_type").val())) {
|
||||
|
||||
|
||||
$.getJSON("<?= self::getUrl("FiberPlanPipe", "api", ['do' => 'getBuildingInfo']) ?>&network_id=" + $.trim($("#network_id").val()) + "&bdtype=" + $.trim($("#startpoint_type").val()), {})
|
||||
.done(function (data) {
|
||||
$.each(data, function (k, val) {
|
||||
options = options + '<option value="' + val.id + '">' + val.name + '</option>';
|
||||
});
|
||||
$('#starting-point-building').empty();
|
||||
$('#starting-point-building').append('<select id="startpoint" required="required" name="startpoint" class="select2 form-control">' + options + '</select>');
|
||||
$(".select2").select2({placeholder: ""});
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
$("body").on("change", "#entpoint_type,#network_id2", function () {
|
||||
var options;
|
||||
if ($.trim($("#network_id2").val()) != "" && $.trim($("#entpoint_type").val())) {
|
||||
|
||||
|
||||
$.getJSON("<?= self::getUrl("FiberPlanPipe", "api", ['do' => 'getBuildingInfo']) ?>&network_id=" + $.trim($("#network_id2").val()) + "&bdtype=" + $.trim($("#entpoint_type").val()), {})
|
||||
.done(function (data) {
|
||||
$.each(data, function (k, val) {
|
||||
options = options + '<option value="' + val.id + '">' + val.name + '</option>';
|
||||
});
|
||||
$('#end-point-building').empty();
|
||||
$('#end-point-building').append('<select id="endpoint" name="endpoint" required="required" class="select2 form-control">' + options + '</select><input type="hidden" name="endpointid[]" value="">');
|
||||
$(".select2").select2({placeholder: ""});
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
$("body").on("change", "#type", function () {
|
||||
if ($(this).val() < 3) {
|
||||
$('#dimesion-div').show();
|
||||
$('#dimension-bundle-div').hide();
|
||||
$("#type_description").prop("disabled", false);
|
||||
$("#fiberplanpipetemplate_id").prop("disabled", true);
|
||||
$(".select2").select2({placeholder: ""});
|
||||
} else {
|
||||
$('#dimesion-div').hide();
|
||||
$('#dimension-bundle-div').show();
|
||||
$("#type_description").prop("disabled", true);
|
||||
$("#fiberplanpipetemplate_id").prop("disabled", false);
|
||||
$(".select2").select2({placeholder: ""});
|
||||
}
|
||||
});
|
||||
$("body").on("change", "#responsible", function () {
|
||||
if ($(this).val() == 1) {
|
||||
$('#responsible-div').show();
|
||||
$("#address_id").prop("disabled", false);
|
||||
$(".select2").select2({placeholder: ""});
|
||||
} else {
|
||||
$('#responsible-div').hide();
|
||||
$("#address_id").prop("disabled", true);
|
||||
$(".select2").select2({placeholder: ""});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// disable mousewheel on a input number field when in focus
|
||||
$('form').on('focus', 'input[type=number]', function (e) {
|
||||
$(this).on('wheel.disableScroll', function (e) {
|
||||
e.preventDefault()
|
||||
})
|
||||
});
|
||||
$('form').on('blur', 'input[type=number]', function (e) {
|
||||
$(this).off('wheel.disableScroll')
|
||||
});
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
$(".select2").select2({placeholder: ""});
|
||||
if ($.trim($("#network_id").val()) != "" && $.trim($("#startpoint_type").val())) {
|
||||
|
||||
$.getJSON("<?= self::getUrl("FiberPlanPipe", "api", ['do' => 'getBuildingInfo']) ?>&network_id=" + $.trim($("#network_id").val()) + "&bdtype=" + $.trim($("#startpoint_type").val()), {})
|
||||
.done(function (data) {
|
||||
var options;
|
||||
$.each(data, function (k, val) {
|
||||
if ($('#startpoint_type').data('startpoint') == val.id) {
|
||||
options = options + '<option selected="selected" value="' + val.id + '">' + val.name + '</option>';
|
||||
} else {
|
||||
options = options + '<option value="' + val.id + '">' + val.name + '</option>';
|
||||
}
|
||||
});
|
||||
$('#starting-point-building').empty();
|
||||
$('#starting-point-building').append('<select id="startpoint" name="startpoint" required="required" class="select2 form-control">' + options + '</select>');
|
||||
$(".select2").select2({placeholder: ""});
|
||||
});
|
||||
}
|
||||
if ($.trim($("#network_id2").val()) != "" && $.trim($("#entpoint_type").val())) {
|
||||
|
||||
|
||||
$.getJSON("<?= self::getUrl("FiberPlanPipe", "api", ['do' => 'getBuildingInfo']) ?>&network_id=" + $.trim($("#network_id2").val()) + "&bdtype=" + $.trim($("#entpoint_type").val()), {})
|
||||
.done(function (data) {
|
||||
var options;
|
||||
$.each(data, function (k, val) {
|
||||
if ($('#entpoint_type').data('endpoint') == val.id) {
|
||||
options = options + '<option selected="selected" value="' + val.id + '">' + val.name + '</option>';
|
||||
} else {
|
||||
options = options + '<option value="' + val.id + '">' + val.name + '</option>';
|
||||
}
|
||||
});
|
||||
$('#end-point-building').empty();
|
||||
$('#end-point-building').append('<select id="endpoint" name="endpoint" required="required" class="select2 form-control">' + options + '</select>');
|
||||
$(".select2").select2({placeholder: ""});
|
||||
});
|
||||
|
||||
}
|
||||
$("body").on("click", "#add-endpoint", function (event) {
|
||||
let randid = Math.floor(Math.random() * 10000);
|
||||
let endpointtype = $('#startpoint_type').html();
|
||||
let endpointcounter = $('.endpoint-maindiv').length + 1;
|
||||
let endpointuparrow = "";
|
||||
let standorttext = "";
|
||||
if (endpointcounter > 1) {
|
||||
endpointuparrow = '<i title="nach oben verschieben" class="fa-sharp fa-solid fa-up move-endpoint-up"></i>';
|
||||
}
|
||||
|
||||
if (endpointcounter <= 7) {
|
||||
$('#endpoints').append(`<div class="form-group row endpoint-maindiv">
|
||||
<label class="col-lg-2 col-form-label endpoint-label" for="` + randid + `_endpoint_network_id"><span class="label-text">Standort ` + $('.endpoint-maindiv').length + ` * </span>` + endpointuparrow + `<span class="endpointsymbol"><i class="fa-regular fa-circle-minus remove-endpoint"></i></span></label>
|
||||
<div class="col-lg-2"><select id="` + randid + `_endpoint_network_id" required="required" name="endpoint_network_id[]"
|
||||
class="select2 form-control endpoint_network_id">` + $('#network_id').html() + `</select></div>
|
||||
<div class="col-lg-2 ">
|
||||
<select id="` + randid + `_endpoint_type" name="endpoint_type[]" required="required"
|
||||
class="select2 form-control endpoint_type" data-startpoint="" : "" >
|
||||
<option value=""></option>
|
||||
<option value="4">
|
||||
Schacht-Verteiler
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-2" id="` + randid + `_mid-point-building">
|
||||
|
||||
</div>
|
||||
</div>`);
|
||||
$('#' + randid + '_endpoint_network_id').val($('#network_id').val());
|
||||
checkendpoints();
|
||||
$(".select2").select2({placeholder: ""});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
259
Layout/default/FiberPlanPipe/Index.php
Normal file
259
Layout/default/FiberPlanPipe/Index.php
Normal file
@@ -0,0 +1,259 @@
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$typeOption[1] = "Einzel";
|
||||
$typeOption[2] = "Schutzrohr";
|
||||
$typeOption[3] = "Verband";
|
||||
$dimension_v1Option[1] = "MR7";
|
||||
$dimension_v1Option[2] = "MR14";
|
||||
$dimension_v1Option[3] = "MR16";
|
||||
$dimension_v1Option[4] = "MR20";
|
||||
$dimension_v1Option[5] = "PE32";
|
||||
$dimension_v1Option[6] = "PE40";
|
||||
$dimension_v1Option[7] = "PE50";
|
||||
$dimension_v1Option[8] = "KSR50";
|
||||
$dimension_v1Option[9] = "KSR80";
|
||||
$dimension_v1Option[10] = "KSR100";
|
||||
$dimension_v2Option[1] = "Anzahl";
|
||||
$dimension_v2Option[2] = "Dimenson";
|
||||
$dimension_v2Option[3] = "Farben";
|
||||
$starting_pointOption[1] = "Greenfield";
|
||||
$starting_pointOption[2] = "POP";
|
||||
$starting_pointOption[3] = "Building";
|
||||
$starting_pointOption[4] = "Schacht-Verteiler";
|
||||
$statusOption[10] = "Geplant";
|
||||
$statusOption[20] = "Umsetzung";
|
||||
$statusOption[30] = "Fertiggestellt";
|
||||
$responsibleOption[1] = "(F)";
|
||||
$responsibleOption[2] = "(P)";
|
||||
|
||||
foreach ($networks as $network) {
|
||||
$Network[$network->id] = $network->name;
|
||||
}
|
||||
foreach ($pipworkeraddresses as $pipworkeraddress) {
|
||||
$Pipeworker[$pipworkeraddress->id] = $pipworkeraddress->company;
|
||||
}
|
||||
?>
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<!-- start page title -->
|
||||
<style>
|
||||
#map {
|
||||
height: 600px;
|
||||
width: 100%
|
||||
}
|
||||
</style>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">Rohrverzeichnisse</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Rohrverzeichnisse</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="float-left">
|
||||
<h4 class="header-title">Liste aller Rohrverzeichnisse</h4>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<a class="btn btn-primary mb-2" href="<?= self::getUrl("FiberPlanPipe", "add") ?>"><i
|
||||
class="fas fa-plus"></i> Neuen Rohrverzeichnis anlegen</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="datatable" class="table table-striped table-hover table-sm font-13">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th class="text-center">Bezeichnung</th>
|
||||
<th class="text-center">Type/Bezeichnung</th>
|
||||
|
||||
<th class="text-center">Länge (m)</th>
|
||||
<th>Netzgebiet(e)</th>
|
||||
<th class="text-center">Anfangspunkt</th>
|
||||
<th class="text-center">Endpunkt</th>
|
||||
<th class="text-center">Zuständig</th>
|
||||
<th class="text-center">Status</th>
|
||||
<th class="edit-width"></th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
|
||||
<th></th>
|
||||
<th></th>
|
||||
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($fiberplanpipes as $fiberplanpipe):
|
||||
|
||||
|
||||
if ($fiberplanpipe->type == "3") {
|
||||
$name = "";
|
||||
if ($fiberplanpipe->fiberPlanPipeTemplate->pipe7x4 && $fiberplanpipe->fiberPlanPipeTemplate->pipe14x10) {
|
||||
$name = $fiberplanpipe->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipe->fiberPlanPipeTemplate->pipe7x4 . "*7x4" . "/" . $fiberplanpipe->fiberPlanPipeTemplate->pipe14x10 . "*14x10";
|
||||
} else if ($fiberplanpipe->fiberPlanPipeTemplate->pipe7x4) {
|
||||
$name = $fiberplanpipe->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipe->fiberPlanPipeTemplate->pipe7x4 . "*7x4";
|
||||
} else if ($fiberplanpipe->fiberPlanPipeTemplate->pipe14x10) {
|
||||
$name = $fiberplanpipe->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipe->fiberPlanPipeTemplate->pipe14x10 . "*14x10";
|
||||
}
|
||||
$typeDescription = $name;
|
||||
//
|
||||
} else {
|
||||
$typeDescription = $dimension_v1Option[$fiberplanpipe->type_description];
|
||||
}
|
||||
$startpoint = '<span class="startpoint" data-toggle="modal" data-target="#pipemap" data-gpslat="' . $buildings[$fiberplanpipe->startpoint_type][$fiberplanpipe->startpoint]['gps_lat'] . '" data-gpslong="' . $buildings[$fiberplanpipe->startpoint_type][$fiberplanpipe->startpoint]['gps_long'] . '">' . $starting_pointOption[$fiberplanpipe->startpoint_type] . "/" . $buildings[$fiberplanpipe->startpoint_type][$fiberplanpipe->startpoint]['name'] . '</span>';
|
||||
$endpoint = '<span class="endpoint" data-toggle="modal" data-target="#pipemap" data-gpslat="' . $buildings[$fiberplanpipe->entpoint_type][$fiberplanpipe->endpoint]['gps_lat'] . '" data-gpslong="' . $buildings[$fiberplanpipe->entpoint_type][$fiberplanpipe->endpoint]['gps_long'] . '">' . $starting_pointOption[$fiberplanpipe->entpoint_type] . "/" . $buildings[$fiberplanpipe->entpoint_type][$fiberplanpipe->endpoint]['name'] . '</span>';
|
||||
|
||||
$responsible = $responsibleOption[$fiberplanpipe->responsible];
|
||||
|
||||
if ($fiberplanpipe->address_id) {
|
||||
$responsible .= " " . $Pipeworker[$fiberplanpipe->address_id];
|
||||
if ($fiberplanpipe->responsible_text) {
|
||||
$responsible .= " (" . $fiberplanpipe->responsible_text . ")";
|
||||
}
|
||||
} else {
|
||||
$responsible .= " " . $fiberplanpipe->responsible_text;
|
||||
}
|
||||
if ($fiberplanpipe->startpoint_network_id == $fiberplanpipe->endpoint_network_id) {
|
||||
$networkName = $Network[$fiberplanpipe->startpoint_network_id];
|
||||
} else {
|
||||
$networkName = $Network[$fiberplanpipe->startpoint_network_id] . " / " . $Network[$fiberplanpipe->endpoint_network_id];
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><a href="<?= self::getUrl("FiberPlanPipe", "Detail", ["id" => $fiberplanpipe->id]) ?>"><?= $fiberplanpipe->description ?></a></td>
|
||||
<td style="white-space: nowrap"><?= $typeOption[$fiberplanpipe->type] . " / " . $typeDescription ?></td>
|
||||
<td class="text-center"><?= $fiberplanpipe->length ?></td>
|
||||
|
||||
<td><?= $networkName ?></td>
|
||||
<td><?= $startpoint ?></td>
|
||||
<td><?= $endpoint ?></td>
|
||||
<td><?= $responsible ?></td>
|
||||
<td><?= $statusOption[$fiberplanpipe->status] ?></td>
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?= self::getUrl("FiberPlanPipe", "edit", ["id" => $fiberplanpipe->id]) ?>"><i
|
||||
class="far fa-edit" title="Bearbeiten"></i></a>
|
||||
<a href="<?= self::getUrl("FiberPlanPipe", "delete", ["id" => $fiberplanpipe->id]) ?>"
|
||||
onclick="if(!confirm('Rohrverzeichnis wirklich löschen?')) return false;"
|
||||
class="text-danger"
|
||||
title="Löschen"><i class="fas fa-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#pipemap">
|
||||
Launch demo modal
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade" id="pipemap" tabindex="-1" role="dialog" aria-labelledby="pipemap"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="pipemapLabel">Rohrverzeichnis</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="map"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Schließen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var startlat;
|
||||
var startlong;
|
||||
var endlat;
|
||||
var endlong;
|
||||
var startmarkertext;
|
||||
var endmarkertext;
|
||||
var marker;
|
||||
var polylinec;
|
||||
var polyline;
|
||||
var map = L.map('map').setView([51.505, -0.09], 13);
|
||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19
|
||||
}).addTo(map);
|
||||
L.MakiMarkers.accessToken = '<?=TT_MAPBOX_TILE_API_TOKEN?>';
|
||||
var hidesearch = [2, 8];
|
||||
var columnfilter = [7];
|
||||
var columnoptions = '<option class="text-left" value="">Alle</option><option class="text-left" value="Geplant">Geplant</option><option class="text-left" value="Umsetzung">Umsetzung</option><option class="text-left" value="Fertiggestellt">Fertiggestellt</option>';
|
||||
$(document).ready(function () {
|
||||
|
||||
|
||||
$('#pipemap').on('show.bs.modal', function (event) {
|
||||
var button = $(event.relatedTarget);
|
||||
map.remove();
|
||||
map = L.map('map').setView([51.505, -0.09], 13);
|
||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19
|
||||
}).addTo(map);
|
||||
startlat = button.closest('tr').find('.startpoint').data('gpslat');
|
||||
startlong = button.closest('tr').find('.startpoint').data('gpslong');
|
||||
endlat = button.closest('tr').find('.endpoint').data('gpslat');
|
||||
endlong = button.closest('tr').find('.endpoint').data('gpslong');
|
||||
startmarkertext = button.closest('tr').find('.startpoint').text();
|
||||
endmarkertext = button.closest('tr').find('.endpoint').text();
|
||||
|
||||
var icon_name = "town";
|
||||
var icon_color = "#ec98a2";
|
||||
var icon = L.MakiMarkers.icon({icon: icon_name, color: icon_color, size: "l"});
|
||||
marker = L.marker([startlat, startlong]).addTo(map);
|
||||
marker.bindPopup("" + startmarkertext);
|
||||
map.setView([button.data('gpslat'), button.data('gpslong')], 13)
|
||||
marker = L.marker([endlat, endlong]).addTo(map);
|
||||
// marker = L.marker([endlat, endlong], {icon: icon}).addTo(map);
|
||||
marker.bindPopup("" + endmarkertext);
|
||||
|
||||
polylinec = [
|
||||
[startlat, startlong],
|
||||
[endlat, endlong]
|
||||
];
|
||||
polyline = L.polyline(polylinec, {color: 'red'}).addTo(map);
|
||||
|
||||
|
||||
});
|
||||
$('#pipemap').on('shown.bs.modal', function (event) {
|
||||
map.invalidateSize();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
185
Layout/default/HistoricTicket/Index.php
Normal file
185
Layout/default/HistoricTicket/Index.php
Normal file
@@ -0,0 +1,185 @@
|
||||
<?php /** @noinspection PhpUndefinedClassInspection
|
||||
* @var string $mfLayoutPackage
|
||||
* @var TYPE_NAME $git_merge_ts
|
||||
*/
|
||||
|
||||
//additional css /css/views/RaspberryDisplay.css
|
||||
|
||||
$JSGlobals = ["BASE_URL" => self::getUrl("Domain"),
|
||||
"DASHBOARD_URL" => self::getUrl("Dashboard"),
|
||||
"MFAPPNAME" => MFAPPNAME_SLUG,
|
||||
"PAGE_TITLE" => "Historische Tickets",
|
||||
"PATH" => [
|
||||
["text" => MFAPPNAME_SLUG, "href" => self::getUrl("Dashboard")],
|
||||
["text" => "Historische Tickets", "href" => self::getUrl("HistoricTicket")]
|
||||
],
|
||||
"HISTORIC_TICKET_API_URL" => self::getUrl("HistoricTicket/api"),
|
||||
];
|
||||
|
||||
$additionalJS = ["plugins/vue/vue.js",
|
||||
"plugins/axios/axios.min.js",
|
||||
"plugins/vue/tt-components/tt-page-title.js",
|
||||
"plugins/vue/tt-components/tt-table.js",
|
||||
];
|
||||
$additionalCSS = [
|
||||
'plugins/vue/tt-components/css/tt-table.css',
|
||||
];
|
||||
|
||||
include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
|
||||
<div id="app">
|
||||
<!-- start page title -->
|
||||
<tt-page-title :title="window['TT_CONFIG']['PAGE_TITLE']" :path="window['TT_CONFIG']['PATH']"></tt-page-title>
|
||||
|
||||
<tt-table :fetch-url="window['TT_CONFIG']['HISTORIC_TICKET_API_URL'] + '?do=getHistoricTickets'"
|
||||
:table-config="historicTicketTableConfig"
|
||||
small ref="table">
|
||||
<template v-slot:top-buttons>
|
||||
<!-- add input for global search with label and bootstrap class-->
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control" placeholder="Globale Suche" v-model="globalSearch" @keydown.enter="doGlobalSearch">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary" type="button" @click="doGlobalSearch">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-slot:first_name="{ row }">
|
||||
{{ row.first_name }} {{ row.last_name }}
|
||||
</template>
|
||||
|
||||
<template v-slot:ctime="{ row }">
|
||||
{{ new Date(row.ctime * 1000).toLocaleString() }}
|
||||
</template>
|
||||
|
||||
<template v-slot:ticket_number="{ row }">
|
||||
<a href="#" @click="clickTicketNumber(row.ticket_number)">{{ row.ticket_number }}</a>
|
||||
</template>
|
||||
|
||||
</tt-table>
|
||||
|
||||
|
||||
<!-- Bootstrap Modal to show global search results -->
|
||||
<div class="modal show d-block" tabindex="0" role="dialog" style="background: rgba(0, 0, 0, 0.5);" @click="globalSearchModal = false" @keydown.esc="globalSearchModal = false" ref="globalSearchModal"
|
||||
v-if="globalSearchModal">
|
||||
<div class="modal-dialog" role="document" @click.stop
|
||||
style="width:fit-content;max-width: 80vw ; max-height: 80vh; overflow-y: auto;">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Suchergebnisse</h5>
|
||||
<button type="button" class="close" @click="globalSearchModal = false">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<tt-table
|
||||
:fetch-url="`${window['TT_CONFIG']['HISTORIC_TICKET_API_URL']}?do=findHistoricTicket&query=${globalSearch}`"
|
||||
:table-config="globalSearchModalTableConfig"
|
||||
small ref="table">
|
||||
|
||||
<template v-slot:ctime="{ row }">
|
||||
{{ new Date(row.ctime * 1000).toLocaleString() }}
|
||||
</template>
|
||||
|
||||
<template v-slot:ticket_number="{ row }">
|
||||
<a href="#" @click="clickTicketNumber(row.ticket_number)">{{ row.ticket_number }}</a>
|
||||
</template>
|
||||
</tt-table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-secondary" @click="globalSearchModal = false">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Bootstrap Modal to show ticket messages -->
|
||||
<div class="modal show d-block" tabindex="0" role="dialog" style="background: rgba(0, 0, 0, 0.5);" @click="selectedTicketNumber = null" @keydown.esc="selectedTicketNumber = null" ref="selectedTicketModal"
|
||||
v-if="selectedTicketNumber">
|
||||
<div class="modal-dialog" role="document" @click.stop
|
||||
style="width:fit-content;max-width: 80vw ; max-height: 80vh; overflow-y: auto;">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Ticket {{ selectedTicketNumber }}</h5>
|
||||
<button type="button" class="close" @click="selectedTicketNumber = null">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div v-if="selectedTicketData">
|
||||
<h5>{{ selectedTicketData.ticket.subject }}</h5>
|
||||
<p>{{ selectedTicketData.ticket.message }}</p>
|
||||
<div v-for="message in selectedTicketData.messages">
|
||||
<hr>
|
||||
<h6>{{ new Date(message.ctime * 1000).toLocaleString()}}</h6>
|
||||
<p style="word-break: break-all;" v-html="message.content?.replaceAll('\n', '<br>')"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="spinner-border text-primary" role="status">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
window: window,
|
||||
selectedTicketNumber: null,
|
||||
selectedTicketData: null,
|
||||
globalSearch: '',
|
||||
globalSearchModal: false,
|
||||
globalSearchModalTableConfig: {
|
||||
headers: [
|
||||
{text: 'Ticket Number', key: 'ticket_number', filter: false},
|
||||
{text: 'Erstellt', key: 'ctime', filter: false},
|
||||
{text: 'Subject', key: 'ticket_subject', filter: false},
|
||||
{text: 'Message', key: 'ticket_message', filter: false},
|
||||
],
|
||||
tableHeader: 'Suchergebnisse',
|
||||
},
|
||||
historicTicketTableConfig: {
|
||||
headers: [
|
||||
{text: 'Ticket Number', key: 'ticket_number', filter: 'search'},
|
||||
{text: 'Erstellt', key: 'ctime', filter: false},
|
||||
{text: 'Subject', key: 'subject', filter: 'search'},
|
||||
{text: 'Type', key: 'type', filter: 'search'},
|
||||
{text: 'Status', key: 'status', filter: 'search'},
|
||||
{text: 'Name', key: 'first_name', filter: 'search'},
|
||||
{text: 'Email', key: 'email', filter: 'search'},
|
||||
{text: 'Phone', key: 'phone', filter: 'search'},
|
||||
],
|
||||
defaultPageSize: 25,
|
||||
tableHeader: 'Bestellungen',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async doGlobalSearch() {
|
||||
if (this.globalSearch.length > 0) {
|
||||
this.globalSearchModal = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.globalSearchModal.focus();
|
||||
});
|
||||
}
|
||||
},
|
||||
async clickTicketNumber(ticketNumber) {
|
||||
this.globalSearchModal = false;
|
||||
this.selectedTicketData = null;
|
||||
|
||||
this.selectedTicketNumber = ticketNumber;
|
||||
const response = await axios.post(`${window['TT_CONFIG']['HISTORIC_TICKET_API_URL']}?do=getHistoricTicketMessages`, {ticketNumber});
|
||||
this.selectedTicketData = response.data;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.selectedTicketModal.focus();
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
|
||||
@@ -13,7 +13,6 @@ $monthger[10] = "Oktober";
|
||||
$monthger[11] = "November";
|
||||
$monthger[12] = "Dezember";
|
||||
$time = time();
|
||||
|
||||
for ($i = 1; $i <= 25; $i++) {
|
||||
$kw = date('W', $time);
|
||||
$year = date('Y', $time);
|
||||
@@ -196,7 +195,7 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 mb-2 businesstrip-div">
|
||||
<div class="col-lg-2 mb-2 businesstrip-div businesstrip-check-div ">
|
||||
|
||||
<div class="form-check text-center mt-1">
|
||||
<input class="form-check-input" type="checkbox" name="businesstrip"
|
||||
@@ -211,6 +210,30 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
placeholder="Ort"
|
||||
class="form-control"/>
|
||||
</div>
|
||||
<div class="col-lg-2 car-div car-div-car" style="display:none">
|
||||
|
||||
<select id="timerecordingCar_id" name="timerecordingCar_id"
|
||||
class="select2 form-control">
|
||||
<option value="">Auto auswählen</option>
|
||||
<?php foreach ($timerecordingCars as $timerecordingCar): ?>
|
||||
|
||||
<option value="<?= $timerecordingCar->id ?>"
|
||||
data-mileagenow="<?= $timerecordingCar->mileage_now ?>"><?= $timerecordingCar->number_plate . " (" . $timerecordingCar->brand." ".$timerecordingCar->model . ")" ?></option>
|
||||
</option>
|
||||
<?php
|
||||
endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-1 car-div " style="display:none">
|
||||
<input style="" type="number" id="mileage_start" name="mileage_start"
|
||||
placeholder="KM Start"
|
||||
class="form-control"/>
|
||||
</div>
|
||||
<div class="col-lg-1 car-div" style="display:none">
|
||||
<input style="" type="number" id="mileage_end" name="mileage_end"
|
||||
placeholder="KM Ende"
|
||||
class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" row mt-2">
|
||||
<div class="col-lg-3 ">
|
||||
|
||||
154
Layout/default/TimerecordingBilling/Detail.php
Normal file
154
Layout/default/TimerecordingBilling/Detail.php
Normal file
@@ -0,0 +1,154 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
|
||||
?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">Zeiterfassung Verrechnung</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 id="month" data-month="<?= $month ?>" class="page-title">Verrechnung/Abrechnung <?= $month ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="float-left">
|
||||
<h4 class="header-title">Liste aller Mitarbeiter</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="datatable" class="table table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">Mitarbeiter</th>
|
||||
<th class="text-center">Personal Nr.</th>
|
||||
<th class="text-center">Sollstunden</th>
|
||||
<th class="text-center">Iststunden</th>
|
||||
<th class="text-center">Sollabweichung</th>
|
||||
<th class="text-center">Akuelle Gutstunden</th>
|
||||
<th class="text-center">Akuelle Überstunden</th>
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
<th class="text-center">Black P. Stunden</th>
|
||||
<?php endif; ?>
|
||||
<th class="text-center">Nichtleistungszeiten</th>
|
||||
<th class="text-center">Diäten</th>
|
||||
<th class="text-center">Homeoffice Tage</th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
<th></th>
|
||||
<?php endif; ?>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($timerecordings as $timerecording):
|
||||
if (!empty($timerecording['data']['time']['daysum'])) {
|
||||
$offdays = "";
|
||||
$counter = 1;
|
||||
foreach ($timerecording['data']['time']['daysum'] as $category => $value) {
|
||||
if ($counter > 1) {
|
||||
$offdays .= "</div>";
|
||||
}
|
||||
$offdays .= "<div>";
|
||||
if ($value < 100) {
|
||||
$offdays .= $category . ": " . $value . " Tag(e) ";
|
||||
} else {
|
||||
|
||||
$offdays .= $category . ": " . sprintf('%02dh:%02dm', floor($value / 3600), floor($value / 60 % 60));
|
||||
}
|
||||
$counter++;
|
||||
}
|
||||
$offdays .= "</div>";
|
||||
} else {
|
||||
$offdays = "-";
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?= $timerecording['user_name'] ?></td>
|
||||
<td class="text-center edit-width-large"><?= $timerecording['employee_number'] ?></td>
|
||||
<td data-order="<?= $timerecording['data']['time']['mustorder'] ?>"
|
||||
class="text-center"><?= $timerecording['data']['time']['must'] ?></td>
|
||||
<td data-order="<?= $timerecording['data']['time']['isorder'] ?>"
|
||||
class="text-center"><?= $timerecording['data']['time']['is'] ?></td>
|
||||
<td data-order="<?= $timerecording['data']['time']['summsecondsorder'] ?>"
|
||||
class="text-center"><?= $timerecording['data']['time']['summseconds'] ?></td>
|
||||
<td data-order="<?= $timerecording['data']['time']['plushours_noworder'] ?>"
|
||||
class="text-center"><?= $timerecording['data']['time']['plushours_now'] ?></td>
|
||||
<td data-order="<?= $timerecording['data']['time']['overtime_noworder'] ?>"
|
||||
class="text-center"><?= $timerecording['data']['time']['overtime_now'] ?></td>
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
<td data-order="<?= $timerecording['data']['time']['bpahours'] ?>"
|
||||
class="text-center"><?= $timerecording['data']['time']['bpahours'] ?></td>
|
||||
<?php endif; ?>
|
||||
<td class=""><?= $offdays ?></td>
|
||||
<td class="text-center"><?= number_format($timerecording['data']['time']['diet'], 2, ',', '.') . " €" ?></td>
|
||||
<td class="text-center"><?= $timerecording['data']['time']['homeoffice'] ?> Tag(e)</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [2, 3, 4, 5, 6, 8, 9];
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
hidesearch = [2, 3, 4, 5, 6, 7, 9, 10];
|
||||
<?php endif; ?>
|
||||
$(document).ready(function () {
|
||||
$('.buttons-excel').closest('div').append('<div ><button id="month-complete" class="btn btn-danger margina">Monats Abschluss</button></div>');
|
||||
$('.buttons-excel').closest('div').append('<div ><button id="bmd-export" class="btn btn-info margina">BMD Import</button></div>');
|
||||
$('.buttons-excel').closest('div').append('<div ><button id="bmd-export-nlz" class="btn btn-info margina">BMD NLZ Import</button></div>');
|
||||
|
||||
$('body').on('click', '#bmd-export', function () {
|
||||
|
||||
window.open('<?= self::getUrl("TimerecordingBilling", "api", ['do' => 'generatebmdexport']) ?>&month=' + $('#month').data('month'), '_blank');
|
||||
});
|
||||
$('body').on('click', '#bmd-export-nlz', function () {
|
||||
window.open('<?= self::getUrl("TimerecordingBilling", "api", ['do' => 'generatebmdexportnlz']) ?>&month=' + $('#month').data('month'), '_blank');
|
||||
});
|
||||
$('body').on('click', '#month-complete', function () {
|
||||
if (confirm('Monat ' + $('#month').data('month') + ' wirklich abschließen?')) {
|
||||
$.post("<?= self::getUrl("TimerecordingBilling", "api", ['do' => 'completemonth']) ?>", {
|
||||
month: $.trim($('#month').data('month')),
|
||||
ajax: 1
|
||||
}).done(function (data) {
|
||||
window.location.href = "<?= self::getUrl("TimerecordingBilling", "detailClosed", ['month' => $month]) ?>";
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
325
Layout/default/TimerecordingBilling/DetailClosed.php
Normal file
325
Layout/default/TimerecordingBilling/DetailClosed.php
Normal file
@@ -0,0 +1,325 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
|
||||
|
||||
?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<style>
|
||||
.fa-arrow-right-from-bracket {
|
||||
margin-top: 3px;
|
||||
margin-right: 10px;
|
||||
color: #2238d1;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.filler {
|
||||
width: 30px;
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
.filler-0 {
|
||||
width: 7px;
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
#overtimeModal .table td, #overtimeModal .table th {
|
||||
border: none;
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.modal-lg, .modal-xl {
|
||||
max-width: 400px !important;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">Zeiterfassung Verrechnung</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 id="month" data-month="<?= $month ?>" class="page-title">Verrechnung/Abrechnung <?= $month ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="float-left">
|
||||
<h4 class="header-title">Liste aller Mitarbeiter</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="datatable" class="table table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">Mitarbeiter/PersNr.</th>
|
||||
<th class="text-center">Leistungszeiten</th>
|
||||
<th class="text-center">Nichtleistungszeiten</th>
|
||||
<th class="text-center">Iststunden (NLZ+LZ)</th>
|
||||
<th class="text-center">Sollstunden</th>
|
||||
<th class="text-center">Sollabweichung</th>
|
||||
<th class="text-center">Gesamt Überstunden</th>
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
<th class="text-center">Black P. Stunden</th>
|
||||
<?php endif; ?>
|
||||
<th class="text-center">Ü50</th>
|
||||
<th class="text-center">Ü100</th>
|
||||
<th class="text-center">Diäten</th>
|
||||
<th class="text-center">Homeoffice</th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
<th></th>
|
||||
<?php endif; ?>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($timerecordings as $timerecording):
|
||||
$user = new User($timerecording->timerecordingEmployee->user->id);
|
||||
$employee_number = (string)$user->getFlag('employee_number');
|
||||
unset ($nlz);
|
||||
if ($timerecording->nlz) {
|
||||
$nlz_details = json_decode($timerecording->nlz, true);
|
||||
foreach ($nlz_details as $key => $nlz_detail) {
|
||||
if ($nlz_detail < 100) {
|
||||
$nlz .= $key . ": " . $nlz_detail . " Tag(e)<br>";
|
||||
} else {
|
||||
$nlz .= $key . ": " . round($nlz_detail / 3600, 2) . " Stunden<br>";
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$nlz = "";
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td class="text-nowrap">(<?= $employee_number ?>
|
||||
) <?= $timerecording->timerecordingEmployee->user->name ?> </td>
|
||||
<td class="text-center"><?= number_format(round($timerecording->ishours / 3600, 2), "2", ",", ".") ?></td>
|
||||
<td class="text-center"><?= $nlz ?></td>
|
||||
<td class="text-center"><?= number_format(round($timerecording->ishourssum / 3600, 2), "2", ",", ".") ?></td>
|
||||
<td class="text-center"><?= number_format(round($timerecording->musthours / 3600, 2), "2", ",", ".") ?></td>
|
||||
<td class="text-center"><?= (($timerecording->ishourssum - $timerecording->musthours) == 0) ? '<div class="filler-0 float-left"></div>' : '' ?><?= number_format(round(($timerecording->ishourssum - $timerecording->musthours) / 3600, 2), "2", ",", ".") ?>
|
||||
<?= (($timerecording->ishourssum - $timerecording->musthours) > 0) ? '<i class="float-right fa-regular fa-arrow-right-from-bracket change-difference" data-toggle="modal" data-target="#overtimeModal" data-hours="' . number_format(round(($timerecording->ishourssum - $timerecording->musthours) / 3600, 2), "2", ",", ".") . '" data-id="' . $timerecording->id . '"></i>' : '<div class="filler float-right"></div>' ?></td>
|
||||
<td class="text-center"><?= ($timerecording->timerecordingEmployee->overtime_now == 0) ? '<div class="filler-0 float-left"></div>' : '' ?><?= number_format(round($timerecording->timerecordingEmployee->overtime_now / 3600, 2), "2", ",", ".") ?>
|
||||
<?= ($timerecording->timerecordingEmployee->overtime_now > 0) ? '<i class="float-right fa-regular fa-arrow-right-from-bracket change-overtime" data-toggle="modal" data-target="#overtimeModal" data-hours="' . number_format(round($timerecording->timerecordingEmployee->overtime_now / 3600, 2), "2", ",", ".") . '" data-id="' . $timerecording->id . '"></i>' : '<div class="filler float-right"></div>' ?></td>
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
<td class="text-center"><?= number_format(round($timerecording->timerecordingEmployee->bpahours / 3600, 2), "2", ",", ".") ?></td>
|
||||
<?php endif; ?>
|
||||
<td class="text-center"><?= number_format(round($timerecording->overtime50free / 3600, 2), "2", ",", ".") ?></td>
|
||||
<td class="text-center"><?= number_format(round($timerecording->overtime100free / 3600, 2), "2", ",", ".") ?></td>
|
||||
<td class="text-center"><?= number_format($timerecording->diet, 2, ',', '.') . " €" ?></td>
|
||||
<td class="text-center"><?= $timerecording->homeoffice ?> Tag(e)</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="overtimeModal" tabindex="-1" role="dialog"
|
||||
aria-labelledby="overtimeModalInfoLabel"
|
||||
aria-hidden="true" data-id="">
|
||||
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="overtimeModal-title"></h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table ">
|
||||
<tr id="overtimes">
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="align-middle">Überstunden 50</th>
|
||||
<td><input type="number" step="any" class="form-control change-overtime-value"
|
||||
name="overtime50"
|
||||
id="overtime50"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-nowrap align-middle">Überstunden 100</th>
|
||||
<td><input type="number" step="any" class="form-control change-overtime-value"
|
||||
name="overtime100"
|
||||
id="overtime100"></td>
|
||||
</tr>
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
<tr>
|
||||
<th class="text-nowrap align-middle">Blackpig</th>
|
||||
<td><input type="number" step="any" class="form-control change-overtime-value"
|
||||
name="overtimebpa"
|
||||
id="overtimebpa"></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="submit-button" data-type="" type="button" class="btn btn-primary" data-dismiss="modal">
|
||||
Speichern
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Schließen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
hidesearch = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
||||
<?php endif; ?>
|
||||
$(document).ready(function () {
|
||||
// $('.buttons-excel').closest('div').append('<div ><button id="month-complete" class="btn btn-danger margina">Monats Abschluss</button></div>');
|
||||
$('.buttons-excel').closest('div').append('<div ><button id="bmd-export" class="btn btn-info margina">BMD Import</button></div>');
|
||||
$('.buttons-excel').closest('div').append('<div ><button id="bmd-export-nlz" class="btn btn-info margina">BMD NLZ Import</button></div>');
|
||||
|
||||
$('body').on('click', '#bmd-export', function () {
|
||||
|
||||
window.open('<?= self::getUrl("TimerecordingBilling", "api", ['do' => 'generatebmdexportclosed']) ?>&month=' + $('#month').data('month'), '_blank');
|
||||
});
|
||||
$('body').on('click', '#bmd-export-nlz', function () {
|
||||
window.open('<?= self::getUrl("TimerecordingBilling", "api", ['do' => 'generatebmdexportnlzclosed']) ?>&month=' + $('#month').data('month'), '_blank');
|
||||
});
|
||||
$('body').on('click', '#month-complete', function () {
|
||||
if (confirm('Monat wirklich abschließen?')) {
|
||||
$.post("<?= self::getUrl("TimerecordingBilling", "api", ['do' => 'completemonth']) ?>", {
|
||||
month: $.trim($('#month').data('month')),
|
||||
ajax: 1
|
||||
}).done(function (data) {
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
$('#overtimeModal').on('shown.bs.modal', function (event) {
|
||||
var button = $(event.relatedTarget);
|
||||
|
||||
if (button.hasClass('change-difference')) {
|
||||
$('#overtimeModal-title').text('Mehrstunden Transfer');
|
||||
$('#overtimeModal').data('id', button.data('id'));
|
||||
|
||||
$('#overtimes').html('<th>Mehrstunden:</th> <td id="overtime-hours" data-hours="' + button.data('hours') + '">' + button.data('hours') + ' (6,5)</td>');
|
||||
$('#submit-button').data('type', 'difference');
|
||||
}
|
||||
if (button.hasClass('change-overtime')) {
|
||||
$('#overtimeModal-title').text('Überstunden Transfer');
|
||||
$('#overtimes').html('<th>Überstunden:</th> <td id="overtime-hours" data-hours="' + button.data('hours') + '">' + button.data('hours') + '</td>');
|
||||
$('#submit-button').data('type', 'overtime');
|
||||
$('#overtimeModal').data('id', button.data('id'));
|
||||
}
|
||||
$('.change-overtime-value').val('');
|
||||
});
|
||||
$('body').on('change', '.change-overtime-value', function () {
|
||||
//$('#overtime-hours').data('hours') to float
|
||||
var difference = 0;
|
||||
|
||||
$(".change-overtime-value").each(function (index) {
|
||||
//check if float
|
||||
var value = $(this).val().replace(",", ".");
|
||||
// console.log(value);
|
||||
if (isNaN(parseFloat(value))) {
|
||||
|
||||
} else {
|
||||
difference += parseFloat(value);
|
||||
}
|
||||
});
|
||||
var valdiff = difference - parseFloat($(this).val());
|
||||
valdiff = Math.round(valdiff * 100) / 100;
|
||||
console.log("valdif" + valdiff);
|
||||
var hours = $('#overtime-hours').data('hours').replace(",", ".");
|
||||
|
||||
if (parseFloat(hours) < difference) {
|
||||
difference = difference - parseFloat(hours)
|
||||
difference = Math.round(difference * 100) / 100;
|
||||
console.log(difference);
|
||||
if (valdiff == 0) {
|
||||
$(this).val(hours);
|
||||
} else if (valdiff == parseFloat(hours)) {
|
||||
$(this).val('0');
|
||||
} else {
|
||||
var calc = Math.round((hours - valdiff) * 100) / 100
|
||||
$(this).val(calc);
|
||||
}
|
||||
} else {
|
||||
hours = hours.replace(",", ".");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
$('body').on('click', '#submit-button', function () {
|
||||
var id = $('#overtimeModal').data('id');
|
||||
var overtime50 = $('#overtime50').val();
|
||||
var overtime100 = $('#overtime100').val();
|
||||
var overtimebpa = $('#overtimebpa').val();
|
||||
$.post("<?= self::getUrl("TimerecordingBilling", "api", ['do' => 'saveovertime']) ?>", {
|
||||
id: id,
|
||||
type: $(this).data('type'),
|
||||
overtime50: overtime50,
|
||||
overtime100: overtime100,
|
||||
overtimebpa: overtimebpa,
|
||||
ajax: 1
|
||||
}).done(function (data) {
|
||||
window.location.reload();
|
||||
|
||||
});
|
||||
});
|
||||
//$.post(insertUrl, {
|
||||
// id: $.trim($('#id').val()),
|
||||
// timerecordingCategory_id: $.trim($('#timerecordingCategory_id').val()),
|
||||
// date: $.trim($('#date').val()),
|
||||
// enddate: $.trim($('#enddate').val()),
|
||||
// start: $.trim($('#start').val()),
|
||||
// end: $.trim($('#end').val()),
|
||||
// comment: $.trim($('#comment').val()),
|
||||
// businesstrip: businesstrip,
|
||||
// businesstrip_info: $.trim($('#businesstrip_info').val()),
|
||||
// timerecordingCar_id: $.trim($('#timerecordingCar_id').val()),
|
||||
// mileage_start: $.trim($('#mileage_start').val()),
|
||||
// mileage_end: $.trim($('#mileage_end').val()),
|
||||
// homeoffice: homeoffice,
|
||||
// hourday: $.trim($('#timerecordingCategory_id').find(':selected').data('hourday')),
|
||||
// ajax: 1
|
||||
//}).done(function (data) {
|
||||
// if (data.success) {
|
||||
// window.location.href = '<?php //= self::getUrl("Timerecording") ?>//';
|
||||
// } else {
|
||||
// $('#error').html(data.error);
|
||||
// }
|
||||
//});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
94
Layout/default/TimerecordingBilling/Index.php
Normal file
94
Layout/default/TimerecordingBilling/Index.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
|
||||
?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">Zeiterfassung Verrechnung</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Zeiterfassung Verrechnung/Abrechnung</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="float-left">
|
||||
<h4 class="header-title">Liste aller Abrechnungsmonate</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="datatable" class="table table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">Monat</th>
|
||||
<th class="text-center">Abgeschlossen</th>
|
||||
<th class="text-center">Abgeschlossen am</th>
|
||||
<th class="text-center">Abgeschlossen von</th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
foreach ($months as $month):
|
||||
if ($timerecordingbillings[ltrim($month, "0")]) {
|
||||
|
||||
$closetime = $timerecordingbillings[ltrim($month, "0")]->closetime;
|
||||
$closetime = date("d.m.Y H:i", $closetime);
|
||||
$closer = $timerecordingbillings[ltrim($month, "0")]->creator->name;
|
||||
$closed = "Ja";
|
||||
|
||||
} else {
|
||||
$closetime = "";
|
||||
$closer = "";
|
||||
$closed = "Nein";
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td class="text-center"><a
|
||||
href="<?= self::getUrl("TimerecordingBilling", "detail", ["month" => $month]) ?>"> <?= $month ?></a>
|
||||
</td>
|
||||
<td class="text-center"><?= $closed ?></td>
|
||||
<td class="text-center"><?= $closetime ?></td>
|
||||
<td class="text-center"><?= $closer ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [7];
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
204
Layout/default/TimerecordingCar/Detail.php
Normal file
204
Layout/default/TimerecordingCar/Detail.php
Normal file
@@ -0,0 +1,204 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
|
||||
$initialApproval = date("Y-m-d H:i:s", $timerecordingcar->initial_approval);
|
||||
$initialApprovalMonth = date("m", $timerecordingcar->initial_approval);
|
||||
$firstApproval = strtotime('+' . $timerecordingcar->first_approval . 'years', strtotime($initialApproval));
|
||||
if ($firstApproval < time()) {
|
||||
$firstApproval = strtotime(date("Y-$initialApprovalMonth-01", time()));
|
||||
if ($firstApproval < time()) {
|
||||
$firstApproval = strtotime(date("Y-$initialApprovalMonth-01", strtotime('+1 year')));
|
||||
}
|
||||
}
|
||||
$approval = date("m/Y", $firstApproval);
|
||||
?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<style>
|
||||
table.dataTable.table-sm > thead > tr > th:not(.sorting_disabled) {
|
||||
padding-right: 10px;
|
||||
}
|
||||
</style>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
|
||||
</li>
|
||||
<li class="breadcrumb-item"><a href="<?= self::getUrl("TimerecordingCar") ?>">Fahrzeuge</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active"><?= $timerecordingcar->number_plate ?></li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title"><?= $timerecordingcar->brand . "/" . $timerecordingcar->model . " (" . $timerecordingcar->number_plate . ")" ?>
|
||||
Detail
|
||||
<span class="ml-2">
|
||||
<a href="<?= self::getUrl("TimerecordingCar", "edit", ["id" => $timerecordingcar->id, 'returnto' => "detail"]) ?>">
|
||||
<button class="btn btn-primary">Bearbeiten</button>
|
||||
</a>
|
||||
</span>
|
||||
</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-5 card-border">
|
||||
<div>
|
||||
<h4>Fahrzeug Informationen </h4>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<table class="table table-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="w-30">Marke</th>
|
||||
<td><?= $timerecordingcar->brand ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Model/Typ</th>
|
||||
<td><?= $timerecordingcar->model ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Erste §57a nach</th>
|
||||
<td><?= ($timerecordingcar->first_approval) ? $timerecordingcar->first_approval . " Jahr(en)" : "-" ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fahrzeugverwalter</th>
|
||||
<td><?= ($timerecordingcar->user_id) ? $timerecordingcar->user->name : "-" ?></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-12 col-lg-5 card-border">
|
||||
<div>
|
||||
<h4> </h4>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<table class="table table-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Fahrtenbuch</th>
|
||||
<td><?= ($timerecordingcar->timerecording) ? "Ja" : "Nein" ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Erstzulassung</th>
|
||||
<td><?= ($timerecordingcar->initial_approval) ? date("m/Y", $timerecordingcar->initial_approval) : "-" ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Nächste $57a</th>
|
||||
<td><?= ($timerecordingcar->initial_approval) ? $approval : "-" ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th class="w-30">Kilometerstand</th>
|
||||
<td><?= ($timerecordingcar->mileage_now) ? $timerecordingcar->mileage_now . " KM" : "-" ?></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="float-left">
|
||||
<h4 class="header-title">Fahrtenbuch</h4>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="datatable" class="table table-striped table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">Startkilometer</th>
|
||||
<th class="text-center">Endkilometer</th>
|
||||
<th class="text-center">Kilometer</th>
|
||||
<th class="text-center">Fahrer</th>
|
||||
<th class="text-center">Datum</th>
|
||||
<th class="text-center">Zeit</th>
|
||||
|
||||
<th class="text-center">Ort</th>
|
||||
<th class="edit-width"></th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($timerecordings as $timerecording): ?>
|
||||
<tr>
|
||||
<td class="text-center"><?= $timerecording->mileage_start ?> KM</td>
|
||||
<td class="text-center"><?= $timerecording->mileage_end ?> KM</td>
|
||||
<td class="text-center"><?= $timerecording->mileage_end - $timerecording->mileage_start ?>KM
|
||||
<td class="text-center"><?= $timerecording->user->name ?></td>
|
||||
<td data-order="<?= $timerecording->start ?>"
|
||||
class="text-center"><?= date("d.m.Y", $timerecording->start) ?></td>
|
||||
<td class="text-center"><?= date("H:i", $timerecording->start) . " - " . date("H:i", $timerecording->end) ?></td>
|
||||
|
||||
</td>
|
||||
<td class="text-center"><?= $timerecording->businesstrip_info ?></td>
|
||||
|
||||
</td>
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<!-- <a href="-->
|
||||
<?php //= self::getUrl("TimerecordingCar", "edit", ["id" => $timerecordingcar->id]) ?><!--"><i-->
|
||||
<!-- class="far fa-edit" title="Bearbeiten"></i></a>-->
|
||||
<!-- <a href="-->
|
||||
<?php //= self::getUrl("TimerecordingCar", "delete", ["id" => $timerecordingcar->id]) ?><!--"-->
|
||||
<!-- onclick="if(!confirm('Auto wirklich löschen?')) return false;" class="text-danger"-->
|
||||
<!-- title="Löschen"><i class="fas fa-trash"></i></a>-->
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [7];
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
169
Layout/default/TimerecordingCar/Form.php
Normal file
169
Layout/default/TimerecordingCar/Form.php
Normal file
@@ -0,0 +1,169 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
|
||||
if (isset($_GET['returnto']) && $_GET['returnto'] == "detail") {
|
||||
$cancelUrl = self::getUrl("TimerecordingCar", "Detail", ["id" => $timerecordingcars->id]);
|
||||
} else {
|
||||
$cancelUrl = self::getUrl("TimerecordingCar");
|
||||
}
|
||||
foreach ($timerecordingusers as $timerecordinguser) {
|
||||
$timerecordingUsers[$timerecordinguser->name] = $timerecordinguser->id;
|
||||
}
|
||||
ksort($timerecordingUsers);
|
||||
?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
|
||||
</li>
|
||||
<li class="breadcrumb-item"><a
|
||||
href="<?= self::getUrl("TimerecordingCar") ?>">Fahrzeuge</a></li>
|
||||
<li class="breadcrumb-item active"><?= ($timerecordingcars->id) ? "bearbeiten" : "Neu" ?></li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title"><?= ($timerecordingcars->id) ? "Fahrzeug bearbeiten" : "Neues Fahrzeug" ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card bg-light">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-2"><?= ($timerecordingcars->id) ? "Fahrzeug bearbeiten" : "Neues Fahrzeug" ?></h4>
|
||||
|
||||
<form class="form-horizontal" method="post"
|
||||
action="<?= self::getUrl("TimerecordingCar", "save", ["returnto" => $_GET["returnto"]]) ?>">
|
||||
<div class="card no-shadow">
|
||||
<div class="card-body">
|
||||
<input type="hidden" name="id" value="<?= $timerecordingcars->id ?>"/>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="number_plate">Kennzeichen *</label>
|
||||
<div class="col-lg-1">
|
||||
<input required="required" type="text" id="number_plate" name="number_plate"
|
||||
class="form-control"
|
||||
value="<?= $timerecordingcars->number_plate ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="brand">Fahrzeugverwalter</label>
|
||||
<div class="col-lg-2">
|
||||
<select id="user_id_select" name="user_id"
|
||||
class="select2 form-control" required="required">
|
||||
<option value="-"> </option>
|
||||
<?php foreach ($timerecordingUsers as $key => $timerecordingUser): ?>
|
||||
<option <?= ($timerecordingcars->user_id==$timerecordingUser) ? 'selected="selected' : "" ?> value="<?= $timerecordingUser ?>"><?= $key ?></option>
|
||||
<?php
|
||||
endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="brand">Marke *</label>
|
||||
<div class="col-lg-3">
|
||||
<input required="required" type="text" id="brand" name="brand"
|
||||
class="form-control"
|
||||
value="<?= $timerecordingcars->brand ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="model">Model/Typ *</label>
|
||||
<div class="col-lg-3">
|
||||
<input required="required" type="text" id="model" name="model"
|
||||
class="form-control"
|
||||
value="<?= $timerecordingcars->model ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="initial_approval">Erstzulassung</label>
|
||||
<div class="col-lg-2">
|
||||
<input type="month" id="initial_approval"
|
||||
name="initial_approval"
|
||||
class="form-control"
|
||||
value="<?= ($timerecordingcars->initial_approval) ? date('Y-m', $timerecordingcars->initial_approval) : "" ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="first_approval">Erste §57a nach</label>
|
||||
<div class="col-lg-2">
|
||||
<select id="first_approval" name="first_approval" class="select2 form-control">
|
||||
<option value=" "> </option>
|
||||
<option value="1" <?= ($timerecordingcars->first_approval == "1") ? "selected='selected'" : "" ?>>
|
||||
1 Jahr
|
||||
</option>
|
||||
<option value="2" <?= ($timerecordingcars->first_approval == "2") ? "selected='selected'" : "" ?>>
|
||||
2 Jahren
|
||||
</option>
|
||||
<option value="3" <?= ($timerecordingcars->first_approval == "3") ? "selected='selected'" : "" ?>>
|
||||
3 Jahren
|
||||
</option>
|
||||
<option value="4" <?= ($timerecordingcars->first_approval == "4") ? "selected='selected'" : "" ?>>
|
||||
4 Jahren
|
||||
</option>
|
||||
<option value="5" <?= ($timerecordingcars->first_approval == "5") ? "selected='selected'" : "" ?>>
|
||||
5 Jahren
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="mileage">Kilometerstand</label>
|
||||
<div class="col-lg-1">
|
||||
<input type="number" id="mileage" name="mileage"
|
||||
class="form-control"
|
||||
value="<?= $timerecordingcars->mileage ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label"
|
||||
for="timerecording">Digitales Fahrtenbuch</label>
|
||||
<div class="col-lg-3">
|
||||
<div class="form-check">
|
||||
<input id="timerecording"
|
||||
class="form-check-input" <?= ($timerecordingcars->timerecording) ? 'checked="checked"' : '' ?>
|
||||
type="checkbox" name="timerecording" value="1"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2"></label>
|
||||
<div class="col-lg-10">
|
||||
<button type="submit" class="btn btn-primary">Speichern</button>
|
||||
<a href="<?= $cancelUrl ?>">
|
||||
<button type="button" class="btn btn-secondary">Abbrechen</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(".select2").select2({placeholder: ""});
|
||||
|
||||
// disable mousewheel on a input number field when in focus
|
||||
$('form').on('focus', 'input[type=number]', function (e) {
|
||||
$(this).on('wheel.disableScroll', function (e) {
|
||||
e.preventDefault()
|
||||
})
|
||||
});
|
||||
$('form').on('blur', 'input[type=number]', function (e) {
|
||||
$(this).off('wheel.disableScroll')
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
123
Layout/default/TimerecordingCar/Index.php
Normal file
123
Layout/default/TimerecordingCar/Index.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<style>
|
||||
table.dataTable.table-sm > thead > tr > th:not(.sorting_disabled) {
|
||||
padding-right: 10px;
|
||||
}
|
||||
</style>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">Fahrzeuge</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Fahrzeuge</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="float-left">
|
||||
<h4 class="header-title">Liste aller Fahrzeuge</h4>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<a class="btn btn-primary mb-2" href="<?= self::getUrl("TimerecordingCar", "add") ?>"><i
|
||||
class="fas fa-plus"></i> Neues Fahrzeug anlegen</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="datatable" class="table table-striped table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">Kennzeichen</th>
|
||||
<th class="text-center">Fahrzeugverwalter</th>
|
||||
<th class="text-center">Marke</th>
|
||||
<th class="text-center">Model/Typ</th>
|
||||
<th class="text-center">Erstzulassssung</th>
|
||||
<th class="text-center">$57a</th>
|
||||
<th class="text-center">Fahrtenbuch</th>
|
||||
<th class="text-center">Kilometerstand</th>
|
||||
<th class="edit-width"></th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($timerecordingcars as $timerecordingcar):
|
||||
$initialApproval = date("Y-m-d H:i:s", $timerecordingcar->initial_approval);
|
||||
$initialApprovalMonth = date("m", $timerecordingcar->initial_approval);
|
||||
$firstApproval = strtotime('+' . $timerecordingcar->first_approval . 'years', strtotime($initialApproval));
|
||||
if ($firstApproval < time()) {
|
||||
$firstApproval = strtotime(date("Y-$initialApprovalMonth-01", time()));
|
||||
if ($firstApproval < time()) {
|
||||
$firstApproval = strtotime(date("Y-$initialApprovalMonth-01", strtotime('+1 year')));
|
||||
}
|
||||
}
|
||||
$approval = date("m/Y", $firstApproval);
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?= self::getUrl("TimerecordingCar", "detail", ["id" => $timerecordingcar->id]) ?>"> <?= $timerecordingcar->number_plate ?></a>
|
||||
</td>
|
||||
<td><?= ($timerecordingcar->user_id) ? $timerecordingcar->user->name : "-" ?></td>
|
||||
<td><?= $timerecordingcar->brand ?></td>
|
||||
<td><?= $timerecordingcar->model ?></td>
|
||||
<td class="text-center"><?= ($timerecordingcar->initial_approval) ? date("m/Y", $timerecordingcar->initial_approval) : "-" ?></td>
|
||||
<td class="text-center"><?= ($timerecordingcar->initial_approval) ? $approval : "-" ?></td>
|
||||
<td class="text-center"><?= ($timerecordingcar->timerecording) ? "Ja" : "Nein" ?></td>
|
||||
<td class="text-center"><?= ($timerecordingcar->mileage_now) ? number_format($timerecordingcar->mileage_now, 0, ',', '.')." KM" : "-" ?>
|
||||
</td>
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?= self::getUrl("TimerecordingCar", "edit", ["id" => $timerecordingcar->id]) ?>"><i
|
||||
class="far fa-edit" title="Bearbeiten"></i></a>
|
||||
<a href="<?= self::getUrl("TimerecordingCar", "delete", ["id" => $timerecordingcar->id]) ?>"
|
||||
onclick="if(!confirm('Fahrzeug wirklich löschen?')) return false;" class="text-danger"
|
||||
title="Löschen"><i class="fas fa-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [8];
|
||||
|
||||
var columnfilter = [6];
|
||||
var columnoptions = '<option value=""></option><option value="Ja">Ja</option><option value="Nein">Nein</option>';
|
||||
$(document).ready(function () {
|
||||
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
@@ -93,6 +93,17 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label"
|
||||
for="businesstrip">Unbezahlt</label>
|
||||
<div class="col-lg-3">
|
||||
<div class="form-check">
|
||||
<input id="businesstrip"
|
||||
class="form-check-input" <?php if ($timerecordingcategoriess->unpaid) echo 'checked="checked"'; ?>
|
||||
type="checkbox" name="unpaid" value="1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="only_admin">Nur für Buchhaltung zu
|
||||
buchen</label>
|
||||
|
||||
@@ -61,6 +61,17 @@ $daysSelect .= "</select>";
|
||||
<div class="card no-shadow">
|
||||
<div class="card-body">
|
||||
<input type="hidden" name="id" value="<?= $timerecordingemployees->id ?>"/>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label"
|
||||
for="bmd_active">Aktive Verrechnung</label>
|
||||
<div class="col-lg-3">
|
||||
<div class="form-check">
|
||||
<input id="bmd_active"
|
||||
class="form-check-input" <?php if ($timerecordingemployees->bmd_active) echo 'checked="checked"'; ?>
|
||||
type="checkbox" name="bmd_active" value="1"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="user_id">Mitarbeiter *</label>
|
||||
<div class="col-lg-3">
|
||||
@@ -89,6 +100,15 @@ $daysSelect .= "</select>";
|
||||
value="<?= ($timerecordingemployees->startdate) ? date('Y-m-d', $timerecordingemployees->startdate): "" ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="enddate">Enddatum
|
||||
Zeiterfassung</label>
|
||||
<div class="col-lg-2">
|
||||
<input type="date" id="enddate" name="enddate"
|
||||
class="form-control"
|
||||
value="<?= ($timerecordingemployees->enddate) ? date('Y-m-d', $timerecordingemployees->enddate): "" ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="birthday">Geburtstag</label>
|
||||
<div class="col-lg-2">
|
||||
|
||||
@@ -9,9 +9,14 @@ $type[3] = "Lehrling";
|
||||
.border-dark {
|
||||
border-color: #cbcbcb !important;
|
||||
}
|
||||
|
||||
.border-bottom {
|
||||
border-bottom: 1px dotted #adadad !important;
|
||||
}
|
||||
|
||||
.inactive_empoyee {
|
||||
background-color: #ff75756e !important;
|
||||
}
|
||||
</style>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
@@ -52,6 +57,9 @@ $type[3] = "Lehrling";
|
||||
<th class="text-center">Sollstunden</th>
|
||||
<th class="text-center">Mehrstunden</th>
|
||||
<th class="text-center">Überstunden</th>
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
<th class="text-center">Black P. Stunden</th>
|
||||
<?php endif; ?>
|
||||
<th class="text-center">Offene Urlaube</th>
|
||||
<th class="text-center edit-width">Schnellbuchung</th>
|
||||
<th class="edit-width"></th>
|
||||
@@ -62,6 +70,9 @@ $type[3] = "Lehrling";
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
<th></th>
|
||||
<?php endif; ?>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
@@ -97,7 +108,7 @@ $type[3] = "Lehrling";
|
||||
}
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<tr class="<?= ($timerecordingemployees[$timerecordinguser->id]['bmd_active'] == "0") ? "inactive_empoyee" : "" ?>">
|
||||
<td><?= $timerecordinguser->name ?></td>
|
||||
<td><?= $type[$timerecordingemployees[$timerecordinguser->id]['type']] ?></td>
|
||||
<td class="text-center"><?= ($timerecordingemployees[$timerecordinguser->id]['startdate']) ? date("d.m.Y", $timerecordingemployees[$timerecordinguser->id]['startdate']) : "-" ?></td>
|
||||
@@ -105,8 +116,14 @@ $type[3] = "Lehrling";
|
||||
<td class="text-center"><?= $sum ?></td>
|
||||
<td class="text-center"
|
||||
data-order="<?= ($timerecordingemployees[$timerecordinguser->id]['plushours_now']) ? $timerecordingemployees[$timerecordinguser->id]['plushours_now'] : 0 ?>"><?= $plusHours ?></td>
|
||||
<td class="text-center" data-order="<?= $timerecordingemployees[$timerecordinguser->id]['overtime_now'] ?>"><?= $overTime ?></td>
|
||||
<td class="text-center" data-order="<?= ($timerecordingemployees[$timerecordinguser->id]['holidays_now']) ? $timerecordingemployees[$timerecordinguser->id]['holidays_now'] : '' ?>"><?= ($timerecordingemployees[$timerecordinguser->id]['holidays_now']) ? $timerecordingemployees[$timerecordinguser->id]['holidays_now'] . ' Tage' : '' ?> </td>
|
||||
<td class="text-center"
|
||||
data-order="<?= $timerecordingemployees[$timerecordinguser->id]['overtime_now'] ?>"><?= $overTime ?></td>
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
<td class="text-center"
|
||||
data-order="<?= $timerecordingemployees[$timerecordinguser->id]['bpa_hours'] ?>"><?= sprintf('%02dh:%02dm', floor($timerecordingemployees[$timerecordinguser->id]['bpa_hours'] / 3600), floor($timerecordingemployees[$timerecordinguser->id]['bpa_hours'] / 60 % 60)) ?></td>
|
||||
<?php endif; ?>
|
||||
<td class="text-center"
|
||||
data-order="<?= ($timerecordingemployees[$timerecordinguser->id]['holidays_now']) ? $timerecordingemployees[$timerecordinguser->id]['holidays_now'] : '' ?>"><?= ($timerecordingemployees[$timerecordinguser->id]['holidays_now']) ? $timerecordingemployees[$timerecordinguser->id]['holidays_now'] . ' Tage' : '' ?> </td>
|
||||
<td class="text-center"><?= ($timerecordingemployees[$timerecordinguser->id]['auto_workinghours'] == '1') ? 'Ja' : 'Nein' ?></td>
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?= self::getUrl("TimerecordingEmployee", "edit", ['id' => $timerecordingemployees[$timerecordinguser->id]['id'], "userid" => $timerecordinguser->id]) ?>"><i
|
||||
@@ -126,7 +143,9 @@ $type[3] = "Lehrling";
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [3, 4, 5, 6, 7, 9];
|
||||
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
hidesearch = [3, 4, 5, 6, 7,8 ,10];
|
||||
<?php endif; ?>
|
||||
$(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
@@ -121,7 +121,7 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
<input id="id" type="hidden" name="id" value=""/>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-lg-2">
|
||||
<label class="col-form-label" for="user_id">Buchungsart</label>
|
||||
<label class="col-form-label" for="user_id">Mitarbeiter</label>
|
||||
|
||||
<select id="user_id_select" name="user_id"
|
||||
class="select2 form-control" required="required">
|
||||
@@ -220,7 +220,7 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2 mb-2 businesstrip-div">
|
||||
<div class="col-lg-2 mb-2 businesstrip-div businesstrip-check-div ">
|
||||
|
||||
<div class="form-check text-center mt-1">
|
||||
<input class="form-check-input" type="checkbox" name="businesstrip"
|
||||
@@ -235,8 +235,32 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
placeholder="Ort"
|
||||
class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2 car-div car-div-car" style="display:none">
|
||||
|
||||
<select id="timerecordingCar_id" name="timerecordingCar_id"
|
||||
class="select2 form-control">
|
||||
<option value="">Auto auswählen</option>
|
||||
<?php foreach ($timerecordingCars as $timerecordingCar): ?>
|
||||
|
||||
<option value="<?= $timerecordingCar->id ?>"
|
||||
data-mileagenow="<?= $timerecordingCar->mileage_now ?>"><?= $timerecordingCar->number_plate . " (" . $timerecordingCar->brand." ".$timerecordingCar->model . ")" ?></option>
|
||||
</option>
|
||||
<?php
|
||||
|
||||
endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-1 car-div " style="display:none">
|
||||
<input style="" type="number" id="mileage_start" name="mileage_start"
|
||||
placeholder="KM Start"
|
||||
class="form-control"/>
|
||||
</div>
|
||||
<div class="col-lg-1 car-div" style="display:none">
|
||||
<input style="" type="number" id="mileage_end" name="mileage_end"
|
||||
placeholder="KM Ende"
|
||||
class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" row mt-2">
|
||||
<div class="col-lg-2 ">
|
||||
<button id="submit-button" type="submit" class="btn btn-primary">Speichern</button>
|
||||
@@ -245,16 +269,17 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class=" row mt-2">
|
||||
<div class="col-lg-4" id="message-box">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<div class="form-group module-row row mb-3">
|
||||
@@ -292,7 +317,7 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
<div class="input-group">
|
||||
<select id="datayear" class="form-control select2">
|
||||
<?php foreach ($years as $key => $Year): ?>
|
||||
<option <?= (date('Y', time()) == $Year) ? "selected='selsected'" : NULL ?>
|
||||
<option <?= (date('Y', time()) == $Year) ? "selected='selected'" : NULL ?>
|
||||
value="<?= $key ?>"><?= $Year ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
160
Layout/default/VoiceCallActive/Index.php
Normal file
160
Layout/default/VoiceCallActive/Index.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?php /** @noinspection PhpUndefinedClassInspection
|
||||
* @var string $mfLayoutPackage
|
||||
* @var TYPE_NAME $git_merge_ts
|
||||
*/
|
||||
|
||||
//additional css /css/views/RaspberryDisplay.css
|
||||
|
||||
$JSGlobals = ["BASE_URL" => self::getUrl("VoiceCallActive"),
|
||||
"DASHBOARD_URL" => self::getUrl("Dashboard"),
|
||||
"MFAPPNAME" => MFAPPNAME_SLUG,
|
||||
"PAGE_TITLE" => "Active Voice Calls",
|
||||
"PATH" => [
|
||||
["text" => MFAPPNAME_SLUG, "href" => self::getUrl("Dashboard")],
|
||||
["text" => "Active Voice Calls", "href" => self::getUrl("VoiceCallActive")]
|
||||
],
|
||||
"VOICE_CALL_ACTIVE_API_URL" => self::getUrl("VoiceCallActive/api"),
|
||||
];
|
||||
|
||||
$additionalJS = ["plugins/vue/vue.js",
|
||||
"plugins/axios/axios.min.js",
|
||||
"plugins/vue/tt-components/tt-page-title.js",
|
||||
"plugins/vue/tt-components/tt-table.js",
|
||||
];
|
||||
$additionalCSS = [
|
||||
'plugins/vue/tt-components/css/tt-table.css',
|
||||
];
|
||||
|
||||
include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
|
||||
<div id="app">
|
||||
<tt-page-title :title="window['TT_CONFIG']['PAGE_TITLE']" :path="window['TT_CONFIG']['PATH']"></tt-page-title>
|
||||
|
||||
<tt-table :fetch-url="window['TT_CONFIG']['VOICE_CALL_ACTIVE_API_URL'] + '?do=getActiveCalls'" :table-config="VoiceCallActiveTableConfig"
|
||||
small ref="table">
|
||||
|
||||
<template v-slot:top-buttons>
|
||||
<button type="button" class="btn btn-primary" @click="refresh" data-toggle="tooltip" data-placement="bottom" title="Refreshing too often will run into API-Rate limits and will cause errors.">
|
||||
<template v-if="refreshLoading">
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<i class="fas fa-sync-alt"></i>
|
||||
Refresh
|
||||
</template>
|
||||
</button>
|
||||
|
||||
<div class="d-flex">
|
||||
<label style="margin-bottom: 0 !important;">
|
||||
<input type="checkbox" id="autoRefresh" data-toggle="toggle" data-size="lg" @change="clickedCheckBox(this.checked)">
|
||||
<span class="ml-2">Auto Refresh (5sec)</span>
|
||||
</label>
|
||||
<span style="width: 50px"></span>
|
||||
<div class="voice-yellow p-2">Ringing</div>
|
||||
<div class="voice-red p-2">Outgoing</div>
|
||||
<div class="voice-green p-2">Ingoing</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-slot:answer_time="{ row }">
|
||||
{{ !isNaN(new Date(row.answer_time)) ? new Date(row.answer_time).toLocaleString() : 'Call is not running' }}
|
||||
</template>
|
||||
|
||||
<template v-slot:status="{ row }">
|
||||
<i v-if="!row.dst_device_extension && row.status !== 'Ringing'" class="fas fa-phone-arrow-up-right"></i>
|
||||
<i v-else-if="!row.dst_device_extension && row.status === 'Ringing'" class="fas fa-phone-arrow-up-right fa-shake"></i>
|
||||
<i v-else-if="row.status === 'Ringing'" class="fas fa-phone-arrow-down-left fa-shake"></i>
|
||||
<i v-else class="fas fa-phone-arrow-down-left"></i>
|
||||
{{ row.status }}
|
||||
</template>
|
||||
|
||||
</tt-table>
|
||||
</div>
|
||||
|
||||
<!-- TODO: download from cdn to local -->
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/css/bootstrap4-toggle.min.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/js/bootstrap4-toggle.min.js"></script>
|
||||
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
|
||||
|
||||
<style>
|
||||
.voice-green {
|
||||
background-color: #6CAE75 !important
|
||||
}
|
||||
.voice-yellow {
|
||||
background-color: #E8E288 !important
|
||||
}
|
||||
.voice-red {
|
||||
background-color: #FF8360 !important
|
||||
}
|
||||
|
||||
.table-sm td {
|
||||
padding: 4px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
window: window,
|
||||
VoiceCallActiveTableConfig: {
|
||||
customRowClass: function (row) {
|
||||
if (row.status.toLowerCase() === 'ringing') {
|
||||
return 'voice-yellow';
|
||||
}
|
||||
if (!row.dst_device_extension) {
|
||||
return 'voice-red';
|
||||
}
|
||||
if (row.status.toLowerCase() === 'answered') {
|
||||
return 'voice-green';
|
||||
}
|
||||
},
|
||||
headers: [
|
||||
{text: 'Call ID', key: 'id', filter: false},
|
||||
{text: 'Status', key: 'status', filter: false},
|
||||
{text: 'Answer Time', key: 'answer_time', filter: false},
|
||||
{text: 'Duration', key: 'duration', filter: false},
|
||||
{text: 'Source', key: 'src', filter: false},
|
||||
{text: 'Device Type', key: 'device_type', filter: false},
|
||||
{text: 'Destination', key: 'localized_dst', filter: false},
|
||||
{text: 'Destination User', key: 'dst_user', filter: false},
|
||||
{text: 'Destination Device Extension', key: 'dst_device_extension', filter: false},
|
||||
],
|
||||
tableHeader: 'Active Voice Calls',
|
||||
},
|
||||
refreshLoading: false,
|
||||
autoRefresh: null,
|
||||
},
|
||||
mounted() {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
|
||||
const _this = this;
|
||||
$('#autoRefresh').change(function () {
|
||||
console.log(this.checked);
|
||||
if (this.checked) {
|
||||
_this.autoRefresh = setInterval(function () {
|
||||
_this.refresh();
|
||||
}, 5000);
|
||||
} else {
|
||||
clearInterval(_this.autoRefresh);
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
async refresh() {
|
||||
this.refreshLoading = true;
|
||||
this.$refs.table.loading = true;
|
||||
await this.$refs.table.fetchData();
|
||||
$('.tooltip').tooltip('hide');
|
||||
this.$refs.table.loading = false;
|
||||
this.refreshLoading = false;
|
||||
},
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
|
||||
89
Layout/default/VoiceCallHistory/Index.php
Normal file
89
Layout/default/VoiceCallHistory/Index.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php /** @noinspection PhpUndefinedClassInspection
|
||||
* @var string $mfLayoutPackage
|
||||
* @var TYPE_NAME $git_merge_ts
|
||||
*/
|
||||
|
||||
//additional css /css/views/RaspberryDisplay.css
|
||||
|
||||
$JSGlobals = ["BASE_URL" => self::getUrl("Domain"),
|
||||
"DASHBOARD_URL" => self::getUrl("Dashboard"),
|
||||
"MFAPPNAME" => MFAPPNAME_SLUG,
|
||||
"PAGE_TITLE" => "Domains",
|
||||
"PATH" => [
|
||||
["text" => MFAPPNAME_SLUG, "href" => self::getUrl("Dashboard")],
|
||||
["text" => "Voice Calls History", "href" => self::getUrl("VoiceCallHistory")]
|
||||
],
|
||||
"VOICE_CALL_HISTORY_API_URL" => self::getUrl("VoiceCallHistory/api"),
|
||||
];
|
||||
|
||||
$additionalJS = ["plugins/vue/vue.js",
|
||||
"plugins/axios/axios.min.js",
|
||||
"plugins/vue/tt-components/tt-page-title.js",
|
||||
"plugins/vue/tt-components/tt-table.js",
|
||||
];
|
||||
$additionalCSS = [
|
||||
'plugins/vue/tt-components/css/tt-table.css',
|
||||
];
|
||||
|
||||
include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
|
||||
<div id="app">
|
||||
<tt-page-title :title="window['TT_CONFIG']['PAGE_TITLE']" :path="window['TT_CONFIG']['PATH']"></tt-page-title>
|
||||
|
||||
<tt-table :fetch-url="window['TT_CONFIG']['VOICE_CALL_HISTORY_API_URL'] + '?do=getCalls'" :table-config="VoiceCallHistoryTableConfig"
|
||||
small ref="table">
|
||||
<template v-slot:top-buttons>
|
||||
<button type="button" class="btn btn-primary" @click="importCallsFromToday">
|
||||
<template v-if="importCallsFromTodayLoading">
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<i class="fas fa-sync-alt"></i>
|
||||
Re-Import Calls from Today
|
||||
</template>
|
||||
</button>
|
||||
|
||||
</template>
|
||||
</tt-table>
|
||||
</div>
|
||||
|
||||
<!-- TODO: download from cdn to local -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/css/bootstrap-select.min.css">
|
||||
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
|
||||
|
||||
<script>
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
window: window,
|
||||
VoiceCallHistoryTableConfig: {
|
||||
headers: [
|
||||
{text: "Call-ID", key: "uid"},
|
||||
{text: "Voice Account", key: "voice_account"},
|
||||
{text: "Time Range", key: "start", filter: "dateRange"},
|
||||
{text: "Source", key: "source"},
|
||||
{text: "Destination", key: "destination"},
|
||||
{text: "Billable", key: "billable"},
|
||||
{text: "Duration", key: "duration"},
|
||||
],
|
||||
tableHeader: 'Voice Call History',
|
||||
},
|
||||
importCallsFromTodayLoading: false,
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
async importCallsFromToday() {
|
||||
this.importCallsFromTodayLoading = true;
|
||||
const response = await axios.get(window['TT_CONFIG']['VOICE_CALL_HISTORY_API_URL'] + '?do=importCallsFromToday');
|
||||
window.notify(response.data.status === 'success' ? 'success' : 'error', response.data.message);
|
||||
await this.$refs.table.fetchData();
|
||||
this.importCallsFromTodayLoading = false;
|
||||
},
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
|
||||
@@ -40,9 +40,11 @@
|
||||
<?php if ($me->can('Fibu')): ?>
|
||||
<li><a href="<?=self::getUrl("TimerecordingPermit")?>"><i class="far fa-fw fa-calendar-check text-info"></i> Freigaben</a></li>
|
||||
<li><a href="<?=self::getUrl("TimerecordingReport")?>"><i class="far fa-fw fa-chart-pie text-info"></i> Auswertung/Korrektur</a></li>
|
||||
<li><a href="<?=self::getUrl("TimerecordingBilling")?>"><i class="far fa-fw fa-money-bill-1-wave text-info"></i> Verrechnung</a></li>
|
||||
<li><a href="<?=self::getUrl("TimerecordingCategory")?>"><i class="far fa-fw fa-list text-info"></i> Buchungsarten</a></li>
|
||||
<li><a href="<?=self::getUrl("TimerecordingHoliday")?>"><i class="far fa-fw fa-umbrella-beach text-info"></i> Feiertage</a></li>
|
||||
<li><a href="<?=self::getUrl("TimerecordingEmployee")?>"><i class="far fa-fw fa-user text-info"></i> Personaladministration</a></li>
|
||||
<li><a href="<?=self::getUrl("TimerecordingCar")?>"><i class="far fa-fw fa-sharp fa-regular fa-cars text-info"></i> Fahrzeugverwaltung</a></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -75,6 +77,7 @@
|
||||
<?php if($me->is(["Admin"])): ?>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("OpenAccessId")?>"><i class="fad fa-fw fa-link-simple text-info"></i> Open Access IDs</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("Producttech")?>"><i class="fad fa-fw fa-microchip text-info"></i> Technologien</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("HistoricTicket")?>"><i class="fad fa-fw fa-headset text-info"></i> Historische Tickets</a></li>
|
||||
<?php if($me->can("Fibu")): ?><li class="mobile-hide"><a href="<?=self::getUrl("Vatgroup")?>"><i class="fas fa-fw fa-circle-dollar-to-slot text-info"></i> Steuersätze</a></li><?php endif; ?>
|
||||
<!--<li><a href="<?=self::getUrl("Contractconfig")?>"><i class="fad fa-gear text-info"></i> ContractConfig</a></li>-->
|
||||
<?php endif; ?>
|
||||
@@ -95,6 +98,9 @@
|
||||
<?php if($me->is(["Admin","netowner","lineplanner","lineworker"]) && $me->can("Linework")): ?><li><a href="<?=self::getUrl("Linework")?>"><i class="fas fa-fw fa-ethernet text-info"></i> Leitungsbau</a></li><?php endif; ?>
|
||||
<?php if($me->is(["Admin","netowner","netoperator","lineworker"]) && $me->can("Patching")): ?><li class="has-sub-submenu"><a href="<?=self::getUrl("Patching")?>"><i class="fas fa-fw fa-plug text-info"></i> Patchungen</a></li><?php endif; ?>
|
||||
<?php if($me->is(["Admin","netowner","pipeplanner","lineplanner","pipeworker","netoperator","lineworker"]) && $me->can("Filestore")): ?><li><a href="<?=self::getUrl("Filestore")?>"><i class="fas fa-fw fa-file text-info"></i> Dateiablage</a></li><?php endif; ?>
|
||||
<?php if($me->is(["Admin","netowner","pipeplanner","pipeplanner"]) && $me->is("employee")): ?><li><a href="<?=self::getUrl("FiberPlanDispatcher")?>"><i class="fas fa-building-circle-arrow-right text-info"></i> Verteiler und Schächte</a></li><?php endif; ?>
|
||||
<?php if($me->is(["Admin","netowner","lineplanner","lineworker"]) && $me->is("employee")): ?><li><a href="<?=self::getUrl("FiberPlanPipe")?>"><i class="fas fa-pipe text-info pl-1"></i> Rohrverzeichnis</a></li><?php endif; ?>
|
||||
<!-- --><?php //if($me->is(["Admin","netowner","lineplanner","lineworker"]) && $me->is("employee")): ?><!--<li><a href="--><?php //=self::getUrl("FiberPlanCable")?><!--"><i class="fas fa-pipe text-info pl-1"></i> Kabelverzeichnis</a></li>--><?php //endif; ?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
@@ -107,6 +113,7 @@
|
||||
<ul class="submenu">
|
||||
<?php if($me->isAdmin() || $me->can("Cpeprovisioning")): ?><li><a href="<?=self::getUrl("Cpeprovisioning")?>"><i class="fad fa-fw fa-hdd text-info"></i> CPE Provisioning</a></li><?php endif; ?>
|
||||
<?php if($me->isAdmin() || $me->can("Cpeshipping")): ?><li><a href="<?=self::getUrl("Cpeshipping")?>"><i class="fad fa-fw fa-shipping-fast text-info"></i> CPE Versand</a></li><?php endif; ?>
|
||||
<?php if($me->isAdmin()) : ?><li><a href="<?=self::getUrl("Domain")?>"><i class="fad fa-fw fa-globe text-info"></i> Domains</a></li><?php endif; ?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
@@ -119,6 +126,8 @@
|
||||
<ul class="submenu">
|
||||
<?php if($me->isAdmin() || $me->can("Voipnumbering")): ?><li><a href="<?=self::getUrl("Voicenumberblock")?>"><i class="fad fa-fw fa-phone-office text-info"></i> Rufnummernblöcke</a></li><?php endif; ?>
|
||||
<?php if($me->isAdmin() || $me->can("Voiceplan")): ?><li><a href="<?=self::getUrl("Voiceplan")?>"><i class="fas fa-fw fa-phone-arrow-up-right text-info"></i> Sprachtarife</a></li><?php endif; ?>
|
||||
<?php if($me->isAdmin() || $me->can("VoiceCallHistory")): ?><li><a href="<?=self::getUrl("VoiceCallHistory")?>"><i class="fas fa-fw fa-phone-arrow-down-left text-info"></i> Voice Call History</a></li><?php endif; ?>
|
||||
<?php if($me->isAdmin() || $me->can("VoiceCallActive")): ?><li><a href="<?=self::getUrl("VoiceCallActive")?>"><i class="fas fa-fw fa-phone-volume text-info"></i> Active Voice Calls</a></li><?php endif; ?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -43,6 +43,7 @@ class DeviceController extends mfBaseController
|
||||
$this->layout()->setTemplate("Device/Detail");
|
||||
$devicesconfig = DeviceModel::getconifg($id);
|
||||
$devices = DeviceModel::getOne($id);
|
||||
$devicesall= DeviceModel::getAll();
|
||||
|
||||
if ($devices->devicetype->olt == "1") {
|
||||
$customer = DeviceModel::getOltCustomer($device->ip);
|
||||
@@ -52,6 +53,7 @@ class DeviceController extends mfBaseController
|
||||
|
||||
$this->layout()->set("devicesconfig", $devicesconfig);
|
||||
$this->layout()->set("devices", $devices);
|
||||
$this->layout()->set("devicesall", $devicesall);
|
||||
$this->layout()->set("customer", $customer);
|
||||
|
||||
}
|
||||
@@ -61,6 +63,7 @@ class DeviceController extends mfBaseController
|
||||
$this->layout()->setTemplate("Device/Form");
|
||||
$this->layout()->set("devicetypes", DevicetypeModel::getAll());
|
||||
$this->layout()->set("pops", PopModel::getAll());
|
||||
$this->layout()->set("devices", DeviceModel::getAll());
|
||||
|
||||
}
|
||||
|
||||
@@ -102,6 +105,7 @@ class DeviceController extends mfBaseController
|
||||
$data = [];
|
||||
$data['name'] = trim($r->name);
|
||||
$data['devicetype_id'] = $r->devicetype_id;
|
||||
$data['parent_id'] = $r->parent_id;
|
||||
$data['autobackup'] = trim($r->autobackup);
|
||||
|
||||
if (trim($r->pop_id) == "0") {
|
||||
@@ -132,6 +136,9 @@ class DeviceController extends mfBaseController
|
||||
if ($data['autobackup'] != "1") {
|
||||
$data['autobackup'] = "0";
|
||||
}
|
||||
if (!$data['parent_id']) {
|
||||
$data['parent_id'] = NULL;
|
||||
}
|
||||
$data['ip'] = $r->ip;
|
||||
$data['mac'] = $r->mac;
|
||||
$data['serial'] = $r->serial;
|
||||
|
||||
@@ -8,6 +8,7 @@ class DeviceModel
|
||||
public $serial = null;
|
||||
public $comment = null;
|
||||
public $devicetype_id = null;
|
||||
public $parent_id = null;
|
||||
public $pop_id = null;
|
||||
public $addr_street = null;
|
||||
public $addr_number = null;
|
||||
|
||||
9
application/Domain/Domain.php
Normal file
9
application/Domain/Domain.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property mixed|null $name
|
||||
*/
|
||||
class Domain extends mfBaseModel
|
||||
{
|
||||
|
||||
}
|
||||
200
application/Domain/DomainController.php
Normal file
200
application/Domain/DomainController.php
Normal file
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
|
||||
|
||||
class DomainController extends mfBaseController {
|
||||
private User $me;
|
||||
private string $INWX_USER = INWX_USER;
|
||||
private string $INWX_PASS = INWX_PASS;
|
||||
private string $PLESK_USER = PLESK_HOST;
|
||||
private string $PLESK_AUTH = PLESK_AUTH;
|
||||
private Inwx $inwx;
|
||||
private Plesk $plesk;
|
||||
|
||||
|
||||
protected function init(): void {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->layout()->set("me", $me);
|
||||
$this->me = $me;
|
||||
|
||||
if (!$this->me->isAdmin()) {
|
||||
$this->redirect("dashboard");
|
||||
}
|
||||
|
||||
$this->inwx = new Inwx($this->INWX_USER, $this->INWX_PASS);
|
||||
$this->plesk = new Plesk($this->PLESK_USER, $this->PLESK_AUTH);
|
||||
}
|
||||
|
||||
protected function indexAction(): void {
|
||||
$this->layout()->setTemplate("Domain/Index");
|
||||
}
|
||||
|
||||
protected function apiAction() {
|
||||
$do = $this->request->do;
|
||||
|
||||
if ($do !== "getConfig" && !$this->me->is("employee")) {
|
||||
$this->redirect("dashboard");
|
||||
}
|
||||
switch ($do) {
|
||||
case "importAllDomains":
|
||||
$return = $this->importAllDomains();
|
||||
break;
|
||||
case "getDomains":
|
||||
$return = $this->getAllDomains();
|
||||
break;
|
||||
case "getDomainContacts":
|
||||
$return = $this->getDomainContacts();
|
||||
break;
|
||||
case "getDnsRecords":
|
||||
$return = $this->getDnsRecords();
|
||||
break;
|
||||
case "checkDomain":
|
||||
$return = $this->checkDomain();
|
||||
break;
|
||||
default:
|
||||
$return = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$return) {
|
||||
$return = [
|
||||
"status" => "error",
|
||||
"message" => "Invalid request."
|
||||
];
|
||||
}
|
||||
|
||||
die(json_encode($return));
|
||||
}
|
||||
|
||||
protected function importDomain(): void {
|
||||
// use plesk api to get all domains
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function importAllDomains(): array {
|
||||
|
||||
try {
|
||||
$inwxContact = $this->inwx->contactList();
|
||||
$pleskDomains = $this->plesk->getAllDomains();
|
||||
$inwxDomains = $this->inwx->domainList();
|
||||
|
||||
$domains = [];
|
||||
$pleskDomainsArray = [];
|
||||
|
||||
foreach ($pleskDomains as $pleskDomain) {
|
||||
$pleskDomainsArray[$pleskDomain['name']] = $pleskDomain;
|
||||
}
|
||||
|
||||
foreach ($inwxDomains as $inwxDomain) {
|
||||
if (isset($pleskDomainsArray[$inwxDomain['domain']])) {
|
||||
$inwxDomain['plesk'] = [
|
||||
"id" => $pleskDomainsArray[$inwxDomain['domain']]['id'],
|
||||
"hosting_type" => $pleskDomainsArray[$inwxDomain['domain']]['hosting_type'],
|
||||
"created" => strtotime($pleskDomainsArray[$inwxDomain['domain']]['created'])
|
||||
];
|
||||
}
|
||||
|
||||
$domains[] = $inwxDomain;
|
||||
}
|
||||
|
||||
$domainsImport = DomainModel::importDomains($domains);
|
||||
$contactsImport = DomainContactModel::importDomainContacts($inwxContact);
|
||||
|
||||
return [
|
||||
"status" => "success",
|
||||
"importMessages" => [
|
||||
$domainsImport['message'],
|
||||
$contactsImport['message']
|
||||
],
|
||||
];
|
||||
} catch (Exception $e) {
|
||||
$this->log->error("Error while importing domains: " . $e->getMessage());
|
||||
return [
|
||||
"status" => "error",
|
||||
"message" => "Error while importing domains: " . $e->getMessage()
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function getAllDomains(): array {
|
||||
|
||||
$json = json_decode(file_get_contents('php://input'), true);
|
||||
|
||||
$filters = $json['filters'] ?? [];
|
||||
$page = $json['pagination']['page'] ?? 1;
|
||||
$perPage = $json['pagination']['per_page'] ?? 10;
|
||||
|
||||
$domains = DomainModel::getAllDomains($filters, $perPage, $perPage * $page - $perPage);
|
||||
$totalRows = DomainModel::countDomains($filters);
|
||||
|
||||
return [
|
||||
"rows" => $domains,
|
||||
"pagination" => [
|
||||
"page" => $page,
|
||||
"total_pages" => ceil($totalRows / $perPage),
|
||||
"per_page" => $perPage,
|
||||
"total_rows" => intval($totalRows)
|
||||
]
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
private function getDnsRecords() {
|
||||
if (!empty($this->request->domain)) {
|
||||
return ["status" => "error", "message" => "No domain specified."];
|
||||
}
|
||||
|
||||
$domain = $this->request->domain;
|
||||
return array_merge(
|
||||
dns_get_record($domain, DNS_TXT),
|
||||
dns_get_record($domain, DNS_A),
|
||||
dns_get_record($domain, DNS_CNAME),
|
||||
dns_get_record($domain, DNS_MX),
|
||||
dns_get_record($domain, DNS_NS),
|
||||
dns_get_record($domain, DNS_SOA),
|
||||
dns_get_record($domain, DNS_SRV),
|
||||
dns_get_record($domain, DNS_AAAA),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
private function getDomainContacts(): array {
|
||||
$domainContacts = [];
|
||||
$dbDomainContacts = DomainContactModel::getAllDomainContacts();
|
||||
|
||||
foreach ($dbDomainContacts as $dbDomainContact) {
|
||||
$domainContacts[$dbDomainContact['inwxRoId']] = $dbDomainContact;
|
||||
}
|
||||
|
||||
return $domainContacts;
|
||||
}
|
||||
|
||||
private function checkDomain(): array {
|
||||
$domain = $this->request->domain;
|
||||
|
||||
if(empty($domain)) {
|
||||
return ["status" => "error", "message" => "No domain or tld specified."];
|
||||
}
|
||||
|
||||
try {
|
||||
$domainCheck = $this->inwx->domainCheck($domain);
|
||||
|
||||
if($domainCheck['domain'][0]['status'] === "free") {
|
||||
$domainPrice = $this->inwx->domainGetDomainPrice($domain, "reg");
|
||||
} else {
|
||||
$domainPrice = $this->inwx->domainGetDomainPrice($domain, "transfer");
|
||||
}
|
||||
|
||||
$domainCheck['domain'][0]['price'] = $domainPrice;
|
||||
|
||||
return $domainCheck['domain'][0];
|
||||
} catch (Exception $e) {
|
||||
$this->log->error("Error while checking domain: " . $e->getMessage());
|
||||
return ["status" => "error", "message" => "Error while checking domain: " . $e->getMessage()];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
133
application/Domain/DomainModel.php
Normal file
133
application/Domain/DomainModel.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
class DomainModel {
|
||||
public $inwxRoId;
|
||||
public $domain;
|
||||
public $period;
|
||||
public $crDate;
|
||||
public $exDate;
|
||||
public $reDate;
|
||||
public $upDate;
|
||||
public $transferLock;
|
||||
public $status;
|
||||
public $authCode;
|
||||
public $registrant;
|
||||
public $admin;
|
||||
public $tech;
|
||||
public $billing;
|
||||
public $ns;
|
||||
public $pleskId;
|
||||
public $pleskHostingType;
|
||||
public $pleskCreated;
|
||||
|
||||
|
||||
public function __construct($data = []) {
|
||||
foreach ($data as $field => $value) {
|
||||
if (property_exists(get_called_class(), $field)) {
|
||||
$this->$field = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function importDomains($domains): array {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$db->query("TRUNCATE TABLE `Domain`");
|
||||
|
||||
$sql = /** @lang text */
|
||||
"INSERT INTO `Domain` (`inwxRoId`, `domain`, `period`, `crDate`, `exDate`, `reDate`, `upDate`, `transferLock`, `status`, `authCode`, `registrant`, `admin`, `tech`, `billing`, `ns`, `pleskId`, `pleskHostingType`, `pleskCreated`) VALUES ";
|
||||
$values = [];
|
||||
foreach ($domains as $domain) {
|
||||
$valueStr = "(" .
|
||||
$domain['roId'] . ", '" .
|
||||
$domain['domain'] . "', '" .
|
||||
$domain['period'] . "', " .
|
||||
$domain['crDate']['timestamp'] . ", " .
|
||||
(isset($domain['reDate']) ? $domain['reDate']['timestamp'] : "NULL") . ", " .
|
||||
(isset($domain['reDate']) ? $domain['reDate']['timestamp'] : "NULL") . ", " .
|
||||
$domain['upDate']['timestamp'] . ", " .
|
||||
($domain['transferLock'] ? 1 : 0) . ", '" .
|
||||
$domain['status'] . "', '" .
|
||||
$domain['authCode'] . "', " .
|
||||
$domain['registrant'] . ", " .
|
||||
$domain['admin'] . ", " .
|
||||
$domain['tech'] . ", " .
|
||||
$domain['billing'] . ", '" .
|
||||
implode(", ", $domain['ns']) . "', ";
|
||||
|
||||
// Check if 'pleskId' is set
|
||||
if (isset($domain['plesk']) && is_array($domain['plesk'])) {
|
||||
$valueStr .= $domain['plesk']['id'] . ", ";
|
||||
$valueStr .= "'" . $domain['plesk']['hosting_type'] . "', ";
|
||||
$valueStr .= $domain['plesk']['created'];
|
||||
} else {
|
||||
$valueStr .= "NULL, NULL, NULL";
|
||||
}
|
||||
|
||||
$values[] = $valueStr . ")";
|
||||
}
|
||||
$sql .= implode(", ", $values);
|
||||
$db->query($sql);
|
||||
return [
|
||||
"message" => "Imported " . count($domains) . " domains."
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate SQL Filter condition (space separated) for a given column.
|
||||
*
|
||||
* @param string|null $filterValue The filter value to match against.
|
||||
* @param string $columnName The name of the column in the database table.
|
||||
* @return string The SQL condition generated based on the filter value and column name.
|
||||
*/
|
||||
public static function generateFilterCondition(?string $filterValue, string $columnName): string {
|
||||
$sql = "";
|
||||
if (!empty($filterValue)) {
|
||||
$filterItems = explode(" ", $filterValue);
|
||||
foreach ($filterItems as $item) {
|
||||
$sql .= " AND `$columnName` LIKE '%" . $item . "%'";
|
||||
}
|
||||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
public static function getSqlFilter($filters): string {
|
||||
$sql = isset($filters['domain']) ? self::generateFilterCondition($filters['domain'], "domain") : "";
|
||||
$sql .= isset($filters['crDate']) ? " AND `crDate` = " . $filters['crDate'] : "";
|
||||
$sql .= isset($filters['exDate']) ? " AND `exDate` = " . $filters['exDate'] : "";
|
||||
$sql .= isset($filters['reDate']) ? " AND `reDate` = " . $filters['reDate'] : "";
|
||||
$sql .= isset($filters['upDate']) ? " AND `upDate` = " . $filters['upDate'] : "";
|
||||
$sql .= isset($filters['status']) ? " AND `status` = '" . $filters['status'] . "'" : "";
|
||||
$sql .= isset($filters['transferLock']) && $filters['transferLock'] == 1 ? " AND `transferLock` = true" : "";
|
||||
$sql .= isset($filters['authCode']) ? self::generateFilterCondition($filters['authCode'], "authCode") : "";
|
||||
$sql .= isset($filters['registrant']) && $filters['registrant'] !== 'all' ? " AND `registrant` = " . $filters['registrant'] : "";
|
||||
$sql .= isset($filters['admin']) && $filters['admin'] !== 'all' ? " AND `admin` = " . $filters['admin'] : "";
|
||||
$sql .= isset($filters['tech']) && $filters['tech'] !== 'all' ? " AND `tech` = " . $filters['tech'] : "";
|
||||
$sql .= isset($filters['billing']) && $filters['billing'] !== 'all' ? " AND `billing` = " . $filters['billing'] : "";
|
||||
$sql .= isset($filters['ns']) ? self::generateFilterCondition($filters['ns'], "ns") : "";
|
||||
return $sql;
|
||||
|
||||
}
|
||||
|
||||
public static function getAllDomains($filters, $limit = null, $offset = 0): array {
|
||||
$db = FronkDB::singleton();
|
||||
$sql = "SELECT * FROM `Domain` WHERE 1 " . self::getSqlFilter($filters);
|
||||
$sql .= $limit === null ? "" : " LIMIT " . $limit . " OFFSET " . $offset;
|
||||
|
||||
$result = $db->query($sql);
|
||||
$rows = [];
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$rows[] = new DomainModel($row);
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public static function countDomains($filters) {
|
||||
$db = FronkDB::singleton();
|
||||
$sql = "SELECT COUNT(*) as `total_rows` FROM `Domain` WHERE 1 " . self::getSqlFilter($filters);
|
||||
$result = $db->query($sql);
|
||||
return $result->fetch_assoc()['total_rows'];
|
||||
}
|
||||
}
|
||||
8
application/DomainContact/DomainContact.php
Normal file
8
application/DomainContact/DomainContact.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property mixed|null $name
|
||||
*/
|
||||
class DomainContact extends mfBaseModel {
|
||||
|
||||
}
|
||||
121
application/DomainContact/DomainContactModel.php
Normal file
121
application/DomainContact/DomainContactModel.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
class DomainContactModel {
|
||||
|
||||
public $id;
|
||||
public $roId;
|
||||
public $type;
|
||||
public $name;
|
||||
public $street;
|
||||
public $city;
|
||||
public $pc;
|
||||
public $cc;
|
||||
public $voice;
|
||||
public $email;
|
||||
public $protection;
|
||||
public $usedCount;
|
||||
public $verificationStatus;
|
||||
|
||||
|
||||
public function __construct($data = []) {
|
||||
foreach ($data as $field => $value) {
|
||||
if (property_exists(get_called_class(), $field)) {
|
||||
$this->$field = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function importDomainContacts($domainContacts): array {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$db->query("TRUNCATE TABLE `DomainContact`");
|
||||
|
||||
$sql = /** @lang text */
|
||||
"INSERT INTO `DomainContact` (`inwxRoId`, `type`, `name`, `street`, `city`, `pc`, `cc`, `voice`, `email`, `protection`, `verificationStatus`, `usedCount`) VALUES ";
|
||||
$values = [];
|
||||
|
||||
foreach ($domainContacts as $domainContact) {
|
||||
$valueStr = "(" .
|
||||
$domainContact['roId'] . ", '" .
|
||||
$domainContact['type'] . "', '" .
|
||||
$domainContact['name'] . "', '" .
|
||||
$domainContact['street'] . "', '" .
|
||||
$domainContact['city'] . "', '" .
|
||||
$domainContact['pc'] . "', '" .
|
||||
$domainContact['cc'] . "', '" .
|
||||
$domainContact['voice'] . "', '" .
|
||||
$domainContact['email'] . "', " .
|
||||
($domainContact['protection'] ? 1 : 0) . ", '" .
|
||||
$domainContact['verificationStatus'] . "', ";
|
||||
|
||||
$valueStr .= $domainContact['usedCount'] ?? "NULL";
|
||||
$valueStr .= ")";
|
||||
|
||||
$values[] = $valueStr;
|
||||
}
|
||||
|
||||
$sql .= implode(", ", $values);
|
||||
$db->query($sql);
|
||||
return [
|
||||
"message" => "Imported " . count($domainContacts) . " domain contacts."
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate SQL Filter condition (space separated) for a given column.
|
||||
*
|
||||
* @param string|null $filterValue The filter value to match against.
|
||||
* @param string $columnName The name of the column in the database table.
|
||||
* @return string The SQL condition generated based on the filter value and column name.
|
||||
*/
|
||||
public static function generateFilterCondition(?string $filterValue, string $columnName): string {
|
||||
$sql = "";
|
||||
if (!empty($filterValue)) {
|
||||
$filterItems = explode(" ", $filterValue);
|
||||
foreach ($filterItems as $item) {
|
||||
$sql .= " AND `$columnName` LIKE '%" . $item . "%'";
|
||||
}
|
||||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
public static function getSqlFilter($filters): string {
|
||||
$sql = isset($filters['roId']) ? " AND `inwxRoId` = " . $filters['roId'] : "";
|
||||
$sql .= isset($filters['type']) ? " AND `type` = '" . $filters['type'] . "'" : "";
|
||||
$sql .= isset($filters['name']) ? self::generateFilterCondition($filters['name'], "name") : "";
|
||||
$sql .= isset($filters['street']) ? self::generateFilterCondition($filters['street'], "street") : "";
|
||||
$sql .= isset($filters['city']) ? self::generateFilterCondition($filters['city'], "city") : "";
|
||||
$sql .= isset($filters['pc']) ? " AND `pc` = " . $filters['pc'] : "";
|
||||
$sql .= isset($filters['cc']) ? " AND `cc` = " . $filters['cc'] : "";
|
||||
$sql .= isset($filters['voice']) ? " AND `voice` = " . $filters['voice'] : "";
|
||||
$sql .= isset($filters['email']) ? self::generateFilterCondition($filters['email'], "email") : "";
|
||||
$sql .= isset($filters['protection']) ? " AND `protection` = " . $filters['protection'] : "";
|
||||
$sql .= isset($filters['usedCount']) ? " AND `usedCount` = " . $filters['usedCount'] : "";
|
||||
$sql .= isset($filters['verificationStatus']) ? " AND `verificationStatus` = '" . $filters['verificationStatus'] . "'" : "";
|
||||
return $sql;
|
||||
|
||||
}
|
||||
|
||||
public static function getAllDomainContacts($filters = null, $limit = null, $offset = 0, $raw_array = true): array {
|
||||
$db = FronkDB::singleton();
|
||||
$sql = "SELECT * FROM `DomainContact` WHERE 1 ";
|
||||
$sql .= $filters === null ? "" : self::getSqlFilter($filters);
|
||||
$sql .= $limit === null ? "" : " LIMIT " . $limit . " OFFSET " . $offset;
|
||||
|
||||
$result = $db->query($sql);
|
||||
$rows = [];
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$rows[] = $raw_array ? $row : new DomainContactModel($row);
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public static function countDomainContacts($filters) {
|
||||
$db = FronkDB::singleton();
|
||||
$sql = "SELECT COUNT(*) as `total_rows` FROM `DomainContact` WHERE 1 " . self::getSqlFilter($filters);
|
||||
$result = $db->query($sql);
|
||||
return $result->fetch_assoc()['total_rows'];
|
||||
}
|
||||
}
|
||||
59
application/FiberPlanDispatcher/FiberPlanDispatcher.php
Normal file
59
application/FiberPlanDispatcher/FiberPlanDispatcher.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
class FiberPlanDispatcher extends mfBaseModel
|
||||
{
|
||||
private $editor;
|
||||
private $network;
|
||||
private $creator;
|
||||
|
||||
|
||||
public function getProperty($name)
|
||||
{
|
||||
if ($this->$name == null) {
|
||||
|
||||
if (!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if($name == "creator") {
|
||||
$this->creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
|
||||
if($this->creator === null) {
|
||||
$this->creator = new User($this->create_by);
|
||||
if($this->creator->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator);
|
||||
}
|
||||
}
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if($name == "editor") {
|
||||
$this->editor = mfValuecache::singleton()->get("Worker-id-".$this->edit_by);
|
||||
if($this->editor === null) {
|
||||
$this->editor = new User($this->edit_by);
|
||||
if($this->editor->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-".$this->edit_by, $this->editor);
|
||||
}
|
||||
}
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield);
|
||||
if(!$this->$name) {
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
}
|
||||
|
||||
if($this->$name->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-$name-".$this->$name->id, $this->$name);
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
class FiberPlanDispatcherController extends mfBaseController
|
||||
{
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
|
||||
$this->layout()->setTemplate("FiberPlanDispatcher/Index");
|
||||
$fiberplandispatchers = FiberPlanDispatcherModel::getAll();
|
||||
$this->layout()->set("fiberplandispatchers", $fiberplandispatchers);
|
||||
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
$this->layout()->setTemplate("FiberPlanDispatcher/Form");
|
||||
$networks = NetworkModel::getAll();
|
||||
$this->layout()->set("networks", $networks);
|
||||
$networkaddresses = NetworkAddressModel::getAll();
|
||||
$this->layout()->set("networkaddresses", $networkaddresses);
|
||||
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("Verteiler/Schacht nicht gefunden", "error");
|
||||
$this->redirect("FiberPlanDispatcher");
|
||||
}
|
||||
|
||||
$fiberplandispatchers = new FiberPlanDispatcher($id);
|
||||
if ($fiberplandispatchers->id != $id) {
|
||||
$this->layout()->setFlash("Verteiler/Schacht nicht gefunden", "error");
|
||||
$this->redirect("FiberPlanDispatcher");
|
||||
}
|
||||
|
||||
$this->layout()->set("fiberplandispatchers", $fiberplandispatchers);
|
||||
if ($fiberplandispatchers->object_type == "2") {
|
||||
$sleeves = FiberPlanDispatchersleeveModel::getAllbyDispatcher($id);
|
||||
$this->layout()->set("sleeves", $sleeves);
|
||||
}
|
||||
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
protected function saveAction()
|
||||
{
|
||||
$r = $this->request;
|
||||
$id = $r->id;
|
||||
//var_dump($r->get());exit;
|
||||
if (is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
$fiberplandispatcher = new FiberPlanDispatcher($id);
|
||||
if (!$fiberplandispatcher->id) {
|
||||
$this->layout()->setFlash("Verteiler/Schacht nicht gefunden", "error");
|
||||
$this->redirect("FiberPlanDispatcher");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['network_id'] = trim($r->network_id);
|
||||
$data['object_type'] = trim($r->object_type);
|
||||
$data['description'] = trim($r->description);
|
||||
if ($r->type) {
|
||||
$data['type'] = trim($r->type);
|
||||
}
|
||||
if ($r->gps_lat) {
|
||||
$data['gps_lat'] = trim($r->gps_lat);
|
||||
}
|
||||
if ($r->gps_long) {
|
||||
$data['gps_long'] = trim($r->gps_long);
|
||||
}
|
||||
if ($r->comment) {
|
||||
$data['comment'] = trim($r->comment);
|
||||
}
|
||||
|
||||
if (!$data['network_id']) {
|
||||
$this->layout()->setFlash("Netzgebiet darf nicht leer sein", "error");
|
||||
$this->redirect("FiberPlanDispatcher");
|
||||
}
|
||||
if (!$data['object_type']) {
|
||||
$this->layout()->setFlash("Objekt Typ darf nicht leer sein", "error");
|
||||
$this->redirect("FiberPlanDispatcher");
|
||||
}
|
||||
if (!$data['description']) {
|
||||
$this->layout()->setFlash("Beschreibung darf nicht leer sein", "error");
|
||||
$this->redirect("FiberPlanDispatcher");
|
||||
}
|
||||
|
||||
// var_dump($_FILES);
|
||||
// var_dump($upload);
|
||||
// exit;
|
||||
|
||||
|
||||
if ($mode == "edit") {
|
||||
$fiberplandispatcher->update($data);
|
||||
|
||||
} else {
|
||||
$fiberplandispatcher = FiberPlanDispatcherModel::create($data);
|
||||
|
||||
}
|
||||
// var_dump($filestore);
|
||||
// exit;
|
||||
$id = $fiberplandispatcher->save();
|
||||
if ($mode == "edit") {
|
||||
if ($data['object_type'] == "2") {
|
||||
FiberPlanDispatchersleeveModel::deletebyDispatcher($id);
|
||||
$sleeves = $r->sleeves;
|
||||
$sleevedata = [];
|
||||
if (is_array($sleeves)) {
|
||||
foreach ($sleeves as $sleeve) {
|
||||
$sleevedata['name'] = trim($sleeve);
|
||||
$sleevedata['fiberPlanDispatcher_id'] = $id;
|
||||
$fiberplandispatchersleeve = FiberPlanDispatchersleeveModel::create($sleevedata);
|
||||
$fiberplandispatchersleeve->save();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
if ($data['object_type'] == "2") {
|
||||
$sleeves = $r->sleeves;
|
||||
$sleevedata = [];
|
||||
|
||||
if (is_array($sleeves)) {
|
||||
foreach ($sleeves as $sleeve) {
|
||||
$sleevedata['name'] = trim($sleeve);
|
||||
$sleevedata['fiberPlanDispatcher_id'] = $id;
|
||||
$fiberplandispatchersleeve = FiberPlanDispatchersleeveModel::create($sleevedata);
|
||||
$fiberplandispatchersleeve->save();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!$id) {
|
||||
$this->layout()->setFlash("Verteiler/Schacht konnte nicht angelegt werden", "error");
|
||||
$this->redirect("FiberPlanDispatcher");
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
$this->layout()->setFlash("Verteiler/Schacht erfolgreich geändert", "success");
|
||||
} else if ($mode = "add") {
|
||||
$this->layout()->setFlash("Verteiler/Schacht erfolgreich angelegt", "success");
|
||||
}
|
||||
$this->redirect("FiberPlanDispatcher");
|
||||
}
|
||||
|
||||
|
||||
protected function deleteAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
$fiberplandispatcher = new FiberPlanDispatcher($id);
|
||||
if (!$fiberplandispatcher->id || $fiberplandispatcher->id != $id) {
|
||||
$this->layout()->setFlash("Verteiler/Schacht nicht gefunden.", "error");
|
||||
$this->redirect("FiberPlanDispatcher");
|
||||
}
|
||||
|
||||
$fiberplandispatcher->delete();
|
||||
$this->redirect("FiberPlanDispatcher");
|
||||
}
|
||||
|
||||
}
|
||||
137
application/FiberPlanDispatcher/FiberPlanDispatcherModel.php
Normal file
137
application/FiberPlanDispatcher/FiberPlanDispatcherModel.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
class FiberPlanDispatcherModel
|
||||
{
|
||||
public $network_id = null;
|
||||
public $object_type = null;
|
||||
public $price = null;
|
||||
public $gps_lat = null;
|
||||
public $gps_long = null;
|
||||
public $type = null;
|
||||
public $comment = null;
|
||||
public $description = null;
|
||||
|
||||
|
||||
public $create_by = null;
|
||||
public $edit_by = null;
|
||||
public $create = null;
|
||||
public $edit = null;
|
||||
|
||||
public static function find($data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static function create(array $data)
|
||||
{
|
||||
$model = new FiberPlanDispatcher();
|
||||
|
||||
foreach ($data as $field => $value) {
|
||||
if (property_exists(get_called_class(), $field)) {
|
||||
if (substr($field, 0, 5) == "vlan_" && !$value) {
|
||||
$model->$field = null;
|
||||
continue;
|
||||
}
|
||||
$model->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = mfValuecache::singleton()->get("me");
|
||||
if (!$me) {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
mfValuecache::singleton()->set("me", $me);
|
||||
}
|
||||
|
||||
if ($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if ($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getOne($id)
|
||||
{
|
||||
if (!is_numeric($id) || !$id) {
|
||||
throw new Exception("Invalid number", 400);
|
||||
}
|
||||
$item = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("Devicetype", "*", "id=$id LIMIT 1");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Devicetype($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("FiberPlanDispatcher", "*", "1=1 ORDER BY network_id");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new FiberPlanDispatcher($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst()
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("Devicetype", "*", "$where ORDER BY name, network_id");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Devicetype($data);
|
||||
if ($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function search($filter)
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("Devicetype", "*", "$where ORDER BY name, network_id");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new Devicetype($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter)
|
||||
{
|
||||
$where = "1=1 ";
|
||||
|
||||
//var_dump($filter);exit;
|
||||
if (array_key_exists("network_id", $filter)) {
|
||||
$networkid = $filter['network_id'];
|
||||
if (is_numeric($networkid)) {
|
||||
$where .= " AND network_id=$networkid";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
class FiberPlanDispatchersleeve extends mfBaseModel
|
||||
{
|
||||
private $editor;
|
||||
private $creator;
|
||||
private $fiberPlanDispatcher;
|
||||
|
||||
|
||||
|
||||
public function getProperty($name)
|
||||
{
|
||||
if ($this->$name == null) {
|
||||
|
||||
if (!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if($name == "creator") {
|
||||
$this->creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
|
||||
if($this->creator === null) {
|
||||
$this->creator = new User($this->create_by);
|
||||
if($this->creator->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator);
|
||||
}
|
||||
}
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if($name == "editor") {
|
||||
$this->editor = mfValuecache::singleton()->get("Worker-id-".$this->edit_by);
|
||||
if($this->editor === null) {
|
||||
$this->editor = new User($this->edit_by);
|
||||
if($this->editor->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-".$this->edit_by, $this->editor);
|
||||
}
|
||||
}
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield);
|
||||
if(!$this->$name) {
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
}
|
||||
|
||||
if($this->$name->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-$name-".$this->$name->id, $this->$name);
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
class FiberPlanDispatchersleeveController extends mfBaseController
|
||||
{
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
|
||||
$this->layout()->setTemplate("FiberPlanDispatchersleeve/Index");
|
||||
$fiberplandispatchersleeves = FiberPlanDispatchersleeveModel::getAll();
|
||||
$this->layout()->set("fiberplandispatchersleeves", $fiberplandispatchersleeves);
|
||||
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
$fiberPlanDispatchers=FiberPlanDispatcherModel::getAll();
|
||||
$this->layout()->set("fiberPlanDispatchers", $fiberPlanDispatchers);
|
||||
|
||||
$this->layout()->setTemplate("FiberPlanDispatchersleeve/Form");
|
||||
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("Muffen nicht gefunden", "error");
|
||||
$this->redirect("FiberPlanDispatchersleeve");
|
||||
}
|
||||
|
||||
$fiberplandispatchersleeves = new FiberPlanDispatchersleeve($id);
|
||||
if ($fiberplandispatchersleeves->id != $id) {
|
||||
$this->layout()->setFlash("Muffen nicht gefunden", "error");
|
||||
$this->redirect("FiberPlanDispatchersleeve");
|
||||
}
|
||||
|
||||
$this->layout()->set("fiberplandispatchersleeves", $fiberplandispatchersleeves);
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
protected function saveAction()
|
||||
{
|
||||
$r = $this->request;
|
||||
$id = $r->id;
|
||||
//var_dump($r->get());exit;
|
||||
if (is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
$fiberplandispatchersleeves = new FiberPlanDispatchersleeve($id);
|
||||
if (!$fiberplandispatchersleeves->id) {
|
||||
$this->layout()->setFlash("Muffe nicht gefunden", "error");
|
||||
$this->redirect("FiberPlanDispatchersleeve");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['fiberPlanDispatcher_id'] = trim($r->fiberPlanDispatcher_id);
|
||||
$data['name'] = trim($r->name);
|
||||
|
||||
|
||||
if (!$data['fiberPlanDispatcher_id']) {
|
||||
$data['fiberPlanDispatcher_id']=NULL;
|
||||
}
|
||||
if (!$data['name']) {
|
||||
$data['name']=NULL;
|
||||
}
|
||||
|
||||
|
||||
// var_dump($_FILES);
|
||||
// var_dump($upload);
|
||||
// exit;
|
||||
|
||||
|
||||
if ($mode == "edit") {
|
||||
$fiberplandispatchersleeves->update($data);
|
||||
|
||||
} else {
|
||||
$fiberplandispatchersleeves = FiberPlanDispatchersleeveModel::create($data);
|
||||
}
|
||||
// var_dump($filestore);
|
||||
// exit;
|
||||
$id = $fiberplandispatchersleeves->save();
|
||||
|
||||
if (!$id) {
|
||||
$this->layout()->setFlash("Muffen konnte nicht angelegt werden", "error");
|
||||
$this->redirect("FiberPlanDispatchersleeve");
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
$this->layout()->setFlash("Muffen erfolgreich geändert", "success");
|
||||
} else if ($mode = "add") {
|
||||
$this->layout()->setFlash("Muffen erfolgreich angelegt", "success");
|
||||
}
|
||||
$this->redirect("FiberPlanDispatchersleeve");
|
||||
}
|
||||
|
||||
|
||||
protected function deleteAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
$fiberplandispatchersleeves = new FiberPlanDispatchersleeve($id);
|
||||
if (!$fiberplandispatchersleeves->id || $fiberplandispatchersleeves->id != $id) {
|
||||
$this->layout()->setFlash("Muffen nicht gefunden.", "error");
|
||||
$this->redirect("FiberPlanDispatchersleeve");
|
||||
}
|
||||
|
||||
$fiberplandispatchersleeves->delete();
|
||||
$this->redirect("FiberPlanDispatchersleeve");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
class FiberPlanDispatchersleeveModel
|
||||
{
|
||||
private $fiberPlanDispatcher_id;
|
||||
private $name;
|
||||
|
||||
|
||||
public static function find($data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static function create(array $data)
|
||||
{
|
||||
$model = new FiberPlanDispatchersleeve();
|
||||
|
||||
foreach ($data as $field => $value) {
|
||||
if (property_exists(get_called_class(), $field)) {
|
||||
if (substr($field, 0, 5) == "vlan_" && !$value) {
|
||||
$model->$field = null;
|
||||
continue;
|
||||
}
|
||||
$model->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = mfValuecache::singleton()->get("me");
|
||||
if (!$me) {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
mfValuecache::singleton()->set("me", $me);
|
||||
}
|
||||
|
||||
if ($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if ($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getOne($id)
|
||||
{
|
||||
if (!is_numeric($id) || !$id) {
|
||||
throw new Exception("Invalid number", 400);
|
||||
}
|
||||
$item = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("FiberPlanDispatchersleeve", "*", "id=$id LIMIT 1");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new FiberPlanDispatchersleeve($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("FiberPlanDispatchersleeve", "*", "1=1");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new FiberPlanDispatchersleeve($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst()
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("FiberPlanDispatchersleeve", "*", "$where ");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new FiberPlanDispatchersleeve($data);
|
||||
if ($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function search($filter)
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("FiberPlanDispatchersleeve", "*", "$where");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new FiberPlanDispatchersleeve($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter)
|
||||
{
|
||||
$where = "1=1 ";
|
||||
|
||||
//var_dump($filter);exit;
|
||||
if (array_key_exists("network_id", $filter)) {
|
||||
$networkid = $filter['network_id'];
|
||||
if (is_numeric($networkid)) {
|
||||
$where .= " AND network_id=$networkid";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
public static function getAllbyDispatcher($dispatcher_id)
|
||||
{
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
$sql = "SELECT `id`, `fiberPlanDispatcher_id`, `name` FROM `FiberPlanDispatchersleeve`
|
||||
WHERE `fiberPlanDispatcher_id`='" . $dispatcher_id . "'";
|
||||
|
||||
$res = $db->query($sql);
|
||||
if ($db->num_rows($res)) {
|
||||
$oldrackid = "";
|
||||
$counter = -1;
|
||||
while ($data = $db->fetch_array($res)) {
|
||||
$items[] = $data;
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
|
||||
public static function deletebyDispatcher($dispatcher_id)
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
$sql = "DELETE FROM `FiberPlanDispatchersleeve` WHERE `fiberPlanDispatcher_id`='" . $dispatcher_id . "'";
|
||||
$db->query($sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
62
application/FiberPlanPipe/FiberPlanPipe.php
Normal file
62
application/FiberPlanPipe/FiberPlanPipe.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
class FiberPlanPipe extends mfBaseModel
|
||||
{
|
||||
private $editor;
|
||||
private $creator;
|
||||
private $network;
|
||||
private $fiberPlanPipeManufacturer;
|
||||
private $fiberPlanPipeTemplate;
|
||||
|
||||
|
||||
|
||||
public function getProperty($name)
|
||||
{
|
||||
if ($this->$name == null) {
|
||||
|
||||
if (!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if($name == "creator") {
|
||||
$this->creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
|
||||
if($this->creator === null) {
|
||||
$this->creator = new User($this->create_by);
|
||||
if($this->creator->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator);
|
||||
}
|
||||
}
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if($name == "editor") {
|
||||
$this->editor = mfValuecache::singleton()->get("Worker-id-".$this->edit_by);
|
||||
if($this->editor === null) {
|
||||
$this->editor = new User($this->edit_by);
|
||||
if($this->editor->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-".$this->edit_by, $this->editor);
|
||||
}
|
||||
}
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield);
|
||||
if(!$this->$name) {
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
}
|
||||
|
||||
if($this->$name->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-$name-".$this->$name->id, $this->$name);
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
}
|
||||
281
application/FiberPlanPipe/FiberPlanPipeController.php
Normal file
281
application/FiberPlanPipe/FiberPlanPipeController.php
Normal file
@@ -0,0 +1,281 @@
|
||||
<?php
|
||||
|
||||
class FiberPlanPipeController extends mfBaseController
|
||||
{
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
$networks = NetworkModel::getAll();
|
||||
$this->layout()->setTemplate("FiberPlanPipe/Index");
|
||||
$fiberplanpipes = FiberPlanPipeModel::getAll();
|
||||
$pipworkeraddresses = FiberPlanPipeModel::getPipeworkerAddresses();
|
||||
$buildings = FiberPlanPipeModel::getBuildingInfoAll();
|
||||
$this->layout()->set("networks", $networks);
|
||||
$this->layout()->set("buildings", $buildings);
|
||||
$this->layout()->set("pipworkeraddresses", $pipworkeraddresses);
|
||||
$this->layout()->set("fiberplanpipes", $fiberplanpipes);
|
||||
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
$networks = NetworkModel::getAll();
|
||||
$fiberplanpipetemplates = FiberPlanPipeModel::getTemplates();
|
||||
$pipworkeraddresses = FiberPlanPipeModel::getPipeworkerAddresses();
|
||||
$this->layout()->set("networks", $networks);
|
||||
$this->layout()->set("pipworkeraddresses", $pipworkeraddresses);
|
||||
$this->layout()->set("fiberplanpipetemplates", $fiberplanpipetemplates);
|
||||
|
||||
$this->layout()->setTemplate("FiberPlanPipe/Form");
|
||||
|
||||
}
|
||||
|
||||
protected function apiAction()
|
||||
{
|
||||
$do = $this->request->do;
|
||||
$network = $this->request->network_id;
|
||||
$bdtype = $this->request->bdtype;
|
||||
|
||||
|
||||
switch ($do) {
|
||||
case "getBuildingInfo":
|
||||
$return = $this->getBuildingInfo($network, $bdtype);
|
||||
break;
|
||||
case "getPops":
|
||||
$return = $this->getPops($network);
|
||||
break;
|
||||
default:
|
||||
$return = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function detailAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
$networks = NetworkModel::getAll();
|
||||
$this->layout()->setTemplate("FiberPlanPipe/Detail");
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("Rohrverzeichnis nicht gefunden", "error");
|
||||
$this->redirect("FiberPlanPipe");
|
||||
}
|
||||
$fiberplanpipes = new FiberPlanPipe($id);
|
||||
if ($fiberplanpipes->id != $id) {
|
||||
$this->layout()->setFlash("Rohrverzeichnis nicht gefunden", "error");
|
||||
$this->redirect("FiberPlanPipe");
|
||||
}
|
||||
$this->layout()->set("fiberplanpipes", $fiberplanpipes);
|
||||
$pipworkeraddresses = FiberPlanPipeModel::getPipeworkerAddresses();
|
||||
$buildings = FiberPlanPipeModel::getBuildingInfoAll();
|
||||
$fiberplanpipeendpoints = FiberPlanPipeEndpointModel::search(['fiberPlanPipe_id' => $id]);
|
||||
$this->layout()->set("networks", $networks);
|
||||
$this->layout()->set("buildings", $buildings);
|
||||
$this->layout()->set("pipworkeraddresses", $pipworkeraddresses);
|
||||
$this->layout()->set("fiberplanpipeendpoints", $fiberplanpipeendpoints);
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("Rohrverzeichnis nicht gefunden", "error");
|
||||
$this->redirect("FiberPlanPipe");
|
||||
}
|
||||
|
||||
$fiberplanpipes = new FiberPlanPipe($id);
|
||||
if ($fiberplanpipes->id != $id) {
|
||||
$this->layout()->setFlash("Rohrverzeichnis nicht gefunden", "error");
|
||||
$this->redirect("FiberPlanPipe");
|
||||
}
|
||||
$fiberplanpipeendpoints = FiberPlanPipeEndpointModel::search(['fiberPlanPipe_id' => $id]);
|
||||
$this->layout()->set("fiberplanpipeendpoints", $fiberplanpipeendpoints);
|
||||
$this->layout()->set("fiberplanpipes", $fiberplanpipes);
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
protected function saveAction()
|
||||
{
|
||||
$r = $this->request;
|
||||
$id = $r->id;
|
||||
var_dump($r->get());
|
||||
die();
|
||||
if (is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
$fiberplanpipes = new FiberPlanPipe($id);
|
||||
if (!$fiberplanpipes->id) {
|
||||
$this->layout()->setFlash("Rohrverzeichnisse nicht gefunden", "error");
|
||||
$this->redirect("FiberPlanPipe");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['description'] = trim($r->description);
|
||||
$data['gisid'] = trim($r->gisid);
|
||||
$data['type'] = trim($r->type);
|
||||
$data['type_description'] = trim($r->type_description);
|
||||
$data['fiberplanpipetemplate_id'] = trim($r->fiberplanpipetemplate_id);
|
||||
$data['length'] = trim($r->length);
|
||||
$data['status'] = trim($r->status);
|
||||
$data['responsible'] = trim($r->responsible);
|
||||
$data['responsible_text'] = trim($r->responsible_text);
|
||||
$data['address_id'] = trim($r->address_id);
|
||||
$data['comment'] = trim($r->comment);
|
||||
|
||||
$returnUrl = "FiberPlanPipe";
|
||||
$returnAction = "Index";
|
||||
$returnVariables = array();
|
||||
$returnAnker = "";
|
||||
if ($this->request->returnto) {
|
||||
|
||||
if (strpos($this->request->returnto, "-") !== false) {
|
||||
$urls = explode('-', $this->request->returnto);
|
||||
$urlCounter = 0;
|
||||
$returnUrlGen = "";
|
||||
foreach ($urls as $url) {
|
||||
if ($urlCounter > 0) {
|
||||
$returnUrlGen .= "/";
|
||||
$returnUrlGen .= ucfirst($url);
|
||||
} else {
|
||||
$returnUrlGen .= 'FiberPlanPipe';
|
||||
}
|
||||
$urlCounter++;
|
||||
}
|
||||
$returnAction = "";
|
||||
$returnVariables['id'] = $id;
|
||||
$returnUrl = $returnUrlGen;
|
||||
} else {
|
||||
$returnUrl = ucfirst($this->request->returnto);
|
||||
|
||||
}
|
||||
}
|
||||
if (!$data['description']) {
|
||||
$this->layout()->setFlash("Bezeichnung darf nicht leer sein", "error");
|
||||
$this->redirect("FiberPlanPipe");
|
||||
}
|
||||
if (!$data['type']) {
|
||||
$data['type'] = NULL;
|
||||
}
|
||||
if (!$data['gisid']) {
|
||||
$data['gisid'] = NULL;
|
||||
}
|
||||
if (!$data['responsible_text']) {
|
||||
$data['responsible_text'] = NULL;
|
||||
}
|
||||
if (!$data['address_id']) {
|
||||
$data['address_id'] = NULL;
|
||||
}
|
||||
if (!$data['type_description']) {
|
||||
$data['type_description'] = NULL;
|
||||
}
|
||||
if (!$data['fiberplanpipetemplate_id']) {
|
||||
$data['fiberplanpipetemplate_id'] = NULL;
|
||||
}
|
||||
if (!$data['length']) {
|
||||
$data['length'] = NULL;
|
||||
}
|
||||
if (!$data['startpoint']) {
|
||||
$data['startpoint'] = NULL;
|
||||
}
|
||||
if (!$data['endpoint']) {
|
||||
$data['endpoint'] = NULL;
|
||||
}
|
||||
if (!$data['status']) {
|
||||
$data['status'] = NULL;
|
||||
}
|
||||
if (!$data['responsible']) {
|
||||
$data['responsible'] = NULL;
|
||||
}
|
||||
if (!$data['comment']) {
|
||||
$data['comment'] = NULL;
|
||||
}
|
||||
|
||||
|
||||
// var_dump($_FILES);
|
||||
// var_dump($upload);
|
||||
// exit;
|
||||
|
||||
|
||||
if ($mode == "edit") {
|
||||
$fiberplanpipes->update($data);
|
||||
|
||||
} else {
|
||||
$fiberplanpipes = FiberPlanPipeModel::create($data);
|
||||
}
|
||||
// var_dump($filestore);
|
||||
// exit;
|
||||
$id = $fiberplanpipes->save();
|
||||
|
||||
$endpoint_id = $r->endpointid;
|
||||
$endpoint_type = $r->endpoint_type;
|
||||
$endpoint = $r->endpoint;
|
||||
|
||||
if (!empty($endpoint)) {
|
||||
$counter = 1;
|
||||
foreach ($endpoint as $key => $Endpoint) {
|
||||
if ($endpoint_type[$key] == 4) {
|
||||
$endpointarray['fiberPlanDispatcher_id'] = $Endpoint;
|
||||
} else if ($endpoint_type[$key] == 2) {
|
||||
$endpointarray['pop_id'] = $Endpoint;
|
||||
}
|
||||
$endpointarray['fiberPlanPipe_id'] = $id;
|
||||
$endpointarray['sort'] = $counter;
|
||||
if ($endpoint_id[$key]) {
|
||||
$fiberplanpipeendpoint = new FiberPlanPipeEndpoint($id);
|
||||
$fiberplanpipeendpoint->update($endpointarray);
|
||||
} else {
|
||||
$fiberplanpipeendpoint = FiberPlanPipeEndpointModel::create($endpointarray);
|
||||
}
|
||||
$fiberplanpipeendpoint->save();
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!$id) {
|
||||
$this->layout()->setFlash("Rohrverzeichnis konnte nicht angelegt werden", "error");
|
||||
$this->redirect($returnUrl, $returnAction, $returnVariables, $returnAnker);
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
$this->layout()->setFlash("Rohrverzeichnis erfolgreich geändert", "success");
|
||||
} else if ($mode = "add") {
|
||||
$this->layout()->setFlash("Rohrverzeichnis erfolgreich angelegt", "success");
|
||||
}
|
||||
$this->redirect($returnUrl, $returnAction, $returnVariables, $returnAnker);
|
||||
}
|
||||
|
||||
|
||||
protected function deleteAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
$fiberplanpipes = new FiberPlanPipe($id);
|
||||
if (!$fiberplanpipes->id || $fiberplanpipes->id != $id) {
|
||||
$this->layout()->setFlash("Rohrverzeichnis nicht gefunden.", "error");
|
||||
$this->redirect("FiberPlanPipe");
|
||||
}
|
||||
|
||||
$fiberplanpipes->delete();
|
||||
$this->redirect("FiberPlanPipe");
|
||||
}
|
||||
|
||||
protected function getBuildingInfo($network, $bdtype)
|
||||
{
|
||||
FiberPlanPipeModel::getBuildingInfo($network, $bdtype);
|
||||
}
|
||||
}
|
||||
376
application/FiberPlanPipe/FiberPlanPipeModel.php
Normal file
376
application/FiberPlanPipe/FiberPlanPipeModel.php
Normal file
@@ -0,0 +1,376 @@
|
||||
<?php
|
||||
|
||||
class FiberPlanPipeModel
|
||||
{
|
||||
private $network_id;
|
||||
private $description;
|
||||
private $gisid;
|
||||
private $type;
|
||||
private $type_description;
|
||||
private $fiberplanpipetemplate_id;
|
||||
private $length;
|
||||
private $startpoint_type;
|
||||
private $startpoint_network_id;
|
||||
private $startpoint;
|
||||
private $midpoint;
|
||||
private $endpoint_network_id;
|
||||
private $entpoint_type;
|
||||
private $endpoint;
|
||||
private $status;
|
||||
private $responsible;
|
||||
private $responsible_text;
|
||||
private $address_id;
|
||||
private $comment;
|
||||
public static $type_descrition_definition = array(1 => "MR7", 2 => "MR14", 3 => "MR16", 4 => "MR20", 5 => "PE32", 6 => "PE40", 7 => "PE50", 8 => "KSR50", 9 => "KSR80", 10 => "KSR100");
|
||||
public static $type_definition = array(1 => "Enzel", 2 => "Schutzrohr", 3 => "Verband");
|
||||
|
||||
public static function find($data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static function create(array $data)
|
||||
{
|
||||
$model = new FiberPlanPipe();
|
||||
|
||||
foreach ($data as $field => $value) {
|
||||
if (property_exists(get_called_class(), $field)) {
|
||||
if (substr($field, 0, 5) == "vlan_" && !$value) {
|
||||
$model->$field = null;
|
||||
continue;
|
||||
}
|
||||
$model->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = mfValuecache::singleton()->get("me");
|
||||
if (!$me) {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
mfValuecache::singleton()->set("me", $me);
|
||||
}
|
||||
|
||||
if ($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if ($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getOne($id)
|
||||
{
|
||||
if (!is_numeric($id) || !$id) {
|
||||
throw new Exception("Invalid number", 400);
|
||||
}
|
||||
$item = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("FiberPlanPipe", "*", "id=$id LIMIT 1");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new FiberPlanPipe($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("FiberPlanPipe", "*", "1=1");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new FiberPlanPipe($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getAllPipeManufacturer()
|
||||
{
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("FiberPlanPipeManufacturer", "*", "1=1");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new FiberPlanPipe($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getAllPipe()
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
$sql = "SELECT `FiberPlanPipe`.`id`,`FiberPlanPipe`.`description`,`FiberPlanPipe`.`type`,`FiberPlanPipe`.`type_description`,`FiberPlanPipe`.`startpoint_network_id`, `FiberPlanPipe`.`endpoint_network_id`,`FiberPlanPipeTemplate`. `fiberPlanPipeManufacturer_id`,`FiberPlanPipeTemplate`.`pipe7x4`,`FiberPlanPipeTemplate`.`pipe14x10` FROM `FiberPlanPipe`
|
||||
LEFT JOIN `FiberPlanPipeTemplate` ON `FiberPlanPipe`.`fiberPlanPipeTemplate_id`=`FiberPlanPipeTemplate`.id";
|
||||
$res = $db->query($sql);
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new FiberPlanPipe($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function getFirst()
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("FiberPlanPipe", "*", "$where ");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new FiberPlanPipe($data);
|
||||
if ($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function search($filter)
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("FiberPlanPipe", "*", "$where");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new FiberPlanPipe($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter)
|
||||
{
|
||||
$where = "1=1 ";
|
||||
|
||||
//var_dump($filter);exit;
|
||||
if (array_key_exists("network_id", $filter)) {
|
||||
$networkid = $filter['network_id'];
|
||||
if (is_numeric($networkid)) {
|
||||
$where .= " AND network_id=$networkid";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
public static function getTemplates()
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
$sql = "SELECT `FiberPlanPipeTemplate`.id,FiberPlanPipeTemplate.pipe7x4,FiberPlanPipeTemplate.pipe14x10,FiberPlanPipeManufacturer.name FROM `FiberPlanPipeTemplate` INNER JOIN FiberPlanPipeManufacturer ON FiberPlanPipeManufacturer.id=FiberPlanPipeTemplate.fiberPlanPipeManufacturer_id ";
|
||||
$res = $db->query($sql);
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new FiberPlanPipe($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getPipeworkerAddresses()
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
$sql = "SELECT `Addresstype`.`id`,`Address`.`company` FROM `Addresstype`
|
||||
INNER JOIN `Address` ON (`Address`.`id`=`Addresstype`.`address_id`)
|
||||
WHERE `type` = 'pipeworker' ORDER by `Address`.`company` ";
|
||||
$res = $db->query($sql);
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new FiberPlanPipe($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getBuildingInfo($network, $bdtype, $api = 1)
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
if ($bdtype == "1") {
|
||||
$sql = "SELECT `id`,`description` `name` FROM `FiberPlanDispatcher` WHERE network_id='" . $network . "' AND `object_type`='3' ";
|
||||
} else if ($bdtype == "2") {
|
||||
$sql = "SELECT `Pop`.`id`,`Pop`.`name` FROM `PopNetwork`
|
||||
INNER JOIN `Pop` ON (`Pop`.`id`=`PopNetwork`.`pop_id`)
|
||||
WHERE `PopNetwork`.`network_id`='" . $network . "'";
|
||||
} else if ($bdtype == "3") {
|
||||
$sql = "SELECT `id`,`code` ,`street`, `zip`, `city` name FROM Building WHERE network_id='" . $network . "' ORDER by street";
|
||||
} else if ($bdtype == "4") {
|
||||
$sql = "SELECT `id`,`description` `name` FROM `FiberPlanDispatcher` WHERE network_id='" . $network . "' AND (`object_type`='1' OR `object_type`='2') ";
|
||||
}
|
||||
|
||||
$res = $db->query($sql);
|
||||
|
||||
if ($db->num_rows($res)) {
|
||||
$counter = 0;
|
||||
while ($data = $db->fetch_array($res)) {
|
||||
$items[$counter]['id'] = $data['id'];
|
||||
if ($bdtype == "3") {
|
||||
$items[$counter]['name'] = $data['street'] . " " . $data['zip'] . " " . $data['city'];
|
||||
} else {
|
||||
$items[$counter]['name'] = $data['name'];
|
||||
}
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
if ($api === 1) {
|
||||
echo json_encode($items);
|
||||
exit;
|
||||
} else {
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getBuildingInfoAll()
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
$sql = "SELECT `id`, `fiberPlanDispatcher_id`, `name` FROM `FiberPlanDispatchersleeve` ORDER by id";
|
||||
$res = $db->query($sql);
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_array($res)) {
|
||||
$sleeves[$data['fiberPlanDispatcher_id']][$data['id']] = $data['name'];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT '1' as `type`,'Greenfield' as `typename`,`id`,`description` as `name`,`gps_lat`,`gps_long` FROM `FiberPlanDispatcher` WHERE `object_type`='3'
|
||||
UNION
|
||||
SELECT '2' as `type`,'Pop' as `typename`,`id`,`name`,`gps_lat`,`gps_long` FROM `Pop`
|
||||
UNION
|
||||
SELECT '3' as `type`,'Building' as `typename`,`id`,CONCAT_WS(' ',`street`, `zip`, `city`) as name,`gps_lat`,`gps_long` FROM Building
|
||||
UNION
|
||||
SELECT '4' as `type`,'Schacht-Verteiler' as `typename`,`id`,`description` as `name`,`gps_lat`,`gps_long` FROM `FiberPlanDispatcher` WHERE (`object_type`='1' OR `object_type`='2')";
|
||||
$res = $db->query($sql);
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_array($res)) {
|
||||
$items[$data['type']][$data['id']] = $data;
|
||||
if ($data['type'] == 4) {
|
||||
$items[$data['type']][$data['id']]['sleeves'] = $sleeves[$data['id']];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function generateEndpoints($endpoints, $networks)
|
||||
{
|
||||
|
||||
foreach ($networks as $network) {
|
||||
$Network[$network->id] = $network->name;
|
||||
}
|
||||
$counter = 1;
|
||||
$endpointuparrow = "";
|
||||
$typeArray[1] = 'Greenfield';
|
||||
$typeArray[2] = 'POP';
|
||||
$typeArray[3] = 'Building';
|
||||
$typeArray[4] = 'Schacht-Verteiler';
|
||||
|
||||
// print_r($buildings);
|
||||
$counter = 1;
|
||||
foreach ($endpoints as $Endpoint) {
|
||||
|
||||
if ($Endpoint->pop_id) {
|
||||
$networkid = $Endpoint->pop->network_id;
|
||||
$endpointid = $Endpoint->pop->id;
|
||||
$endpointtype = 2;
|
||||
} else if ($Endpoint->fiberPlanDispatcher_id) {
|
||||
$networkid = $Endpoint->fiberPlanDispatcher->network_id;
|
||||
$endpointid = $Endpoint->fiberPlanDispatcher->id;
|
||||
if ($Endpoint->fiberPlanDispatcher->object_type == 3) {
|
||||
$endpointtype = 1;
|
||||
} else {
|
||||
$endpointtype = 4;
|
||||
}
|
||||
} else if ($Endpoint->building_id) {
|
||||
$networkid = $Endpoint->building->network_id;
|
||||
$endpointid = $Endpoint->building->id;
|
||||
$endpointtype = 3;
|
||||
}
|
||||
$randid = rand(1000, 10000);
|
||||
if ($counter > 1) {
|
||||
$Endpointuparrow = '<i title="nach oben verschieben" class="fa-sharp fa-solid fa-up move-endpoint-up"></i>';
|
||||
}
|
||||
if ($counter == 1) {
|
||||
$endpointType = "Startpunkt";
|
||||
$endpointsymbol = '<span class="endpointsymbol"><i id="add-endpoint" class="fa-regular fa-circle-plus"></i></span>';
|
||||
}
|
||||
else if (count($endpoints)==2)
|
||||
{
|
||||
$endpointcount = $counter - 1;
|
||||
$endpointType = "Standort " . $endpointcount;
|
||||
$endpointsymbol='<span class="endpointsymbol">';
|
||||
}
|
||||
else {
|
||||
$endpointcount = $counter - 1;
|
||||
$endpointType = "Standort " . $endpointcount;
|
||||
$endpointsymbol = '<span class="endpointsymbol"><i class="fa-regular fa-circle-minus remove-endpoint"></i></span>';
|
||||
}
|
||||
$html = '<div class="form-group row endpoint-maindiv">
|
||||
<label class="col-lg-2 col-form-label endpoint-label" for="' . $randid . '_endpoint_network_id"><span class="label-text">' . $endpointType . ' * </span>' . $Endpointuparrow . $endpointsymbol . '</label>
|
||||
<div class="col-lg-2"><select id="' . $randid . '_endpoint_network_id" required="required" name="endpoint_network_id[]" class="select2 form-control endpoint_network_id">';
|
||||
foreach ($networks as $network) {
|
||||
if ($network->id == $networkid) {
|
||||
$html .= '<option selected="selected" value="' . $network->id . '">' . $network->name . '</option>';
|
||||
} else {
|
||||
$html .= '<option value="' . $network->id . '">' . $network->name . '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '</select></div>
|
||||
<div class="col-lg-2 ">
|
||||
<select id="' . $randid . '_endpoint_type" name="endpoint_type[]" required="required" class="select2 form-control endpoint_type" >';
|
||||
|
||||
foreach ($typeArray as $key => $type) {
|
||||
if ($key == $endpointtype) {
|
||||
$html .= '<option selected="selected" value="' . $key . '">' . $type . '</option>';
|
||||
} else {
|
||||
$html .= '<option value="' . $key . '">' . $type . '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '</select></div>
|
||||
<div class="col-lg-2" id="' . $randid . '_end-point-building">
|
||||
<select id=' . $randid . '_endpoint" required="required" name="endpoint[]" class="select2 form-control">';
|
||||
$buildings = FiberPlanPipeModel::getBuildingInfo($networkid, $endpointtype, 0);
|
||||
|
||||
foreach ($buildings as $key => $building) {
|
||||
if ($building['id'] == $endpointid) {
|
||||
$html .= '<option selected="selected" value="' . $building['id'] . '">' . $building['name'] . '</option>';
|
||||
} else {
|
||||
$html .= '<option value="' . $building['id'] . '">' . $building['name'] . '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '</select><input type="hidden" name="endpointid[]" value="' . $Endpoint->id . '" ></div></div>';
|
||||
echo $html;
|
||||
$counter++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
64
application/FiberPlanPipeEndpoint/FiberPlanPipeEndpoint.php
Normal file
64
application/FiberPlanPipeEndpoint/FiberPlanPipeEndpoint.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
class FiberPlanPipeEndpoint extends mfBaseModel
|
||||
{
|
||||
private $editor;
|
||||
private $creator;
|
||||
private $fiberPlanPipe;
|
||||
private $pop;
|
||||
private $fiberPlanDispatcher;
|
||||
|
||||
private $building;
|
||||
|
||||
|
||||
|
||||
public function getProperty($name)
|
||||
{
|
||||
if ($this->$name == null) {
|
||||
|
||||
if (!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($name == "creator") {
|
||||
$this->creator = mfValuecache::singleton()->get("Worker-id-" . $this->create_by);
|
||||
if ($this->creator === null) {
|
||||
$this->creator = new User($this->create_by);
|
||||
if ($this->creator->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-" . $this->create_by, $this->creator);
|
||||
}
|
||||
}
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if ($name == "editor") {
|
||||
$this->editor = mfValuecache::singleton()->get("Worker-id-" . $this->edit_by);
|
||||
if ($this->editor === null) {
|
||||
$this->editor = new User($this->edit_by);
|
||||
if ($this->editor->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-" . $this->edit_by, $this->editor);
|
||||
}
|
||||
}
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name . "_id";
|
||||
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-" . $this->$idfield);
|
||||
if (!$this->$name) {
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
}
|
||||
|
||||
if ($this->$name->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-$name-" . $this->$name->id, $this->$name);
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
class FiberPlanPipeEndpointController extends mfBaseController
|
||||
{
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
|
||||
$this->layout()->setTemplate("FiberPlanPipeEndpoint/Index");
|
||||
$fiberplanpipeendpoints = FiberPlanPipeEndpointModel::getAll();
|
||||
$this->layout()->set("fiberplanpipeendpoints", $fiberplanpipeendpoints);
|
||||
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
$fiberPlanPipes=FiberPlanPipeModel::getAll();
|
||||
$this->layout()->set("fiberPlanPipes", $fiberPlanPipes);
|
||||
$pops=PopModel::getAll();
|
||||
$this->layout()->set("pops", $pops);
|
||||
$fiberPlanDispatchers=FiberPlanDispatcherModel::getAll();
|
||||
$this->layout()->set("fiberPlanDispatchers", $fiberPlanDispatchers);
|
||||
$buildings=BuildingModel::getAll();
|
||||
$this->layout()->set("buildings", $buildings);
|
||||
|
||||
$this->layout()->setTemplate("FiberPlanPipeEndpoint/Form");
|
||||
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("dfsdf nicht gefunden", "error");
|
||||
$this->redirect("FiberPlanPipeEndpoint");
|
||||
}
|
||||
|
||||
$fiberplanpipeendpoints = new FiberPlanPipeEndpoint($id);
|
||||
if ($fiberplanpipeendpoints->id != $id) {
|
||||
$this->layout()->setFlash("dfsdf nicht gefunden", "error");
|
||||
$this->redirect("FiberPlanPipeEndpoint");
|
||||
}
|
||||
|
||||
$this->layout()->set("fiberplanpipeendpoints", $fiberplanpipeendpoints);
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
protected function saveAction()
|
||||
{
|
||||
$r = $this->request;
|
||||
$id = $r->id;
|
||||
//var_dump($r->get());exit;
|
||||
if (is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
$fiberplanpipeendpoints = new FiberPlanPipeEndpoint($id);
|
||||
if (!$fiberplanpipeendpoints->id) {
|
||||
$this->layout()->setFlash("sdfsdf nicht gefunden", "error");
|
||||
$this->redirect("FiberPlanPipeEndpoint");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['fiberPlanPipe_id'] = trim($r->fiberPlanPipe_id);
|
||||
$data['pop_id'] = trim($r->pop_id);
|
||||
$data['fiberPlanDispatcher_id'] = trim($r->fiberPlanDispatcher_id);
|
||||
$data['building_id'] = trim($r->building_id);
|
||||
$data['sort'] = trim($r->sort);
|
||||
|
||||
|
||||
if (!$data['fiberPlanPipe_id']) {
|
||||
$data['fiberPlanPipe_id']=NULL;
|
||||
}
|
||||
if (!$data['pop_id']) {
|
||||
$data['pop_id']=NULL;
|
||||
}
|
||||
if (!$data['fiberPlanDispatcher_id']) {
|
||||
$data['fiberPlanDispatcher_id']=NULL;
|
||||
}
|
||||
if (!$data['building_id']) {
|
||||
$data['building_id']=NULL;
|
||||
}
|
||||
if (!$data['sort']) {
|
||||
$data['sort']=NULL;
|
||||
}
|
||||
|
||||
|
||||
// var_dump($_FILES);
|
||||
// var_dump($upload);
|
||||
// exit;
|
||||
|
||||
|
||||
if ($mode == "edit") {
|
||||
$fiberplanpipeendpoints->update($data);
|
||||
|
||||
} else {
|
||||
$fiberplanpipeendpoints = FiberPlanPipeEndpointModel::create($data);
|
||||
}
|
||||
// var_dump($filestore);
|
||||
// exit;
|
||||
$id = $fiberplanpipeendpoints->save();
|
||||
|
||||
if (!$id) {
|
||||
$this->layout()->setFlash("dfsdf konnte nicht angelegt werden", "error");
|
||||
$this->redirect("FiberPlanPipeEndpoint");
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
$this->layout()->setFlash("dfsdf erfolgreich geändert", "success");
|
||||
} else if ($mode = "add") {
|
||||
$this->layout()->setFlash("dfsdf erfolgreich angelegt", "success");
|
||||
}
|
||||
$this->redirect("FiberPlanPipeEndpoint");
|
||||
}
|
||||
|
||||
|
||||
protected function deleteAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
$fiberplanpipeendpoints = new FiberPlanPipeEndpoint($id);
|
||||
if (!$fiberplanpipeendpoints->id || $fiberplanpipeendpoints->id != $id) {
|
||||
$this->layout()->setFlash("dfsdf nicht gefunden.", "error");
|
||||
$this->redirect("FiberPlanPipeEndpoint");
|
||||
}
|
||||
|
||||
$fiberplanpipeendpoints->delete();
|
||||
$this->redirect("FiberPlanPipeEndpoint");
|
||||
}
|
||||
|
||||
}
|
||||
129
application/FiberPlanPipeEndpoint/FiberPlanPipeEndpointModel.php
Normal file
129
application/FiberPlanPipeEndpoint/FiberPlanPipeEndpointModel.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
class FiberPlanPipeEndpointModel
|
||||
{
|
||||
private $fiberPlanPipe_id;
|
||||
private $pop_id;
|
||||
private $fiberPlanDispatcher_id;
|
||||
private $building_id;
|
||||
private $sort;
|
||||
|
||||
|
||||
public static function find($data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static function create(array $data)
|
||||
{
|
||||
$model = new FiberPlanPipeEndpoint();
|
||||
|
||||
foreach ($data as $field => $value) {
|
||||
if (property_exists(get_called_class(), $field)) {
|
||||
if (substr($field, 0, 5) == "vlan_" && !$value) {
|
||||
$model->$field = null;
|
||||
continue;
|
||||
}
|
||||
$model->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = mfValuecache::singleton()->get("me");
|
||||
if (!$me) {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
mfValuecache::singleton()->set("me", $me);
|
||||
}
|
||||
|
||||
if ($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if ($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getOne($id)
|
||||
{
|
||||
if (!is_numeric($id) || !$id) {
|
||||
throw new Exception("Invalid number", 400);
|
||||
}
|
||||
$item = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("FiberPlanPipeEndpoint", "*", "id=$id LIMIT 1");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new FiberPlanPipeEndpoint($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("FiberPlanPipeEndpoint", "*", "1=1");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new FiberPlanPipeEndpoint($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst()
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("FiberPlanPipeEndpoint", "*", "$where ");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new FiberPlanPipeEndpoint($data);
|
||||
if ($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function search($filter)
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("FiberPlanPipeEndpoint", "*", "$where ORDER by sort");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new FiberPlanPipeEndpoint($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter)
|
||||
{
|
||||
$where = "1=1 ";
|
||||
|
||||
//var_dump($filter);exit;
|
||||
if (array_key_exists("fiberPlanPipe_id", $filter)) {
|
||||
$fiberPlanPipe_id = $filter['fiberPlanPipe_id'];
|
||||
if (is_numeric($fiberPlanPipe_id)) {
|
||||
$where .= " AND fiberPlanPipe_id=$fiberPlanPipe_id";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
class FiberPlanPipeManufacturer extends mfBaseModel
|
||||
{
|
||||
private $editor;
|
||||
private $creator;
|
||||
|
||||
|
||||
|
||||
public function getProperty($name)
|
||||
{
|
||||
if ($this->$name == null) {
|
||||
|
||||
if (!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($name == "creator") {
|
||||
$this->creator = new User($this->create_by);
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if ($name == "editor") {
|
||||
$this->editor = new User($this->edit_by);
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name . "_id";
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
|
||||
if ($this->$name->id) {
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
class FiberPlanPipeManufacturerModel
|
||||
{
|
||||
private $name;
|
||||
private $colors;
|
||||
|
||||
|
||||
public static function find($data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static function create(array $data)
|
||||
{
|
||||
$model = new FiberPlanPipeManufacturer();
|
||||
|
||||
foreach ($data as $field => $value) {
|
||||
if (property_exists(get_called_class(), $field)) {
|
||||
if (substr($field, 0, 5) == "vlan_" && !$value) {
|
||||
$model->$field = null;
|
||||
continue;
|
||||
}
|
||||
$model->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = mfValuecache::singleton()->get("me");
|
||||
if (!$me) {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
mfValuecache::singleton()->set("me", $me);
|
||||
}
|
||||
|
||||
if ($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if ($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getOne($id)
|
||||
{
|
||||
if (!is_numeric($id) || !$id) {
|
||||
throw new Exception("Invalid number", 400);
|
||||
}
|
||||
$item = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("FiberPlanPipeManufacturer", "*", "id=$id LIMIT 1");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new FiberPlanPipeManufacturer($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("FiberPlanPipeManufacturer", "*", "1=1");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new FiberPlanPipeManufacturer($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst()
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("FiberPlanPipeManufacturer", "*", "$where ");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new FiberPlanPipeManufacturer($data);
|
||||
if ($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function search($filter)
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("FiberPlanPipeManufacturer", "*", "$where");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new FiberPlanPipeManufacturer($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter)
|
||||
{
|
||||
$where = "1=1 ";
|
||||
|
||||
//var_dump($filter);exit;
|
||||
if (array_key_exists("network_id", $filter)) {
|
||||
$networkid = $filter['network_id'];
|
||||
if (is_numeric($networkid)) {
|
||||
$where .= " AND network_id=$networkid";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
43
application/FiberPlanPipeTemplate/FiberPlanPipeTemplate.php
Normal file
43
application/FiberPlanPipeTemplate/FiberPlanPipeTemplate.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
class FiberPlanPipeTemplate extends mfBaseModel
|
||||
{
|
||||
private $editor;
|
||||
private $creator;
|
||||
private $fiberPlanPipeManufacturer;
|
||||
|
||||
|
||||
|
||||
public function getProperty($name)
|
||||
{
|
||||
if ($this->$name == null) {
|
||||
|
||||
if (!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($name == "creator") {
|
||||
$this->creator = new User($this->create_by);
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if ($name == "editor") {
|
||||
$this->editor = new User($this->edit_by);
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name . "_id";
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
|
||||
if ($this->$name->id) {
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
}
|
||||
127
application/FiberPlanPipeTemplate/FiberPlanPipeTemplateModel.php
Normal file
127
application/FiberPlanPipeTemplate/FiberPlanPipeTemplateModel.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
class FiberPlanPipeTemplateModel
|
||||
{
|
||||
private $fiberplanpipemanufacturer_id;
|
||||
private $pipe7x4;
|
||||
private $pipe14x10;
|
||||
|
||||
|
||||
public static function find($data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static function create(array $data)
|
||||
{
|
||||
$model = new FiberPlanPipeTemplate();
|
||||
|
||||
foreach ($data as $field => $value) {
|
||||
if (property_exists(get_called_class(), $field)) {
|
||||
if (substr($field, 0, 5) == "vlan_" && !$value) {
|
||||
$model->$field = null;
|
||||
continue;
|
||||
}
|
||||
$model->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = mfValuecache::singleton()->get("me");
|
||||
if (!$me) {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
mfValuecache::singleton()->set("me", $me);
|
||||
}
|
||||
|
||||
if ($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if ($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getOne($id)
|
||||
{
|
||||
if (!is_numeric($id) || !$id) {
|
||||
throw new Exception("Invalid number", 400);
|
||||
}
|
||||
$item = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("FiberPlanPipeTemplate", "*", "id=$id LIMIT 1");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new FiberPlanPipeTemplate($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("FiberPlanPipeTemplate", "*", "1=1");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new FiberPlanPipeTemplate($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst()
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("FiberPlanPipeTemplate", "*", "$where ");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new FiberPlanPipeTemplate($data);
|
||||
if ($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function search($filter)
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("FiberPlanPipeTemplate", "*", "$where");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new FiberPlanPipeTemplate($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter)
|
||||
{
|
||||
$where = "1=1 ";
|
||||
|
||||
//var_dump($filter);exit;
|
||||
if (array_key_exists("network_id", $filter)) {
|
||||
$networkid = $filter['network_id'];
|
||||
if (is_numeric($networkid)) {
|
||||
$where .= " AND network_id=$networkid";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
9
application/HistoricTicket/HistoricTicket.php
Normal file
9
application/HistoricTicket/HistoricTicket.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property mixed|null $name
|
||||
*/
|
||||
class HistoricTicket extends mfBaseModel
|
||||
{
|
||||
|
||||
}
|
||||
103
application/HistoricTicket/HistoricTicketController.php
Normal file
103
application/HistoricTicket/HistoricTicketController.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
|
||||
class HistoricTicketController extends mfBaseController {
|
||||
private User $me;
|
||||
|
||||
protected function init(): void {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->layout()->set("me", $me);
|
||||
$this->me = $me;
|
||||
}
|
||||
|
||||
protected function indexAction(): void {
|
||||
if (!$this->me->is("employee")) {
|
||||
$this->redirect("dashboard");
|
||||
}
|
||||
$this->layout()->setTemplate("HistoricTicket/Index");
|
||||
}
|
||||
|
||||
protected function apiAction() {
|
||||
$do = $this->request->do;
|
||||
|
||||
if ($do !== "getConfig" && !$this->me->is("employee")) {
|
||||
$this->redirect("dashboard");
|
||||
}
|
||||
|
||||
switch ($do) {
|
||||
case "getHistoricTickets":
|
||||
$return = $this->getHistoricTickets();
|
||||
break;
|
||||
case "getHistoricTicketMessages":
|
||||
$return = $this->getHistoricTicketMessages();
|
||||
break;
|
||||
case "findHistoricTicket":
|
||||
$return = $this->findHistoricTicket();
|
||||
break;
|
||||
default:
|
||||
$return = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$return) {
|
||||
$return = [
|
||||
"status" => "error",
|
||||
"message" => "Invalid request."
|
||||
];
|
||||
}
|
||||
|
||||
die(json_encode($return));
|
||||
}
|
||||
|
||||
private function getHistoricTickets(): array {
|
||||
$json = json_decode(file_get_contents('php://input'), true);
|
||||
|
||||
$filters = $json['filters'] ?? [];
|
||||
$page = $json['pagination']['page'] ?? 1;
|
||||
$perPage = $json['pagination']['per_page'] ?? 10;
|
||||
|
||||
$historicTickets = HistoricTicketModel::getAllHistoricTickets($filters, $perPage, ($page - 1) * $perPage);
|
||||
$total = HistoricTicketModel::countHistoricTickets($filters);
|
||||
|
||||
return [
|
||||
"rows" => $historicTickets,
|
||||
"pagination" => [
|
||||
"page" => $page,
|
||||
"total_pages" => ceil($total / $perPage),
|
||||
"per_page" => $perPage,
|
||||
"total_rows" => intval($total)
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
private function getHistoricTicketMessages(): array {
|
||||
$json = json_decode(file_get_contents('php://input'), true);
|
||||
$ticketNumber = $json['ticketNumber'];
|
||||
|
||||
return HistoricTicketModel::findHistoricTicket($ticketNumber);
|
||||
}
|
||||
|
||||
private function findHistoricTicket(): array {
|
||||
$query = $this->request->query;
|
||||
|
||||
if (empty($query)) {
|
||||
return [
|
||||
"status" => "error",
|
||||
"message" => "No query provided."
|
||||
];
|
||||
}
|
||||
|
||||
$rows = HistoricTicketModel::findTicket($query);
|
||||
|
||||
return [
|
||||
"rows" => $rows,
|
||||
"pagination" => [
|
||||
"page" => 1,
|
||||
"total_pages" => 1,
|
||||
"per_page" => count($rows),
|
||||
"total_rows" => count($rows)
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
183
application/HistoricTicket/HistoricTicketModel.php
Normal file
183
application/HistoricTicket/HistoricTicketModel.php
Normal file
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
|
||||
class HistoricTicketModel {
|
||||
public $id;
|
||||
public $ticket_number;
|
||||
public $ticket_verifier;
|
||||
public $priority;
|
||||
public $status_id;
|
||||
public $status;
|
||||
public $type_id;
|
||||
public $type;
|
||||
public $user_id;
|
||||
public $agent_id;
|
||||
public $contact_id;
|
||||
public $company;
|
||||
public $company_id;
|
||||
public $first_name;
|
||||
public $middle_name;
|
||||
public $last_name;
|
||||
public $email;
|
||||
public $phone;
|
||||
public $subject;
|
||||
public $ctime;
|
||||
public $mtime;
|
||||
public $muser_id;
|
||||
public $files_folder_id;
|
||||
public $unseen;
|
||||
public $group_id;
|
||||
public $order_id;
|
||||
public $last_response_time;
|
||||
public $cc_addresses;
|
||||
|
||||
|
||||
public function __construct($data = []) {
|
||||
foreach ($data as $field => $value) {
|
||||
if (property_exists(get_called_class(), $field)) {
|
||||
$this->$field = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function generateFilterCondition(?string $filterValue, string $columnName): string {
|
||||
$sql = "";
|
||||
if (!empty($filterValue)) {
|
||||
$filterItems = explode(" ", $filterValue);
|
||||
foreach ($filterItems as $item) {
|
||||
$sql .= " AND `$columnName` LIKE '%" . $item . "%'";
|
||||
}
|
||||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
public static function getSqlFilter($filters): string {
|
||||
$sql = isset($filters['subject']) ? self::generateFilterCondition($filters['subject'], "subject") : "";
|
||||
$sql .= isset($filters['ticket_number']) ? self::generateFilterCondition($filters['ticket_number'], "ticket_number") : "";
|
||||
$sql .= isset($filters['priority']) ? " AND `priority` = " . $filters['priority'] : "";
|
||||
$sql .= isset($filters['status']) ? self::generateFilterCondition($filters['status'], "status") : "";
|
||||
$sql .= isset($filters['status_id']) ? " AND `status_id` = " . $filters['status_id'] : "";
|
||||
$sql .= isset($filters['type']) ? self::generateFilterCondition($filters['type'], "type") : "";
|
||||
$sql .= isset($filters['type_id']) ? " AND `type_id` = " . $filters['type_id'] : "";
|
||||
$sql .= isset($filters['user_id']) ? " AND `user_id` = " . $filters['user_id'] : "";
|
||||
$sql .= isset($filters['agent_id']) ? " AND `agent_id` = " . $filters['agent_id'] : "";
|
||||
$sql .= isset($filters['contact_id']) ? " AND `contact_id` = " . $filters['contact_id'] : "";
|
||||
$sql .= isset($filters['company']) ? self::generateFilterCondition($filters['company'], "company") : "";
|
||||
$sql .= isset($filters['company_id']) ? " AND `company_id` = " . $filters['company_id'] : "";
|
||||
$sql .= isset($filters['middle_name']) ? self::generateFilterCondition($filters['middle_name'], "middle_name") : "";
|
||||
$sql .= isset($filters['last_name']) ? self::generateFilterCondition($filters['last_name'], "last_name") : "";
|
||||
$sql .= isset($filters['email']) ? " AND `email` LIKE '%" . $filters['email'] . "%'" : "";
|
||||
$sql .= isset($filters['phone']) ? " AND `phone` LIKE '%" . $filters['phone'] . "%'" : "";
|
||||
$sql .= isset($filters['ctime']) ? " AND `ctime` = " . $filters['ctime'] : "";
|
||||
$sql .= isset($filters['mtime']) ? " AND `mtime` = " . $filters['mtime'] : "";
|
||||
$sql .= isset($filters['muser_id']) ? " AND `muser_id` = " . $filters['muser_id'] : "";
|
||||
$sql .= isset($filters['files_folder_id']) ? " AND `files_folder_id` = " . $filters['files_folder_id'] : "";
|
||||
$sql .= isset($filters['unseen']) ? " AND `unseen` = " . $filters['unseen'] : "";
|
||||
$sql .= isset($filters['group_id']) ? " AND `group_id` = " . $filters['group_id'] : "";
|
||||
$sql .= isset($filters['order_id']) ? " AND `order_id` = " . $filters['order_id'] : "";
|
||||
$sql .= isset($filters['last_response_time']) ? " AND `last_response_time` = " . $filters['last_response_time'] : "";
|
||||
$sql .= isset($filters['cc_addresses']) ? self::generateFilterCondition($filters['cc_addresses'], "cc_addresses") : "";
|
||||
|
||||
if (isset($filters['first_name'])) {
|
||||
$filterItems = explode(" ", $filters['first_name']);
|
||||
foreach ($filterItems as $item) {
|
||||
$sql .= " AND (`first_name` LIKE '%" . $item . "%' OR `middle_name` LIKE '%" . $item . "%' OR `last_name` LIKE '%" . $item . "%')";
|
||||
}
|
||||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
public static function getAllHistoricTickets($filters, $limit = null, $offset = 0): array {
|
||||
$db = FronkDB::singleton();
|
||||
$sql = "SELECT * FROM `HistoricTicket` WHERE 1 " . self::getSqlFilter($filters) . " ORDER BY `ticket_number` DESC";
|
||||
$sql .= $limit === null ? "" : " LIMIT " . $limit . " OFFSET " . $offset;
|
||||
|
||||
$result = $db->query($sql);
|
||||
$rows = [];
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public static function countHistoricTickets($filters) {
|
||||
$db = FronkDB::singleton();
|
||||
$sql = "SELECT COUNT(*) as `total_rows` FROM `HistoricTicket` WHERE 1 " . self::getSqlFilter($filters);
|
||||
$result = $db->query($sql);
|
||||
return $result->fetch_assoc()['total_rows'];
|
||||
}
|
||||
|
||||
public static function findHistoricTicket($ticketNumber): array {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$ticketSql = "SELECT * FROM `HistoricTicket` WHERE `ticket_number` = " . $ticketNumber;
|
||||
$ticketResult = $db->query($ticketSql);
|
||||
$ticket = $ticketResult->fetch_assoc();
|
||||
|
||||
$messagesSql = "SELECT * FROM `HistoricTicketMessage` WHERE `ticket_id` = " . $ticket["id"];
|
||||
$messagesResult = $db->query($messagesSql);
|
||||
$messages = [];
|
||||
while ($message = $messagesResult->fetch_assoc()) {
|
||||
$messages[] = $message;
|
||||
}
|
||||
|
||||
return [
|
||||
"ticket" => $ticket,
|
||||
"messages" => $messages
|
||||
];
|
||||
}
|
||||
|
||||
public static function findTicket($query): array {
|
||||
$db = FronkDB::singleton();
|
||||
$ticketSql = "SELECT * FROM `HistoricTicket` WHERE `ticket_number` LIKE '%" . $query . "%' OR `subject` LIKE '%" . $query . "%' OR `first_name` LIKE '%" . $query . "%' OR `last_name` LIKE '%" . $query . "%'";
|
||||
$ticketResult = $db->query($ticketSql);
|
||||
$tickets = [];
|
||||
while ($ticket = $ticketResult->fetch_assoc()) {
|
||||
$tickets[] = $ticket;
|
||||
}
|
||||
|
||||
//explore $query by space and add each word to the sql query with and
|
||||
$query = explode(" ", $query);
|
||||
|
||||
$whereStr = "";
|
||||
foreach ($query as $word) {
|
||||
$whereStr .= " AND `content` LIKE '%" . $word . "%'";
|
||||
}
|
||||
|
||||
$messagesSql = "SELECT * FROM `HistoricTicketMessage`
|
||||
LEFT JOIN `HistoricTicket` ON `HistoricTicket`.`id` = `HistoricTicketMessage`.`ticket_id`
|
||||
WHERE 1 AND `content` " . $whereStr;
|
||||
$messagesResult = $db->query($messagesSql);
|
||||
$messages = [];
|
||||
while ($message = $messagesResult->fetch_assoc()) {
|
||||
$messages[] = $message;
|
||||
}
|
||||
|
||||
$return = [];
|
||||
|
||||
foreach ($tickets as $ticket) {
|
||||
$return[] = [
|
||||
"table_entry" => "ticket",
|
||||
"ticket_id" => $ticket["id"],
|
||||
"ticket_number" => $ticket["ticket_number"],
|
||||
"ctime" => $ticket["ctime"],
|
||||
"ticket_subject" => $ticket["subject"],
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($messages as $message) {
|
||||
$return[] = [
|
||||
"table_entry" => "message",
|
||||
"ticket_id" => $message["ticket_id"],
|
||||
"ticket_number" => $message["ticket_number"],
|
||||
"ticket_subject" => $message["subject"],
|
||||
"ctime" => $message["ctime"],
|
||||
"ticket_message" => $message["content"],
|
||||
];
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ class Timerecording extends mfBaseModel
|
||||
private $creator;
|
||||
private $user;
|
||||
private $timerecordingCategory;
|
||||
private $timerecordingCar;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,9 @@ class TimerecordingController extends mfBaseController
|
||||
$this->updateHolidays($this->me->id);
|
||||
|
||||
$timerecordingCategoriess = TimerecordingCategoryModel::getAll();
|
||||
$timerecordingCars = TimerecordingCarModel::search(['timerecording' => 1]);
|
||||
$this->layout()->set("timerecordingCategoriess", $timerecordingCategoriess);
|
||||
$this->layout()->set("timerecordingCars", $timerecordingCars);
|
||||
$this->layout()->setTemplate("Timerecording/Index");
|
||||
}
|
||||
|
||||
@@ -206,13 +208,12 @@ class TimerecordingController extends mfBaseController
|
||||
$employee = TimerecordingEmployeeModel::search(['user_id' => $userid]);
|
||||
|
||||
$plushours = $employee[0]->plushours_now * 1.25;
|
||||
$overtime = $employee[0]->overtime * 1.5;
|
||||
$overtime = $employee[0]->overtime_now * 1.5;
|
||||
$overtimesum = $plushours + $overtime;
|
||||
if ($overtimesum < $isTime) {
|
||||
if ($overtimesum < 0) {
|
||||
$overtimesum = 0;
|
||||
}
|
||||
|
||||
$result['state'] = "error";
|
||||
$result['error'] = "Maximal verfügbarer ZA: " . sprintf('%02dh:%02dm', floor($overtimesum / 3600), floor($overtimesum / 60 % 60)) . ".";
|
||||
echo json_encode($result);
|
||||
@@ -221,7 +222,7 @@ class TimerecordingController extends mfBaseController
|
||||
if ($plushours >= $isTime) {
|
||||
$isTime = $isTime * 0.8;
|
||||
$return['hours'] = $isTime;
|
||||
} elseif ($plushours <= 0) {
|
||||
} elseif ($plushours == 0) {
|
||||
$isTime = $isTime * 0.66666666666666666666666666666667;
|
||||
$return ['hours_overtime'] = $isTime;
|
||||
} else {
|
||||
@@ -265,7 +266,7 @@ class TimerecordingController extends mfBaseController
|
||||
$this->updateOpenTimerecording();
|
||||
}
|
||||
$data = [];
|
||||
if ($hourday == 1 || $hourday == 6) {
|
||||
if ($hourday == 1 || $hourday == 6 || $hourday == 7) {
|
||||
$starttime = strtotime($r->date . " " . $r->start . ":00");
|
||||
$endtime = strtotime($r->date . " " . $r->end . ":00");
|
||||
if ($hourday == 6) {
|
||||
@@ -282,7 +283,7 @@ class TimerecordingController extends mfBaseController
|
||||
$endtime = strtotime($r->date . " 23:59:00");
|
||||
}
|
||||
|
||||
if ($hourday != 5) {
|
||||
if ($hourday != 5 && $hourday != 7) {
|
||||
$result = $this->checkTimerecording($starttime, $endtime, $id);
|
||||
}
|
||||
if ($result['state'] == "error") {
|
||||
@@ -321,6 +322,19 @@ class TimerecordingController extends mfBaseController
|
||||
$data['businesstrip_info'] = $r->businesstrip_info;
|
||||
$data['homeoffice'] = $r->homeoffice;
|
||||
$data['days'] = $r->days;
|
||||
$data['timerecordingCar_id'] = $r->timerecordingCar_id;
|
||||
$data['mileage_start'] = $r->mileage_start;
|
||||
$data['mileage_end'] = $r->mileage_end;
|
||||
|
||||
if (!$data['timerecordingCar_id']) {
|
||||
$data['timerecordingCar_id'] = NULL;
|
||||
}
|
||||
if (!$data['mileage_start']) {
|
||||
$data['mileage_start'] = NULL;
|
||||
}
|
||||
if (!$data['mileage_end']) {
|
||||
$data['mileage_end'] = NULL;
|
||||
}
|
||||
|
||||
if (!$data['businesstrip'] || $data['businesstrip'] == "false") {
|
||||
$data['businesstrip'] = 0;
|
||||
@@ -436,6 +450,7 @@ class TimerecordingController extends mfBaseController
|
||||
$this->updateHolidays($data['user_id']);
|
||||
}
|
||||
$this->updatePlushours($data['user_id']);
|
||||
TimerecordingCarModel::calcMileage();
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
@@ -828,6 +843,16 @@ class TimerecordingController extends mfBaseController
|
||||
$sum = "-" . sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
$isSeconds = $isSeconds + $seconds;
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 7) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$start = date("H:i", $timerecording->start);
|
||||
$end = date("H:i", $timerecording->end);
|
||||
$seconds = $timerecording->end - $timerecording->start;
|
||||
$minutes = floor(($seconds % 3600) / 60);
|
||||
$hours = floor($seconds / 3600);
|
||||
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
}
|
||||
|
||||
if ($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0) {
|
||||
@@ -836,8 +861,17 @@ class TimerecordingController extends mfBaseController
|
||||
$state = '<i class="fa-regular fa-circle-check mr-1"></i>';
|
||||
}
|
||||
$edit = "";
|
||||
if ($timerecording->businesstrip == 1) {
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'> (Dienstreise: " . $timerecording->businesstrip_info . ")</span>";
|
||||
if ($timerecording->timerecordingCategory->hourday == 7) {
|
||||
$distance = $timerecording->mileage_end - $timerecording->mileage_start;
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'>(" . $timerecording->timerecordingCar->number_plate . " " . $distance . "KM) (Zielort: " . $timerecording->businesstrip_info . ")</span>";
|
||||
} else if ($timerecording->businesstrip == 1) {
|
||||
if ($timerecording->timerecordingCar) {
|
||||
$distance = $timerecording->mileage_end - $timerecording->mileage_start;
|
||||
$car = " (" . $timerecording->timerecordingCar->number_plate . " " . $distance . "KM)";
|
||||
} else {
|
||||
$car = "";
|
||||
}
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'>$car (Dienstreise: " . $timerecording->businesstrip_info . ")</span>";
|
||||
} else if ($timerecording->homeoffice == 1) {
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'> (Homeoffice)</span>";
|
||||
} else {
|
||||
@@ -860,13 +894,16 @@ class TimerecordingController extends mfBaseController
|
||||
data-businesstrip="' . $timerecording->businesstrip . '"
|
||||
data-businesstripinfo="' . $timerecording->businesstrip_info . '"
|
||||
data-homeoffice="' . $timerecording->homeoffice . '"
|
||||
data-car="' . $timerecording->timerecordingCar_id . '"
|
||||
data-mileagestart="' . $timerecording->mileage_start . '"
|
||||
data-mileageend="' . $timerecording->mileage_end . '"
|
||||
title="Bearbeiten"></i>';
|
||||
else :
|
||||
$edit .= '<div class="edit-placeholder"></div>';
|
||||
endif;
|
||||
$edit .= '<i data-id="' . $timerecording->id . '" class="fas fa-trash text-danger delete-item" ></i>';
|
||||
endif;
|
||||
if ($datatype == 3 && $timerecording->timerecordingCategory->hourday == 1) {
|
||||
if ($datatype == 3 && ($timerecording->timerecordingCategory->hourday == 1 || $timerecording->timerecordingCategory->hourday == 7 || $timerecording->timerecordingCategory->hourday == 5)) {
|
||||
} else {
|
||||
$rows[] = array(
|
||||
'date' => array('date' => $state . $day . " " . $date, 'order' => $orderdate),
|
||||
|
||||
@@ -11,6 +11,10 @@ class TimerecordingModel
|
||||
private $timerecordingCategory_id;
|
||||
private $businesstrip;
|
||||
private $businesstrip_info;
|
||||
private $timerecordingCar_id;
|
||||
private $mileage_start;
|
||||
private $mileage_end;
|
||||
|
||||
private $homeoffice;
|
||||
private $comment;
|
||||
private $approved;
|
||||
@@ -151,7 +155,7 @@ class TimerecordingModel
|
||||
$start = $filter['start'];
|
||||
$end = $filter['end'];
|
||||
if (is_numeric($start) && is_numeric($end)) {
|
||||
$where .= " AND ((`start` >= $start AND `start` <= $end) OR (`end` >= $start AND `end` <= $end) OR `end` is NULL) ORDER by user_id ASC";
|
||||
$where .= " AND ((`start` >= $start AND `start` <= $end) OR (`end` >= $start AND `end` <= $end) OR `end` is NULL) ORDER by user_id,start ASC";
|
||||
}
|
||||
}
|
||||
if (array_key_exists("start", $filter) && array_key_exists("timerecordingCategory_id", $filter)) {
|
||||
@@ -174,7 +178,20 @@ class TimerecordingModel
|
||||
$where .= " AND `start` >= $start AND `days` !=0 ORDER by start ASC";
|
||||
}
|
||||
}
|
||||
if (array_key_exists("timerecordingCar_id", $filter)) {
|
||||
$timerecordingCar = $filter['timerecordingCar_id'];
|
||||
|
||||
if (is_numeric($timerecordingCar)) {
|
||||
$where .= " AND `timerecordingCar_id` = $timerecordingCar ORDER by mileage_end DESC LIMIT 1";
|
||||
}
|
||||
}
|
||||
if (array_key_exists("timerecordingCar_id_all", $filter)) {
|
||||
$timerecordingCar = $filter['timerecordingCar_id_all'];
|
||||
|
||||
if (is_numeric($timerecordingCar)) {
|
||||
$where .= " AND `timerecordingCar_id` = $timerecordingCar ORDER by mileage_start ASC";
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists("starttime", $filter) && array_key_exists("endtime", $filter)) {
|
||||
$starttime = $filter['starttime'];
|
||||
@@ -184,9 +201,9 @@ class TimerecordingModel
|
||||
if ($id && is_numeric($id)) {
|
||||
$where .= " AND `id` != $id ";
|
||||
}
|
||||
$where .= " AND (((`start` <= $starttime AND `end` > $starttime ) OR (`start` > $endtime AND `end` < $endtime) OR (`start` > $starttime AND `end` > $starttime AND `start` <= $endtime AND `end` <= $endtime) OR (`start` > $starttime AND `end` > $starttime AND `start` < $endtime AND `end` > $endtime) OR (`start` = $starttime AND `end` = $endtime )) OR ( `start` <= $starttime AND `end` IS NULL)) ORDER by user_id ASC";
|
||||
$where .= " AND (((`start` <= $starttime AND `end` > $starttime ) OR (`start` > $endtime AND `end` < $endtime) OR (`start` > $starttime AND `end` > $starttime AND `start` <= $endtime AND `end` <= $endtime) OR (`start` > $starttime AND `end` > $starttime AND `start` < $endtime AND `end` > $endtime) OR (`start` = $starttime AND `end` = $endtime )) OR ( `start` <= $starttime AND `end` IS NULL)) AND `days` = 0 ORDER by user_id,start ASC";
|
||||
|
||||
//var_dump($where);exit;
|
||||
//echo ($where);die();
|
||||
}
|
||||
}
|
||||
if (array_key_exists("type", $filter)) {
|
||||
|
||||
60
application/TimerecordingBilling/TimerecordingBilling.php
Normal file
60
application/TimerecordingBilling/TimerecordingBilling.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingBilling extends mfBaseModel
|
||||
{
|
||||
private $editor;
|
||||
private $creator;
|
||||
|
||||
private $timerecordingEmployee;
|
||||
|
||||
|
||||
public function getProperty($name)
|
||||
{
|
||||
if ($this->$name == null) {
|
||||
|
||||
if (!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($name == "creator") {
|
||||
$this->creator = mfValuecache::singleton()->get("Worker-id-" . $this->create_by);
|
||||
if ($this->creator === null) {
|
||||
$this->creator = new User($this->create_by);
|
||||
if ($this->creator->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-" . $this->create_by, $this->creator);
|
||||
}
|
||||
}
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if ($name == "editor") {
|
||||
$this->editor = mfValuecache::singleton()->get("Worker-id-" . $this->edit_by);
|
||||
if ($this->editor === null) {
|
||||
$this->editor = new User($this->edit_by);
|
||||
if ($this->editor->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-" . $this->edit_by, $this->editor);
|
||||
}
|
||||
}
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name . "_id";
|
||||
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-" . $this->$idfield);
|
||||
if (!$this->$name) {
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
}
|
||||
|
||||
if ($this->$name->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-$name-" . $this->$name->id, $this->$name);
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,557 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingBillingController extends mfBaseController
|
||||
{
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->can(["Fibu"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
$startdate = 1709254800;
|
||||
$today = time();
|
||||
$months = [];
|
||||
$month = $startdate;
|
||||
while ($month < $today) {
|
||||
$months[] = date("m.Y", $month);
|
||||
$month = strtotime("+1 month", $month);
|
||||
}
|
||||
$timerecordingBillings = TimerecordingBillingModel::getAll();
|
||||
|
||||
foreach ($timerecordingBillings as $timerecordingBilling) {
|
||||
$timerecordingbillings[$timerecordingBilling->month] = $timerecordingBilling;
|
||||
echo $timerecordingBilling->month;
|
||||
}
|
||||
|
||||
$this->layout()->set("months", $months);
|
||||
$this->layout()->set("timerecordingbillings", $timerecordingbillings);
|
||||
$this->layout()->setTemplate("TimerecordingBilling/Index");
|
||||
}
|
||||
|
||||
protected function detailClosedAction($timerecordingBilling)
|
||||
{
|
||||
$r = $this->request;
|
||||
$month = $r->get("month");
|
||||
$month = strtotime("01." . $month);
|
||||
|
||||
$timerecordings = TimerecordingBillingEmployeeModel::search(["timerecordingBilling_id" => $timerecordingBilling[0]->id]);
|
||||
$this->layout()->setTemplate("TimerecordingBilling/DetailClosed");
|
||||
$this->layout()->set("month", date("m.Y", $month));
|
||||
$this->layout()->set("timerecordings", $timerecordings);
|
||||
|
||||
}
|
||||
|
||||
protected function detailAction()
|
||||
{
|
||||
$r = $this->request;
|
||||
$month = $r->get("month");
|
||||
if (!$month) {
|
||||
$this->redirect("TimerecordingBilling");
|
||||
}
|
||||
$timerecordingBilling = TimerecordingBillingModel::search(["month" => $month]);
|
||||
if ($timerecordingBilling) {
|
||||
$this->detailclosedAction($timerecordingBilling);
|
||||
} else {
|
||||
$month = strtotime("01." . $month);
|
||||
$timerecordingsEmolyees = TimerecordingEmployeeModel::getAll();
|
||||
foreach ($timerecordingsEmolyees as $timerecordingsEmolyee) {
|
||||
if ($timerecordingsEmolyee->bmd_active == 0) continue;
|
||||
$user = new User($timerecordingsEmolyee->user_id);
|
||||
$employee_number = (string)$user->getFlag('employee_number');
|
||||
$timerecordingReport = new TimerecordingReportController();
|
||||
$timerecordings[$timerecordingsEmolyee->user_id]['user_id'] = $timerecordingsEmolyee->user_id;
|
||||
$timerecordings[$timerecordingsEmolyee->user_id]['user_name'] = $timerecordingsEmolyee->user->name;
|
||||
$timerecordings[$timerecordingsEmolyee->user_id]['employee_number'] = $employee_number;
|
||||
$timerecordings[$timerecordingsEmolyee->user_id]['data'] = $timerecordingReport->getTimerecordingsTimes('2', $month, $month, $month, $timerecordingsEmolyee->user_id, 0);
|
||||
}
|
||||
$this->layout()->set("timerecordings", $timerecordings);
|
||||
$this->layout()->setTemplate("TimerecordingBilling/Detail");
|
||||
$this->layout()->set("month", date("m.Y", $month));
|
||||
}
|
||||
}
|
||||
|
||||
protected function apiAction()
|
||||
{
|
||||
$do = $this->request->do;
|
||||
$month = $this->request->month;
|
||||
|
||||
$data = [];
|
||||
|
||||
switch ($do) {
|
||||
case "generatebmdexport":
|
||||
$return = $this->generateBmdExport($month);
|
||||
break;
|
||||
case "generatebmdexportnlz":
|
||||
$return = $this->generateBmdExport($month, 1);
|
||||
break;
|
||||
case "generatebmdexportclosed":
|
||||
$return = $this->generateBmdExportClosed($month);
|
||||
break;
|
||||
case "generatebmdexportnlzclosed":
|
||||
$return = $this->generateBmdExportClosed($month, 1);
|
||||
break;
|
||||
case "completemonth":
|
||||
$return = $this->completemonth($month);
|
||||
break;
|
||||
case "saveovertime":
|
||||
$return = $this->saveovertime();
|
||||
break;
|
||||
default:
|
||||
$return = false;
|
||||
}
|
||||
if (!is_array($return) || !count($return)) {
|
||||
$data = ["status" => "error"];
|
||||
$this->returnJson($data);
|
||||
}
|
||||
$data['status'] = "OK";
|
||||
$data['result'] = $return;
|
||||
$this->returnJson($data);
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected function saveAction()
|
||||
{
|
||||
$r = $this->request;
|
||||
$id = $r->id;
|
||||
//var_dump($r->get());exit;
|
||||
if (is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
$timerecordingbillings = new TimerecordingBilling($id);
|
||||
if (!$timerecordingbillings->id) {
|
||||
$this->layout()->setFlash("Timerecording nicht gefunden", "error");
|
||||
$this->redirect("TimerecordingBilling");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['month'] = trim($r->month);
|
||||
$data['closetime'] = time();
|
||||
|
||||
|
||||
if (!$data['month']) {
|
||||
$data['month'] = NULL;
|
||||
}
|
||||
if (!$data['closetime']) {
|
||||
$data['closetime'] = NULL;
|
||||
}
|
||||
|
||||
|
||||
// var_dump($_FILES);
|
||||
// var_dump($upload);
|
||||
// exit;
|
||||
|
||||
|
||||
if ($mode == "edit") {
|
||||
$timerecordingbillings->update($data);
|
||||
|
||||
} else {
|
||||
$timerecordingbillings = TimerecordingBillingModel::create($data);
|
||||
}
|
||||
// var_dump($filestore);
|
||||
// exit;
|
||||
$id = $timerecordingbillings->save();
|
||||
|
||||
if (!$id) {
|
||||
$this->layout()->setFlash("Timerecording konnte nicht angelegt werden", "error");
|
||||
$this->redirect("TimerecordingBilling");
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
// $this->layout()->setFlash("Timerecording erfolgreich geändert", "success");
|
||||
} else if ($mode = "add") {
|
||||
// $this->layout()->setFlash("Timerecording erfolgreich angelegt", "success");
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
||||
protected function deleteAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
$timerecordingbillings = new TimerecordingBilling($id);
|
||||
if (!$timerecordingbillings->id || $timerecordingbillings->id != $id) {
|
||||
$this->layout()->setFlash("Timerecording nicht gefunden.", "error");
|
||||
$this->redirect("TimerecordingBilling");
|
||||
}
|
||||
|
||||
$timerecordingbillings->delete();
|
||||
$this->redirect("TimerecordingBilling");
|
||||
}
|
||||
|
||||
protected function generateBmdLine()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected function generateBmdExportClosed($month, $nlz = 0)
|
||||
{
|
||||
$filename = "import_bmd_" . $month . ".csv";
|
||||
$file = fopen("php://output", 'w');
|
||||
header('Content-Type: text/csv; charset=utf-8');
|
||||
header('Content-Disposition: attachment; filename=' . $filename);
|
||||
$monthbmd = date("n", strtotime("01." . $month));
|
||||
$companybmd = "1";
|
||||
if ($nlz == 0) {
|
||||
$headerarray = ["Monat", "Firma", "Mitarbeiter", "Lohnart", "Menge", "Satz", "Betrag", "Kostenstelle", "NLZ-Kennzeichen", "NLZ Von-Datum", "NLZ Bis-Datum"];
|
||||
fputcsv($file, $headerarray, ";");
|
||||
} else {
|
||||
$headerarray = ["Firma", "Mitarbeiter", "DV-Nr", "Art", "Sonderzeit", "Verarbeitungs-KZ", "Von", "Bis", "Verwaltung", "Bezahlt"];
|
||||
fputcsv($file, $headerarray, ";");
|
||||
}
|
||||
$billing = TimerecordingBillingModel::search(["month" => $month]);
|
||||
$timerecordingBillingEmployees = TimerecordingBillingEmployeeModel::search(["timerecordingBilling_id" => $billing[0]->id]);
|
||||
foreach ($timerecordingBillingEmployees as $timerecordingBillingEmployee) {
|
||||
if ($timerecordingBillingEmployee->timerecordingEmployee->bmd_active == 0) continue;
|
||||
$user = new User($timerecordingBillingEmployee->timerecordingEmployee->user_id);
|
||||
$employee_number = (string)$user->getFlag('employee_number');
|
||||
$employeetypesbmd = TimerecordingEmployeeModel::$employeetypesbmd;
|
||||
$employee_type = $employeetypesbmd[$timerecordingBillingEmployee->timerecordingEmployee->type];
|
||||
$overtimebase = 0;
|
||||
if ($nlz == 0) {
|
||||
$hours = $timerecordingBillingEmployee->ishours / 3600;
|
||||
$hours = round($hours, 2);
|
||||
$hours = str_replace(".", ",", $hours);
|
||||
if ($hours > 0) {
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, $employee_type, $hours, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
if ($timerecordingBillingEmployee->overtime50free > 0) {
|
||||
$overtime50free = $timerecordingBillingEmployee->overtime50free / 3600;
|
||||
$overtime50free = round($overtime50free, 2);
|
||||
$overtimebase = $overtimebase + $overtime50free;
|
||||
$overtime50free = str_replace(".", ",", $overtime50free);
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "3110", $overtime50free, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
if ($timerecordingBillingEmployee->overtime100free > 0) {
|
||||
$overtime100free = $timerecordingBillingEmployee->overtime100free / 3600;
|
||||
$overtime100free = round($overtime100free, 2);
|
||||
$overtimebase = $overtimebase + $overtime100free;
|
||||
$overtime100free = str_replace(".", ",", $overtime100free);
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "3160", $overtime100free, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
if ($overtimebase > 0) {
|
||||
$overtimebase = str_replace(".", ",", $overtimebase);
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "3100", $overtimebase, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
|
||||
if ($timerecordingBillingEmployee->homeoffice > 0) {
|
||||
$homeoffice = $timerecordingBillingEmployee->homeoffice;
|
||||
$homeoffice = round($homeoffice, 2);
|
||||
$homeoffice = str_replace(".", ",", $homeoffice);
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "7590", $homeoffice, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
|
||||
} else {
|
||||
if ($timerecordingBillingEmployee->nlz_detail) {
|
||||
foreach (json_decode($timerecordingBillingEmployee->nlz_detail, true) as $nlztime) {
|
||||
|
||||
$bodyarray = [$companybmd, $employee_number, 1, $nlztime['categoryshort'], $nlztime['catExtended'], "3", $nlztime['start'], $nlztime['end'], $nlztime['time'], $nlztime['pay']];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($timerecordingBillingEmployee->diet > 0 && $nlz == 0) {
|
||||
$dietsum = round($timerecordingBillingEmployee->diet, 2);
|
||||
$dietsum = str_replace(".", ",", $dietsum);
|
||||
$bodyarray = [$monthbmd, $companybmd, $employee_number, "2500", "", "", $dietsum, "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
fclose($file);
|
||||
exit;
|
||||
}
|
||||
|
||||
protected function generateBmdExport($month, $nlz = 0, $export = 1)
|
||||
{
|
||||
//create and download csv file
|
||||
if ($export == 1) {
|
||||
$filename = "import_bmd_" . $month . ".csv";
|
||||
$file = fopen("php://output", 'w');
|
||||
header('Content-Type: text/csv; charset=utf-8');
|
||||
header('Content-Disposition: attachment; filename=' . $filename);
|
||||
}
|
||||
if ($export == 1) {
|
||||
if ($nlz == 0) {
|
||||
$headerarray = ["Monat", "Firma", "Mitarbeiter", "Lohnart", "Menge", "Satz", "Betrag", "Kostenstelle", "NLZ-Kennzeichen", "NLZ Von-Datum", "NLZ Bis-Datum"];
|
||||
fputcsv($file, $headerarray, ";");
|
||||
} else {
|
||||
$headerarray = ["Firma", "Mitarbeiter", "DV-Nr", "Art", "Sonderzeit", "Verarbeitungs-KZ", "Von", "Bis", "Verwaltung", "Bezahlt"];
|
||||
fputcsv($file, $headerarray, ";");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$month = strtotime("01." . $month);
|
||||
//last of month
|
||||
$monthend = date("Y-m-d", strtotime("last day of this month", $month));
|
||||
$monthend = strtotime($monthend . " 23:59:59");
|
||||
|
||||
|
||||
$monthbmd = date("n", $month);
|
||||
$companybmd = "1";
|
||||
$timerecordingsEmolyees = TimerecordingEmployeeModel::getAll();
|
||||
foreach ($timerecordingsEmolyees as $timerecordingsEmolyee) {
|
||||
if ($timerecordingsEmolyee->bmd_active == 0) continue;
|
||||
$user = new User($timerecordingsEmolyee->user_id);
|
||||
$employee_number = (string)$user->getFlag('employee_number');
|
||||
$employeetypesbmd = TimerecordingEmployeeModel::$employeetypesbmd;
|
||||
$employee_type = $employeetypesbmd[$timerecordingsEmolyee->type];
|
||||
$timerecordingReport = new TimerecordingReportController();
|
||||
$timerecording = $timerecordingReport->getTimerecordingsTimes('2', $month, $month, $month, $timerecordingsEmolyee->user_id, 0);
|
||||
if ($export == 0) {
|
||||
$reponse[$employee_number]['employee_id'] = $timerecordingsEmolyee->id;
|
||||
$reponse[$employee_number]['homeoffice'] = $timerecording['time']['homeoffice'];
|
||||
$reponse[$employee_number]['istimeall'] = $timerecording['time']['isorder'];
|
||||
$reponse[$employee_number]['musttime'] = $timerecording['time']['mustorder'];
|
||||
}
|
||||
|
||||
foreach ($timerecording['time']['isclean'] as $key => $value) {
|
||||
$hours = $value;
|
||||
//calc ishours in hours
|
||||
$hours = $hours / 3600;
|
||||
$hours = round($hours, 2);
|
||||
$hours = str_replace(".", ",", $hours);
|
||||
if (strpos($key, ',') !== false && $nlz == 0) {
|
||||
if ($export == 1) {
|
||||
$bodyarray = [$monthbmd, $companybmd, $employee_number, $employee_type, $hours, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
} else {
|
||||
$reponse[$employee_number]['istime'] = $value;
|
||||
}
|
||||
} else if (strpos($key, ',') === false && $nlz == 1) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($timerecording['time']['diet'] > 0 && $nlz == 0) {
|
||||
$dietsum = round($timerecording['time']['diet'], 2);
|
||||
if ($export == 1) {
|
||||
$dietsum = str_replace(".", ",", $dietsum);
|
||||
$bodyarray = [$monthbmd, $companybmd, $employee_number, "2500", "", "", $dietsum, "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
} else {
|
||||
$reponse[$employee_number]['diet'] = $dietsum;
|
||||
}
|
||||
}
|
||||
if (!empty($timerecording['time']['nlztimes']) && ($nlz == 1 || $export == 0)) {
|
||||
foreach ($timerecording['time']['nlztimes'] as $nlztime) {
|
||||
if (strtotime($nlztime['start']) < $month) {
|
||||
$nlztime['start'] = date("d.m.Y", $month);
|
||||
}
|
||||
if ((strtotime($nlztime['end']) + 84599) > $monthend) {
|
||||
$nlztime['end'] = date("d.m.Y", $monthend);
|
||||
}
|
||||
|
||||
|
||||
if (strpos($nlztime['categoryshort'], '6-') !== false) {
|
||||
$catExtended = explode("-", $nlztime['categoryshort']);
|
||||
$catExtended = $catExtended[1];
|
||||
$nlztime['categoryshort'] = "6";
|
||||
} else {
|
||||
$catExtended = "";
|
||||
}
|
||||
|
||||
if ($nlztime['minutes']) {
|
||||
$timesecounds = $nlztime['minutes'];
|
||||
$time = $nlztime['minutes'] / 60;
|
||||
$time = round($time, 2);
|
||||
$time = str_replace(".", ",", $time);
|
||||
if ($nlztime['unpaid'] == "0") {
|
||||
$pay = $time;
|
||||
} else {
|
||||
$pay = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (empty($catExtended)) {
|
||||
$time = "";
|
||||
$timesecounds = "";
|
||||
$pay = "";
|
||||
} else {
|
||||
//calc days from $nlztime['start'] to $nlztime['end']
|
||||
$start = strtotime($nlztime['start']);
|
||||
$end = strtotime($nlztime['end']);
|
||||
$time = ($end - $start);
|
||||
$timesecounds = $time;
|
||||
$time = $time / 86400 + 1;
|
||||
$time = round($time, 0);
|
||||
|
||||
|
||||
if ($nlztime['unpaid'] == "0") {
|
||||
$pay = $time;
|
||||
} else {
|
||||
$pay = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if ($export == 1) {
|
||||
$bodyarray = [$companybmd, $employee_number, 1, $nlztime['categoryshort'], $catExtended, "3", $nlztime['start'], $nlztime['end'], $time, $pay];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
} else {
|
||||
$reponse[$employee_number]['nlz'][] = array("categoryshort" => $nlztime['categoryshort'], "catExtended" => $catExtended, "start" => $nlztime['start'], "end" => $nlztime['end'], "time" => $time, "pay" => $pay);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if ($export == 0) {
|
||||
$reponse[$employee_number]['daysum'] = json_encode($timerecording['time']['daysum']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if ($export == 1) {
|
||||
fclose($file);
|
||||
exit;
|
||||
} else {
|
||||
return $reponse;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function completemonth($month)
|
||||
{
|
||||
$id = $this->saveAction();
|
||||
$user = new User($timerecordingsEmolyee->user_id);
|
||||
$employee_number = (string)$user->getFlag('employee_number');
|
||||
|
||||
$timerecordings = $this->generateBmdExport($month, 0, 0);
|
||||
foreach ($timerecordings as $employeenumber => $timerecording) {
|
||||
$data = [];
|
||||
$data['timerecordingBilling_id'] = $id;
|
||||
$data['timerecordingEmployee_id'] = $timerecording['employee_id'];
|
||||
$data['musthours'] = $timerecording['musttime'];
|
||||
if ($timerecording['istime']) {
|
||||
$data['ishours'] = $timerecording['istime'];
|
||||
} else {
|
||||
$data['ishours'] = 0;
|
||||
}
|
||||
$data['ishourssum'] = $timerecording['istimeall'];
|
||||
$data['diet'] = $timerecording['diet'];
|
||||
if ($timerecording['nlz']) {
|
||||
$data['nlz_detail'] = json_encode($timerecording['nlz']);
|
||||
}
|
||||
if ($timerecording['daysum']) {
|
||||
$data['nlz'] = $timerecording['daysum'];
|
||||
}
|
||||
if ($timerecording['homeoffice']) {
|
||||
$data['homeoffice'] = $timerecording['homeoffice'];
|
||||
}
|
||||
|
||||
|
||||
if (!$data['diet']) {
|
||||
$data['diet'] = 0;
|
||||
|
||||
}
|
||||
|
||||
$timerecordingbillingemployee = TimerecordingBillingEmployeeModel::create($data);
|
||||
$timerecordingbillingemployee->save();
|
||||
}
|
||||
$result['state'] = "success";
|
||||
echo json_encode($result);
|
||||
die();
|
||||
}
|
||||
|
||||
protected function saveovertime()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
$type = $this->request->type;
|
||||
$timerecordingbillingsemployee = new TimerecordingBillingEmployee($id);
|
||||
if ($type == "overtime") {
|
||||
$sum = 0;
|
||||
$data = [];
|
||||
if ($this->request->overtime50) {
|
||||
$data['overtime50free'] = $timerecordingbillingsemployee->overtime50free + $this->request->overtime50 * 3600;
|
||||
$sum += $this->request->overtime50 * 3600;
|
||||
}
|
||||
if ($this->request->overtime100) {
|
||||
$data['overtime100free'] = $timerecordingbillingsemployee->overtime100free + $this->request->overtime100 * 3600;
|
||||
$sum += $this->request->overtime100 * 3600;
|
||||
}
|
||||
if ($this->request->overtimebpa) {
|
||||
$timerecordingbillingsemployee->timerecordingEmployee->id;
|
||||
$timerecordingEmployee = new TimerecordingEmployee($timerecordingbillingsemployee->timerecordingEmployee->id);
|
||||
$dataemployee = [];
|
||||
$dataemployee['bpahours'] = $timerecordingEmployee->bpahours + $this->request->overtimebpa * 3600;
|
||||
$sum += $this->request->overtimebpa * 3600;
|
||||
$timerecordingEmployee->update($dataemployee);
|
||||
$timerecordingEmployee->save();
|
||||
|
||||
}
|
||||
if ($data) {
|
||||
$timerecordingbillingsemployee->update($data);
|
||||
$timerecordingbillingsemployee->save();
|
||||
$timerecordingbillingsemployee->timerecordingEmployee->id;
|
||||
$timerecordingEmployee = new TimerecordingEmployee($timerecordingbillingsemployee->timerecordingEmployee->id);
|
||||
$dataemployee = [];
|
||||
$dataemployee['overtime_now'] = $timerecordingEmployee->overtime_now - $sum;
|
||||
$dataemployee['overtime'] = $timerecordingEmployee->overtime - $sum;
|
||||
$timerecordingEmployee->update($dataemployee);
|
||||
$timerecordingEmployee->save();
|
||||
}
|
||||
} else if ($type == "difference") {
|
||||
$sum = 0;
|
||||
$data = [];
|
||||
if ($this->request->overtime50) {
|
||||
$data['overtime50free'] = $timerecordingbillingsemployee->overtime50free + $this->request->overtime50 * 3600;
|
||||
$sum += $this->request->overtime50 * 3600;
|
||||
}
|
||||
if ($this->request->overtime100) {
|
||||
$data['overtime100free'] = $timerecordingbillingsemployee->overtime100free + $this->request->overtime100 * 3600;
|
||||
$sum += $this->request->overtime100 * 3600;
|
||||
}
|
||||
if ($this->request->overtimebpa) {
|
||||
$timerecordingbillingsemployee->timerecordingEmployee->id;
|
||||
$timerecordingEmployee = new TimerecordingEmployee($timerecordingbillingsemployee->timerecordingEmployee->id);
|
||||
$dataemployee = [];
|
||||
$dataemployee['bpahours'] = $timerecordingEmployee->bpahours + $this->request->overtimebpa * 3600;
|
||||
$sum += $this->request->overtimebpa * 3600;
|
||||
$timerecordingEmployee->update($dataemployee);
|
||||
$timerecordingEmployee->save();
|
||||
|
||||
}
|
||||
if ($sum > 0) {
|
||||
$data['ishourssum'] = $timerecordingbillingsemployee->ishourssum - $sum;
|
||||
$timerecordingbillingsemployee->update($data);
|
||||
$timerecordingbillingsemployee->save();
|
||||
}
|
||||
}
|
||||
$response['state'] = "success";
|
||||
echo json_encode($response);
|
||||
die();
|
||||
}
|
||||
}
|
||||
128
application/TimerecordingBilling/TimerecordingBillingModel.php
Normal file
128
application/TimerecordingBilling/TimerecordingBillingModel.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingBillingModel
|
||||
{
|
||||
public static $dieatBase = 26.4;
|
||||
public static $excludeEmployees = [1000, 1001, 9999, 4, 5, 6, 7, 8, 9, 10];
|
||||
private $month;
|
||||
private $closetime;
|
||||
|
||||
|
||||
public static function find($data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static function create(array $data)
|
||||
{
|
||||
$model = new TimerecordingBilling();
|
||||
|
||||
foreach ($data as $field => $value) {
|
||||
if (property_exists(get_called_class(), $field)) {
|
||||
if (substr($field, 0, 5) == "vlan_" && !$value) {
|
||||
$model->$field = null;
|
||||
continue;
|
||||
}
|
||||
$model->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = mfValuecache::singleton()->get("me");
|
||||
if (!$me) {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
mfValuecache::singleton()->set("me", $me);
|
||||
}
|
||||
|
||||
if ($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if ($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getOne($id)
|
||||
{
|
||||
if (!is_numeric($id) || !$id) {
|
||||
throw new Exception("Invalid number", 400);
|
||||
}
|
||||
$item = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("TimerecordingBilling", "*", "id=$id LIMIT 1");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new TimerecordingBilling($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("TimerecordingBilling", "*", "1=1");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new TimerecordingBilling($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst()
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("TimerecordingBilling", "*", "$where ");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new TimerecordingBilling($data);
|
||||
if ($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function search($filter)
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("TimerecordingBilling", "*", "$where");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new TimerecordingBilling($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter)
|
||||
{
|
||||
$where = "1=1 ";
|
||||
|
||||
//var_dump($filter);exit;
|
||||
if (array_key_exists("month", $filter)) {
|
||||
$month = $filter['month'];
|
||||
if ($month) {
|
||||
$where .= " AND month=$month";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingBillingEmployee extends mfBaseModel
|
||||
{
|
||||
private $editor;
|
||||
private $creator;
|
||||
private $timerecordingBilling;
|
||||
private $timerecordingEmployee;
|
||||
|
||||
|
||||
|
||||
public function getProperty($name)
|
||||
{
|
||||
if ($this->$name == null) {
|
||||
|
||||
if (!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($name == "creator") {
|
||||
$this->creator = mfValuecache::singleton()->get("Worker-id-" . $this->create_by);
|
||||
if ($this->creator === null) {
|
||||
$this->creator = new User($this->create_by);
|
||||
if ($this->creator->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-" . $this->create_by, $this->creator);
|
||||
}
|
||||
}
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if ($name == "editor") {
|
||||
$this->editor = mfValuecache::singleton()->get("Worker-id-" . $this->edit_by);
|
||||
if ($this->editor === null) {
|
||||
$this->editor = new User($this->edit_by);
|
||||
if ($this->editor->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-" . $this->edit_by, $this->editor);
|
||||
}
|
||||
}
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name . "_id";
|
||||
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-" . $this->$idfield);
|
||||
if (!$this->$name) {
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
}
|
||||
|
||||
if ($this->$name->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-$name-" . $this->$name->id, $this->$name);
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingBillingEmployeeController extends mfBaseController
|
||||
{
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
|
||||
$this->layout()->setTemplate("TimerecordingBillingEmployee/Index");
|
||||
$timerecordingbillingemployees = TimerecordingBillingEmployeeModel::getAll();
|
||||
$this->layout()->set("timerecordingbillingemployees", $timerecordingbillingemployees);
|
||||
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
$timerecordingBillingEmployees = TimerecordingBillingEmployeeModel::getAll();
|
||||
$this->layout()->set("timerecordingBillingEmployees", $timerecordingBillingEmployees);
|
||||
$timerecordingEmployees = TimerecordingEmployeeModel::getAll();
|
||||
$this->layout()->set("timerecordingEmployees", $timerecordingEmployees);
|
||||
|
||||
$this->layout()->setTemplate("TimerecordingBillingEmployee/Form");
|
||||
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("fdfsdf nicht gefunden", "error");
|
||||
$this->redirect("TimerecordingBillingEmployee");
|
||||
}
|
||||
|
||||
$timerecordingbillingemployees = new TimerecordingBillingEmployee($id);
|
||||
if ($timerecordingbillingemployees->id != $id) {
|
||||
$this->layout()->setFlash("fdfsdf nicht gefunden", "error");
|
||||
$this->redirect("TimerecordingBillingEmployee");
|
||||
}
|
||||
|
||||
$this->layout()->set("timerecordingbillingemployees", $timerecordingbillingemployees);
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
protected function saveAction()
|
||||
{
|
||||
$r = $this->request;
|
||||
$id = $r->id;
|
||||
//var_dump($r->get());exit;
|
||||
if (is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
$timerecordingbillingemployees = new TimerecordingBillingEmployee($id);
|
||||
if (!$timerecordingbillingemployees->id) {
|
||||
$this->layout()->setFlash("dfsdfsdfds nicht gefunden", "error");
|
||||
$this->redirect("TimerecordingBillingEmployee");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['timerecordingBillingEmployee_id'] = trim($r->timerecordingBillingEmployee_id);
|
||||
$data['timerecordingEmployee_id'] = trim($r->timerecordingEmployee_id);
|
||||
$data['type'] = trim($r->type);
|
||||
$data['ishours'] = trim($r->ishours);
|
||||
$data['overtime25'] = trim($r->overtime25);
|
||||
$data['plushours50'] = trim($r->plushours50);
|
||||
$data['plushours50free'] = trim($r->plushours50free);
|
||||
$data['plushours100'] = trim($r->plushours100);
|
||||
$data['plushours100free'] = trim($r->plushours100free);
|
||||
$data['homeoffice'] = trim($r->homeoffice);
|
||||
$data['diet'] = trim($r->diet);
|
||||
$data['nlz'] = trim($r->nlz);
|
||||
$data['nlz_detail'] = trim($r->nlz_detail);
|
||||
|
||||
|
||||
if (!$data['timerecordingBillingEmployee_id']) {
|
||||
$data['timerecordingBillingEmployee_id'] = NULL;
|
||||
}
|
||||
if (!$data['timerecordingEmployee_id']) {
|
||||
$data['timerecordingEmployee_id'] = NULL;
|
||||
}
|
||||
if (!$data['type']) {
|
||||
$data['type'] = NULL;
|
||||
}
|
||||
if (!$data['ishours']) {
|
||||
$data['ishours'] = NULL;
|
||||
}
|
||||
if (!$data['overtime25']) {
|
||||
$data['overtime25'] = NULL;
|
||||
}
|
||||
if (!$data['plushours50']) {
|
||||
$data['plushours50'] = NULL;
|
||||
}
|
||||
if (!$data['plushours50free']) {
|
||||
$data['plushours50free'] = NULL;
|
||||
}
|
||||
if (!$data['plushours100']) {
|
||||
$data['plushours100'] = NULL;
|
||||
}
|
||||
if (!$data['plushours100free']) {
|
||||
$data['plushours100free'] = NULL;
|
||||
}
|
||||
if (!$data['homeoffice']) {
|
||||
$data['homeoffice'] = NULL;
|
||||
}
|
||||
if ($data['diet'] == NULL) {
|
||||
$data['diet'] = 0;
|
||||
}
|
||||
if (!$data['nlz']) {
|
||||
$data['nlz'] = NULL;
|
||||
}
|
||||
if (!$data['nlz_detail']) {
|
||||
$data['nlz_detail'] = NULL;
|
||||
}
|
||||
|
||||
// var_dump($_FILES);
|
||||
// var_dump($upload);
|
||||
// exit;
|
||||
|
||||
|
||||
if ($mode == "edit") {
|
||||
$timerecordingbillingemployees->update($data);
|
||||
|
||||
} else {
|
||||
$timerecordingbillingemployees = TimerecordingBillingEmployeeModel::create($data);
|
||||
}
|
||||
// var_dump($filestore);
|
||||
// exit;
|
||||
$id = $timerecordingbillingemployees->save();
|
||||
|
||||
if (!$id) {
|
||||
$this->layout()->setFlash("fdfsdf konnte nicht angelegt werden", "error");
|
||||
$this->redirect("TimerecordingBillingEmployee");
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
$this->layout()->setFlash("fdfsdf erfolgreich geändert", "success");
|
||||
} else if ($mode = "add") {
|
||||
$this->layout()->setFlash("fdfsdf erfolgreich angelegt", "success");
|
||||
}
|
||||
$this->redirect("TimerecordingBillingEmployee");
|
||||
}
|
||||
|
||||
|
||||
protected function deleteAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
$timerecordingbillingemployees = new TimerecordingBillingEmployee($id);
|
||||
if (!$timerecordingbillingemployees->id || $timerecordingbillingemployees->id != $id) {
|
||||
$this->layout()->setFlash("fdfsdf nicht gefunden.", "error");
|
||||
$this->redirect("TimerecordingBillingEmployee");
|
||||
}
|
||||
|
||||
$timerecordingbillingemployees->delete();
|
||||
$this->redirect("TimerecordingBillingEmployee");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingBillingEmployeeModel
|
||||
{
|
||||
private $timerecordingBilling_id;
|
||||
private $timerecordingEmployee_id;
|
||||
private $musthours;
|
||||
private $type;
|
||||
private $ishours;
|
||||
private $ishourssum;
|
||||
private $overtime25;
|
||||
private $plushours50;
|
||||
private $plushours50free;
|
||||
private $plushours100;
|
||||
private $plushours100free;
|
||||
private $homeoffice;
|
||||
private $diet;
|
||||
private $nlz;
|
||||
private $nlz_detail;
|
||||
|
||||
|
||||
public static function find($data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static function create(array $data)
|
||||
{
|
||||
$model = new TimerecordingBillingEmployee();
|
||||
|
||||
foreach ($data as $field => $value) {
|
||||
if (property_exists(get_called_class(), $field)) {
|
||||
if (substr($field, 0, 5) == "vlan_" && !$value) {
|
||||
$model->$field = null;
|
||||
continue;
|
||||
}
|
||||
$model->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = mfValuecache::singleton()->get("me");
|
||||
if (!$me) {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
mfValuecache::singleton()->set("me", $me);
|
||||
}
|
||||
|
||||
if ($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if ($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getOne($id)
|
||||
{
|
||||
if (!is_numeric($id) || !$id) {
|
||||
throw new Exception("Invalid number", 400);
|
||||
}
|
||||
$item = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("TimerecordingBillingEmployee", "*", "id=$id LIMIT 1");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new TimerecordingBillingEmployee($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("TimerecordingBillingEmployee", "*", "1=1");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new TimerecordingBillingEmployee($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst()
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("TimerecordingBillingEmployee", "*", "$where ");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new TimerecordingBillingEmployee($data);
|
||||
if ($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function search($filter)
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("TimerecordingBillingEmployee", "*", "$where");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new TimerecordingBillingEmployee($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter)
|
||||
{
|
||||
$where = "1=1 ";
|
||||
|
||||
//var_dump($filter);exit;
|
||||
if (array_key_exists("timerecordingBilling_id", $filter)) {
|
||||
$timerecordingBilling_id = $filter['timerecordingBilling_id'];
|
||||
if (is_numeric($timerecordingBilling_id)) {
|
||||
$where .= " AND timerecordingBilling_id='$timerecordingBilling_id'";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
60
application/TimerecordingCar/TimerecordingCar.php
Normal file
60
application/TimerecordingCar/TimerecordingCar.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingCar extends mfBaseModel
|
||||
{
|
||||
private $user;
|
||||
private $editor;
|
||||
private $creator;
|
||||
|
||||
|
||||
|
||||
public function getProperty($name)
|
||||
{
|
||||
if ($this->$name == null) {
|
||||
|
||||
if (!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($name == "creator") {
|
||||
$this->creator = mfValuecache::singleton()->get("Worker-id-" . $this->create_by);
|
||||
if ($this->creator === null) {
|
||||
$this->creator = new User($this->create_by);
|
||||
if ($this->creator->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-" . $this->create_by, $this->creator);
|
||||
}
|
||||
}
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if ($name == "editor") {
|
||||
$this->editor = mfValuecache::singleton()->get("Worker-id-" . $this->edit_by);
|
||||
if ($this->editor === null) {
|
||||
$this->editor = new User($this->edit_by);
|
||||
if ($this->editor->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-" . $this->edit_by, $this->editor);
|
||||
}
|
||||
}
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name . "_id";
|
||||
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-" . $this->$idfield);
|
||||
if (!$this->$name) {
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
}
|
||||
|
||||
if ($this->$name->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-$name-" . $this->$name->id, $this->$name);
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
}
|
||||
179
application/TimerecordingCar/TimerecordingCarController.php
Normal file
179
application/TimerecordingCar/TimerecordingCarController.php
Normal file
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingCarController extends mfBaseController
|
||||
{
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
|
||||
$this->layout()->setTemplate("TimerecordingCar/Index");
|
||||
$timerecordingcars = TimerecordingCarModel::getAll();
|
||||
$this->layout()->set("timerecordingcars", $timerecordingcars);
|
||||
|
||||
}
|
||||
|
||||
protected function detailAction()
|
||||
{
|
||||
$timerecordingcarid = $this->request->id;
|
||||
$this->layout()->setTemplate("TimerecordingCar/Detail");
|
||||
$timerecordingcar = TimerecordingCarModel::getOne($timerecordingcarid);
|
||||
$this->layout()->set("timerecordingcar", $timerecordingcar);
|
||||
$timerecordings = TimerecordingModel::search(["timerecordingCar_id_all" => $timerecordingcarid]);
|
||||
$this->layout()->set("timerecordings", $timerecordings);
|
||||
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
$timerecordingusers = UserModel::search(['employee' => 'true']);
|
||||
$this->layout()->set("timerecordingusers", $timerecordingusers);
|
||||
$this->layout()->setTemplate("TimerecordingCar/Form");
|
||||
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("Auto nicht gefunden", "error");
|
||||
$this->redirect("TimerecordingCar");
|
||||
}
|
||||
|
||||
$timerecordingcars = new TimerecordingCar($id);
|
||||
if ($timerecordingcars->id != $id) {
|
||||
$this->layout()->setFlash("Auto nicht gefunden", "error");
|
||||
$this->redirect("TimerecordingCar");
|
||||
}
|
||||
|
||||
|
||||
$this->layout()->set("timerecordingcars", $timerecordingcars);
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
protected function saveAction()
|
||||
{
|
||||
$r = $this->request;
|
||||
$id = $r->id;
|
||||
//var_dump($r->get());exit;
|
||||
if (is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
$timerecordingcars = new TimerecordingCar($id);
|
||||
if (!$timerecordingcars->id) {
|
||||
$this->layout()->setFlash("Autos nicht gefunden", "error");
|
||||
$this->redirect("TimerecordingCar");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['number_plate'] = trim($r->number_plate);
|
||||
$data['user_id'] = trim($r->user_id);
|
||||
$data['brand'] = trim($r->brand);
|
||||
$data['model'] = trim($r->model);
|
||||
$data['mileage'] = trim($r->mileage);
|
||||
$data['initial_approval'] = strtotime($r->initial_approval);
|
||||
$data['timerecording'] = $r->timerecording;
|
||||
$data['first_approval'] = trim($r->first_approval);
|
||||
|
||||
|
||||
if (!$data['user_id'] || $data['user_id'] == "-") {
|
||||
$data['user_id'] = null;
|
||||
}
|
||||
if (!$data['initial_approval']) {
|
||||
$data['initial_approval'] = null;
|
||||
}
|
||||
|
||||
if (!$data['timerecording']) {
|
||||
$data['timerecording'] = 0;
|
||||
}
|
||||
if (!$data['mileage']) {
|
||||
$data['mileage'] = null;
|
||||
}
|
||||
|
||||
if (!$data['first_approval'] || trim($data['first_approval']) == "") {
|
||||
$data['first_approval'] = null;
|
||||
}
|
||||
|
||||
if (!$data['number_plate']) {
|
||||
$this->layout()->setFlash("Kennzeichen darf nicht leer sein", "error");
|
||||
$this->redirect("TimerecordingCar");
|
||||
}
|
||||
if (!$data['brand']) {
|
||||
$this->layout()->setFlash("Marke darf nicht leer sein", "error");
|
||||
$this->redirect("TimerecordingCar");
|
||||
}
|
||||
if (!$data['model']) {
|
||||
$this->layout()->setFlash("Model/Typ darf nicht leer sein", "error");
|
||||
$this->redirect("TimerecordingCar");
|
||||
}
|
||||
|
||||
|
||||
// var_dump($_FILES);
|
||||
// var_dump($upload);
|
||||
// exit;
|
||||
|
||||
|
||||
if ($mode == "edit") {
|
||||
$timerecordingcars->update($data);
|
||||
|
||||
} else {
|
||||
$timerecordingcars = TimerecordingCarModel::create($data);
|
||||
}
|
||||
// var_dump($filestore);
|
||||
// exit;
|
||||
$id = $timerecordingcars->save();
|
||||
|
||||
$returnUrl = "TimerecordingCar";
|
||||
$returnAction = "Index";
|
||||
$returnVariables = array();
|
||||
$returnAnker = "";
|
||||
if ($this->request->returnto == "detail") {
|
||||
$returnUrl = "TimerecordingCar";
|
||||
$returnAction = "detail";
|
||||
$returnVariables = array("id" => $id);
|
||||
|
||||
}
|
||||
TimerecordingCarModel::calcMileage();
|
||||
if (!$id) {
|
||||
$this->layout()->setFlash("Auto konnte nicht angelegt werden", "error");
|
||||
$this->redirect("TimerecordingCar");
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
$this->layout()->setFlash("Auto erfolgreich geändert", "success");
|
||||
} else if ($mode = "add") {
|
||||
$this->layout()->setFlash("Auto erfolgreich angelegt", "success");
|
||||
}
|
||||
$this->redirect($returnUrl, $returnAction, $returnVariables, $returnAnker);
|
||||
}
|
||||
|
||||
|
||||
protected function deleteAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
$timerecordingcars = new TimerecordingCar($id);
|
||||
if (!$timerecordingcars->id || $timerecordingcars->id != $id) {
|
||||
$this->layout()->setFlash("Auto nicht gefunden.", "error");
|
||||
$this->redirect("TimerecordingCar");
|
||||
}
|
||||
|
||||
$timerecordingcars->delete();
|
||||
$this->redirect("TimerecordingCar");
|
||||
}
|
||||
|
||||
}
|
||||
157
application/TimerecordingCar/TimerecordingCarModel.php
Normal file
157
application/TimerecordingCar/TimerecordingCarModel.php
Normal file
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingCarModel
|
||||
{
|
||||
private $user_id;
|
||||
private $number_plate;
|
||||
private $brand;
|
||||
private $model;
|
||||
private $mileage;
|
||||
private $mileage_now;
|
||||
private $mileage_timestamp;
|
||||
private $initial_approval;
|
||||
private $first_approval;
|
||||
private $timerecording;
|
||||
|
||||
|
||||
public static function find($data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static function create(array $data)
|
||||
{
|
||||
$model = new TimerecordingCar();
|
||||
|
||||
foreach ($data as $field => $value) {
|
||||
if (property_exists(get_called_class(), $field)) {
|
||||
if (substr($field, 0, 5) == "vlan_" && !$value) {
|
||||
$model->$field = null;
|
||||
continue;
|
||||
}
|
||||
$model->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = mfValuecache::singleton()->get("me");
|
||||
if (!$me) {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
mfValuecache::singleton()->set("me", $me);
|
||||
}
|
||||
|
||||
if ($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if ($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getOne($id)
|
||||
{
|
||||
if (!is_numeric($id) || !$id) {
|
||||
throw new Exception("Invalid number", 400);
|
||||
}
|
||||
$item = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("TimerecordingCar", "*", "id=$id LIMIT 1");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new TimerecordingCar($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function calcMileage()
|
||||
{
|
||||
$TimerecordingCars = self::getAll();
|
||||
foreach ($TimerecordingCars as $TimerecordingCar) {
|
||||
$timerecording = TimerecordingModel::search(["timerecordingCar_id" => $TimerecordingCar->id]);
|
||||
if (!$timerecording) {
|
||||
if ($TimerecordingCar->mileage_now != $TimerecordingCar->mileage) {
|
||||
$TimerecordingCar->mileage_now = $TimerecordingCar->mileage;
|
||||
$TimerecordingCar->save();
|
||||
}
|
||||
} else {
|
||||
if (!$TimerecordingCar->mileage_now || $TimerecordingCar->mileage_now < $timerecording[0]->mileage_end) {
|
||||
$TimerecordingCar->mileage_now = $timerecording[0]->mileage_end;
|
||||
$TimerecordingCar->save();
|
||||
} else if ($timerecording[0]->mileage_end < $TimerecordingCar->mileage) {
|
||||
$TimerecordingCar->mileage_now = $TimerecordingCar->mileage;
|
||||
$TimerecordingCar->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("TimerecordingCar", "*", "1=1");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new TimerecordingCar($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst()
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("TimerecordingCar", "*", "$where ");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new TimerecordingCar($data);
|
||||
if ($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function search($filter)
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("TimerecordingCar", "*", "$where");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new TimerecordingCar($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter)
|
||||
{
|
||||
$where = "1=1 ";
|
||||
|
||||
//var_dump($filter);exit;
|
||||
if (array_key_exists("timerecording", $filter)) {
|
||||
$timerecording = $filter['timerecording'];
|
||||
if (is_numeric($timerecording)) {
|
||||
$where .= " AND timerecording=$timerecording";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -87,6 +87,7 @@ class TimerecordingCategoryController extends mfBaseController
|
||||
$data['require_comment'] = trim($r->require_comment);
|
||||
$data['only_admin'] = trim($r->only_admin);
|
||||
$data['businesstrip'] = trim($r->businesstrip);
|
||||
$data['unpaid'] = trim($r->unpaid);
|
||||
|
||||
|
||||
if (!$data['name']) {
|
||||
@@ -107,6 +108,9 @@ class TimerecordingCategoryController extends mfBaseController
|
||||
if (!$data['businesstrip']) {
|
||||
$data['businesstrip'] = 0;
|
||||
}
|
||||
if (!$data['unpaid']) {
|
||||
$data['unpaid'] = 0;
|
||||
}
|
||||
// var_dump($_FILES);
|
||||
// var_dump($upload);
|
||||
// exit;
|
||||
|
||||
@@ -9,7 +9,8 @@ class TimerecordingCategoryModel
|
||||
private $require_comment;
|
||||
private $only_admin;
|
||||
private $businesstrip;
|
||||
public static $hourday_definition = array(1 => "Uhrzeit (von/bis)", 2 => "Tage (von/bis)", 3 => "Startdatum", 4 => "Enddatum", 5 => "Anzahl Tage", 6 => "ZA Uhrzeit (von/bis)");
|
||||
private $unpaid;
|
||||
public static $hourday_definition = array(1 => "Uhrzeit (von/bis)", 2 => "Tage (von/bis)", 3 => "Startdatum", 4 => "Enddatum", 5 => "Anzahl Tage", 6 => "ZA Uhrzeit (von/bis)", 7 => "Fahrtenbuch (von/bis)");
|
||||
public static $approval_definition = array(0 => "Nein", 1 => "Ja");
|
||||
public static $require_comment_definition = array(0 => "Nein", 1 => "Ja");
|
||||
public static $businesstrip_definition = array(0 => "Nein", 1 => "Ja");
|
||||
|
||||
@@ -114,13 +114,21 @@ class TimerecordingEmployeeController extends mfBaseController
|
||||
$data['holidays'] = trim($r->holidays);
|
||||
$data['plushours'] = $plushours;
|
||||
$data['startdate'] = strtotime($r->startdate);
|
||||
$data['enddate'] = strtotime($r->enddate);
|
||||
$data['type'] = trim($r->type);
|
||||
$data['bmd_active'] = trim($r->bmd_active);
|
||||
$data['overtime'] = $overtime;
|
||||
#
|
||||
|
||||
if (!$data['overtime']) {
|
||||
$data['overtime'] = 0;
|
||||
}
|
||||
if (!$data['bmd_active']) {
|
||||
$data['bmd_active'] = 0;
|
||||
}
|
||||
if (!$data['enddate']) {
|
||||
$data['enddate'] = null;
|
||||
}
|
||||
|
||||
if ($r->birthday) {
|
||||
$data['birthday'] = strtotime($r->birthday);
|
||||
|
||||
@@ -16,7 +16,10 @@ class TimerecordingEmployeeModel
|
||||
private $overtime_timestamp;
|
||||
private $bpahours;
|
||||
private $startdate;
|
||||
private $enddate;
|
||||
private $bmd_active;
|
||||
private $birthday;
|
||||
public static $employeetypesbmd = array('1' => '1000', '2' => '1200', '3' => '1400');
|
||||
|
||||
|
||||
public static function find($data)
|
||||
|
||||
@@ -25,6 +25,8 @@ class TimerecordingReportController extends mfBaseController
|
||||
$this->layout()->set("timerecordingusers", $timerecordingusers);
|
||||
$timerecordings = TimerecordingModel::getAll();
|
||||
$this->layout()->set("timerecordings", $timerecordings);
|
||||
$timerecordingCars = TimerecordingCarModel::search(['timerecording' => 1]);
|
||||
$this->layout()->set("timerecordingCars", $timerecordingCars);
|
||||
}
|
||||
|
||||
protected function apiAction()
|
||||
@@ -57,7 +59,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
$this->returnJson($data);
|
||||
}
|
||||
|
||||
protected function getTimerecordingsApi($datatype, $dataweek, $datamonth, $datayear)
|
||||
public function getTimerecordingsApi($datatype, $dataweek, $datamonth, $datayear)
|
||||
{
|
||||
$mustSeconds = 0;
|
||||
$isSeconds = 0;
|
||||
@@ -290,6 +292,16 @@ class TimerecordingReportController extends mfBaseController
|
||||
$sum = "-" . sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
$isSeconds = $isSeconds + $seconds;
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 7) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$start = date("H:i", $timerecording->start);
|
||||
$end = date("H:i", $timerecording->end);
|
||||
$seconds = $timerecording->end - $timerecording->start;
|
||||
$minutes = floor(($seconds % 3600) / 60);
|
||||
$hours = floor($seconds / 3600);
|
||||
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
}
|
||||
|
||||
if ($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0) {
|
||||
@@ -298,8 +310,17 @@ class TimerecordingReportController extends mfBaseController
|
||||
$state = '<i class="fa-regular fa-circle-check mr-1"></i>';
|
||||
}
|
||||
$edit = "";
|
||||
if ($timerecording->businesstrip == 1) {
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'> (Dienstreise: " . $timerecording->businesstrip_info . ")</span>";
|
||||
if ($timerecording->timerecordingCategory->hourday == 7) {
|
||||
$distance = $timerecording->mileage_end - $timerecording->mileage_start;
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'>(" . $timerecording->timerecordingCar->number_plate . " " . $distance . "KM) (Zielort: " . $timerecording->businesstrip_info . ")</span>";
|
||||
} else if ($timerecording->businesstrip == 1) {
|
||||
if ($timerecording->timerecordingCar) {
|
||||
$distance = $timerecording->mileage_end - $timerecording->mileage_start;
|
||||
$car = " (" . $timerecording->timerecordingCar->number_plate . " " . $distance . "KM)";
|
||||
} else {
|
||||
$car = "";
|
||||
}
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'>$car (Dienstreise: " . $timerecording->businesstrip_info . ")</span>";
|
||||
} else if ($timerecording->homeoffice == 1) {
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'> (Homeoffice)</span>";
|
||||
} else {
|
||||
@@ -324,13 +345,16 @@ class TimerecordingReportController extends mfBaseController
|
||||
data-businesstripinfo="' . $timerecording->businesstrip_info . '"
|
||||
data-homeoffice="' . $timerecording->homeoffice . '"
|
||||
data-days="' . $timerecording->days . '"
|
||||
data-car="' . $timerecording->timerecordingCar_id . '"
|
||||
data-mileagestart="' . $timerecording->mileage_start . '"
|
||||
data-mileageend="' . $timerecording->mileage_end . '"
|
||||
title="Bearbeiten"></i>';
|
||||
else :
|
||||
$edit .= '<div class="edit-placeholder"></div>';
|
||||
endif;
|
||||
$edit .= '<i data-id="' . $timerecording->id . '" class="fas fa-trash text-danger delete-item" ></i>';
|
||||
endif;
|
||||
if ($datatype == 3 && $timerecording->timerecordingCategory->hourday == 1) {
|
||||
if ($datatype == 3 && ($timerecording->timerecordingCategory->hourday == 1 || $timerecording->timerecordingCategory->hourday == 7 || $timerecording->timerecordingCategory->hourday == 5)) {
|
||||
} else {
|
||||
$rows[] = array(
|
||||
'user' => array('user' => $timerecording->user->name, 'order' => $timerecording->user->name),
|
||||
@@ -363,23 +387,33 @@ class TimerecordingReportController extends mfBaseController
|
||||
}
|
||||
|
||||
|
||||
protected function getTimerecordingsTimes($datatype, $dataweek, $datamonth, $datayear)
|
||||
public function getTimerecordingsTimes($datatype, $dataweek, $datamonth, $datayear, $user_id = NULL, $ajax = 1)
|
||||
{
|
||||
$r = $this->request;
|
||||
$mustSeconds = 0;
|
||||
$isSeconds = 0;
|
||||
$isSecondscleanarray = array();
|
||||
$holiDays = 0;
|
||||
$plusHours = 0;
|
||||
$nlzTimes = array();
|
||||
$daysum = array();
|
||||
if (!$user_id) {
|
||||
$user_id = $r->user_id;
|
||||
}
|
||||
|
||||
|
||||
$rows = [];
|
||||
$employee = TimerecordingEmployeeModel::search(['user_id' => $r->user_id]);
|
||||
$employee = TimerecordingEmployeeModel::search(['user_id' => $user_id]);
|
||||
if ($employee) {
|
||||
$holiDays = $employee[0]->holidays;
|
||||
$plusHours = $employee[0]->plushours;
|
||||
$plusHours_now = $employee[0]->plushours_now;
|
||||
$overtime_now = $employee[0]->overtime_now;
|
||||
$auto_workinghours = $employee[0]->auto_workinghours;
|
||||
$startdate = $employee[0]->startdate;
|
||||
$bpahours = $employee[0]->bpahours;
|
||||
}
|
||||
$workinghours = TimerecordingEmployeeWorkingHourModel::search(['user_id' => $r->user_id]);
|
||||
$workinghours = TimerecordingEmployeeWorkingHourModel::search(['user_id' => $user_id]);
|
||||
$holidays = TimerecordingHolidayModel::getAll();
|
||||
foreach ($workinghours as $workinghour) {
|
||||
|
||||
@@ -402,7 +436,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
$timestamp_sonntag = strtotime("{$year}-W{$kw}-7");
|
||||
$firstdate = strtotime(date("Y-m-d", $timestamp_montag) . " 00:00:00");
|
||||
$lastdate = strtotime(date("Y-m-d", $timestamp_sonntag) . ' 23:59:59');
|
||||
$searchArray = ['user_id' => $r->user_id, 'start' => $timestamp_montag, 'end' => $lastdate];
|
||||
$searchArray = ['user_id' => $user_id, 'start' => $timestamp_montag, 'end' => $lastdate];
|
||||
|
||||
$daycounter = '0';
|
||||
|
||||
@@ -422,7 +456,11 @@ class TimerecordingReportController extends mfBaseController
|
||||
$lastdate = strtotime(date("Y-m-t", $datamonth));
|
||||
$daycount = date("t", $datamonth);
|
||||
$lastdate = strtotime(date("Y-m-d", $lastdate) . ' 23:59:59');
|
||||
$searchArray = ['user_id' => $r->user_id, 'start' => $firstdate, 'end' => $lastdate];
|
||||
//Lastdate staticmust deleted
|
||||
// $lastdate = strtotime("2024-03-22 23:59:59");
|
||||
// $daycount=22;
|
||||
|
||||
$searchArray = ['user_id' => $user_id, 'start' => $firstdate, 'end' => $lastdate];
|
||||
$timestamp = $firstdate;
|
||||
|
||||
for ($i = 1; $i <= $daycount; $i++) {
|
||||
@@ -441,7 +479,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
$lastdate = strtotime(date("Y-12-31 23:59:59", $datayear));
|
||||
$daycount = date("t", $datamonth);
|
||||
$lastdate = strtotime(date("Y-m-d", $lastdate) . ' 23:59:59');
|
||||
$searchArray = ['user_id' => $r->user_id, 'start' => $firstdate, 'end' => $lastdate];
|
||||
$searchArray = ['user_id' => $user_id, 'start' => $firstdate, 'end' => $lastdate];
|
||||
$timestamp = $firstdate;
|
||||
|
||||
for ($i = 1; $i <= $daycount; $i++) {
|
||||
@@ -462,14 +500,52 @@ class TimerecordingReportController extends mfBaseController
|
||||
$timerecordingcategories = TimerecordingCategoryModel::getAll();
|
||||
|
||||
$timerecordings = TimerecordingModel::search($searchArray);
|
||||
|
||||
$responsecount = count($timerecordings);
|
||||
$oldday = "";
|
||||
$homeoffice = false;
|
||||
$homeofficesum = 0;
|
||||
$dietsum = 0;
|
||||
$diet = 0;
|
||||
$dietbase = TimerecordingBillingModel::$dieatBase;
|
||||
|
||||
foreach ($timerecordings as $timerecording):
|
||||
$state = "";
|
||||
$enddate = "";
|
||||
$sum = "-";
|
||||
$day = "";
|
||||
$orderdate = $timerecording->start;
|
||||
if ($oldday != date('Y-m-d', $timerecording->start)) {
|
||||
|
||||
if ($homeoffice == 1) {
|
||||
$homeofficesum++;
|
||||
$homeoffice = false;
|
||||
}
|
||||
if ($diet > 10800) {
|
||||
if ($diet >= 43200) {
|
||||
$diet = 43200;
|
||||
}
|
||||
$calcdiet = $dietbase / 12;
|
||||
$calcdiet = ($diet / 3600) * $calcdiet;
|
||||
$dietsum = $dietsum + $calcdiet;
|
||||
}
|
||||
$diet = 0;
|
||||
|
||||
}
|
||||
if ($timerecording->homeoffice == 1 && (!$homeoffice || $homeoffice == 1)) {
|
||||
|
||||
$homeoffice = 1;
|
||||
} else {
|
||||
$homeoffice = 0;
|
||||
}
|
||||
|
||||
|
||||
if ($timerecording->businesstrip == 1 && $timerecording->timerecordingCategory->hourday == 1) {
|
||||
$diet = $diet + $timerecording->end - $timerecording->start;
|
||||
}
|
||||
|
||||
if ($timerecording->timerecordingCategory->hourday == 1) {
|
||||
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$start = date("H:i", $timerecording->start);
|
||||
@@ -480,6 +556,27 @@ class TimerecordingReportController extends mfBaseController
|
||||
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
$isSeconds = $isSeconds + $seconds;
|
||||
if ($isSecondscleanarray[$timerecording->timerecordingCategory->short]) {
|
||||
$isSecondscleanarray[$timerecording->timerecordingCategory->short] = $isSecondscleanarray[$timerecording->timerecordingCategory->short] + $seconds;
|
||||
} else {
|
||||
$isSecondscleanarray[$timerecording->timerecordingCategory->short] = $seconds;
|
||||
}
|
||||
|
||||
|
||||
if ($timerecording->timerecordingCategory->short != "1000,1200,1400") {
|
||||
if (!$daysum[$timerecording->timerecordingCategory->name]) {
|
||||
$daysum[$timerecording->timerecordingCategory->name] = $seconds;
|
||||
} else {
|
||||
$daysum[$timerecording->timerecordingCategory->name] = $daysum[$timerecording->timerecordingCategory->name] + $seconds;
|
||||
}
|
||||
|
||||
$nlzTimes[$timerecording->id]['start'] = date("d.m.Y", $timerecording->start);
|
||||
$nlzTimes[$timerecording->id]['end'] = date("d.m.Y", $timerecording->end);
|
||||
$nlzTimes[$timerecording->id]['minutes'] = $seconds / 60;
|
||||
$nlzTimes[$timerecording->id]['unpaid'] = $timerecording->timerecordingCategory->unpaid;
|
||||
$nlzTimes[$timerecording->id]['category'] = $timerecording->timerecordingCategory->name;
|
||||
$nlzTimes[$timerecording->id]['categoryshort'] = $timerecording->timerecordingCategory->short;
|
||||
}
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 2 || ($timerecording->timerecordingCategory->hourday == 3 && $timerecording->end)) {
|
||||
$date = date("d.m.", $timerecording->start) . " - " . $daysgerm[date("w", $timerecording->end)] . " " . date("d.m.Y", $timerecording->end);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
@@ -500,10 +597,18 @@ class TimerecordingReportController extends mfBaseController
|
||||
}
|
||||
$summcounter = 0;
|
||||
$savecounter = 0;
|
||||
$sumdays = 0;
|
||||
|
||||
for ($i = $starttimecalc; $i <= $endtimecalc; $i = $i + 86400) {
|
||||
$holidaycounter = $workingHours[date("w", $i)];
|
||||
$daycheck = date("Y-m-d", $i);
|
||||
if (!$holiDay[$daycheck]) {
|
||||
if ($holidaycounter) {
|
||||
$isSeconds = $isSeconds + $holidaycounter;
|
||||
$summcounter = $summcounter + $holidaycounter;
|
||||
$sumdays++;
|
||||
}
|
||||
}
|
||||
if ($savecounter == 1000) {
|
||||
echo $savecounter;
|
||||
die();
|
||||
@@ -513,7 +618,24 @@ class TimerecordingReportController extends mfBaseController
|
||||
$seconds = $summcounter;
|
||||
$minutes = floor(($seconds % 3600) / 60);
|
||||
$hours = floor($seconds / 3600);
|
||||
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
// $sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
if ($sumdays == 1 || $sumdays == 0) {
|
||||
$sum = $sumdays . " Tag";
|
||||
} else if ($sumdays > 1) {
|
||||
$sum = $sumdays . " Tage";
|
||||
}
|
||||
|
||||
if (!$daysum[$timerecording->timerecordingCategory->name]) {
|
||||
$daysum[$timerecording->timerecordingCategory->name] = $sumdays;
|
||||
} else {
|
||||
$daysum[$timerecording->timerecordingCategory->name] = $daysum[$timerecording->timerecordingCategory->name] + $sumdays;
|
||||
}
|
||||
$nlzTimes[$timerecording->id]['start'] = date("d.m.Y", $timerecording->start);
|
||||
$nlzTimes[$timerecording->id]['end'] = date("d.m.Y", $timerecording->end);
|
||||
$nlzTimes[$timerecording->id]['days'] = $sumdays;
|
||||
$nlzTimes[$timerecording->id]['unpaid'] = $timerecording->timerecordingCategory->unpaid;
|
||||
$nlzTimes[$timerecording->id]['category'] = $timerecording->timerecordingCategory->name;
|
||||
$nlzTimes[$timerecording->id]['categoryshort'] = $timerecording->timerecordingCategory->short;
|
||||
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 3 && !$timerecording->end) {
|
||||
$date = date("d.m.Y", $timerecording->start) . " - " . $daysgerm[date("w", time())] . " " . date("d.m.Y", time());;
|
||||
@@ -554,6 +676,18 @@ class TimerecordingReportController extends mfBaseController
|
||||
$end = "-";
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
$sum = $timerecording->days . " Tage";
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 6) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$start = date("H:i", $timerecording->start);
|
||||
$end = date("H:i", $timerecording->end);
|
||||
// $seconds = $timerecording->hours;
|
||||
$seconds = $timerecording->end - $timerecording->start;
|
||||
$minutes = floor(($seconds % 3600) / 60);
|
||||
$hours = floor($seconds / 3600);
|
||||
$sum = "-" . sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
$isSeconds = $isSeconds + $seconds;
|
||||
}
|
||||
|
||||
if ($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0) {
|
||||
@@ -593,18 +727,75 @@ class TimerecordingReportController extends mfBaseController
|
||||
} else {
|
||||
|
||||
}
|
||||
$oldday = date('Y-m-d', $timerecording->start);
|
||||
endforeach;
|
||||
if ($homeoffice == 1) {
|
||||
$homeofficesum++;
|
||||
$homeoffice = 0;
|
||||
}
|
||||
if ($diet > 10800) {
|
||||
if ($diet >= 43200) {
|
||||
$diet = 43200;
|
||||
}
|
||||
$calcdiet = $dietbase / 12;
|
||||
$calcdiet = ($diet / 3600) * $calcdiet;
|
||||
$dietsum = $dietsum + $calcdiet;
|
||||
}
|
||||
|
||||
$summseconds = $isSeconds - $mustSeconds;
|
||||
$isorder = $isSeconds;
|
||||
if ($isSeconds < 0) {
|
||||
$isSeconds = $isSeconds * -1;
|
||||
$isSeconds = "-" . sprintf('%02dh:%02dm', floor($isSeconds / 3600), floor($isSeconds / 60 % 60));
|
||||
} else {
|
||||
$isSeconds = sprintf('%02dh:%02dm', floor($isSeconds / 3600), floor($isSeconds / 60 % 60));
|
||||
}
|
||||
$summsecondsorder = $summseconds;
|
||||
if ($summseconds < 0) {
|
||||
$summseconds = $summseconds * -1;
|
||||
$summseconds = "-" . sprintf('%02dh:%02dm', floor($summseconds / 3600), floor($summseconds / 60 % 60));
|
||||
} else {
|
||||
$summseconds = sprintf('%02dh:%02dm', floor($summseconds / 3600), floor($summseconds / 60 % 60));
|
||||
}
|
||||
$plusHours_noworder = $plusHours_now;
|
||||
if ($plusHours_now < 0) {
|
||||
$plusHours_now = $plusHours_now * -1;
|
||||
$plusHours_now = "-" . sprintf('%02dh:%02dm', floor($plusHours_now / 3600), floor($plusHours_now / 60 % 60));
|
||||
} else {
|
||||
$plusHours_now = sprintf('%02dh:%02dm', floor($plusHours_now / 3600), floor($plusHours_now / 60 % 60));
|
||||
}
|
||||
|
||||
$json['success'] = true;
|
||||
$json['time']['auto_workinghours'] = $auto_workinghours;
|
||||
$json['time']['is'] = sprintf('%02dh:%02dm', floor($isSeconds / 3600), floor($isSeconds / 60 % 60));
|
||||
$json['time']['is'] = $isSeconds;
|
||||
$json['time']['isorder'] = $isorder;
|
||||
$json['time']['isclean'] = $isSecondscleanarray;
|
||||
$json['time']['must'] = sprintf('%02dh:%02dm', floor($mustSeconds / 3600), floor($mustSeconds / 60 % 60));
|
||||
$json['time']['mustorder'] = $mustSeconds;
|
||||
$json['time']['holidays'] = $holiDays;
|
||||
$json['time']['plushours'] = sprintf('%02dh:%02dm', floor($plusHours / 3600), floor($plusHours / 60 % 60));
|
||||
$json['time']['plushours_now'] = $plusHours_now;
|
||||
$json['time']['plushours_noworder'] = $plusHours_noworder;
|
||||
$json['time']['bpahours'] = sprintf('%02dh:%02dm', floor($bpahours / 3600), floor($bpahours / 60 % 60));
|
||||
|
||||
$json['time']['overtime_now'] = sprintf('%02dh:%02dm', floor($overtime_now / 3600), floor($overtime_now / 60 % 60));
|
||||
$json['time']['overtime_noworder'] = $overtime_now;
|
||||
$json['time']['homeoffice'] = $homeofficesum;
|
||||
$json['time']['summseconds'] = $summseconds;
|
||||
$json['time']['summsecondsorder'] = $summsecondsorder;
|
||||
$json['time']['nlztimes'] = $nlzTimes;
|
||||
$json['time']['diet'] = $dietsum;
|
||||
$json['time']['daysum'] = $daysum;
|
||||
$json['recordsFiltered'] = $responsecount;
|
||||
$json['recordsTotal'] = $responsecount;
|
||||
|
||||
if ($ajax == 1) {
|
||||
$json = json_encode($json);
|
||||
echo trim($json);
|
||||
die();
|
||||
} else {
|
||||
return $json;
|
||||
}
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
|
||||
9
application/VoiceCallActive/VoiceCallActive.php
Normal file
9
application/VoiceCallActive/VoiceCallActive.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property mixed|null $name
|
||||
*/
|
||||
class VoiceCallActive extends mfBaseModel
|
||||
{
|
||||
|
||||
}
|
||||
61
application/VoiceCallActive/VoiceCallActiveController.php
Normal file
61
application/VoiceCallActive/VoiceCallActiveController.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
class VoiceCallActiveController extends mfBaseController {
|
||||
private User $me;
|
||||
private string $VOICE_PORTAL_HOST = KOLMISOFT_API_HOST;
|
||||
private string $VOICE_PORTAL_API_KEY = KOLMISOFT_API_KEY;
|
||||
private string $VOICE_PORTAL_USERNAME = KOLMISOFT_API_USERNAME;
|
||||
|
||||
private KolmisoftMore $kolmisoftMore;
|
||||
|
||||
|
||||
protected function init(): void {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->layout()->set("me", $me);
|
||||
$this->me = $me;
|
||||
|
||||
if (!$this->me->isAdmin()) {
|
||||
$this->redirect("dashboard");
|
||||
}
|
||||
|
||||
$this->kolmisoftMore = new KolmisoftMore($this->VOICE_PORTAL_HOST, $this->VOICE_PORTAL_API_KEY, $this->VOICE_PORTAL_USERNAME);
|
||||
|
||||
}
|
||||
|
||||
protected function indexAction(): void {
|
||||
$this->layout()->setTemplate("VoiceCallActive/Index");
|
||||
}
|
||||
|
||||
protected function apiAction() {
|
||||
$do = $this->request->do;
|
||||
|
||||
if (!$this->me->isAdmin()) {
|
||||
$this->redirect("dashboard");
|
||||
}
|
||||
|
||||
switch ($do) {
|
||||
case "getActiveCalls":
|
||||
$return = $this->getActiveCalls();
|
||||
break;
|
||||
default:
|
||||
$return = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$return) {
|
||||
$return = [
|
||||
"status" => "error",
|
||||
"message" => "Invalid request."
|
||||
];
|
||||
}
|
||||
|
||||
die(json_encode($return));
|
||||
}
|
||||
|
||||
private function getActiveCalls(): array {
|
||||
return [
|
||||
"rows" => array_reverse($this->kolmisoftMore->getActiveCalls())
|
||||
];
|
||||
}
|
||||
}
|
||||
9
application/VoiceCallHistory/VoiceCallHistory.php
Normal file
9
application/VoiceCallHistory/VoiceCallHistory.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property mixed|null $name
|
||||
*/
|
||||
class VoiceCallHistory extends mfBaseModel
|
||||
{
|
||||
|
||||
}
|
||||
91
application/VoiceCallHistory/VoiceCallHistoryController.php
Normal file
91
application/VoiceCallHistory/VoiceCallHistoryController.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
class VoiceCallHistoryController extends mfBaseController {
|
||||
private User $me;
|
||||
private string $VOICE_PORTAL_HOST = KOLMISOFT_API_HOST;
|
||||
private string $VOICE_PORTAL_API_KEY = KOLMISOFT_API_KEY;
|
||||
private string $VOICE_PORTAL_USERNAME = KOLMISOFT_API_USERNAME;
|
||||
|
||||
private KolmisoftMore $kolmisoftMore;
|
||||
|
||||
|
||||
protected function init(): void {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->layout()->set("me", $me);
|
||||
$this->me = $me;
|
||||
|
||||
if (!$this->me->isAdmin()) {
|
||||
$this->redirect("dashboard");
|
||||
}
|
||||
|
||||
$this->kolmisoftMore = new KolmisoftMore($this->VOICE_PORTAL_HOST, $this->VOICE_PORTAL_API_KEY, $this->VOICE_PORTAL_USERNAME);
|
||||
|
||||
}
|
||||
|
||||
protected function indexAction(): void {
|
||||
$this->layout()->setTemplate("VoiceCallHistory/Index");
|
||||
}
|
||||
|
||||
protected function apiAction() {
|
||||
$do = $this->request->do;
|
||||
|
||||
if (!$this->me->isAdmin()) {
|
||||
$this->redirect("dashboard");
|
||||
}
|
||||
|
||||
switch ($do) {
|
||||
case "getCalls":
|
||||
$return = $this->getCalls();
|
||||
break;
|
||||
case "importCallsFromToday":
|
||||
$return = $this->importCallsFromToday();
|
||||
break;
|
||||
default:
|
||||
$return = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$return) {
|
||||
$return = [
|
||||
"status" => "error",
|
||||
"message" => "Invalid request."
|
||||
];
|
||||
}
|
||||
|
||||
die(json_encode($return));
|
||||
}
|
||||
|
||||
private function importCallsFromToday(): array {
|
||||
$startDate = strtotime(date("Y-m-d 0:00:00"));
|
||||
$endDate = strtotime(date("Y-m-d 23:59:59"));
|
||||
|
||||
$callHistory = $this->kolmisoftMore->getVoiceCallHistory($startDate, $endDate);
|
||||
|
||||
return VoiceCallHistoryModel::importCallsFromKolmisoft($callHistory);
|
||||
}
|
||||
|
||||
private function getCalls(): array {
|
||||
$json = json_decode(file_get_contents('php://input'), true);
|
||||
|
||||
$filters = $json['filters'] ?? [];
|
||||
$page = $json['pagination']['page'] ?? 1;
|
||||
$perPage = $json['pagination']['per_page'] ?? 10;
|
||||
|
||||
$calls = VoiceCallHistoryModel::getVoiceCallHistory($filters, $perPage, $perPage * $page - $perPage);
|
||||
$totalRows = VoiceCallHistoryModel::countVoiceCallHistory($filters);
|
||||
|
||||
return [
|
||||
"rows" => $calls,
|
||||
"pagination" => [
|
||||
"page" => $page,
|
||||
"total_pages" => ceil($totalRows / $perPage),
|
||||
"per_page" => $perPage,
|
||||
"total_rows" => intval($totalRows)
|
||||
]
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
143
application/VoiceCallHistory/VoiceCallHistoryModel.php
Normal file
143
application/VoiceCallHistory/VoiceCallHistoryModel.php
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
class VoiceCallHistoryModel {
|
||||
public $uid;
|
||||
public $voice_account;
|
||||
public $start;
|
||||
public $source;
|
||||
public $destination;
|
||||
public $billable;
|
||||
public $duration;
|
||||
|
||||
|
||||
public function __construct($data = []) {
|
||||
foreach ($data as $field => $value) {
|
||||
if (property_exists(get_called_class(), $field)) {
|
||||
$this->$field = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate SQL Filter condition (space separated) for a given column.
|
||||
*
|
||||
* @param string|null $filterValue The filter value to match against.
|
||||
* @param string $columnName The name of the column in the database table.
|
||||
* @return string The SQL condition generated based on the filter value and column name.
|
||||
*/
|
||||
public static function generateFilterCondition(?string $filterValue, string $columnName): string {
|
||||
$sql = "";
|
||||
if (!empty($filterValue)) {
|
||||
$filterItems = explode(" ", $filterValue);
|
||||
foreach ($filterItems as $item) {
|
||||
$sql .= " AND `$columnName` LIKE '%" . $item . "%'";
|
||||
}
|
||||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
//TODO: combine these two functions into one
|
||||
public static function importCallsFromKolmisoft($callHistory): array {
|
||||
{
|
||||
|
||||
$modifiedCallHistory = [];
|
||||
for ($i = 0; $i < count($callHistory); $i++) {
|
||||
$call = $callHistory[$i];
|
||||
$date = date("Y-m-d H:i:s", strtotime($call["calldate2"] . " UTC"));
|
||||
|
||||
$modifiedCall = [
|
||||
"uid" => $call["uniqueid"],
|
||||
"voice_account" => strpos($call["clid"], "Anonymous") !== false ? 'Anonymous' : preg_replace('/[^0-9]/', '', explode(" ", $call["clid"])[0]),
|
||||
"start" => $date,
|
||||
"source" => strpos($call["clid"], "nymous") !== false ? 'Anonymous' : str_replace("+", "", $call["src"]),
|
||||
"destination" => $call["dst"],
|
||||
"state" => preg_replace('/[^0-9]/', '', explode("(", $call["dispod"])[1]),
|
||||
"billable" => gettype($call["did"]) === "string" ? 0 : 1,
|
||||
"duration" => $call["nice_billsec"],
|
||||
];
|
||||
$modifiedCallHistory[] = $modifiedCall;
|
||||
}
|
||||
|
||||
$voiceHistoryImport = VoiceCallHistoryModel::importVoiceCallHistory($modifiedCallHistory);
|
||||
|
||||
if ($callHistory === false) {
|
||||
return [
|
||||
"status" => "error",
|
||||
"message" => "Failed to import calls."
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
"status" => "success",
|
||||
"message" => $voiceHistoryImport["message"]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
public static function importVoiceCallHistory($callHistory): array {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$sql = /** @lang text */ "INSERT INTO `VoiceCallHistory` (`uid`, `voice_account`, `start`, `source`, `destination`, `state`, `billable`, `duration`) VALUES ";
|
||||
$values = [];
|
||||
foreach ($callHistory as $voiceCall) {
|
||||
$uid = $voiceCall['uid'];
|
||||
$valueStr = "(" .
|
||||
($voiceCall['uid'] === 'Anonymous' ? 'NULL' : "'$uid'") . ", " .
|
||||
($voiceCall['voice_account'] === 'Anonymous' ? 'NULL' : "'" . $voiceCall['voice_account']. "'" ) . ", '" .
|
||||
$voiceCall['start'] . "', '" .
|
||||
($voiceCall['source'] === 'Anonymous' ? "NULL" : $voiceCall['source']) . "', '" .
|
||||
($voiceCall['destination'] === 'Anonymous' ? "NULL" : $voiceCall['destination'] ) . "', " .
|
||||
$voiceCall['state'] . ", " .
|
||||
$voiceCall['billable'] . ", " .
|
||||
$voiceCall['duration'] . ")";
|
||||
|
||||
$values[] = $valueStr;
|
||||
}
|
||||
|
||||
$sql .= implode(", ", $values);
|
||||
$sql .= " ON DUPLICATE KEY UPDATE duration = VALUES(duration)";
|
||||
|
||||
$db->query($sql);
|
||||
|
||||
return [
|
||||
"message" => "Imported " . count($callHistory) . " calls to the history."
|
||||
];
|
||||
}
|
||||
|
||||
public static function getSqlFilter($filters): string {
|
||||
|
||||
$sql = "";
|
||||
if (isset($filters['start']['from']) && isset($filters['start']['to'])) {
|
||||
$sql = " AND `start` >= FROM_UNIXTIME(" . $filters['start']['from'] . ") AND `start` <= FROM_UNIXTIME(" . $filters['start']['to'] . ")";
|
||||
}
|
||||
$sql .= isset($filters['end']) ? " AND `start` <= '" . $filters['end'] . "'" : "";
|
||||
$sql .= isset($filters['source']) ? self::generateFilterCondition($filters['source'], "source") : "";
|
||||
$sql .= isset($filters['destination']) ? self::generateFilterCondition($filters['destination'], "destination") : "";
|
||||
$sql .= isset($filters['billable']) ? self::generateFilterCondition($filters['billable'], "billable") : "";
|
||||
$sql .= isset($filters['duration']) ? self::generateFilterCondition($filters['duration'], "duration") : "";
|
||||
|
||||
return $sql . " ORDER BY `start` DESC";
|
||||
}
|
||||
|
||||
public static function getVoiceCallHistory($filters, $limit = null, $offset = 0): array {
|
||||
$db = FronkDB::singleton();
|
||||
$sql = "SELECT * FROM `VoiceCallHistory` WHERE 1 " . self::getSqlFilter($filters);
|
||||
$sql .= $limit === null ? "" : " LIMIT " . $limit . " OFFSET " . $offset;
|
||||
|
||||
$result = $db->query($sql);
|
||||
$rows = [];
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$rows[] = new VoiceCallHistoryModel($row);
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public static function countVoiceCallHistory($filters) {
|
||||
$db = FronkDB::singleton();
|
||||
$sql = "SELECT COUNT(*) as `total_rows` FROM `VoiceCallHistory` WHERE 1 " . self::getSqlFilter($filters);
|
||||
$result = $db->query($sql);
|
||||
return $result->fetch_assoc()['total_rows'];
|
||||
}
|
||||
}
|
||||
9
application/VoiceCallHistoryJob/VoiceCallHistoryJob.php
Normal file
9
application/VoiceCallHistoryJob/VoiceCallHistoryJob.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property mixed|null $name
|
||||
*/
|
||||
class VoiceCallHistoryJob extends mfBaseModel
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
//display errors
|
||||
//ini_set('display_errors', 1);
|
||||
//ini_set('display_startup_errors', 1);
|
||||
//error_reporting(E_ALL);
|
||||
|
||||
class VoiceCallHistoryJobController extends mfBaseController {
|
||||
private User $me;
|
||||
private string $VOICE_PORTAL_HOST = KOLMISOFT_API_HOST;
|
||||
private string $VOICE_PORTAL_API_KEY = KOLMISOFT_API_KEY;
|
||||
private string $VOICE_PORTAL_USERNAME = KOLMISOFT_API_USERNAME;
|
||||
|
||||
private KolmisoftMore $kolmisoftMore;
|
||||
|
||||
|
||||
protected function init(): void {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->layout()->set("me", $me);
|
||||
$this->me = $me;
|
||||
|
||||
if (!$this->me->isAdmin()) {
|
||||
$this->redirect("dashboard");
|
||||
}
|
||||
|
||||
$this->kolmisoftMore = new KolmisoftMore($this->VOICE_PORTAL_HOST, $this->VOICE_PORTAL_API_KEY, $this->VOICE_PORTAL_USERNAME);
|
||||
|
||||
}
|
||||
|
||||
protected function indexAction(): void {
|
||||
$this->layout()->setTemplate("VoiceCallHistoryJob/Index");
|
||||
}
|
||||
|
||||
protected function apiAction() {
|
||||
$do = $this->request->do;
|
||||
|
||||
if (!$this->me->isAdmin()) {
|
||||
$this->redirect("dashboard");
|
||||
}
|
||||
|
||||
switch ($do) {
|
||||
case "runJobs":
|
||||
$return = $this->runJobs();
|
||||
break;
|
||||
default:
|
||||
$return = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$return) {
|
||||
$return = [
|
||||
"status" => "error",
|
||||
"message" => "Invalid request."
|
||||
];
|
||||
}
|
||||
|
||||
die(json_encode($return));
|
||||
}
|
||||
|
||||
public function runJobs(): array {
|
||||
VoiceCallHistoryJobModel::createJobsUntilToday();
|
||||
|
||||
$jobs = VoiceCallHistoryJobModel::getJobsNotDone();
|
||||
|
||||
$messages = [
|
||||
"success" => [],
|
||||
"error" => []
|
||||
];
|
||||
foreach ($jobs as $job) {
|
||||
$startDate = strtotime(date("Y-m-d 00:00:00", strtotime($job->date)));
|
||||
$endDate = strtotime(date("Y-m-d 00:00:00", strtotime($job->date . " +1 day")));
|
||||
|
||||
$callHistory = $this->kolmisoftMore->getVoiceCallHistory($startDate, $endDate);
|
||||
|
||||
$importedCalls = VoiceCallHistoryModel::importCallsFromKolmisoft($callHistory);
|
||||
|
||||
if ($importedCalls) {
|
||||
$messages["success"][$job->date] = $importedCalls["message"];
|
||||
VoiceCallHistoryJobModel::updateJobStatus($job->id, "success");
|
||||
} else {
|
||||
$messages["error"][$job->date] = "Failed to import calls for job $job->id.";
|
||||
VoiceCallHistoryJobModel::updateJobStatus($job->id, "failed");
|
||||
}
|
||||
}
|
||||
|
||||
return $messages;
|
||||
}
|
||||
}
|
||||
86
application/VoiceCallHistoryJob/VoiceCallHistoryJobModel.php
Normal file
86
application/VoiceCallHistoryJob/VoiceCallHistoryJobModel.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
class VoiceCallHistoryJobModel {
|
||||
public $id;
|
||||
public $date;
|
||||
public $status;
|
||||
public $create;
|
||||
public $edit;
|
||||
|
||||
|
||||
public function __construct($data = []) {
|
||||
foreach ($data as $field => $value) {
|
||||
if (property_exists(get_called_class(), $field)) {
|
||||
$this->$field = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate SQL Filter condition (space separated) for a given column.
|
||||
*
|
||||
* @param string|null $filterValue The filter value to match against.
|
||||
* @param string $columnName The name of the column in the database table.
|
||||
* @return string The SQL condition generated based on the filter value and column name.
|
||||
*/
|
||||
public static function generateFilterCondition(?string $filterValue, string $columnName): string {
|
||||
$sql = "";
|
||||
if (!empty($filterValue)) {
|
||||
$filterItems = explode(" ", $filterValue);
|
||||
foreach ($filterItems as $item) {
|
||||
$sql .= " AND `$columnName` LIKE '%" . $item . "%'";
|
||||
}
|
||||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
public static function createJobsUntilToday(): array {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
// $i = first day of the month; $i <= today; $i += 1 day
|
||||
$values = [];
|
||||
for ($i = strtotime(date("Y-m-01")); $i <= strtotime(date("Y-m-d")); $i += 86400) {
|
||||
$values[] = "('" . date("Y-m-d", $i) . "')";
|
||||
}
|
||||
|
||||
$valueStr = implode(", ", $values);
|
||||
|
||||
$db->query("INSERT INTO `VoiceCallHistoryJob` (`date`) VALUES $valueStr ON DUPLICATE KEY UPDATE date=VALUES(date)");
|
||||
$db->query("UPDATE `VoiceCallHistoryJob` SET `status` = 'created', `finished` = NULL WHERE `date` = '" . date("Y-m-d") . "'");
|
||||
|
||||
return [
|
||||
"message" => "Created " . count($values) . " jobs."
|
||||
];
|
||||
}
|
||||
|
||||
public static function updateJobStatus($id, $status): array {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$escapedStatus = $db->escape($status);
|
||||
$escapedId = $db->escape($id);
|
||||
|
||||
$finished = $status == "success" ? ", `finished` = NOW()" : "";
|
||||
|
||||
$db->query("UPDATE `VoiceCallHistoryJob` SET `status` = '$escapedStatus' $finished WHERE `id` = $escapedId");
|
||||
|
||||
return [
|
||||
"message" => "Updated job $id status to $status."
|
||||
];
|
||||
}
|
||||
|
||||
public static function getJobsNotDone(): array {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$query = $db->query("SELECT * FROM `VoiceCallHistoryJob` WHERE `status` = 'created' OR `status` = 'failed' OR `status` = 'pending' ORDER BY `date`");
|
||||
|
||||
$items = [];
|
||||
if($db->num_rows($query)) {
|
||||
while($data = $db->fetch_object($query)) {
|
||||
$items[] = new VoiceCallHistoryJobModel($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,6 +37,7 @@ const IVT_DBPASS = "";
|
||||
const IVT_DBNAME = "ivtdb";
|
||||
|
||||
|
||||
//Raspberry Display Configuration
|
||||
const XINON_RASPBERRY_DISPLAY_SSH_USER = "changeme";
|
||||
const XINON_RASPBERRY_DISPLAY_SSH_PASS = "changeme";
|
||||
|
||||
@@ -818,3 +819,7 @@ const PDFOUTPUTPATH = BASEDIR . "/var/temp";
|
||||
const GIT_BIN_PATH = "/usr/bin/git";
|
||||
const PDFTOTEXT_BIN_PATH = "/usr/bin/pdftotext";
|
||||
const PDFUNITE_BIN_PATH = "/usr/bin/pdfunite";
|
||||
|
||||
const TT_KOLMISOFT_API_URL = "vportal.xxx.xx";
|
||||
const TT_KOLMISOFT_API_KEY = "";
|
||||
const TT_KOLMISOFT_API_USERNAME = "";
|
||||
|
||||
79
db/migrations/20240312154600_add_historic_ticket.php
Normal file
79
db/migrations/20240312154600_add_historic_ticket.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php /** @noinspection ALL */
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class AddHistoricTicket extends AbstractMigration {
|
||||
public function up(): void {
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
//HistoricTicket Table
|
||||
$historicTicket = $this->table("HistoricTicket", ["signed" => true]);
|
||||
|
||||
$historicTicket->addColumn("ticket_number", "integer", ["null" => true]);
|
||||
$historicTicket->addColumn("ticket_verifier", "string", ["null" => false, "default" => "0", "limit" => 255]);
|
||||
$historicTicket->addColumn("priority", "integer", ["null" => false, "default" => "1"]);
|
||||
$historicTicket->addColumn("status_id", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicket->addColumn("status", "string", ["null" => true, "limit" => 255]);
|
||||
$historicTicket->addColumn("type_id", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicket->addColumn("type", "string", ["null" => true, "limit" => 255]);
|
||||
$historicTicket->addColumn("user_id", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicket->addColumn("agent_id", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicket->addColumn("contact_id", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicket->addColumn("company", "string", ["null" => false, "limit" => 255]);
|
||||
$historicTicket->addColumn("company_id", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicket->addColumn("first_name", "string", ["null" => false, "limit" => 255]);
|
||||
$historicTicket->addColumn("middle_name", "string", ["null" => false, "limit" => 255]);
|
||||
$historicTicket->addColumn("last_name", "string", ["null" => false, "limit" => 255]);
|
||||
$historicTicket->addColumn("email", "string", ["null" => false, "limit" => 255]);
|
||||
$historicTicket->addColumn("phone", "string", ["null" => false, "limit" => 255]);
|
||||
$historicTicket->addColumn("subject", "string", ["null" => false, "limit" => 255]);
|
||||
$historicTicket->addColumn("ctime", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicket->addColumn("mtime", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicket->addColumn("muser_id", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicket->addColumn("files_folder_id", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicket->addColumn("unseen", "integer", ["null" => false, "default" => "1"]);
|
||||
$historicTicket->addColumn("group_id", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicket->addColumn("order_id", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicket->addColumn("last_response_time", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicket->addColumn("cc_addresses", "string", ["null" => false, "limit" => 255]);
|
||||
$historicTicket->save();
|
||||
|
||||
//HistoricTicketMessage Table
|
||||
$historicTicketMessage = $this->table("HistoricTicketMessage", ["signed" => true]);
|
||||
|
||||
$historicTicketMessage->addColumn("ticket_id", "integer", ["null" => false]);
|
||||
$historicTicketMessage->addColumn("status_id", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicketMessage->addColumn("type_id", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicketMessage->addColumn("has_status", "integer", ["null" => false, "default" => "0", "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]);
|
||||
$historicTicketMessage->addColumn("has_type", "integer", ["null" => false, "default" => "0", "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]);
|
||||
$historicTicketMessage->addColumn("content", "text", ["null" => true]);
|
||||
$historicTicketMessage->addColumn("attachments", "string", ["null" => false, "limit" => 255]);
|
||||
$historicTicketMessage->addColumn("is_note", "integer", ["null" => false, "default" => "0", "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]);
|
||||
$historicTicketMessage->addColumn("user_id", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicketMessage->addColumn("ctime", "integer", ["null" => false]);
|
||||
$historicTicketMessage->addColumn("mtime", "integer", ["null" => false]);
|
||||
$historicTicketMessage->addColumn("rate_id", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicketMessage->addColumn("rate_amount", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicketMessage->addColumn("rate_hours", "integer", ["null" => false, "default" => "0"]);
|
||||
$historicTicketMessage->addColumn("rate_name", "string", ["null" => false, "limit" => 255]);
|
||||
$historicTicketMessage->addColumn("rate_cost_code", "string", ["null" => true, "limit" => 255]);
|
||||
$historicTicketMessage->save();
|
||||
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void {
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("HistoricTicket")->drop()->save();
|
||||
$this->table("HistoricTicketMessage")->drop()->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
64
db/migrations/20240312203000_add_domain.php
Normal file
64
db/migrations/20240312203000_add_domain.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php /** @noinspection ALL */
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class AddDomain extends AbstractMigration {
|
||||
public function up(): void {
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
//Domain Table
|
||||
$domainTable = $this->table("Domain", ["signed" => true]);
|
||||
$domainTable->addColumn("inwxRoId", "integer", ["null" => true]);
|
||||
$domainTable->addColumn("domain", "string", ["null" => true, "limit" => 255]);
|
||||
$domainTable->addColumn("period", "string", ["null" => true, "limit" => 50]);
|
||||
$domainTable->addColumn("crDate", "integer", ["null" => true]);
|
||||
$domainTable->addColumn("exDate", "integer", ["null" => true]);
|
||||
$domainTable->addColumn("reDate", "integer", ["null" => true]);
|
||||
$domainTable->addColumn("upDate", "integer", ["null" => true]);
|
||||
$domainTable->addColumn("transferLock", "integer", ["null" => true, "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]);
|
||||
$domainTable->addColumn("status", "string", ["null" => true, "limit" => 50]);
|
||||
$domainTable->addColumn("authCode", "string", ["null" => true, "limit" => 50]);
|
||||
$domainTable->addColumn("registrant", "integer", ["null" => true]);
|
||||
$domainTable->addColumn("admin", "integer", ["null" => true]);
|
||||
$domainTable->addColumn("tech", "integer", ["null" => true]);
|
||||
$domainTable->addColumn("billing", "integer", ["null" => true]);
|
||||
$domainTable->addColumn("ns", "string", ["null" => true, "limit" => 255]);
|
||||
$domainTable->addColumn("pleskId", "string", ["null" => true, "limit" => 255]);
|
||||
$domainTable->addColumn("pleskHostingType", "string", ["null" => true, "limit" => 255]);
|
||||
$domainTable->addColumn("pleskCreated", "integer", ["null" => true]);
|
||||
$domainTable->save();
|
||||
|
||||
//DomainContact Table
|
||||
|
||||
$domainContactTable = $this->table("DomainContact", ["signed" => true]);
|
||||
$domainContactTable->addColumn("inwxRoId", "integer", ["null" => true]);
|
||||
$domainContactTable->addColumn("type", "string", ["null" => true, "limit" => 255]);
|
||||
$domainContactTable->addColumn("name", "string", ["null" => true, "limit" => 255]);
|
||||
$domainContactTable->addColumn("street", "string", ["null" => true, "limit" => 255]);
|
||||
$domainContactTable->addColumn("city", "string", ["null" => true, "limit" => 255]);
|
||||
$domainContactTable->addColumn("pc", "string", ["null" => true, "limit" => 255]);
|
||||
$domainContactTable->addColumn("cc", "string", ["null" => true, "limit" => 255]);
|
||||
$domainContactTable->addColumn("voice", "string", ["null" => true, "limit" => 255]);
|
||||
$domainContactTable->addColumn("email", "string", ["null" => true, "limit" => 255]);
|
||||
$domainContactTable->addColumn("protection", "integer", ["null" => true, "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]);
|
||||
$domainContactTable->addColumn("usedCount", "integer", ["null" => true]);
|
||||
$domainContactTable->addColumn("verificationStatus", "string", ["null" => true, "limit" => 255]);
|
||||
$domainContactTable->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void {
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("Domain")->drop()->save();
|
||||
$this->table("DomainContact")->drop()->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
40
db/migrations/20240317165103_timerecording_car.php
Normal file
40
db/migrations/20240317165103_timerecording_car.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TimerecordingCar extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("TimerecordingCar", ["signed" => true]);
|
||||
$table->addColumn("number_plate", "string", ["null" => false]);
|
||||
$table->addColumn("brand", "text", ["null" => true]);
|
||||
$table->addColumn("model", "text", ["null" => true]);
|
||||
$table->addColumn("mileage", "integer", ["null" => true]);
|
||||
$table->addColumn("mileage_now", "integer", ["null" => true]);
|
||||
$table->addColumn("mileage_timestamp", "integer", ["null" => true]);
|
||||
$table->addColumn("initial_approval", "integer", ["null" => true]);
|
||||
$table->addColumn("timerecording", "integer", ["default" => 1]);
|
||||
$table->addColumn("create_by", "integer", ["null" => false]);
|
||||
$table->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$table->addColumn("create", "integer", ["null" => false]);
|
||||
$table->addColumn("edit", "integer", ["null" => false]);
|
||||
$table->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("TimerecordingCar")->drop()->save();
|
||||
}
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TimerecordingAddFieldsCar extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Timerecording", ["signed" => true]);
|
||||
$table->addColumn("timerecordingCar_id", "integer", ["null" => true, "default" => NULL, "after" => "businesstrip_info"]);
|
||||
$table->addColumn("mileage_start", "integer", ["null" => true, "default" => NULL, "after" => "timerecordingCar_id"]);
|
||||
$table->addColumn("mileage_end", "integer", ["null" => true, "default" => NULL, "after" => "mileage_start"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("Timerecording")->removeColumn("timerecordingCar")->save();
|
||||
$this->table("Timerecording")->removeColumn("mileage_start")->save();
|
||||
$this->table("Timerecording")->removeColumn("mileage_end")->save();
|
||||
}
|
||||
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TimerecordingCategoryAddFieldUnpaid extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("TimerecordingCategory", ["signed" => true]);
|
||||
$table->addColumn("unpaid", "integer", ["null" => false, "default" => '0', "after" => "businesstrip"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("TimerecordingCategory")->removeColumn("unpaid")->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TimerecordingCarAddFieldInitialapproval extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("TimerecordingCar", ["signed" => true]);
|
||||
$table->addColumn("first_approval", "integer", ["null" => true, "default" => NULL, "after" => "initial_approval"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("TimerecordingCar")->removeColumn("initial_approval")->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TimerecordingEmployeeAddFieldBmd extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("TimerecordingEmployee", ["signed" => true]);
|
||||
$table->addColumn("bmd_active", "integer", ["null" => false, "default" => 1, "after" => "bpahours"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("TimerecordingEmployee")->removeColumn("bmd_active")->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
35
db/migrations/20240402075053_timerecording_billing.php
Normal file
35
db/migrations/20240402075053_timerecording_billing.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TimerecordingBilling extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("TimerecordingBilling", ["signed" => true]);
|
||||
|
||||
$table->addColumn("month", "string", ["null" => false]);
|
||||
$table->addColumn("closetime", "integer", ["null" => false]);
|
||||
$table->addColumn("create_by", "integer", ["null" => false]);
|
||||
$table->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$table->addColumn("create", "integer", ["null" => false]);
|
||||
$table->addColumn("edit", "integer", ["null" => false]);
|
||||
$table->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("TimerecordingBilling")->drop()->save();
|
||||
}
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TimerecordingBillingEmployee extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("TimerecordingBillingEmployee", ["signed" => true]);
|
||||
|
||||
$table->addColumn("timerecordingBilling_id", "integer", ["null" => false]);
|
||||
$table->addColumn("timerecordingEmployee_id", "integer", ["null" => false]);
|
||||
$table->addColumn("musthours", "integer", ["null" => false]);
|
||||
$table->addColumn("ishours", "integer", ["null" => false]);
|
||||
$table->addColumn("ishourssum", "integer", ["null" => false]);
|
||||
$table->addColumn("plushours25", "integer", ["null" => false, "default" => "0"]);
|
||||
$table->addColumn("overtime50", "integer", ["null" => false, "default" => "0"]);
|
||||
$table->addColumn("overtime50free", "integer", ["null" => false, "default" => "0"]);
|
||||
$table->addColumn("overtime100", "integer", ["null" => false, "default" => "0"]);
|
||||
$table->addColumn("overtime100free", "integer", ["null" => false, "default" => "0"]);
|
||||
$table->addColumn("homeoffice", "integer", ["null" => false, "default" => "0"]);
|
||||
$table->addColumn("diet", "decimal", ["null" => false, "default" => "0", "precision" => 10, "scale" => 2]);
|
||||
$table->addColumn("nlz", "text", ["null" => true]);
|
||||
$table->addColumn("nlz_detail", "text", ["null" => true]);
|
||||
$table->addColumn("create_by", "integer", ["null" => false]);
|
||||
$table->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$table->addColumn("create", "integer", ["null" => false]);
|
||||
$table->addColumn("edit", "integer", ["null" => false]);
|
||||
$table->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("TimerecordingBillingEmployee")->drop()->save();
|
||||
}
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TimerecordingCarAddFieldUser extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("TimerecordingCar", ["signed" => true]);
|
||||
$table->addColumn("user_id", "integer", ["null" => true, "after" => "id"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("TimerecordingCar")->removeColumn("user_id")->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
39
db/migrations/20240409064828_fiber_plan_dispatcher.php
Normal file
39
db/migrations/20240409064828_fiber_plan_dispatcher.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class FiberPlanDispatcher extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("FiberPlanDispatcher", ["signed" => true]);
|
||||
|
||||
$table->addColumn("network_id", "integer", ["null" => false]);
|
||||
$table->addColumn("object_type", "integer", ["null" => false]);
|
||||
$table->addColumn("gps_lat", "decimal", ["null" => true, "precision" => 15, "scale" => 10]);
|
||||
$table->addColumn("gps_long", "decimal", ["null" => true, "precision" => 15, "scale" => 10]);
|
||||
$table->addColumn("description", "text", ["null" => false]);
|
||||
$table->addColumn("type", "text", ["null" => true]);
|
||||
$table->addColumn("comment", "text", ["null" => true]);
|
||||
$table->addColumn("create_by", "integer", ["null" => false]);
|
||||
$table->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$table->addColumn("create", "integer", ["null" => false]);
|
||||
$table->addColumn("edit", "integer", ["null" => false]);
|
||||
$table->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("FiberPlanDispatcher")->drop()->save();
|
||||
}
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
}
|
||||
}
|
||||
}
|
||||
34
db/migrations/20240409064838_fiber_plan_dispatchersleeve.php
Normal file
34
db/migrations/20240409064838_fiber_plan_dispatchersleeve.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class FiberPlanDispatchersleeve extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("FiberPlanDispatchersleeve", ["signed" => true]);
|
||||
|
||||
$table->addColumn("fiberPlanDispatcher_id", "integer", ["null" => false]);
|
||||
$table->addColumn("name", "text", ["null" => false]);
|
||||
$table->addColumn("create_by", "integer", ["null" => false]);
|
||||
$table->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$table->addColumn("create", "integer", ["null" => false]);
|
||||
$table->addColumn("edit", "integer", ["null" => false]);
|
||||
$table->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("FiberPlanDispatchersleeve")->drop()->save();
|
||||
}
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
}
|
||||
}
|
||||
}
|
||||
45
db/migrations/20240410150500_add_voice_call_history.php
Normal file
45
db/migrations/20240410150500_add_voice_call_history.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php /** @noinspection ALL */
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class AddVoiceCallHistory extends AbstractMigration {
|
||||
public function up(): void {
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
|
||||
//VoiceCallHistory Table
|
||||
$voiceCallHistoryTable = $this->table("VoiceCallHistory", ["signed" => true]);
|
||||
$voiceCallHistoryTable->addColumn("uid", "string", ["null" => false, "limit" => 255]);
|
||||
$voiceCallHistoryTable->addColumn("voice_account", "string", ["null" => true, "limit" => 255]);
|
||||
$voiceCallHistoryTable->addColumn("start", "datetime", ["null" => false]);
|
||||
$voiceCallHistoryTable->addColumn("source", "string", ["null" => true, "limit" => 255]);
|
||||
$voiceCallHistoryTable->addColumn("destination", "string", ["null" => true, "limit" => 255]);
|
||||
$voiceCallHistoryTable->addColumn("state", "integer", ["null" => true]);
|
||||
$voiceCallHistoryTable->addColumn("billable", "integer", ["null" => false, "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]);
|
||||
$voiceCallHistoryTable->addColumn("duration", "integer", ["null" => false]);
|
||||
|
||||
//VoiceCallHistory Table Indexes
|
||||
$voiceCallHistoryTable->addIndex(["billable"]);
|
||||
$voiceCallHistoryTable->addIndex(["voice_account"]);
|
||||
$voiceCallHistoryTable->addIndex(["uid"], ["unique" => true]);
|
||||
|
||||
$voiceCallHistoryTable->save();
|
||||
|
||||
//VoiceCallHistoryJob Table
|
||||
$voiceCallHistoryJobTable = $this->table("VoiceCallHistoryJob", ["signed" => true]);
|
||||
$voiceCallHistoryJobTable->addColumn("date", "date", ["null" => false]);
|
||||
$voiceCallHistoryJobTable->addColumn("status", "enum", ["values" => ["created", "pending", "running", "success", "failed"], "default" => "created", "null" => false]);
|
||||
$voiceCallHistoryJobTable->addColumn("finished", "date", ["null" => true]);
|
||||
$voiceCallHistoryJobTable->addIndex(["date"], ["unique" => true]);
|
||||
|
||||
$voiceCallHistoryJobTable->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void {
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("VoiceCallHistory")->drop()->save();
|
||||
$this->table("VoiceCallHistoryJob")->drop()->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
31
db/migrations/20240416123342_device_add_field_parent_id.php
Normal file
31
db/migrations/20240416123342_device_add_field_parent_id.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class DeviceAddFieldParentId extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Device", ["signed" => true]);
|
||||
$table->addColumn("parent_id", "integer", ["null" => true, "after" => "devicetype_id"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("Device")->removeColumn("parent_id")->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
50
db/migrations/20240416144500_fiber_plan_pipe.php
Normal file
50
db/migrations/20240416144500_fiber_plan_pipe.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class FiberPlanPipe extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("FiberPlanPipe", ["signed" => true]);
|
||||
|
||||
$table->addColumn("description", "text", ["null" => false]);
|
||||
$table->addColumn("gisid", "text", ["null" => true]);
|
||||
$table->addColumn("type", "integer", ["null" => false]);
|
||||
$table->addColumn("type_description", "integer", ["null" => true]);
|
||||
$table->addColumn("fiberPlanPipeTemplate_id", "integer", ["null" => true]);
|
||||
$table->addColumn("length", "integer", ["null" => false]);
|
||||
$table->addColumn("startpoint_type", "integer", ["null" => false]);
|
||||
$table->addColumn("startpoint_network_id", "integer", ["null" => false]);
|
||||
$table->addColumn("startpoint", "integer", ["null" => false]);
|
||||
$table->addColumn("midpoint", "text", ["null" => true]);
|
||||
$table->addColumn("entpoint_type", "integer", ["null" => false]);
|
||||
$table->addColumn("endpoint_network_id", "integer", ["null" => false]);
|
||||
$table->addColumn("endpoint", "integer", ["null" => false]);
|
||||
$table->addColumn("status", "integer", ["null" => false]);
|
||||
$table->addColumn("responsible", "integer", ["null" => false]);
|
||||
$table->addColumn("responsible_text", "text", ["null" => true]);
|
||||
$table->addColumn("address_id", "integer", ["null" => true]);
|
||||
$table->addColumn("comment", "text", ["null" => true]);
|
||||
$table->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$table->addColumn("create_by", "integer", ["null" => false]);
|
||||
$table->addColumn("edit", "integer", ["null" => false]);
|
||||
$table->addColumn("create", "integer", ["null" => false]);
|
||||
$table->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("FiberPlanPipe")->drop()->save();
|
||||
}
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class FiberPlanPipeManufacturer extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("FiberPlanPipeManufacturer", ["signed" => true]);
|
||||
$table->addColumn("name", "string", ["null" => false]);
|
||||
$table->addColumn("colors", "text", ["null" => true]);
|
||||
$table->addColumn("create_by", "integer", ["null" => false]);
|
||||
$table->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$table->addColumn("create", "integer", ["null" => false]);
|
||||
$table->addColumn("edit", "integer", ["null" => false]);
|
||||
$table->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("FiberPlanPipeManufacturer")->drop()->save();
|
||||
}
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
}
|
||||
}
|
||||
}
|
||||
34
db/migrations/20240416144535_fiber_plan_pipe_template.php
Normal file
34
db/migrations/20240416144535_fiber_plan_pipe_template.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class FiberPlanPipeTemplate extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("FiberPlanPipeTemplate", ["signed" => true]);
|
||||
$table->addColumn("fiberPlanPipeManufacturer_id", "integer", ["null" => false]);
|
||||
$table->addColumn("pipe7x4", "integer", ["null" => true]);
|
||||
$table->addColumn("pipe14x10", "integer", ["null" => true]);
|
||||
$table->addColumn("create_by", "integer", ["null" => false]);
|
||||
$table->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$table->addColumn("create", "integer", ["null" => false]);
|
||||
$table->addColumn("edit", "integer", ["null" => false]);
|
||||
$table->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("FiberPlanPipeTemplate")->drop()->save();
|
||||
}
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
}
|
||||
}
|
||||
}
|
||||
36
db/migrations/20240416144626_fiber_plan_pipe_endpoint.php
Normal file
36
db/migrations/20240416144626_fiber_plan_pipe_endpoint.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class FiberPlanPipeEndpoint extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("FiberPlanPipeEndpoint", ["signed" => true]);
|
||||
$table->addColumn("fiberPlanPipe_id", "integer", ["null" => false]);
|
||||
$table->addColumn("pop_id", "integer", ["null" => true]);
|
||||
$table->addColumn("fiberPlanDispatcher_id", "integer", ["null" => true]);
|
||||
$table->addColumn("building_id", "integer", ["null" => true]);
|
||||
$table->addColumn("sort", "integer", ["null" => false]);
|
||||
$table->addColumn("create_by", "integer", ["null" => false]);
|
||||
$table->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$table->addColumn("create", "integer", ["null" => false]);
|
||||
$table->addColumn("edit", "integer", ["null" => false]);
|
||||
$table->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("FiberPlanPipeEndpoint")->drop()->save();
|
||||
}
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php /** @noinspection ALL */
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class AddVoiceCallHistoryStartIndex extends AbstractMigration {
|
||||
public function up(): void {
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
//VoiceCallHistory Table add start index
|
||||
$this->table("VoiceCallHistory")->addIndex(["start"])->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void {
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("VoiceCallHistory")->removeIndex(["start"])->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
155
lib/Inwx/Inwx.php
Normal file
155
lib/Inwx/Inwx.php
Normal file
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Represents the INWX API.
|
||||
*
|
||||
* @link https://www.inwx.at/en/help/apidoc JSON-RPC API documentation
|
||||
*/
|
||||
class Inwx {
|
||||
private string $apiUrl = 'https://api.domrobot.com/jsonrpc/';
|
||||
private string $username;
|
||||
private string $password;
|
||||
|
||||
/**
|
||||
* Inwx constructor.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
*/
|
||||
public function __construct(string $username, string $password) {
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of contacts.
|
||||
*
|
||||
* @param int $pageLimit
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function contactList(int $pageLimit = 300): array {
|
||||
$requestData = array(
|
||||
'jsonrpc' => '2.0',
|
||||
'method' => 'contact.list',
|
||||
'params' => array(
|
||||
'user' => $this->username,
|
||||
'pass' => $this->password,
|
||||
'pagelimit' => $pageLimit,
|
||||
),
|
||||
'id' => 1
|
||||
);
|
||||
|
||||
return $this->makeRequest($requestData)['contact'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of domains.
|
||||
*
|
||||
* @param int $pageLimit
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function domainList(int $pageLimit = 300): array {
|
||||
$requestData = array(
|
||||
'jsonrpc' => '2.0',
|
||||
'method' => 'domain.list',
|
||||
'params' => array(
|
||||
'user' => $this->username,
|
||||
'pass' => $this->password,
|
||||
'pagelimit' => $pageLimit,
|
||||
),
|
||||
'id' => 1
|
||||
);
|
||||
|
||||
return $this->makeRequest($requestData)['domain'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a domain is available.
|
||||
*
|
||||
* @param string $domain
|
||||
* @param string $tld
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function domainCheck(string $domain): array {
|
||||
$requestData = array(
|
||||
'jsonrpc' => '2.0',
|
||||
'method' => 'domain.check',
|
||||
'params' => array(
|
||||
'user' => $this->username,
|
||||
'pass' => $this->password,
|
||||
'domain' => $domain
|
||||
),
|
||||
'id' => 1
|
||||
);
|
||||
|
||||
return $this->makeRequest($requestData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the price of a domain.
|
||||
*
|
||||
* @param string $domain
|
||||
* @param string $priceType reg | renewal | transfer | update | trade | restore
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function domainGetDomainPrice(string $domain, string $priceType): array {
|
||||
$requestData = array(
|
||||
'jsonrpc' => '2.0',
|
||||
'method' => 'domain.getdomainprice',
|
||||
'params' => array(
|
||||
'user' => $this->username,
|
||||
'pass' => $this->password,
|
||||
'domain' => $domain,
|
||||
'pricetype' => $priceType,
|
||||
),
|
||||
'id' => 1
|
||||
);
|
||||
|
||||
return $this->makeRequest($requestData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a request to the INWX API.
|
||||
*
|
||||
* @param array $requestData
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
private function makeRequest(array $requestData): array {
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $this->apiUrl);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestData));
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json'
|
||||
));
|
||||
|
||||
$response = curl_exec($ch);
|
||||
|
||||
if ($response === false) {
|
||||
throw new Exception('cURL Error: ' . curl_error($ch));
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
$responseData = json_decode($response, true);
|
||||
|
||||
if (isset($responseData['error'])) {
|
||||
throw new Exception('JSON-RPC Error: ' . $responseData['error']['message']);
|
||||
}
|
||||
|
||||
if (!isset($responseData['resData'])) {
|
||||
throw new Exception('Unexpected response format.');
|
||||
}
|
||||
|
||||
return $responseData['resData'];
|
||||
}
|
||||
}
|
||||
?>
|
||||
100
lib/KolmisoftMore/KolmisoftMore.php
Normal file
100
lib/KolmisoftMore/KolmisoftMore.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
class KolmisoftMore {
|
||||
private string $host;
|
||||
private string $username;
|
||||
private string $apiKey;
|
||||
|
||||
public function __construct($host, $apiKey, $username) {
|
||||
$this->host = $host;
|
||||
$this->apiKey = $apiKey;
|
||||
$this->username = $username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate hash for the given query parameters
|
||||
* @param $queryParameters - Array of query parameters to generate hash
|
||||
* @return string
|
||||
*/
|
||||
public function generateHash($queryParameters): string {
|
||||
// concatenate all query parameters values in order of the array and then add apiKey to the end
|
||||
|
||||
$queryString = implode('', $queryParameters);
|
||||
$queryString .= $this->apiKey;
|
||||
|
||||
return hash('sha1', $queryString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a request to the Kolmisoft API
|
||||
* @param $path - API path
|
||||
* @param $queryString - Query string
|
||||
* @return array|bool
|
||||
*/
|
||||
public function makeRequest($path, $queryString) {
|
||||
$url = "https://{$this->host}/billing/api/$path?$queryString";
|
||||
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$response = curl_exec($curl);
|
||||
|
||||
try {
|
||||
$response = new SimpleXMLElement($response);
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$response = json_decode(json_encode($response), true);
|
||||
|
||||
if (is_array($response)) {
|
||||
return $response;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getVoiceCallHistory($startDate, $endDate) {
|
||||
|
||||
$queryParameters = [
|
||||
'period_start' => $startDate,
|
||||
'period_end' => $endDate
|
||||
];
|
||||
|
||||
$hash = $this->generateHash($queryParameters);
|
||||
|
||||
$queryParameters['hash'] = $hash;
|
||||
$queryParameters['u'] = $this->username;
|
||||
|
||||
$queryString = http_build_query($queryParameters);
|
||||
|
||||
$response = $this->makeRequest('user_calls_get', $queryString);
|
||||
|
||||
if ($response) {
|
||||
return $response['calls_stat']['calls']['call'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getActiveCalls() {
|
||||
$queryParameters = ['u' => $this->username];
|
||||
|
||||
$hash = $this->generateHash($queryParameters);
|
||||
|
||||
$queryParameters['hash'] = $hash;
|
||||
|
||||
$queryString = http_build_query($queryParameters);
|
||||
|
||||
$response = $this->makeRequest('active_calls_get', $queryString);
|
||||
|
||||
if ($response) {
|
||||
return $response['status']['active_call'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
36
lib/Plesk/Plesk.php
Normal file
36
lib/Plesk/Plesk.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
class Plesk {
|
||||
private $host;
|
||||
private $authorization;
|
||||
|
||||
public function __construct($host, $authorization) {
|
||||
$this->host = $host;
|
||||
$this->authorization = $authorization;
|
||||
}
|
||||
|
||||
public function getAllDomains() {
|
||||
// Implement code to fetch all configured domains using Plesk API
|
||||
// You can use cURL or any HTTP client library to make API requests
|
||||
// Example:
|
||||
$url = "https://{$this->host}/api/v2/domains";
|
||||
$headers = array(
|
||||
"Authorization: {$this->authorization}",
|
||||
"Content-Type: application/json"
|
||||
);
|
||||
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$response = curl_exec($curl);
|
||||
|
||||
$response = json_decode($response, true);
|
||||
|
||||
if (is_array($response)) {
|
||||
return $response;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,8 +89,8 @@ class mfUpload_TmpFile {
|
||||
return false;
|
||||
}
|
||||
|
||||
$filename = preg_replace('/[^a-z0-9$()+%äöüß._-]/i', '_', $filename);
|
||||
$filename = preg_replace('/[^a-z0-9$()+%äöüß\[\]&#;,._-]/i', '_', $filename);
|
||||
$filename = preg_replace('/[^a-z0-9$()+%äöüÄÖÜß._-]/i', '_', $filename);
|
||||
$filename = preg_replace('/[^a-z0-9$()+%äöüÄÖÜß\[\]&#;,._-]/i', '_', $filename);
|
||||
|
||||
$parts = explode(".",$filename);
|
||||
$ext = strtolower(array_pop($parts));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user