diff --git a/Layout/default/Linework/Index.php b/Layout/default/Linework/Index.php index f76108e53..0e21aa2dc 100644 --- a/Layout/default/Linework/Index.php +++ b/Layout/default/Linework/Index.php @@ -154,11 +154,11 @@ 0): ?> Anschluss - Baustatus - Patchstatus - BB hergestellt - BEP montiert - K-Kabel eingeblasen + Tiefbau + Patch-/Kabeldaten + Backbone + BEP + Kundenkabel Spleiß Netz Spleiß Kunde Fertig diff --git a/application/Building/Building.php b/application/Building/Building.php index bdc79ca6b..f1594adfe 100644 --- a/application/Building/Building.php +++ b/application/Building/Building.php @@ -83,18 +83,18 @@ class Building extends mfBaseModel { foreach(WorkflowitemModel::search(["object_type" => "building", "active" => 1]) as $item) { $item->setObjectId($this->id); $this->workflowitems[$item->name] = $item; - mfValuecache::set("wfBuilding-".$item->name, $item); + mfValuecache::singleton()->set("wfBuilding-".$item->name, $item); } } public function getWorkflowvalue($itemname, $type = false) { - $item = mfValuecache::get("wfBuilding-".$itemname); + $item = mfValuecache::singleton()->get("wfBuilding-".$itemname); if(!$item) { $item = WorkflowitemModel::getFirst(['name' => $itemname]); if(!$item->id) { return null; } - mfValuecache::set("wfBuilding-".$itemname, $item); + mfValuecache::singleton()->set("wfBuilding-".$itemname, $item); } switch($item->type) { diff --git a/application/Linework/LineworkController.php b/application/Linework/LineworkController.php index 7bee13a27..8064f14b3 100644 --- a/application/Linework/LineworkController.php +++ b/application/Linework/LineworkController.php @@ -4,11 +4,11 @@ class LineworkController extends mfBaseController { protected function init() { $this->needlogin=true; - $me = mfValuecache::get("me"); + $me = mfValuecache::singleton()->get("me"); if(!$me) { $me = new User(); $me->loadMe(); - mfValuecache::set("me", $this->me); + mfValuecache::singleton()->set("me", $this->me); } $this->me = $me; $this->layout()->set("me",$me); diff --git a/application/Termination/Termination.php b/application/Termination/Termination.php index c080caf76..58f00cd76 100644 --- a/application/Termination/Termination.php +++ b/application/Termination/Termination.php @@ -36,21 +36,41 @@ class Termination extends mfBaseModel { } public function loadWorkflowItems() { + $item_ids = []; foreach(WorkflowitemModel::search(["object_type" => "Termination", "active" => 1]) as $item) { $item->setObjectId($this->id); $this->workflowitems[$item->name] = $item; - mfValuecache::set("wfTerm-".$item->name, $item); + //mfValuecache::set("wfTerm-name-".$item->name, $item); + //mfValuecache::set("wfTerm-id-".$item->id, $item); + $item_ids[] = $item->id; } + + // get values + $values = WorkflowvalueModel::search(["object_id" => $this->id]); + //var_dump($values);exit; + foreach($values as $value) { + if(array_key_exists($value->item->name, $this->workflowitems)) { + //var_dump($value);exit; + $this->workflowitems[$value->item->name]->setValue($value); + mfValuecache::singleton()->set("wfTerm-name-".$this->workflowitems[$value->item->name]->name, $this->workflowitems[$value->item->name]); + mfValuecache::singleton()->set("wfTerm-id-".$this->workflowitems[$value->item->name]->id, $this->workflowitems[$value->item->name]); + mfValuecache::singleton()->set("wfItemvalue-item-".$value->item_id."-object-".$value->object_id, $value); + } + } + + //var_dump(array_keys(mfValuecache::singleton()->getCache())); + } public function getWorkflowvalue($itemname, $type = false) { - $item = mfValuecache::get("wfTerm-".$itemname); + $item = mfValuecache::singleton()->get("wfTerm-name-".$itemname); if(!$item) { $item = WorkflowitemModel::getFirst(['name' => $itemname]); if(!$item->id) { return null; } - mfValuecache::set("wfTerm-".$itemname, $item); + mfValuecache::singleton()->set("wfTerm-name-".$itemname, $item); + mfValuecache::singleton()->set("wfTerm-id-".$item->id, $item); } switch($item->type) { @@ -282,14 +302,14 @@ class Termination extends mfBaseModel { } if($name == "creator") { - $user = mfValuecache::get("Worker-id-".$this->create_by); + $user = mfValuecache::singleton()->get("Worker-id-".$this->create_by); if($user) { $this->creator = $user; return $this->creator; } $this->creator = new User($this->create_by); if($this->creator->id) { - mfValuecache::set("Worker-id-".$this->create_by, $this->creator); + mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator); } return $this->creator; } diff --git a/application/Workflowitem/Workflowitem.php b/application/Workflowitem/Workflowitem.php index 4cf1e7fb9..a5b13bab3 100644 --- a/application/Workflowitem/Workflowitem.php +++ b/application/Workflowitem/Workflowitem.php @@ -12,6 +12,10 @@ class Workflowitem extends mfBaseModel { return true; } + public function setValue(Workflowvalue $value) { + $this->value = $value; + } + public function getProperty($name) { if($this->$name == null) { @@ -20,12 +24,18 @@ class Workflowitem extends mfBaseModel { $this->log->warn(__CLASS__."::getProperty('value'): Object ID not set"); return null; } + $value = mfValuecache::singleton()->get("wfItemvalue-item-".$this->id."-object-".$this->object_id); + if($value) { + $this->value = $value; + return $value; + } $value = WorkflowvalueModel::getFirst(['item_id' => $this->id, "object_id" => $this->object_id]); if(!$value) { $vdata['item_id'] = $this->id; $vdata['object_id'] = $this->object_id; $value = WorkflowvalueModel::create($vdata); } + mfValuecache::singleton()->set("wfItemvalue-item-".$this->id."-object-".$this->object_id, $value); $this->value = $value; return $this->value; } diff --git a/application/Workflowitem/WorkflowitemModel.php b/application/Workflowitem/WorkflowitemModel.php index b52ff1a03..33b1c350f 100644 --- a/application/Workflowitem/WorkflowitemModel.php +++ b/application/Workflowitem/WorkflowitemModel.php @@ -27,11 +27,11 @@ class WorkflowitemModel { } } - $me = mfValuecache::get("me"); + $me = mfValuecache::singleton()->get("me"); if(!$me) { $me = new User(); $me->loadMe(); - mfValuecache::set("me", $this->me); + mfValuecache::singleton()->set("me", $this->me); } if($model->create_by === null) { diff --git a/application/Workflowvalue/Workflowvalue.php b/application/Workflowvalue/Workflowvalue.php index 0c5b96be7..7df9b4072 100644 --- a/application/Workflowvalue/Workflowvalue.php +++ b/application/Workflowvalue/Workflowvalue.php @@ -11,11 +11,11 @@ class Workflowvalue extends mfBaseModel { public $is_changed = false; protected function init() { - $this->me = mfValuecache::get("me"); + $this->me = mfValuecache::singleton()->get("me"); if(!$this->me) { $this->me = new User(); $this->me->loadMe(); - mfValuecache::set("me", $this->me); + mfValuecache::singleton()->set("me", $this->me); } } @@ -133,12 +133,19 @@ class Workflowvalue extends mfBaseModel { if($this->$name == null) { if($name == "item") { - $this->item = new Workflowitem($this->item_id); + $this->item = mfValuecache::singleton()->get("wfItem-id-".$this->item_id); + if(!$this->item) { + $this->item = new Workflowitem($this->item_id); + if($this->item->id) { + mfValuecache::singleton()->set("wfItem-id-".$this->item->id, $this->item); + } + } + return $this->item; } if($name == "changer") { - $user = mfValuecache::get("Worker-id-".$this->changed); + $user = mfValuecache::singleton()->get("Worker-id-".$this->changed); if($user) { $this->changer = $user; return $this->changer; @@ -146,7 +153,7 @@ class Workflowvalue extends mfBaseModel { if($this->changed && $this->changed_by) { $this->changer = new User($this->changed_by); if($this->changer->id) { - mfValuecache::set("Worker-id-".$this->changed, $this->changer); + mfValuecache::singleton()->set("Worker-id-".$this->changed, $this->changer); } return $this->changer; } else { diff --git a/application/Workflowvalue/WorkflowvalueModel.php b/application/Workflowvalue/WorkflowvalueModel.php index 2fd531028..e95273b27 100644 --- a/application/Workflowvalue/WorkflowvalueModel.php +++ b/application/Workflowvalue/WorkflowvalueModel.php @@ -24,11 +24,11 @@ class WorkflowvalueModel { } } - $me = mfValuecache::get("me"); + $me = mfValuecache::singleton()->get("me"); if(!$me) { $me = new User(); $me->loadMe(); - mfValuecache::set("me", $this->me); + mfValuecache::singleton()->set("me", $this->me); } if($model->create_by === null) { diff --git a/lib/mvcfronk/mfValuecache/mfValuecache.php b/lib/mvcfronk/mfValuecache/mfValuecache.php index 360e194bf..3c7f16529 100644 --- a/lib/mvcfronk/mfValuecache/mfValuecache.php +++ b/lib/mvcfronk/mfValuecache/mfValuecache.php @@ -4,10 +4,7 @@ class mfValuecache { public static $instance; public $cache = []; - - private function __construct() { - - } + private function __construct() { } public static function singleton() { if(!isset(self::$instance)) { @@ -17,16 +14,18 @@ class mfValuecache { return self::$instance; } - public static function get($key) { - $instance = self::singleton(); - if(array_key_exists($key, $instance->cache)) { - return $instance->cache[$key]; + public function get($key) { + if(array_key_exists($key, $this->cache)) { + return $this->cache[$key]; } return null; } - public static function set($key, $value) { - $instance = self::singleton(); - $instance->cache[$key] = $value; + public function set($key, $value) { + $this->cache[$key] = $value; + } + + public function getCache() { + return $this->cache; } } \ No newline at end of file diff --git a/public/index.php b/public/index.php index 692c630de..2e79d824f 100755 --- a/public/index.php +++ b/public/index.php @@ -21,7 +21,7 @@ if(defined('MFLOCALE_NUMERIC')) { setlocale(LC_NUMERIC, MFLOCALE_NUMERIC); } -define('FRONKDB_SQLDEBUG',false); +define('FRONKDB_SQLDEBUG',true); error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED)); require_once(LIBDIR."/mvcfronk/mfRouter/mfRouter.php");