1{title help="FAQs" admpage="faqs"}{tr}FAQs{/tr}{/title}
2
3{tabset name='tabs_list_faqs'}
4	{tab name="{tr}Available FAQs{/tr}"}
5		<h2>{tr}Available FAQs{/tr}</h2>
6
7		{if $channels or ($find ne '')}
8			{include file='find.tpl'}
9		{/if}
10
11		<div class="{if $js}table-responsive{/if}"> {*the table-responsive class cuts off dropdown menus *}
12			<table class="table table-striped table-hover">
13				<tr>
14					<th>
15						<a href="tiki-list_faqs.php?offset={$offset}&amp;sort_mode={if $sort_mode eq 'title_desc'}title_asc{else}title_desc{/if}">{tr}Title{/tr}</a>
16					</th>
17					<th style="text-align:right;">
18						<a href="tiki-list_faqs.php?offset={$offset}&amp;sort_mode={if $sort_mode eq 'hits_desc'}hits_asc{else}hits_desc{/if}">{tr}Visits{/tr}</a>
19					</th>
20					<th style="text-align:right;">
21						<a href="tiki-list_faqs.php?offset={$offset}&amp;sort_mode={if $sort_mode eq 'questions_desc'}questions_asc{else}questions_desc{/if}">{tr}Questions / Suggested{/tr}</a>
22					</th>
23					{if $tiki_p_admin_faqs eq 'y'}
24						<th></th>
25					{/if}
26				</tr>
27
28				{section name=user loop=$channels}
29					<tr>
30						<td class="text">
31							<a class="tablename" href="tiki-view_faq.php?faqId={$channels[user].faqId}">{$channels[user].title|escape}</a>
32							<div class="subcomment">
33								{$channels[user].description|escape|nl2br}
34							</div>
35						</td>
36						<td class="integer">
37							<span class="badge badge-secondary">{$channels[user].hits}</span>
38						</td>
39						<td class="integer">
40							<span class="badge badge-secondary">{$channels[user].questions}</span> / <span class="badge badge-secondary">{$channels[user].suggested}</span>
41						</td>
42						{if $tiki_p_admin_faqs eq 'y'}
43							<td class="action">
44								{actions}
45									{strip}
46										<action>
47											<a href="tiki-list_faqs.php?offset={$offset}&amp;sort_mode={$sort_mode}&amp;faqId={$channels[user].faqId}">
48												{icon name='edit' _menu_text='y' _menu_icon='y' alt="{tr}Edit{/tr}"}
49											</a>
50										</action>
51										<action>
52											<a href="tiki-faq_questions.php?faqId={$channels[user].faqId}">
53												{icon name='help' _menu_text='y' _menu_icon='y' alt="{tr}Questions{/tr}"}
54											</a>
55										</action>
56										<action>
57											<a href="tiki-list_faqs.php?offset={$offset}&amp;sort_mode={$sort_mode}&amp;remove={$channels[user].faqId}">
58												{icon name='remove' _menu_text='y' _menu_icon='y' alt="{tr}Remove{/tr}"}
59											</a>
60										</action>
61									{/strip}
62								{/actions}
63							</td>
64						{/if}
65					</tr>
66				{sectionelse}
67					{if $tiki_p_admin_faqs eq 'y'}{norecords _colspan=5}{else}{norecords _colspan=4}{/if}
68				{/section}
69			</table>
70		</div>
71
72		{pagination_links cant=$cant step=$maxRecords offset=$offset}{/pagination_links}
73	{/tab}
74
75	{if $tiki_p_admin_faqs eq 'y'}
76		{tab name="{tr}Edit/Create{/tr}"}
77			{if $faqId > 0}
78				<h2>{tr}Edit this FAQ:{/tr} {$title}</h2>
79				<div class="t_navbar mb-2">
80					{button href="tiki-list_faqs.php" class="btn btn-primary" _text="{tr}Create new FAQ{/tr}"}
81				</div>
82			{else}
83				<h2>{tr}Create New FAQ:{/tr}</h2>
84			{/if}
85
86			<form action="tiki-list_faqs.php" method="post">
87				<input type="hidden" name="faqId" value="{$faqId|escape}">
88				<div class="form-group row">
89					<label class="col-form-label col-md-4">
90						{tr}Title:{/tr}
91					</label>
92					<div class="col-md-8">
93						<input type="text" class="form-control" name="title" value="{$title|escape}">
94					</div>
95				</div>
96				<div class="form-group row">
97					<label class="col-form-label col-md-4">
98						{tr}Description:{/tr}
99					</label>
100					<div class="col-md-8">
101						<textarea name="description" class="form-control">{$description|escape}</textarea>
102					</div>
103				</div>
104				<div class="form-group row">
105					<label class="col-form-label col-md-4">
106						{tr}Users can suggest questions:{/tr}
107					</label>
108					<div class="col-md-8">
109						<input type="checkbox" name="canSuggest" {if $canSuggest eq 'y'}checked="checked"{/if}>
110					</div>
111				</div>
112				{include file='categorize.tpl'}
113				<div class="row">
114					<div class="form-group col-lg-12 clearfix">
115						<div class="text-center">
116							<input type="submit" class="btn btn-primary" name="save" value="{tr}Save{/tr}">
117						</div>
118					</div>
119				</div>
120			</form>
121		{/tab}
122	{/if}
123{/tabset}
124
125