Classes

File content/share/ContentSharingActionsMenuLink.class.php

File content/share/ContentSharingActionsMenuLink.class.php

 1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 
<?php
/**
 * @package     Content
 * @subpackage  Share
 * @copyright   &copy; 2005-2019 PHPBoost
 * @license     https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL-3.0
 * @author      Kevin MASSY <reidlos@phpboost.com>
 * @version     PHPBoost 5.2 - last update: 2018 04 14
 * @since       PHPBoost 5.1 - 2018 01 30
 * @contributor Julien BRISWALTER <j1.seth@phpboost.com>
 * @contributor Arnaud GENET <elenwii@phpboost.com>
*/

class ContentSharingActionsMenuLink
{
    private $id;
    private $name;
    private $url;
    private $image_render_html;
    private $tpl;
    private $onclick_tag;
    private $kernel_element;

    public function __construct($id, $name, Url $url, $image_render_html, Template $tpl = null, $onclick_tag = 'javascript:window.open(this.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=500,width=700\');return false;', $kernel_element = false)
    {
        $this->id = $id;
        $this->name = $name;
        $this->url = $url;
        $this->image_render_html = $image_render_html;
        $this->onclick_tag = $onclick_tag;
        $this->kernel_element = $kernel_element;

        if ($tpl instanceof Template)
        {
            $this->tpl = $tpl;
        }
        else
        {
            $this->tpl = new FileTemplate('framework/content/share/ContentSharingActionsMenuLink.tpl');
        }
    }

    public function get_id()
    {
        return $this->id;
    }

    public function get_name()
    {
        return $this->name;
    }

    public function get_url()
    {
        return $this->url;
    }

    public function get_image_render_html()
    {
        return $this->image_render_html;
    }

    public function get_onclick_tag()
    {
        return $this->onclick_tag;
    }

    public function export()
    {
        $this->tpl->put_all(array(
            'C_ONCLICK_TAG'     => !empty($this->onclick_tag),
            'ID'                => $this->id,
            'U_LINK'            => $this->get_url()->rel(),
            'NAME'              => (!$this->kernel_element ? LangLoader::get_message('share_on', 'user-common') . ' ' : '') . $this->name,
            'IMG_RENDER_HTML'   => $this->image_render_html,
            'ONCLICK_TAG'       => $this->onclick_tag,
        ));

        return $this->tpl;
    }
}
?>