Location: PHPKode > projects > Astmail - Asterisk web voicemail > notify.class.php
<?php
/*

 Copyright (c) 2005-2006 Colorado State Univeristy
 All rights reserved.

Please contact Kyle Haefner hide@address.com
for changes, bug notices or feature requests

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/
class notify
{
var $message;
var $fontface;
var $fontcolor;
var $backcolor;
var $msgBlock;
var $divBlock;
var $buttonBlock;
var $divBlock="";
var $buttonName;
var $buttons = array();


//constructor 
function notify ($message, $type)
{
$this->message = $message;
if ($type =="OK")
{
	$this->buttonName =$type;
	$tmp = array($this->buttonName=>"<button OnClick=OK()>".$this->buttonName."</button>");
	$this->buttons = $this->associative_push($this->buttons,$tmp);
}
$this->divBlock =" background: white;";
$this->msgBlock = $message;
$this->buttonBlock = $this->buttons[$this->buttonName];


}

function display()
{
return "<div style='margin: 20px; height:180px;".$this->divBlock."'><center>"
.$this->msgBlock."<br>".$this->buttonBlock."</center></div>";
}

function setBackColor($color)
{
$this->backcolor = $color;
$this->divBlock = "background:".$this->backcolor.";";
}

function setFontSize($size)
{
$this->backcolor = $color;
$this->divBlock .= "font-size:".$size."pt;";
}

function setFontColor($color)
{
$this->fontcolor = $color;
$this->divBlock .= "color:".$this->fontcolor.";";
}

function addCustomButton($button, $command)
{
	$this->buttonBlock ="";
	$this->buttonName = $button;
	$tmp = array("$button"=>"<button $command>$button</button>&nbsp;&nbsp;");
	$this->buttons = $this->associative_push($this->buttons,$tmp);
	//$this->buttonBlock = $this->buttons[$this->buttonName];
	foreach ($this->buttons as $key => $value) 
	{
		if($value != "")
		$this->buttonBlock = $this->buttonBlock.$value;
   }
}

// append associative array elements
function associative_push($arr, $tmp) {
  if (is_array($tmp)) {
   foreach ($tmp as $key => $value) {
     $arr[$key] = $value;
   }
   return $arr;
  }
  return false;
}

}


?>
Return current item: Astmail - Asterisk web voicemail