get my_networks from parent address if exists
This commit is contained in:
@@ -16,7 +16,22 @@ class BuildingController extends mfBaseController {
|
||||
|
||||
protected function indexAction() {
|
||||
$this->layout()->setTemplate("Building/Index");
|
||||
$this->layout()->set("buildings", BuildingModel::getAll());
|
||||
|
||||
if($this->me->is("Admin")) {
|
||||
$this->layout()->set("buildings", BuildingModel::getAll());
|
||||
} else {
|
||||
$buildings = [];
|
||||
foreach($this->me->my_networks as $network) {
|
||||
foreach(BuildingModel::search(["network_id" => $network->id]) as $b) {
|
||||
if(!array_key_exists($b->id, $buildings)) {
|
||||
$buildings[$b->id] = $b;
|
||||
}
|
||||
}
|
||||
}
|
||||
//var_dump($buildings);exit;
|
||||
$this->layout()->set("buildings", $buildings);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function addAction() {
|
||||
|
||||
Reference in New Issue
Block a user