Started creating workflow
This commit is contained in:
39
application/Pipework/PipeworkController.php
Normal file
39
application/Pipework/PipeworkController.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user