00001 <?php
00002
00011 class TKPopupAction extends TKAction {
00012 protected $popup;
00013 protected $action;
00014
00015 const SHOW = 0;
00016 const HIDE = 1;
00017 const TOGGLE = 2;
00018
00028 public function __construct($popup, $action = self::SHOW) {
00029 parent::__construct();
00030
00031 if(!$popup instanceof TKPopup) {
00032 $this->setError('Popup must be instance of TKPopup');
00033 $this->popup = null;
00034 }
00035 else
00036 $this->popup = $popup;
00037
00038 $this->action = $action;
00039 }
00040
00048 public function getInvocation() {
00049 if($this->popup == null)
00050 return "";
00051
00052 $popupId = $this->popup->getId();
00053
00054 switch($this->action) {
00055 case self::SHOW:
00056 $js = "Toolkit.showPopup('${popupId}_outer')";
00057 break;
00058 case self::HIDE:
00059 $js = "Toolkit.hidePopup('${popupId}_outer')";
00060 break;
00061 case self::TOGGLE:
00062 $js = "Toolkit.togglePopup('${popupId}_outer')";
00063 break;
00064 }
00065
00066 return $js;
00067 }
00068 }
00069
00070 ?>