Classes

File content/comments/CommentsTopic.class.php

File content/comments/CommentsTopic.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:  84:  85:  86:  87:  88:  89:  90:  91:  92:  93:  94:  95:  96:  97:  98:  99: 100: 101: 102: 103: 
<?php
/**
 * This class represents the comments topic
 * <div class="message-helper notice">Do not use this class, but one of its children like for your module</div>
 * @package     Content
 * @subpackage  Comments
 * @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: 2015 08 16
 * @since       PHPBoost 3.0 - 2011 03 31
 * @contributor Julien BRISWALTER <j1.seth@phpboost.com>
*/

class CommentsTopic
{
    protected $module_id;
    protected $topic_identifier = '';
    protected $id_in_module;
    protected $url;

    const DEFAULT_TOPIC_IDENTIFIER = 'default';

    public function __construct($module_id, $topic_identifier = self::DEFAULT_TOPIC_IDENTIFIER)
    {
        $this->module_id = $module_id;
        $this->topic_identifier = $topic_identifier;
    }

    /**
     * @return class CommentsAuthorizations
     */
    public function get_authorizations()
    {
        return new CommentsAuthorizations();
    }

    /**
     * @return boolean display
     */
    public function is_display()
    {
        return false;
    }

    /**
     * @return int number comments display default
     */
    public function get_number_comments_display()
    {
        return CommentsConfig::load()->get_number_comments_display();
    }

    /**
     * @return class CommentsTopicEvents
     */
    public function get_events()
    {
        return new CommentsTopicEvents($this);
    }

    public function display()
    {
        return CommentsService::display($this);
    }

    public function get_topic_identifier()
    {
        return $this->topic_identifier;
    }

    public function get_module_id()
    {
        return $this->module_id;
    }

    public function set_id_in_module($id_in_module)
    {
        $this->id_in_module = $id_in_module;
    }

    public function get_id_in_module()
    {
        return $this->id_in_module;
    }

    public function set_url(Url $url)
    {
        $this->url = $url;
    }

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

    public function get_path()
    {
        return $this->url->relative();
    }
}
?>