Location: PHPKode > projects > Monyet > controllers/networkmapnet.php
<?php

//controller for netmapnet :) . get confused? me too..
//
//in network map there is agent-pingmonitoring-netdefinition
//this class is built for net definition management

Class NetworkMapNet extends Management {

	private $netmap;

	public function __construct(){
		parent::__construct();
		$this->netmap = new NetMapNet();
	}

	//redirect show to the networkmap.php
	public function show(){
		$this->xml->addRedir('managenetworkmap/index');
		$this->xml->flush();
	}

	public function remove(){
		parent::remove();
	}

	public function removeItem(){
		$this->netmap->remove($_POST['id']);
	}

	public function populateShowContent(){
	}

	public function populateAddForm(){
	  	$this->xml->addTextField('Net Name',null,'name','text');
	  	$this->xml->addTextField('Axis',null,'axis','text');
		$this->xml->addTextField('Ordinat',null,'ordinat','text');
	}
	public function populateEditForm(){
		$this->netmap->selectByID($_POST['id']);	  
	  	$this->xml->addTextField('Net Name',$this->netmap->getName(),'name','text');
		$this->xml->addTextField('Axis',$this->netmap->getX(),'axis','text');
		$this->xml->addTextField('Ordinat',$this->netmap->getY(),'ordinat','text');
	}
	public function setEditCaption(){
		$this->xml->addText('Edit Net No. '.$_POST['itemnumber'],'headbox',1);
	}


	//return string to set the title
	public function getTitle(){
		return SITENAME.' -netmap-net';
	}

	public function getFormPlace(){
		return 'panel';
	}

	public function editItem(){
	  	$array = array('name'=>$_POST['name'],'x'=>$_POST['axis'],'y'=>$_POST['ordinat']);	  
		return $this->netmap->update($array,$_POST['id']);	  
	}

	public function getKeyVar(){
		return 'axis';
	}

	public function getTotal(){
		return $this->netmap->getTotal();
	}

	public function addItem(){
		$array = array('',$_POST['axis'],$_POST['ordinat'],$_POST['name']);
		$this->netmap->add($array);
	}

	//not implemented
	public function checkAdd(){
	}
	public function checkEdit(){
	}
}
?>
Return current item: Monyet