/**
  * @param string the URL of the image file
  */
 public function setImageUrl($value)
 {
     parent::setImageUrl($value);
     if ($this->getActiveControl()->canUpdateClientSide()) {
         $this->getPage()->getCallbackClient()->setAttribute($this, 'src', $value);
     }
 }
示例#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);
             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);
     return $button;
 }
示例#3
0
 /**
  * Initializes the specified cell to its initial values.
  * This method overrides the parent implementation.
  * It creates a command button within the cell.
  * @param TTableCell the cell to be initialized.
  * @param integer the index to the Columns property that the cell resides in.
  * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem)
  */
 public function initializeCell($cell, $columnIndex, $itemType)
 {
     if ($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) {
         $buttonType = $this->getButtonType();
         if ($buttonType === TButtonColumnType::LinkButton) {
             $button = new TLinkButton();
         } else {
             if ($buttonType === TButtonColumnType::PushButton) {
                 $button = new TButton();
             } else {
                 $button = new TImageButton();
                 $button->setImageUrl($this->getImageUrl());
                 $button->setToolTip($this->getText());
             }
         }
         $button->setText($this->getText());
         $button->setCommandName($this->getCommandName());
         $button->setCausesValidation($this->getCausesValidation());
         $button->setValidationGroup($this->getValidationGroup());
         if ($this->getDataTextField() !== '' || $buttonType === TButtonColumnType::ImageButton && $this->getDataImageUrlField() !== '') {
             $button->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn'));
         }
         $cell->getControls()->add($button);
         $cell->registerObject('Button', $button);
     } else {
         parent::initializeCell($cell, $columnIndex, $itemType);
     }
 }
示例#4
0
 /**
  * Creates a navigation button.
  * It creates a {@link TButton}, {@link TLinkButton}, or {@link TImageButton},
  * depending on the given parameters.
  * @param TWizardNavigationButtonStyle button style
  * @param boolean whether the button should cause validation
  * @param string command name for the button's OnCommand event
  * @throws TInvalidDataValueException if the button type is not recognized
  */
 protected function createNavigationButton($buttonStyle, $causesValidation, $commandName)
 {
     switch ($buttonStyle->getButtonType()) {
         case TWizardNavigationButtonType::Button:
             $button = new TButton();
             break;
         case TWizardNavigationButtonType::Link:
             $button = new TLinkButton();
             break;
         case TWizardNavigationButtonType::Image:
             $button = new TImageButton();
             $button->setImageUrl($buttonStyle->getImageUrl());
             break;
         default:
             throw new TInvalidDataValueException('wizard_buttontype_unknown', $buttonStyle->getButtonType());
     }
     $button->setText($buttonStyle->getButtonText());
     $button->setCausesValidation($causesValidation);
     $button->setCommandName($commandName);
     return $button;
 }