/** * Sets the location of image file of the THyperLink. * @param string the image file location */ public function setImageUrl($value) { parent::setImageUrl($value); if ($this->getActiveControl()->canUpdateClientSide() && $value !== '') { $textWriter = new TTextWriter(); $renderer = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), $textWriter); $this->createImage($value)->renderControl($renderer); $this->getPage()->getCallbackClient()->update($this, $textWriter->flush()); } }
/** * Initializes the specified cell to its initial values. * This method overrides the parent implementation. * It creates a hyperlink 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) { $link = new THyperLink(); if (($url = $this->getImageUrl()) !== '') { $link->setImageUrl($url); if (($width = $this->getImageWidth()) !== '') { $link->setImageWidth($width); } if (($height = $this->getImageHeight()) !== '') { $link->setImageHeight($height); } } $link->setText($this->getText()); $link->setNavigateUrl($this->getNavigateUrl()); $link->setTarget($this->getTarget()); if ($this->getDataTextField() !== '' || $this->getDataNavigateUrlField() !== '') { $link->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); } $cell->getControls()->add($link); $cell->registerObject('HyperLink', $link); } else { parent::initializeCell($cell, $columnIndex, $itemType); } }