Location: PHPKode > projects > Monyet > classes/automate.php

//this class will be notified if corresponding agent is deleted
//if ping is priorited. the priority sets to null

Final Class Automate Extends EntityBase implements Observer {

	private $id;
	private $agent;
	private $caller;
	private $script;
	public function __construct(){

		//PHYSIC TABLE DEFINITION for Ping Monitoring
		$tablename = 'automate';
		$field_agent = 'agent';
		$field_id = 'at_id';
		$field_caller = 'caller';
		$field_script = 'script';

		$rawfields = array('agent'=>$field_agent,'caller'=>$field_caller,'script'=>$field_script);
		$agent = new Agent();
		$attributes = array($agent->getAbsField('description'),$field_caller,$field_script);
		$condition = $agent->getAbsField('id').'='.$tablename.'.'.$field_agent;

	//this is only wrapper to provide single object
	//just copy paste for all children
	public function selectByID($id){
			//special for ping monitoring to simplify query table
			$tempstring = explode('_',$id);
			$id =  $tempstring[1];
		$tempobj = parent::selectByID($id);
			foreach($this->rawfields as $key => $value){
				$this->$key = $tempobj->$value;
	//join table with agent
	//FIXME: still coupled with table field name
	public function selectCouple($attr1,$attr2){
		$sql = 'SELECT agents.'.$attr1.' as '.$attr1.',agents.'.$attr2.' as '.$attr2.' FROM '.$this->getTableQuery().' WHERE '.$this->condition;
		$temp = $this->dba->query($sql);
		$array = array();
		return $array;
	public function getAgentID(){
		return $this->agent;
	public function getCaller(){
		return $this->caller;
	public function getScript(){
		return $this->script;
	//special case notify remove for ping monitoring
	public function notifyRemove($obj,$id){
		if($obj instanceOf Agent){
	public function __destruct(){

Return current item: Monyet