39 lines
994 B
PHP
39 lines
994 B
PHP
<?php
|
|
|
|
class PipeworkController 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", "netowner", "pipeplanner", "pipeworker"])) {
|
|
$this->redirect("Dashboard");
|
|
}
|
|
}
|
|
|
|
protected function indexAction() {
|
|
$this->layout()->setTemplate("Pipework/Index");
|
|
|
|
if($this->me->is("Admin")) {
|
|
$this->layout()->set("buildings", BuildingModel::search(["workflow_finished" => 0]));
|
|
} else {
|
|
$buildings = [];
|
|
foreach($this->me->my_networks as $network) {
|
|
foreach(BuildingModel::search(["network_id" => $network->id, "workflow_finished" => 0]) as $b) {
|
|
if(!array_key_exists($b->id, $buildings)) {
|
|
$buildings[$b->id] = $b;
|
|
}
|
|
}
|
|
}
|
|
//var_dump($buildings);exit;
|
|
|
|
|
|
$this->layout()->set("buildings", $buildings);
|
|
}
|
|
}
|
|
|
|
|
|
} |