<?php
  $raw_post = $this->unescape($this->post);
  //we need to remap the url as it is hard coded for admin portal
  $this->post = str_replace(array("../uploads/knowledgebase/", "&lt;br&gt;"), array("uploads/knowledgebase/", "<br>"), $raw_post);
?>
<div class="content-area dashboard-wraper">
    <div class="container">
        <div class="knowledge-base-article-page">
            <div class="row no-gutters">
                <div class="col-lg-12">
                    <div class="knowledge-base-content-block">
                        <div class="system-requirements-block">
                            <h1>
                                <?php echo $this->title; ?>
                            </h1>
                            <div class="system-requirements-top">
                                <ul class="date-comment">
                                    <li>
                                        <i class="fas fa-clock"></i>
                                        <?php echo $this->user->lang("%s by %s",$this->date, $this->postedBy ); ?>
                                    </li>
                                </ul>
                                <div id="article-content">
                                    <?php echo $this->unescape($this->post); ?>
                                </div>
                                <div>
                                    <i class="fab fa-twitter"></i>
                                    <span>
                                        &nbsp;
                                        <a href="#" target="_blank" class="tweet" title="<?php echo $this->title . ' ' . $this->escape(CE_Lib::getSoftwareURL()) . '/index.php?fuse=home&controller=announcements&view=announcement&ann_id=' . $this->currentId ; ?>">
                                            <?php echo $this->user->lang('Tweet'); ?>
                                        </a>
                                    </span>
                                </div>
                            </div>
                        </div>
                        <div class="knowledge-next-prev d-flex justify-content-between align-items-center">
                            <?php if ($this->previousId == null)  { ?>
                            <a class="knowledge-next-prev-links prev hidden"></a>
                            <?php } else { ?>
                            <a href="<?php echo $this->prevlink; ?>" class="knowledge-next-prev-links announcement-link prev">
                                <i class="fas fa-chevron-left"></i>
                                <div>
                                    <span>
                                        <?php echo $this->user->lang('Previous'); ?>
                                    </span>
                                </div>
                            </a>
                            <?php } ?>
                            <?php if ($this->nextId != null) { ?>
                            <a href="<?php echo $this->nextlink; ?>" class="knowledge-next-prev-links announcement-link next">
                                <div>
                                    <span>
                                        <?php echo $this->user->lang('Next'); ?>
                                    </span>
                                </div>
                                <i class="fas fa-chevron-right"></i>
                            </a>
                            <?php } ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
$('a.tweet').click(function(e) {
    e.preventDefault();
    var loc = escape(window.location.origin + window.location.pathname);
    var title = escape($(this).attr('title'));
    window.open('https://twitter.com/share?url=' + loc + '&text=' + title + '&', 'twitterwindow', 'height=450, width=550, top=' + ($(window).height() / 2 - 225) + ', left=' + $(window).width() / 2 + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');
});
</script>