Added Role view to Network
This commit is contained in:
@@ -3,6 +3,36 @@
|
||||
class Network extends mfBaseModel {
|
||||
private $owner;
|
||||
private $pops;
|
||||
private $addresstypes;
|
||||
private $roles;
|
||||
|
||||
public function loadAddresstypes() {
|
||||
if(!$this->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//$this->loadRoles();
|
||||
|
||||
$types = NetworkAddressModel::search(['network_id' => $this->id]);
|
||||
|
||||
foreach($types as $type) {
|
||||
$this->addresstypes[$type->address_id][] = $type;
|
||||
}
|
||||
|
||||
//var_dump($this->addresstypes);exit;
|
||||
}
|
||||
|
||||
public function loadRoles() {
|
||||
if(!$this->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$types = AddresstypeModel::search(['addresstype' => TT_NETWORK_ROLES]);
|
||||
var_dump($types);exit;
|
||||
foreach($types as $type) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
@@ -26,6 +56,15 @@ class Network extends mfBaseModel {
|
||||
}
|
||||
}
|
||||
|
||||
if($name == "addresstypes") {
|
||||
if($this->id) {
|
||||
$this->loadAddresstypes();
|
||||
return $this->addresstypes;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
|
||||
@@ -17,6 +17,10 @@ class NetworkController extends mfBaseController {
|
||||
protected function indexAction() {
|
||||
$this->layout()->set("owners", AddressModel::search(['addresstype' => ["netowner"]]));
|
||||
$this->layout()->set("networks", NetworkModel::getAll());
|
||||
|
||||
/*$net = new Network(1);
|
||||
$at = $net->addresstypes; //[1]->addresstype->address;
|
||||
var_dump($at);exit;*/
|
||||
}
|
||||
|
||||
protected function addAction() {
|
||||
|
||||
@@ -10,10 +10,7 @@ class NetworkModel {
|
||||
public $create = null;
|
||||
public $edit = null;
|
||||
|
||||
public static function find($data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new Network();
|
||||
|
||||
@@ -60,7 +57,7 @@ class NetworkModel {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("Network", "*". "$where ORDER BY name, owner_id");
|
||||
$res = $db->select("Network", "*", "$where ORDER BY name, owner_id");
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Network($data);
|
||||
@@ -78,7 +75,7 @@ class NetworkModel {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("Network", "*". "$where ORDER BY name, owner_id");
|
||||
$res = $db->select("Network", "*", "$where ORDER BY name, owner_id");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Network($data);
|
||||
|
||||
Reference in New Issue
Block a user