1<?php
2if(!defined('OSTSTAFFINC') || !$faq || !$thisstaff) die('Access Denied');
3
4$category=$faq->getCategory();
5
6?><div class="has_bottom_border" style="padding-top:5px;">
7<div class="pull-left"><h2><?php echo __('Frequently Asked Questions');?></h2></div>
8<div class="pull-right flush-right">
9<?php
10$query = array();
11parse_str($_SERVER['QUERY_STRING'], $query);
12$query['a'] = 'print';
13$query['id'] = $faq->getId();
14$query = http_build_query($query); ?>
15    <a href="faq.php?<?php echo $query; ?>" class="no-pjax action-button">
16    <i class="icon-print"></i>
17        <?php echo __('Print'); ?>
18    </a>
19<?php
20if ($thisstaff->hasPerm(FAQ::PERM_MANAGE)) { ?>
21    <a href="faq.php?id=<?php echo $faq->getId(); ?>&a=edit" class="action-button">
22    <i class="icon-edit"></i>
23        <?php echo __('Edit FAQ'); ?>
24    </a>
25<?php } ?>
26</div><div class="clear"></div>
27
28</div>
29
30<div id="breadcrumbs">
31    <a href="kb.php"><?php echo __('All Categories');?></a>
32    &raquo; <a href="kb.php?cid=<?php echo $category->getId(); ?>"><?php
33    echo $category->getFullName(); ?></a>
34    <span class="faded">(<?php echo $category->isPublic()?__('Public'):__('Internal'); ?>)</span>
35</div>
36
37<div class="pull-right sidebar faq-meta">
38<?php if ($attachments = $faq->getLocalAttachments()->all()) { ?>
39<section>
40    <header><?php echo __('Attachments');?>:</header>
41<?php foreach ($attachments as $att) { ?>
42<div>
43    <i class="icon-paperclip pull-left"></i>
44    <a target="_blank" href="<?php echo $att->file->getDownloadUrl(['id' =>
45    $att->getId()]); ?>"
46        class="attachment no-pjax">
47        <?php echo Format::htmlchars($att->getFilename()); ?>
48    </a>
49</div>
50<?php } ?>
51</section>
52<?php } ?>
53
54<?php if ($faq->getHelpTopics()->count()) { ?>
55<section>
56    <header><?php echo __('Help Topics'); ?></header>
57<?php foreach ($faq->getHelpTopics() as $T) { ?>
58    <div><?php echo $T->topic->getFullName(); ?></div>
59<?php } ?>
60</section>
61<?php } ?>
62
63<?php
64$displayLang = $faq->getDisplayLang();
65$otherLangs = array();
66if ($cfg->getPrimaryLanguage() != $displayLang)
67    $otherLangs[] = $cfg->getPrimaryLanguage();
68foreach ($faq->getAllTranslations() as $T) {
69    if ($T->lang != $displayLang)
70        $otherLangs[] = $T->lang;
71}
72if ($otherLangs) { ?>
73<section>
74    <div><strong><?php echo __('Other Languages'); ?></strong></div>
75<?php
76    foreach ($otherLangs as $lang) { ?>
77    <div><a href="faq.php?kblang=<?php echo $lang; ?>&id=<?php echo $faq->getId(); ?>">
78        <?php echo Internationalization::getLanguageDescription($lang); ?>
79    </a></div>
80    <?php } ?>
81</section>
82<?php } ?>
83
84<section>
85<div>
86    <strong><?php echo $faq->isPublished()?__('Published'):__('Internal'); ?></strong>
87</div>
88<a data-dialog="ajax.php/kb/faq/<?php echo $faq->getId(); ?>/access" href="#"><?php echo __('Manage Access'); ?></a>
89</section>
90
91</div>
92
93<div class="faq-content">
94
95
96<div class="faq-title flush-left"><?php echo $faq->getLocalQuestion() ?>
97</div>
98
99<div class="faded"><?php echo __('Last Updated');?>
100    <?php echo Format::relativeTime(Misc::db2gmtime($faq->getUpdateDate())); ?>
101</div>
102<br/>
103<div class="thread-body bleed">
104<?php echo $faq->getLocalAnswerWithImages(); ?>
105</div>
106
107</div>
108<div class="clear"></div>
109<hr>
110
111<?php
112if ($thisstaff->hasPerm(FAQ::PERM_MANAGE)) { ?>
113<form action="faq.php?id=<?php echo  $faq->getId(); ?>" method="post">
114    <?php csrf_token(); ?>
115    <input type="hidden" name="do" value="manage-faq">
116    <input type="hidden" name="id" value="<?php echo  $faq->getId(); ?>">
117    <button name="a" class="red button" value="delete"><?php echo __('Delete FAQ'); ?></button>
118</form>
119<?php }
120?>
121