Ejemplo n.º 1
0
 protected function createPagerButton($buttonType, $enabled, $text, $commandName, $commandParameter)
 {
     if ($buttonType === TPagerButtonType::LinkButton) {
         if ($enabled) {
             $button = new TActiveLinkButton();
         } else {
             $button = new TLabel();
             $button->setText($text);
             $button->setCssClass($this->getButtonCssClass() . ' active');
             return $button;
         }
     }
     $button->setText($text);
     $button->setCommandName($commandName);
     $button->setCommandParameter($commandParameter);
     $button->setCausesValidation(false);
     $button->setCssClass($this->getButtonCssClass());
     $button->attachEventHandler('OnCallback', array($this, 'handleCallback'));
     $button->getAdapter()->getBaseActiveControl()->setClientSide($this->getClientSide());
     return $button;
 }
Ejemplo n.º 2
0
 /**
  * Creates a pager button.
  * Depending on the button type, a TLinkButton or a TButton may be created.
  * If it is enabled (clickable), its command name and parameter will also be set.
  * Derived classes may override this method to create additional types of buttons, such as TImageButton.
  * @param string button type, either LinkButton or PushButton
  * @param boolean whether the button should be enabled
  * @param string caption of the button.
  * @param string CommandName corresponding to the OnCommand event of the button.
  * @param string CommandParameter corresponding to the OnCommand event of the button
  * @return mixed the button instance
  */
 protected function createPagerButton($buttonType, $enabled, $text, $commandName, $commandParameter)
 {
     if ($buttonType === TPagerButtonType::LinkButton) {
         if ($enabled) {
             $button = new TLinkButton();
         } else {
             $button = new TLabel();
             $button->setText($text);
             $button->setCssClass($this->getButtonCssClass());
             return $button;
         }
     } else {
         if ($buttonType === TPagerButtonType::ImageButton) {
             $button = new TImageButton();
             $button->setImageUrl($this->getPageImageUrl($text, $commandName));
         } else {
             $button = new TButton();
         }
         if (!$enabled) {
             $button->setEnabled(false);
         }
     }
     $button->setText($text);
     $button->setCommandName($commandName);
     $button->setCommandParameter($commandParameter);
     $button->setCausesValidation(false);
     $button->setCssClass($this->getButtonCssClass());
     return $button;
 }
Ejemplo n.º 3
0
 private function processChildren($writer)
 {
     if ($this->getNodeType() == PFTreeList::NODE_TYPE_INTERNAL_LINK) {
         $title = new InternalHyperLink();
         $title->setToPage($this->getToPage());
         $title->setGetVariables($this->getGetVariables());
         $title->setAnchor($this->getAnchor());
         $title->Attributes->OnClick = "toggleSub('" . $this->getID() . "')";
     } elseif ($this->getNodeType() == PFTreeList::NODE_TYPE_INTERNAL_ACTIVE_LINK) {
         $title = new InternalHyperLink();
         $title->setToPage($this->getToPage());
         $title->setGetVariables($this->getGetVariables());
         $title->setAnchor($this->getAnchor());
         $title->Attributes->OnClick = "toggleSub('" . $this->getID() . "')";
     } elseif ($this->getNodeType() == PFTreeList::NODE_TYPE_LINK) {
         $title = new THyperLink();
         $title->setNavigateUrl($this->getToPage());
         $title->Attributes->OnClick = "toggleSub('" . $this->getID() . "')";
     } else {
         $title = new TLabel();
     }
     $title->setCssClass($this->getTitleClass());
     $title->setText($this->getTitle());
     $i = 0;
     foreach ($this->subTree as $c) {
         if (!$c instanceof TWebControl) {
             continue;
         }
         $i++;
         break;
     }
     if ($i == 0) {
         $class = "leaf";
         $fct = "";
     } else {
         $class = $this->getDeploy() ? "node" : "nodeDeployed";
         $fct = $this->getCanDeploy() ? "onClick='toggleSub(\"" . $this->getID() . "\")'" : "";
     }
     $writer->write("<li class='{$class}' {$fct} id='" . $this->getID() . PFTreeList::SUB_ID_LI . "'>");
     $title->render($writer);
     $writer->write("</li>");
     $cssclass = $this->getCssClass() ? " class='" . $this->getCssClass() . "'" : "";
     $style = $this->getDeploy() ? "block" : "none";
     if ($i > 0) {
         $writer->write("<li style='list-style: none outside; padding-left:0px; margin-left:0px; min-height: 0px;' id='" . $this->getID() . PFTreeList::SUB_ID_UL . "'><ul {$cssclass} style='display: {$style}'>\n");
     }
     $order = 0;
     foreach ($this->subTree as $c) {
         if (!$c instanceof TWebControl) {
             continue;
         }
         if ($c instanceof PFTreeList) {
             $c->Parent = $this;
             $c->setOrder($order++);
             $c->setCssClass($this->getCssClass());
             $c->render($writer);
         } else {
             $cssclass = $this->getCssClass() ? " class='" . $this->getCssClass() . "'" : "";
             $writer->write("<ul {$cssclass}><li class='leaf'>");
             $c->getPage()->addParsedObject($c);
             $c->render($writer);
             $writer->write("</li></ul>\n");
         }
     }
     if ($i > 0) {
         $writer->write("</ul></li>\n");
     }
 }