Initial commit

This commit is contained in:
2026-02-18 22:42:13 +05:00
parent 163d926832
commit 965440a0eb
13 changed files with 788 additions and 2 deletions

View File

@@ -1,3 +1,13 @@
# faq
### faq
Вопрос | ответ Только для AVE.CMS ALT
### Вопрос | ответ v1.26.1
### Модуль создания раширенной справочной системы на основе тегов.
### Changelog:
04.09.2019 - версия 1.26.1
26.11.2015 - версия 1.0.1

258
class/faq.php Normal file
View File

@@ -0,0 +1,258 @@
<?php
/**
* Класс работы с модулем Вопрос-Ответ
*
* @package AVE.cms
* @subpackage module_FAQ
* @filesource
*/
class Faq
{
/**
* Вывод списка рубрик
*
* @param string $tpl_dir путь к директории с шаблонами модуля
*/
public static function faqList($tpl_dir)
{
global $AVE_DB, $AVE_Template;
$faq = array();
$sql = $AVE_DB->Query("SELECT * FROM ". PREFIX ."_module_faq");
while ($row = $sql->FetchRow()) array_push($faq, $row);
$AVE_Template->assign("faq_arr", $faq);
$AVE_Template->assign("content", $AVE_Template->fetch($tpl_dir . "admin_faq_list.tpl"));
}
/**
* Создание новой рубрики
*
*/
public static function faqNew()
{
global $AVE_DB;
if (isset($_POST['new_faq_title']) && trim($_POST['new_faq_title']))
{
$AVE_DB->Query("INSERT INTO " . PREFIX . "_module_faq SET id = '', faq_title = '" . mb_substr($_POST['new_faq_title'], 0, 100) . "', faq_description = '" . mb_substr($_POST['new_faq_desc'], 0, 255) . "'");
}
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp=" . SESSION);
exit;
}
/**
* Удаление рубрики вместе с вопросами и ответами
*
* @param string $tpl_dir путь к директории с шаблонами модуля
*/
public static function faqDelete($tpl_dir)
{
global $AVE_DB, $AVE_Template;
if (isset($_GET['fid']) && is_numeric($_GET['fid']) && $_GET['fid'] > 0)
{
$AVE_DB->Query("DELETE FROM " . PREFIX . "_module_faq WHERE id = '" . $_GET['fid'] . "'");
$AVE_DB->Query("DELETE FROM " . PREFIX . "_module_faq_quest WHERE faq_id = '" . $_GET['fid'] . "'");
$AVE_Template->clear_cache($tpl_dir . 'show_faq.tpl', $_GET['fid']);
}
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp=" . SESSION);
exit;
}
/**
* Запись изменений в наименованиях и описаниях рубрик
*
* @param string $tpl_dir путь к директории с шаблонами модуля
*/
public static function faqListSave($tpl_dir)
{
global $AVE_DB, $AVE_Template;
foreach($_POST['faq_title'] as $id => $faq_title)
{
if (is_numeric($id) && $id > 0 && trim($faq_title))
{
$AVE_DB->Query("UPDATE " . PREFIX . "_module_faq SET faq_title = '" . mb_substr($faq_title, 0, 100) . "', faq_description = '" . mb_substr($_POST['faq_description'][$id], 0, 255) . "' WHERE id = '" . $id . "'");
$AVE_Template->clear_cache($tpl_dir . 'show_faq.tpl', $id);
}
}
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp=" . SESSION);
exit;
}
/**
* Вывод списка вопросов и ответов определённой рубрики
*
* @param string $tpl_dir путь к директории с шаблонами модуля
*/
public static function faqQuestionList($tpl_dir)
{
global $AVE_DB, $AVE_Template;
if (!(isset($_GET['fid']) && is_numeric($_GET['fid']) && $_GET['fid'] > 0))
{
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp=" . SESSION);
exit;
}
$questions = array();
$sql = $AVE_DB->Query("SELECT * FROM " . PREFIX . "_module_faq_quest WHERE faq_id = '" . $_GET['fid'] . "'");
while ($row = $sql->FetchRow()) array_push($questions, $row);
$r_name = $AVE_DB->Query("SELECT * FROM ". PREFIX ."_module_faq WHERE id = '" . $_GET['fid'] . "'")->FetchRow();
$AVE_Template->assign("questions", $questions);
$AVE_Template->assign("RubricName", $r_name->faq_title);
$AVE_Template->assign("content", $AVE_Template->fetch($tpl_dir . "admin_faq_edit.tpl"));
}
/**
* Вывод формы редактирования вопроса и ответа на него
*
* @param string $tpl_dir путь к директории с шаблонами модуля
*/
public static function faqQuestionEdit($tpl_dir)
{
global $AVE_DB, $AVE_Template;
if (! (isset($_GET['fid']) && is_numeric($_GET['fid']) && $_GET['fid'] > 0))
{
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp=" . SESSION);
exit;
}
if (isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id'] > 0)
{
$faq = $AVE_DB->Query("
SELECT *
FROM
" . PREFIX . "_module_faq_quest
WHERE
faq_id = '" . (int)$_GET['fid'] . "'
AND
id = '" . (int)$_GET['id'] . "'
")->FetchAssocArray();
if ($faq === false)
{
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp=" . SESSION);
exit;
}
}
else
{
$faq = array(
'id' => '',
'faq_quest' => '',
'faq_answer' => '',
'faq_id' => $_GET['fid']
);
}
$oCKeditor = new CKeditor();
$oCKeditor->returnOutput = true;
$oCKeditor->config['toolbar'] = 'Verysmall';
$oCKeditor->config['height'] = 100;
$config = array();
$faq['faq_quest'] = $oCKeditor->editor('faq_quest', $faq['faq_quest'], $config);
$oCKeditor2 = new CKeditor();
$oCKeditor2->returnOutput = true;
$oCKeditor2->config['toolbar'] = 'Small';
$oCKeditor2->config['height'] = 400;
$config2 = array();
$faq['faq_answer'] = $oCKeditor2->editor('faq_answer', $faq['faq_answer'], $config2);
$AVE_Template->assign($faq);
$AVE_Template->assign("content", $AVE_Template->fetch($tpl_dir . "admin_quest_edit.tpl"));
}
/**
* Запись нового или изменённого вопроса и ответа на него
*
* @param string $tpl_dir путь к директории с шаблонами модуля
*/
public static function faqQuestionSave($tpl_dir)
{
global $AVE_DB, $AVE_Template;
if (!(isset($_POST['fid']) && is_numeric($_POST['fid']) && $_POST['fid'] > 0))
{
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp=" . SESSION);
exit;
}
if (isset($_POST['id']) && is_numeric($_POST['id']) && $_POST['id'] > 0)
{
$AVE_DB->Query("UPDATE " . PREFIX . "_module_faq_quest SET faq_quest = '" . $_POST['faq_quest'] . "', faq_answer = '" . $_POST['faq_answer'] . "' WHERE id = '" . $_POST['id'] . "'");
}
else
{
if ($AVE_DB->Query("SELECT 1 FROM " . PREFIX . "_module_faq WHERE id = '" . $_POST['fid'] . "'")->GetCell())
{
$AVE_DB->Query("INSERT INTO " . PREFIX . "_module_faq_quest SET id = '', faq_id = '" . $_POST['fid'] . "', faq_quest = '" . $_POST['faq_quest'] . "', faq_answer = '" . $_POST['faq_answer'] . "'");
}
}
$AVE_Template->clear_cache($tpl_dir . 'show_faq.tpl', $_POST['fid']);
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=questlist&fid=" . $_POST['fid'] . "&cp=" . SESSION);
exit;
}
/**
* Удаление вопроса и ответа на него
*
* @param string $tpl_dir путь к директории с шаблонами модуля
*/
public static function faqQuestionDelete($tpl_dir)
{
global $AVE_DB, $AVE_Template;
if (!(isset($_GET['fid']) && isset($_GET['id'])
&& is_numeric($_GET['fid']) && is_numeric($_GET['id'])
&& $_GET['fid'] > 0 && $_GET['id'] > 0))
{
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp=" . SESSION);
exit;
}
$AVE_DB->Query("DELETE FROM " . PREFIX . "_module_faq_quest WHERE faq_id = '" . $_GET['fid'] . "' AND id = '" . $_GET['id'] . "'");
$AVE_Template->clear_cache($tpl_dir . 'show_faq.tpl', $_GET['fid']);
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=questlist&fid=" . $_GET['fid'] . "&cp=" . SESSION);
exit;
}
/**
* Вывод модуля вопросов и ответов в публичной части
*
* @param int $id идентификатор рубрики вопросов и ответов
*/
public static function faqShow($id)
{
global $AVE_DB, $AVE_Template;
$faq = $AVE_DB->Query("SELECT faq_title, faq_description FROM " . PREFIX . "_module_faq WHERE id = '" . (int)$id . "'")->fetchArray();
$questions = array();
$sql = $AVE_DB->Query("SELECT * FROM " . PREFIX . "_module_faq_quest WHERE faq_id = '" . (int)$id . "'");
while ($row = $sql->FetchRow()) array_push($questions, $row);
$AVE_Template->assign($faq);
$AVE_Template->assign('questions', $questions);
}
}
?>

4
index.php Normal file
View File

@@ -0,0 +1,4 @@
<?php
header('Location:/');
exit;
?>

20
info.php Normal file
View File

@@ -0,0 +1,20 @@
<?php
if (! defined('BASE_DIR'))
exit;
$module = array(
'ModuleSysName' => 'faq',
'ModuleVersion' => '1.26.1',
'ModuleAutor' => 'Freeon',
'ModuleCopyright' => '&copy; 2007-' . date('Y') . ' AVE.cms',
'ModuleStatus' => 1,
'ModuleIsFunction' => 1,
'ModuleTemplate' => 0,
'ModuleAdminEdit' => 1,
'ModuleFunction' => 'mod_faq',
'ModuleTag' => '[mod_faq:XXX]',
'ModuleTagLink' => null,
'ModuleAveTag' => '#\\\[mod_faq:(\\\d+)]#',
'ModulePHPTag' => "<?php mod_faq(''$1''); ?>"
);
?>

4
lang/index.php Normal file
View File

@@ -0,0 +1,4 @@
<?php
header('Location:/');
exit;
?>

33
lang/ru.txt Normal file
View File

@@ -0,0 +1,33 @@
[name]
MODULE_NAME = "Вопрос/ответ"
MODULE_DESCRIPTION = "Модуль создания раширенной справочной системы на основе тегов."
[module]
FAQ_EDIT = "Редактирование рубрики"
FAQ_EDIT_RUB = "Редактирование рубрики"
FAQ_EDIT_TIP = "В данном разделе представлен список вопросов и ответов выбранной рубрики. Вы можете добавить новый вопрос и ответ на него, перейти к редактированию существующих вопросов и ответов или удалить вопросы и ответы на них."
FAQ_QUEST = "Вопрос"
FAQ_ANSWER = "Ответ"
FAQ_INSERT = "Здесь вы можете редактировать выбранный вопрос и ответ на него."
FAQ_SAVE = "Сохранить"
FAQ_ENTER_NAME = "Пожалуйста, укажите название рубрики"
FAQ_ITEM_NAME = "Название рубрики вопросов и ответов:"
FAQ_BUTTON_SAVE = "Сохранить изменения"
FAQ_BUTTON_ADD = "Добавить рубрику"
FAQ_LIST = "Вопрос-Ответ"
FAQ_LIST_TIP = "В разделе представлен список рубрик модуля Вопрос-Ответ. Вы можете изменить наименование и описание рубрики, перейти к управлению вопросами и ответами определённой рубрики или удалить рубрику вместе с её вопросами и ответами."
FAQ_NAME = "Название рубрики"
FAQ_DESC = "Описание рубрики"
FAQ_TAG = "Системный тег"
FAQ_ACTIONS = "Действия"
FAQ_EDIT_HINT = "Редактировать рубрику"
FAQ_QEDIT_HINT = "Редактировать вопрос и ответ"
FAQ_DELETE_HINT = "Удалить рубрику вместе с вопросами и ответами"
FAQ_QDELETE_HINT = "Удалить вопрос и ответ на него"
FAQ_NO_ITEMS = "В настоящий момент нет данных"
FAQ_ADD = "Добавить рубрику"
FAQ_ADD_QUEST = "Добавить вопрос"
FAQ_BACK = "Управление рубриками"
FAQ_INSERT_H = "Добавление или Редактирование вопросов и ответов"
FAQ_INNAME = "Введите вопрос"
FAQ_INDESC = "Введите ответ на вопрос"

97
module.php Normal file
View File

@@ -0,0 +1,97 @@
<?php
/**
* AVE.cms - Модуль Вопрос-Ответ
*
* @package AVE.cms
* @subpackage module_FAQ
* @since 2.0
* @filesource
*/
if (!defined('BASE_DIR')) exit;
/**
* Обработка тега модуля
*
* @param int $id идентификатор рубрики вопросов и ответов
*/
function mod_faq($id)
{
global $AVE_Template;
$AVE_Template->caching = 1; // Включаем кеширование
$AVE_Template->cache_lifetime = -1; // Неограниченное время жизни кэша
// $AVE_Template->cache_dir .= '/faq'; // Папка для кеша модуля
$tpl_dir = BASE_DIR . '/modules/faq/templates/'; // Путь к шаблону модуля
// Если нету в кеше, то начинаем обрабатывать
if (!$AVE_Template->is_cached($tpl_dir . 'show_faq.tpl', $id))
{
// Проверяем, есть ли папка для кеша, если нет (первый раз) — создаем
if (!is_dir($AVE_Template->cache_dir))
{
$oldumask = umask(0);
@mkdir($AVE_Template->cache_dir, 0777);
umask($oldumask);
}
require_once(BASE_DIR . '/modules/faq/class/faq.php');
Faq::faqShow($id);
}
echo rewrite_link($AVE_Template->fetch($tpl_dir . 'show_faq.tpl', $id));
$AVE_Template->caching = false; // Отключаем кеширование
}
/**
* Администрирование
*/
if (defined('ACP') && !empty($_REQUEST['moduleaction']))
{
require_once(BASE_DIR . '/modules/faq/class/faq.php');
$tpl_dir = BASE_DIR . '/modules/faq/templates/';
$lang_file = BASE_DIR . '/modules/faq/lang/' . $_SESSION['user_language'] . '.txt';
$AVE_Template->config_load($lang_file, 'module');
switch ($_REQUEST['moduleaction'])
{
case '1':
Faq::faqList($tpl_dir);
break;
case 'new':
Faq::faqNew();
break;
case 'del':
Faq::faqDelete($tpl_dir);
break;
case 'save':
Faq::faqListSave($tpl_dir);
break;
case 'questlist':
Faq::faqQuestionList($tpl_dir);
break;
case 'questedit':
Faq::faqQuestionEdit($tpl_dir);
break;
case 'questsave':
Faq::faqQuestionSave($tpl_dir);
break;
case 'questdel':
Faq::faqQuestionDelete($tpl_dir);
break;
}
}
?>

62
sql.php Normal file
View File

@@ -0,0 +1,62 @@
<?php
/**
* AVE.cms - Модуль Вопрос-Ответ
*
* @package AVE.cms
* @subpackage module_FAQ
* @filesource
*/
/**
* mySQL-запросы для установки, обновления и удаления модуля
*/
$module_sql_install = array();
$module_sql_deinstall = array();
$module_sql_update = array();
$module_sql_deinstall[] = "DROP TABLE IF EXISTS %%PRFX%%_module_faq;";
$module_sql_deinstall[] = "DROP TABLE IF EXISTS %%PRFX%%_module_faq_quest;";
$module_sql_install[] = "CREATE TABLE %%PRFX%%_module_faq (
`id` mediumint(5) unsigned NOT NULL auto_increment,
`faq_title` char(100) NOT NULL default '',
`faq_description` char(255) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
$module_sql_install[] = "CREATE TABLE %%PRFX%%_module_faq_quest (
`id` mediumint(5) unsigned NOT NULL auto_increment,
`faq_id` mediumint(5) unsigned NOT NULL default '1',
`faq_quest` text NOT NULL,
`faq_answer` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
$module_sql_update[] = "
UPDATE
`%%PRFX%%_module`
SET
ModuleAveTag = '" . $modul['ModuleAveTag'] . "',
ModulePHPTag = '" . $modul['ModulePHPTag'] . "',
ModuleVersion = '" . $modul['ModuleVersion'] . "'
WHERE
ModuleSysName = '" . $modul['ModuleSysName'] . "'
LIMIT 1;
";
$module_sql_update[] = "
RENAME TABLE
`%%PRFX%%_modul_faq`
TO
`%%PRFX%%_module_faq`
";
$module_sql_update[] = "
RENAME TABLE
`%%PRFX%%_modul_faq_quest`
TO
`%%PRFX%%_module_faq_quest`
";
?>

View File

@@ -0,0 +1,71 @@
<div class="title"><h5>{#FAQ_EDIT_RUB#}</h5></div>
<div class="widget" style="margin-top: 0px;">
<div class="body">
{#FAQ_EDIT_TIP#}
</div>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li>
<li><a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
<li><a href="index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp={$sess}">{#FAQ_LIST#}</a></li>
<li>{$RubricName|escape}</li>
</ul>
</div>
</div>
<div class="widget first">
<div class="head">
<h5 class="iFrames">{if $smarty.request.id != ''}{#FAQ_EDIT_RUB#}{else}{#FAQ_EDIT_RUB#}{/if}</h5>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questedit&fid={$smarty.get.fid}&cp={$sess}">{#FAQ_ADD_QUEST#}</a></div>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp={$sess}">{#FAQ_BACK#}</a></div>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
<col width="40%" />
<col width="50%" />
<col width="1%" />
<col width="1%" />
<thead>
<tr>
<td>{#FAQ_QUEST#}</td>
<td>{#FAQ_ANSWER#}</td>
<td colspan="2">{#FAQ_ACTIONS#}</td>
</tr>
</thead>
{if $questions}
{foreach from=$questions item=question}
<tr>
<td>
<strong><a href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questedit&fid={$smarty.get.fid}&id={$question->id}&cp={$sess}">{$question->faq_quest|strip_tags|escape|truncate:100}</a></strong>
</td>
<td>
{$question->faq_answer|strip_tags|escape|truncate:80}
</td>
<td align="center">
<a class="topleftDir icon_sprite ico_edit" title="{#FAQ_QEDIT_HINT#}" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questedit&fid={$smarty.get.fid}&id={$question->id}&cp={$sess}"></a>
</td>
<td align="center">
<a class="topleftDir ConfirmDelete icon_sprite ico_delete" title="{#FAQ_QDELETE_HINT#}" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questdel&fid={$smarty.get.fid}&id={$question->id}&cp={$sess}"></a>
</td>
</tr>
{/foreach}
{else}
<tr>
<td colspan="4">
<ul class="messages">
<li class="highlight yellow">{#FAQ_NO_ITEMS#}</li>
</ul>
</td>
</tr>
{/if}
</table>
</div>

View File

@@ -0,0 +1,124 @@
<script type="text/javascript" language="JavaScript">
function check_title() {ldelim}
if (document.getElementById('new_faq_title').value == '') {ldelim}
alert('{#FAQ_ENTER_NAME#}');
document.getElementById('new_faq_title').focus();
return false;
{rdelim}
return true;
{rdelim}
</script>
<div class="title"><h5>{#FAQ_LIST#}</h5></div>
<div class="widget" style="margin-top: 0px;">
<div class="body">
{#FAQ_LIST_TIP#}
</div>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li>
<li><a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
<li>{#FAQ_LIST#}</li>
</ul>
</div>
</div>
<div class="widget first">
<ul class="tabs">
<li class="activeTab"><a href="#tab1">Список рубрик</a></li>
<li class=""><a href="#tab2">{#FAQ_ADD#}</a></li>
</ul>
<div class="tab_container">
<div id="tab1" class="tab_content" style="display: block;">
<form method="post" action="index.php?do=modules&action=modedit&mod=faq&moduleaction=save&cp={$sess}">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
<col />
<col />
<col width="100" />
<col width="10" />
<col width="10" />
<thead>
<tr>
<td>{#FAQ_NAME#}</td>
<td>{#FAQ_DESC#}</td>
<td>{#FAQ_TAG#}</td>
<td colspan="2">{#FAQ_ACTIONS#}</td>
</tr>
</thead>
<tbody>
{if $faq_arr}
{foreach from=$faq_arr item=faq}
<tr>
<td>
<div class="pr12"><input style="width:100%" name="faq_title[{$faq->id}]" type="text" id="faq_title[{$faq->id}]" value="{$faq->faq_title|escape}" size="40" /></div>
</td>
<td>
<div class="pr12"><input style="width:100%" name="faq_description[{$faq->id}]" type="text" id="faq_description[{$faq->id}]" value="{$faq->faq_description|escape}" size="40" /></div>
</td>
<td>
<div class="pr12"><input style="width:100%" name="textfield" type="text" value="[mod_faq:{$faq->id}]" readonly /></div>
</td>
<td align="center">
<a class="topleftDir icon_sprite ico_edit" title="{#FAQ_EDIT_HINT#}" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questlist&fid={$faq->id}&cp={$sess}"></a>
</td>
<td align="center">
<a class="topleftDir ConfirmDelete icon_sprite ico_delete" title="{#FAQ_DELETE_HINT#}" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=del&fid={$faq->id}&cp={$sess}"></a>
</td>
</tr>
{/foreach}
</tbody>
<tr>
<td colspan="5">
<input type="submit" class="basicBtn" value="{#FAQ_BUTTON_SAVE#}" />
</td>
</tr>
{else}
<tr>
<td colspan="5">
<ul class="messages">
<li class="highlight yellow">{#FAQ_NO_ITEMS#}</li>
</ul>
</td>
</tr>
{/if}
</table>
</form>
</div>
<div id="tab2" class="tab_content" style="display: none;">
<form action="index.php?do=modules&action=modedit&mod=faq&moduleaction=new&cp={$sess}" method="post" onSubmit="return check_title();">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
<thead>
<tr>
<td class="tableheader">{#FAQ_NAME#}</td>
<td class="tableheader">{#FAQ_DESC#}</td>
</tr>
</thead>
<tr>
<td class="second"><div class="pr12"><input placeholder="{#FAQ_NAME#}" name="new_faq_title" type="text" id="new_faq_title" size="60" maxlength="100" style="width:100%" /></div></td>
<td class="second"><div class="pr12"><input placeholder="{#FAQ_DESC#}" name="new_faq_desc" type="text" id="new_faq_desc" size="60" maxlength="255" style="width:100%" /></div></td>
</tr>
<tr>
<td colspan="2"><input name="submit" type="submit" class="basicBtn" value="{#FAQ_BUTTON_ADD#}" /></td>
</tr>
</table>
</form>
</div>
</div>
<div class="fix"></div>
</div>

View File

@@ -0,0 +1,75 @@
<script type="text/javascript" src="{$ABS_PATH}lib/redactor/ckeditor/ckeditor.js"></script>
<div class="title">
<h5>{#FAQ_INSERT_H#}</h5>
</div>
<div class="widget" style="margin-top: 0px;">
<div class="body">
{#FAQ_INSERT#}
</div>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li>
<li><a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
<li><a href="index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp={$sess}">{#FAQ_LIST#}</a></li>
<li>{#FAQ_INSERT_H#}</li>
</ul>
</div>
</div>
<div class="widget first">
<div class="head">
<h5 class="iFrames">{if $smarty.request.id != ''}{#FAQ_EDIT_RUB#}{else}{#FAQ_EDIT_RUB#}{/if}</h5>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questedit&fid={$smarty.get.fid}&cp={$sess}">{#FAQ_ADD_QUEST#}</a></div>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp={$sess}">{#FAQ_BACK#}</a></div>
</div>
<form action="index.php?do=modules&action=modedit&mod=faq&moduleaction=questsave&cp={$sess}" method="post">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
<tr class="tableheader">
<td>{#FAQ_INNAME#}</td>
</tr>
<tr>
<td class="second">
<div>
{if $smarty.session.use_editor == 0}
{$faq_quest}
{elseif $smarty.session.use_editor == 1}
<textarea class="mousetrap editor" id="faq_quest" name="faq_quest">{$faq_quest|escape}</textarea>
{/if}
</div>
</td>
</tr>
<tr class="tableheader">
<td>{#FAQ_INDESC#}</td>
</tr>
<tr>
<td class="second">
<div>
{if $smarty.session.use_editor == 0}
{$faq_answer}
{elseif $smarty.session.use_editor == 1}
<textarea class="mousetrap editor" id="faq_answer" name="faq_answer">{$sfaq_answer|escape}</textarea>
{/if}
</div>
</td>
</tr>
<tr>
<td class="first">
<input type="hidden" name="id" value="{$id}">
<input type="hidden" name="fid" value="{$faq_id}">
<input name="submit" type="submit" class="basicBtn" value="{#FAQ_SAVE#}" />
</td>
</tr>
</table>
</form>
</div>

4
templates/index.php Normal file
View File

@@ -0,0 +1,4 @@
<?php
header('Location:/');
exit;
?>

24
templates/show_faq.tpl Normal file
View File

@@ -0,0 +1,24 @@
<h3>{$faq_title}</h3>
{if $questions}
<dl>
{foreach from=$questions item=question}
<dt><p><a href="javascript:void(0);">{$question->faq_quest}</a></p></dt>
<dd>
<h2>{$question->faq_quest}</h2>
{$question->faq_answer}
</dd>
{/foreach}
</dl>
{literal}
<script>
$(document).ready(function() {
$("dd").hide();
$("dt").unbind('click');
$("dt").click(function() {
$(this).toggleClass("highligh").next("dd").slideToggle();
});
});
</script>
{/literal}
{/if}