Now listing creator and editor in Building/Index

This commit is contained in:
Frank Schubert
2025-02-07 14:08:37 +01:00
parent 234dd0c27f
commit fd9367bd8d
2 changed files with 30 additions and 1 deletions

View File

@@ -148,6 +148,7 @@
<th>Einheiten</th>
<th>Status</th>
<!--th class="text-center"><img src="<?=self::getResourcePath()?>assets/images/snopp-sm.png" style="width: 24px; height: 24px;" /> Export</th-->
<th>Erstellt<br />Bearbeitet</th>
<th></th>
</tr>
<?php foreach($buildings as $building): ?>
@@ -164,6 +165,10 @@
<td onclick="toggleBuilding(<?=$building->id?>)"><?=$building->units?></td>
<td onclick="toggleBuilding(<?=$building->id?>)" class="text-monospace"><?=__($building->status->name."-b")?></td>
<!--td><input type="checkbox" class="form-control" id="snopp-export-<?=$building->id?>" data-building-id="<?=$building->id?>" /></td-->
<td class="text-monospace">
<?=date('d.m.Y H:i:s',$building->create)?> (<?=$building->creator->name?>)<br />
<?=date('d.m.Y H:i:s',$building->edit)?> (<?=$building->editor->name?>)
</td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<a href="<?=self::getUrl("Building", "edit", ["id" => $building->id])?>"><i class="far fa-edit" title="Objekt Bearbeiten"></i></a>
<a href="<?=self::getUrl("Building", "delete", ["id" => $building->id])?>" class="text-danger" onclick="if(!confirm('Objekt wirklich löschen?')) return false;" title="Objekt Löschen"><i class="fas fa-trash"></i></a>

View File

@@ -15,7 +15,9 @@ class Building extends mfBaseModel {
private $workflowitems;
private $files;
private $pipework_enabler;
private $creator;
private $editor;
public function getAddress($singelLine = false) {
if(!$this->id) {
return false;
@@ -327,6 +329,28 @@ class Building extends mfBaseModel {
return $this->pipework_enabler;
}
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);