48 lines
1.3 KiB
PHP
48 lines
1.3 KiB
PHP
<?php
|
|
|
|
class AdminController 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() {
|
|
$this->layout()->setTemplate("Admin/Index");
|
|
|
|
}
|
|
|
|
|
|
protected function createNetworkAddressForNetowner() {
|
|
$i = 0;
|
|
foreach(NetworkModel::getAll() as $network) {
|
|
$netaddress = NetworkAddressModel::getFirst(["network_id" => $network->id, "address_id" => $network->owner_id, "addresstype" => "netowner"]);
|
|
if(!$netaddress) {
|
|
$netaddress = NetworkAddressModel::create([
|
|
'network_id' => $network->id,
|
|
'address_id' => $network->owner_id,
|
|
'type' => "netowner"
|
|
]);
|
|
$netaddress->save();
|
|
$i++;
|
|
}
|
|
}
|
|
$this->layout()->setFlash("$i NetworkAddress Objekte angelegt.", "success");
|
|
$this->redirect("Admin");
|
|
}
|
|
|
|
protected function ivtImportMatchProductsAction() {
|
|
$this->layout()->setTemplate("Admin/ivtimport_product_match");
|
|
|
|
$ivtproducts = IvtProductModel::getAll();
|
|
$this->layout()->set("ivtproducts", $ivtproducts);
|
|
}
|
|
|
|
} |