Patching readonly
This commit is contained in:
152
Layout/default/Patching/Index.php
Normal file
152
Layout/default/Patching/Index.php
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php include(realpath(dirname(__FILE__)."/../")."/header.php"); ?>
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?=self::getUrl("Dashboard")?>">the-tool</a></li>
|
||||
<li class="breadcrumb-item active">Patchungen</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Patchungen</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<div class="float-left">
|
||||
<h4 class="header-title">Patchungen</h4>
|
||||
</div>
|
||||
|
||||
<?php if($pagination['maxItems'] > $pagination['count']): ?>
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center mb-1">
|
||||
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
|
||||
<a class="page-link" href="<?=$this->getUrl($Mod, "Index", ["filter" => $filter])?>" tabindex="-1">Erste</a>
|
||||
</li>
|
||||
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
|
||||
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $pagination['start'] - $pagination['count'], "filter" => $filter])?>" tabindex="-1">Zurück</a>
|
||||
</li>
|
||||
<?php for($i = 0; $i < ($pagination['maxItems'] / $pagination['count']); $i++): ?>
|
||||
<li class="page-item <?=($pagination['start'] == $i*$pagination['count']) ? "disabled font-weight-bold" : ""?>"><a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $i*$pagination['count'], "filter" => $filter])?>"><?=$i+1?></a></li>
|
||||
<?php endfor; ?>
|
||||
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) < 1) ? "disabled" : ""?>">
|
||||
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $pagination['start'] + $pagination['count'], "filter" => $filter])?>">Vor</a>
|
||||
</li>
|
||||
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) < 1) ? "disabled" : ""?>">
|
||||
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => ($pagination['maxItems'] - $pagination['maxItems'] % $pagination['count']), "filter" => $filter])?>">Letzte</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
<div class="pagination justify-content-center">
|
||||
<?php if($pagination['maxItems']): ?>
|
||||
Patchungen <?=$pagination['start']+1?> bis <?=($pagination['start'] + $pagination['count'] > $pagination['maxItems']) ? $pagination['maxItems'] : $pagination['start'] + $pagination['count']?> von <?=$pagination['maxItems']?>
|
||||
<?php else: ?>
|
||||
Keine Patchungen gefunden
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped table-hover">
|
||||
<tr class="table-bordered text-center">
|
||||
<th colspan="4">Standort</th>
|
||||
<th colspan="2">ODF</th>
|
||||
<th colspan="4">Abschluss POP/Device</th>
|
||||
</tr>
|
||||
<tr class="table-bordered">
|
||||
<th>Netzgebiet</th>
|
||||
<th>POP</th>
|
||||
<th>Kunde</th>
|
||||
<th>Standort</th>
|
||||
<th>Patchposition ODF</th>
|
||||
<th>ODF Port</th>
|
||||
<th>Typ</th>
|
||||
<th>Gerät</th>
|
||||
<th>Ports</th>
|
||||
<th>Gepatched</th>
|
||||
</tr>
|
||||
<?php foreach($terminations as $term): ?>
|
||||
<tr>
|
||||
<td><?=$term->building->network->name?></td>
|
||||
<td><?=$term->order->owner->customer_number?></td>
|
||||
<td><?=$term->order->owner->getCompanyOrName()?></td>
|
||||
<td>
|
||||
<?=$term->building->street?><br />
|
||||
<?=$term->building->zip?> <?=$term->building->city?>
|
||||
</td>
|
||||
<td>
|
||||
<?=$term->workflowitems["schrank"]->value->value_string?> /
|
||||
<?=$term->workflowitems["baugruppe"]->value->value_string?> /
|
||||
<?=$term->workflowitems["modul"]->value->value_string?> /
|
||||
<?=$term->workflowitems["ports"]->value->value_string?> /
|
||||
</td>
|
||||
<td><input type="text" class="form-control" name="linework_port" value="" placeholder="ODF Port" /></td>
|
||||
<td>
|
||||
<select name="device_type" class="form-control">
|
||||
<option></option>
|
||||
<option value="splitter">Splitter</option>
|
||||
<option value="pon">Shared PON-Port</option>
|
||||
<option value="switch">Switch</option>
|
||||
</select>
|
||||
</td>
|
||||
<td><input type="text" class="form-control" name="device_name" value="" placeholder="ODF Port" /></td>
|
||||
<td>
|
||||
<select name="device_ports" class="form-control">
|
||||
<option></option>
|
||||
<?php foreach($term->getLineworkportPairs() as $ports): ?>
|
||||
<?php foreach($ports as $p): ?>
|
||||
<option value="<?=$p?>"><?=$p?></option>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
<td><input type="checkbox" class="form-control" name="patched" value="1" /></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
<?php if($pagination['maxItems'] > $pagination['count']): ?>
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center mb-1">
|
||||
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
|
||||
<a class="page-link" href="<?=$this->getUrl($Mod, "Index", ["filter" => $filter])?>" tabindex="-1">Erste</a>
|
||||
</li>
|
||||
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
|
||||
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $pagination['start'] - $pagination['count'], "filter" => $filter])?>" tabindex="-1">Zurück</a>
|
||||
</li>
|
||||
<?php for($i = 0; $i < ($pagination['maxItems'] / $pagination['count']); $i++): ?>
|
||||
<li class="page-item <?=($pagination['start'] == $i*$pagination['count']) ? "disabled font-weight-bold" : ""?>"><a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $i*$pagination['count'], "filter" => $filter])?>"><?=$i+1?></a></li>
|
||||
<?php endfor; ?>
|
||||
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) < 1) ? "disabled" : ""?>">
|
||||
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $pagination['start'] + $pagination['count'], "filter" => $filter])?>">Vor</a>
|
||||
</li>
|
||||
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) < 1) ? "disabled" : ""?>">
|
||||
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => ($pagination['maxItems'] - $pagination['maxItems'] % $pagination['count']), "filter" => $filter])?>">Letzte</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
<div class="pagination justify-content-center">
|
||||
<?php if($pagination['maxItems']): ?>
|
||||
Patchungen <?=$pagination['start']+1?> bis <?=($pagination['start'] + $pagination['count'] > $pagination['maxItems']) ? $pagination['maxItems'] : $pagination['start'] + $pagination['count']?> von <?=$pagination['maxItems']?>
|
||||
<?php else: ?>
|
||||
Keine Patchungen gefunden
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__)."/../")."/footer.php"); ?>
|
||||
@@ -39,6 +39,7 @@
|
||||
<?php if($me->is(["Admin","netowner","pipeplanner"])): ?><li><a href="<?=self::getUrl("Building")?>">Objekte & Anschlüsse</a></li><?php endif; ?>
|
||||
<?php if($me->is(["Admin","netowner","pipeplanner","pipeworker","lineplanner","lineworker"])): ?><li><a href="<?=self::getUrl("Pipework")?>">Tiefbau</a></li><?php endif; ?>
|
||||
<?php if($me->is(["Admin","netowner","lineplanner","lineworker"])): ?><li><a href="<?=self::getUrl("Linework")?>">Leitungsbau</a></li><?php endif; ?>
|
||||
<?php if($me->is(["Admin", "netowner", "netoperator", "lineworker"])): ?><li><a href="<?=self::getUrl("Patching")?>">Patchungen</a></li><?php endif; ?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -23,9 +23,14 @@ class DashboardController extends mfBaseController {
|
||||
|
||||
/*$address = AddressModel::getOne(5);
|
||||
var_dump($address->types);exit;*/
|
||||
|
||||
/*
|
||||
$a = new Address(1);
|
||||
var_dump($a->generateServicePin());exit;
|
||||
*/
|
||||
|
||||
$t = new Termination(45);
|
||||
$ports = $t->getLineworkportPairs();
|
||||
var_dump($ports);exit;
|
||||
}
|
||||
|
||||
protected function pdfAction() {
|
||||
|
||||
@@ -74,11 +74,24 @@ class OrderModel {
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst() {
|
||||
public static function getFirst($filter = false) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("Order", "*", "$where ORDER BY order_date, owner_id");
|
||||
|
||||
$sql = "SELECT `Order`.id as order_id, `Order`.* FROM `Order`
|
||||
LEFT JOIN OrderProduct ON (OrderProduct.order_id = `Order`.id)
|
||||
LEFT JOIN Product ON (Product.id = OrderProduct.product_id)
|
||||
LEFT JOIN Termination ON (Termination.id = OrderProduct.termination_id)
|
||||
LEFT JOIN Building ON (Building.id = Termination.building_id)
|
||||
LEFT JOIN Terminationstatus ON (Terminationstatus.id = Termination.status_id)
|
||||
LEFT JOIN Buildingstatus ON (Buildingstatus.id = Building.status_id)
|
||||
|
||||
WHERE $where
|
||||
GROUP BY `Order`.id
|
||||
ORDER BY `Order`.order_date ASC";
|
||||
$res = $db->query($sql);
|
||||
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Order($data);
|
||||
@@ -260,7 +273,7 @@ class OrderModel {
|
||||
if(array_key_exists("termination_id", $filter)) {
|
||||
$termination_id = $filter['termination_id'];
|
||||
if(is_numeric($termination_id)) {
|
||||
$where .= " AND Product.termination_id=$termination_id";
|
||||
$where .= " AND OrderProduct.termination_id=$termination_id";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
5
application/Patching/Patching.php
Normal file
5
application/Patching/Patching.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
class Patching extends mfBaseModel {
|
||||
|
||||
}
|
||||
34
application/Patching/PatchingController.php
Normal file
34
application/Patching/PatchingController.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
class PatchingController 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", "netoperator", "lineworker"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction() {
|
||||
$this->layout()->setTemplate("Patching/Index");
|
||||
|
||||
$terminations = PatchingModel::searchByTermination();
|
||||
$terms = [];
|
||||
foreach($terminations as $term) {
|
||||
$term->order = OrderModel::getFirst(["termination_id" => $term->id]);
|
||||
$terms[] = $term;
|
||||
//var_dump($term);
|
||||
}
|
||||
//exit;
|
||||
|
||||
$this->layout()->set("terminations", $terms);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
164
application/Patching/PatchingModel.php
Normal file
164
application/Patching/PatchingModel.php
Normal file
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
class PatchingModel {
|
||||
public $termination_id = null;
|
||||
public $linework_port = null;
|
||||
public $device_type = null;
|
||||
public $device_name = null;
|
||||
public $device_ports = null;
|
||||
public $patched = null;
|
||||
|
||||
public $create_by = null;
|
||||
public $edit_by = null;
|
||||
public $create = null;
|
||||
public $edit = null;
|
||||
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new Patching();
|
||||
|
||||
foreach($data as $field => $value) {
|
||||
if(property_exists(get_called_class(), $field)) {
|
||||
$model ->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
|
||||
if($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getOne($id) {
|
||||
if(!is_numeric($id) || !$id) {
|
||||
throw new Exception("Invalid number", 400);
|
||||
}
|
||||
$item = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("Patching", "*", "id=$id LIMIT 1");
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Patching($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll() {
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("Patching", "*");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Patching($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst() {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("Patching", "*", "$where ORDER BY termination_id");
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Patching($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function searchByTermination($filter = false) {
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
|
||||
$sql = "SELECT Termination.id as termination_id FROM `Order`
|
||||
LEFT JOIN OrderProduct ON (OrderProduct.order_id = `Order`.id)
|
||||
LEFT JOIN Product ON (Product.id = OrderProduct.product_id)
|
||||
LEFT JOIN Termination ON (Termination.id = OrderProduct.termination_id)
|
||||
LEFT JOIN Building ON (Building.id = Termination.building_id)
|
||||
LEFT JOIN Terminationstatus ON (Terminationstatus.id = Termination.status_id)
|
||||
LEFT JOIN Buildingstatus ON (Buildingstatus.id = Building.status_id)
|
||||
LEFT JOIN Patching ON (Patching.Termination_id = OrderProduct.termination_id)
|
||||
LEFT JOIN Workflowitem ON (Workflowitem.object_type = 'Termination')
|
||||
LEFT JOIN Workflowvalue ON (Workflowvalue.item_id = Workflowitem.id)
|
||||
WHERE Workflowitem.name = 'customer_passive_finished'
|
||||
AND Workflowvalue.object_id = OrderProduct.termination_id
|
||||
AND Workflowvalue.value_int = 1
|
||||
AND (Patching.termination_id IS NULL OR Patching.patched = 0)
|
||||
GROUP BY Termination.id
|
||||
ORDER BY Termination.id ASC";
|
||||
|
||||
//mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
if(is_array($limit) && count($limit)) {
|
||||
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
|
||||
} elseif(is_numeric($count)) {
|
||||
$sql .= " LIMIT ".$limit['count'];
|
||||
}
|
||||
}
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Termination($data->termination_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
public static function search($filter = false) {
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("Patching", "*", "$where ORDER BY termination_id");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Patching($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private function getSqlFilter($filter = []) {
|
||||
$where = "1=1 ";
|
||||
if(!is_array($filter) || !count($filter)) {
|
||||
return $where;
|
||||
}
|
||||
|
||||
//var_dump($filter);exit;
|
||||
if(array_key_exists("termination_id", $filter)) {
|
||||
$termination_id = $filter['termination_id'];
|
||||
if(is_numeric($termination_id)) {
|
||||
$where .= " AND termination_id=$termination_id";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -72,6 +72,56 @@ class Termination extends mfBaseModel {
|
||||
return $code;
|
||||
}
|
||||
|
||||
public function getLineworkportPairs() {
|
||||
$ports = $this->getProperty("workflowitems")["ports"]->value->value_string;
|
||||
if(!$ports) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$return = [];
|
||||
$return["range"] = [];
|
||||
$return["pairs"] = [];
|
||||
|
||||
$ports = preg_replace('/[^0-9-]+/', "", $ports);
|
||||
if(strpos($ports, "-") !== false) {
|
||||
// port range
|
||||
$this->log->debug("is range");
|
||||
$port_parts = explode("-", $ports);
|
||||
if(is_array($port_parts) && count($port_parts) == 2) {
|
||||
$from = $port_parts[0];
|
||||
$to = $port_parts[1];
|
||||
|
||||
if($port_parts[0] > $port_parts[1]) {
|
||||
$from = $port_parts[1];
|
||||
$to = $port_parts[0];
|
||||
}
|
||||
|
||||
$range = [];
|
||||
$pairs = [];
|
||||
|
||||
$mod = $from % 2;
|
||||
|
||||
for($i = $from; $i <= $to; $i++) {
|
||||
$range[] = intval($i);
|
||||
if($i % 2 == $mod && $i + 1 <= $to) {
|
||||
$pairs[] = $i."-".($i+1);
|
||||
}
|
||||
}
|
||||
|
||||
$return["range"] = $range;
|
||||
$return["pairs"] = $pairs;
|
||||
}
|
||||
} else {
|
||||
// single port
|
||||
$this->log->debug("not a range");
|
||||
$return["range"] = $ports;
|
||||
}
|
||||
|
||||
//var_dump($return);exit;
|
||||
return $return;
|
||||
|
||||
}
|
||||
|
||||
public function resetProperties() {
|
||||
$this->building = null;
|
||||
$this->status = null;
|
||||
|
||||
Reference in New Issue
Block a user