IMP_Contents::linkViewJS PHP Method

linkViewJS() public method

Generate a javascript link to the download/view page.
public linkViewJS ( Horde_Mime_Part $mime_part, string $actionID, string $text, array $options = [] ) : string
$mime_part Horde_Mime_Part The MIME part to view.
$actionID string The actionID to perform.
$text string The ESCAPED (!) link text.
$options array Additional options: - css: (string) The CSS class to use. - jstext: (string) The javascript link text. - onload: (string) A JS function to run when popup window is fully loaded. - params: (array) A list of any additional parameters that need to be passed to download/view page. (key = name) - widget: (boolean) If true use Horde::widget() to generate, Horde::link() otherwise.
return string A HTML href link to the download/view page.
    public function linkViewJS($mime_part, $actionID, $text, $options = array())
    {
        if (empty($options['params'])) {
            $options['params'] = array();
        }
        if (empty($options['jstext'])) {
            $options['jstext'] = ($description = $mime_part->getDescription(true)) ? sprintf(_("View %s"), $description) : null;
        }
        $url = Horde::popupJs(Horde::url('view.php'), array('menu' => true, 'onload' => empty($options['onload']) ? 'IMP_JS.resizePopup' : $options['onload'], 'params' => $this->_urlViewParams($mime_part, $actionID, isset($options['params']) ? $options['params'] : array()), 'urlencode' => true));
        return empty($options['widget']) ? Horde::link('#', $options['jstext'], empty($options['css']) ? null : $options['css'], null, $url) . $text . '</a>' : Horde::widget(array('url' => '#', 'class' => empty($options['css']) ? null : $options['css'], 'onclick' => $url, 'title' => $text));
    }