51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
|
|
class ContractconfigController 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"])) {
|
|
$this->redirect("Dashboard");
|
|
}
|
|
}
|
|
|
|
protected function indexAction() {
|
|
|
|
}
|
|
|
|
protected function viewAction() {
|
|
|
|
}
|
|
|
|
protected function editAction() {
|
|
$this->layout()->setTemplate("Contractconfig/Form");
|
|
|
|
$contract_id = $this->request->contract_id;
|
|
if(!$contract_id) {
|
|
$this->layout()->setFlash("Contract ID nicht gefunden.","danger");
|
|
$this->redirect("Contract");
|
|
}
|
|
|
|
$contract = new Contract($contract_id);
|
|
if(!$contract_id) {
|
|
$this->layout()->setFlash("Contract ID nicht gefunden.","danger");
|
|
$this->redirect("Contract");
|
|
}
|
|
|
|
if(!is_array($contract->configgroups) || !count($contract->configgroups)) {
|
|
$this->layout()->setFlash("Produkt hat keine Vertragsconfiggruppen hinterlegt.","info");
|
|
$this->redirect("Contract", "View", ["id" => $contract_id]);
|
|
}
|
|
|
|
$this->layout()->set("contract", $contract);
|
|
$this->layout()->set("groups", $contract->configgroups);
|
|
|
|
}
|
|
|
|
|
|
} |