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

Class ManageSNMPDef extends Management {
	private $snmpdef;

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

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

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

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

	public function populateShowContent(){
		$array_column = array("Name","OID","SNMP Version","Is Delta");	  
		$this->xml->addTable($this->snmpdef->select($this->offset,$this->pglimit),
				  $array_column,'Table SNMP Monitoring',$this->navigator->getAccess($this),$this->offset,'rightcontent',0);
	}

	public function populateAddForm(){
		$this->xml->addTextField('Name',null,'name','text');
		$this->xml->addTextField('OID',null,'oid','text');
		$this->xml->addSelect('Version',array('1'=>'1','2c'=>'2c','3'=>'3'),'','version');
		$this->xml->addSelect('Is Delta',array('yes'=>'yes','no'=>'no'),'','isdelta');
	}
	public function populateEditForm(){
		$this->snmpdef->selectByID($_POST['id']);	  
		$this->xml->addTextField('Name',$this->snmpdef->getName(),'name','text');
		$this->xml->addTextField('OID',$this->snmpdef->getOID(),'oid','text');
		$this->xml->addSelect('Version',array('1'=>'1','2c'=>'2c','3'=>'3'),$this->snmpdef->getVersion(),'version');
		$this->xml->addSelect('Is Delta',array('yes'=>'yes','no'=>'no'),$this->snmpdef->getIsDelta(),'isdelta');
	}

	public function setEditCaption(){
		$this->xml->addText('Edit SNMP Definition no. '.$_POST['itemnumber'],'headbox',1);
	}

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

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

	public function editItem(){
		$array = array('name'=>$_POST['name'],'version'=>$_POST['version'],'oid'=>$_POST['oid'],'isdelta'=>$_POST['isdelta']);	  
		return $this->snmpdef->update($array,$_POST['id']);	  
	}

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

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

	public function addItem(){
	  	$array = array('',$_POST['oid'],$_POST['version'],$_POST['isdelta'],$_POST['name']);
		$this->snmpdef->add($array);
	}

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