Exemple #1
0
 /**
  * Конструктор
  * @param  string ID компонента
  * @param  EventReceiver Объект с методом  обработки  события
  * @param  string Имя  мтода-обработчика
  */
 public function __construct($id, EventReceiver $receiver = null, $handler = null)
 {
     parent::__construct($id);
     if (is_object($receiver) && strlen($handler) > 0) {
         $this->setClickHandler($receiver, $handler);
     }
 }
Exemple #2
0
 /**
  * @see  HtmlComponent
  */
 public function RenderImpl()
 {
     parent::RenderImpl();
     if ($this->bookmarkable === true) {
         $_BASEURL = WebApplication::$app->getResponse()->getHostUrl();
         if ($this->encode == true) {
             $url = serialize(array($this->pagename, $this->params));
             if (strlen($url) % 3 == 1) {
                 $url .= '  ';
             }
             if (strlen($url) % 3 == 2) {
                 $url .= ' ';
             }
             $url = $_BASEURL . "/?r=" . base64_encode(serialize(array($this->pagename, $this->params)));
         } else {
             $this->pagename = str_replace("\\", "/", ltrim($this->pagename, "\\"));
             $url = $_BASEURL . "/?p=" . $this->pagename;
             if (count($this->params) > 0) {
                 $_param = implode("/", $this->params);
                 $url .= "&arg=" . $_param;
             }
         }
     } else {
         $url = $this->owner->getURLNode() . "::" . $this->id;
         //для   вызова  обработчика
     }
     $this->setAttribute("href", "{$url}");
 }
Exemple #3
0
 /**
  * @see  HtmlComponent
  */
 public function RenderImpl()
 {
     parent::RenderImpl();
     $link = $this->getLink();
     if (strlen($link) > 0) {
         if (strpos($link, '://') === false) {
             // $link = "http://".$_SERVER["HTTP_HOST"]."/". $link;
             if ($link[0] != '/') {
                 $link = '/' . $link;
             }
         }
         $this->setAttribute("href", $link);
     }
 }
Exemple #4
0
 /**
  * @see HtmlComponent
  */
 public function RenderImpl()
 {
     parent::RenderImpl();
     if ($this->getFormOwner() == null) {
         throw new \Zippy\Exception("Element '" . $this->id . "' outside   FORM tag");
     }
     $formid = $this->getFormOwner()->id;
     if ($this->disabled == true) {
         $this->setAttribute("href", "");
         $this->setAttribute("onclick", "");
         return;
     }
     $url = $this->owner->getURLNode() . '::' . $this->id;
     $url = substr($url, 2 + strpos($url, 'q='));
     $this->setAttribute("onclick", "javascript:{if(beforeZippy('{$this->id}') ==false) return false; \$('#" . $formid . "_q').attr('value','" . $url . "'); \$('#" . $formid . "').submit();event.returnValue=false; return false;}");
     //    $this->setAttribute("onclick","javascript:{ var q = $('#".$formid."_q').attr('value');$('#".$formid."_q').attr('value',q+'::".$this->id."');$('#".$formid."').submit();return  false;}");
 }
Exemple #5
0
 /**
  * @see HtmlComponent
  */
 public function RenderImpl()
 {
     parent::RenderImpl();
     if ($this->event == null) {
         $this->setAttribute("href", "");
         $this->setAttribute("onclick", "");
         return;
     }
     if ($this->disabled == true) {
         $this->setAttribute("href", "");
         $this->setAttribute("onclick", "");
         return;
     }
     $this->setAttribute("href", "javascript:void(0);");
     if ($this->event->isajax == false) {
         $url = $this->owner->getURLNode() . "::" . $this->id;
         $this->setAttribute("onclick", "if(beforeZippy('{$this->id}') ==false) return false;window.location='{$url}';event.returnValue=false; return false;");
     } else {
         $url = $this->owner->getURLNode() . "::" . $this->id . "&ajax=true";
         $this->setAttribute("onclick", "if(beforeZippy('{$this->id}') ==false) return false;getUpdate('{$url}');event.returnValue=false; return false;");
     }
 }
Exemple #6
0
 /**
  * Конструктор
  * @param  string ID компонента
  * @param  string Адрес  ссылки
  */
 public function __construct($id, $link = "")
 {
     AbstractLink::__construct($id);
     $this->link = $link;
 }
Exemple #7
0
 /**
  * Конструктор
  * @param string ID компонента
  * @param string Имя страницы для   редиректа
  * @param array  Список  параметров  для  страницы
  * @param boolean Если  true  - рендерит  bookmarkable  ссылку
  * @param boolean Если  true  - кодирует ссылку
  */
 public function __construct($id, $pagename = "", $params = array(), $bookmarkable = true, $encode = false)
 {
     AbstractLink::__construct($id);
     $this->setLink($pagename, $params, $bookmarkable, $encode);
 }